Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenkernel/BKE_pointcache.h
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenkernel/BKE_pointcache.h')
-rw-r--r--source/blender/blenkernel/BKE_pointcache.h365
1 files changed, 194 insertions, 171 deletions
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index 9cfc43b2e5b..8a8ae3e2566 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -32,46 +32,46 @@
/* Point cache clearing option, for BKE_ptcache_id_clear, before
* and after are non inclusive (they wont remove the cfra) */
-#define PTCACHE_CLEAR_ALL 0
-#define PTCACHE_CLEAR_FRAME 1
-#define PTCACHE_CLEAR_BEFORE 2
-#define PTCACHE_CLEAR_AFTER 3
+#define PTCACHE_CLEAR_ALL 0
+#define PTCACHE_CLEAR_FRAME 1
+#define PTCACHE_CLEAR_BEFORE 2
+#define PTCACHE_CLEAR_AFTER 3
/* Point cache reset options */
-#define PTCACHE_RESET_DEPSGRAPH 0
-#define PTCACHE_RESET_BAKED 1
-#define PTCACHE_RESET_OUTDATED 2
-/* #define PTCACHE_RESET_FREE 3 */ /*UNUSED*/
+#define PTCACHE_RESET_DEPSGRAPH 0
+#define PTCACHE_RESET_BAKED 1
+#define PTCACHE_RESET_OUTDATED 2
+/* #define PTCACHE_RESET_FREE 3 */ /*UNUSED*/
/* Add the blendfile name after blendcache_ */
#define PTCACHE_EXT ".bphys"
#define PTCACHE_PATH "blendcache_"
/* File open options, for BKE_ptcache_file_open */
-#define PTCACHE_FILE_READ 0
-#define PTCACHE_FILE_WRITE 1
+#define PTCACHE_FILE_READ 0
+#define PTCACHE_FILE_WRITE 1
#define PTCACHE_FILE_UPDATE 2
/* PTCacheID types */
-#define PTCACHE_TYPE_SOFTBODY 0
-#define PTCACHE_TYPE_PARTICLES 1
-#define PTCACHE_TYPE_CLOTH 2
-#define PTCACHE_TYPE_SMOKE_DOMAIN 3
-#define PTCACHE_TYPE_SMOKE_HIGHRES 4
-#define PTCACHE_TYPE_DYNAMICPAINT 5
-#define PTCACHE_TYPE_RIGIDBODY 6
+#define PTCACHE_TYPE_SOFTBODY 0
+#define PTCACHE_TYPE_PARTICLES 1
+#define PTCACHE_TYPE_CLOTH 2
+#define PTCACHE_TYPE_SMOKE_DOMAIN 3
+#define PTCACHE_TYPE_SMOKE_HIGHRES 4
+#define PTCACHE_TYPE_DYNAMICPAINT 5
+#define PTCACHE_TYPE_RIGIDBODY 6
/* high bits reserved for flags that need to be stored in file */
-#define PTCACHE_TYPEFLAG_COMPRESS (1 << 16)
-#define PTCACHE_TYPEFLAG_EXTRADATA (1 << 17)
+#define PTCACHE_TYPEFLAG_COMPRESS (1 << 16)
+#define PTCACHE_TYPEFLAG_EXTRADATA (1 << 17)
-#define PTCACHE_TYPEFLAG_TYPEMASK 0x0000FFFF
-#define PTCACHE_TYPEFLAG_FLAGMASK 0xFFFF0000
+#define PTCACHE_TYPEFLAG_TYPEMASK 0x0000FFFF
+#define PTCACHE_TYPEFLAG_FLAGMASK 0xFFFF0000
/* PTCache read return code */
-#define PTCACHE_READ_EXACT 1
-#define PTCACHE_READ_INTERPOLATED 2
-#define PTCACHE_READ_OLD 3
+#define PTCACHE_READ_EXACT 1
+#define PTCACHE_READ_INTERPOLATED 2
+#define PTCACHE_READ_OLD 3
/* Structs */
struct ClothModifierData;
@@ -92,182 +92,190 @@ struct OpenVDBWriter;
/* temp structure for read/write */
typedef struct PTCacheData {
- unsigned int index;
- float loc[3];
- float vel[3];
- float rot[4];
- float ave[3];
- float size;
- float times[3];
- struct BoidData boids;
+ unsigned int index;
+ float loc[3];
+ float vel[3];
+ float rot[4];
+ float ave[3];
+ float size;
+ float times[3];
+ struct BoidData boids;
} PTCacheData;
typedef struct PTCacheFile {
- FILE *fp;
+ FILE *fp;
- int frame, old_format;
- unsigned int totpoint, type;
- unsigned int data_types, flag;
+ int frame, old_format;
+ unsigned int totpoint, type;
+ unsigned int data_types, flag;
- struct PTCacheData data;
- void *cur[BPHYS_TOT_DATA];
+ struct PTCacheData data;
+ void *cur[BPHYS_TOT_DATA];
} PTCacheFile;
-#define PTCACHE_VEL_PER_SEC 1
+#define PTCACHE_VEL_PER_SEC 1
enum {
- PTCACHE_FILE_PTCACHE = 0,
- PTCACHE_FILE_OPENVDB = 1,
+ PTCACHE_FILE_PTCACHE = 0,
+ PTCACHE_FILE_OPENVDB = 1,
};
typedef struct PTCacheID {
- struct PTCacheID *next, *prev;
-
- struct Scene *scene;
- struct Object *ob;
- void *calldata;
- unsigned int type, file_type;
- unsigned int stack_index;
- unsigned int flag;
-
- unsigned int default_step;
- unsigned int max_step;
-
- /* flags defined in DNA_object_force_types.h */
- unsigned int data_types, info_types;
-
- /* copies point data to cache data */
- int (*write_point)(int index, void *calldata, void **data, int cfra);
- /* copies cache cata to point data */
- void (*read_point)(int index, void *calldata, void **data, float cfra, float *old_data);
- /* interpolated between previously read point data and cache data */
- void (*interpolate_point)(int index, void *calldata, void **data, float cfra, float cfra1, float cfra2, float *old_data);
-
- /* copies point data to cache data */
- int (*write_stream)(PTCacheFile *pf, void *calldata);
- /* copies cache cata to point data */
- int (*read_stream)(PTCacheFile *pf, void *calldata);
-
- /* copies point data to cache data */
- int (*write_openvdb_stream)(struct OpenVDBWriter *writer, void *calldata);
- /* copies cache cata to point data */
- int (*read_openvdb_stream)(struct OpenVDBReader *reader, void *calldata);
-
- /* copies custom extradata to cache data */
- void (*write_extra_data)(void *calldata, struct PTCacheMem *pm, int cfra);
- /* copies custom extradata to cache data */
- void (*read_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra);
- /* copies custom extradata to cache data */
- void (*interpolate_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra, float cfra1, float cfra2);
-
- /* total number of simulated points (the cfra parameter is just for using same function pointer with totwrite) */
- int (*totpoint)(void *calldata, int cfra);
- /* report error if number of points does not match */
- void (*error)(void *calldata, const char *message);
- /* number of points written for current cache frame */
- int (*totwrite)(void *calldata, int cfra);
-
- int (*write_header)(PTCacheFile *pf);
- int (*read_header)(PTCacheFile *pf);
-
- struct PointCache *cache;
- /* used for setting the current cache from ptcaches list */
- struct PointCache **cache_ptr;
- struct ListBase *ptcaches;
+ struct PTCacheID *next, *prev;
+
+ struct Scene *scene;
+ struct Object *ob;
+ void *calldata;
+ unsigned int type, file_type;
+ unsigned int stack_index;
+ unsigned int flag;
+
+ unsigned int default_step;
+ unsigned int max_step;
+
+ /* flags defined in DNA_object_force_types.h */
+ unsigned int data_types, info_types;
+
+ /* copies point data to cache data */
+ int (*write_point)(int index, void *calldata, void **data, int cfra);
+ /* copies cache cata to point data */
+ void (*read_point)(int index, void *calldata, void **data, float cfra, float *old_data);
+ /* interpolated between previously read point data and cache data */
+ void (*interpolate_point)(int index,
+ void *calldata,
+ void **data,
+ float cfra,
+ float cfra1,
+ float cfra2,
+ float *old_data);
+
+ /* copies point data to cache data */
+ int (*write_stream)(PTCacheFile *pf, void *calldata);
+ /* copies cache cata to point data */
+ int (*read_stream)(PTCacheFile *pf, void *calldata);
+
+ /* copies point data to cache data */
+ int (*write_openvdb_stream)(struct OpenVDBWriter *writer, void *calldata);
+ /* copies cache cata to point data */
+ int (*read_openvdb_stream)(struct OpenVDBReader *reader, void *calldata);
+
+ /* copies custom extradata to cache data */
+ void (*write_extra_data)(void *calldata, struct PTCacheMem *pm, int cfra);
+ /* copies custom extradata to cache data */
+ void (*read_extra_data)(void *calldata, struct PTCacheMem *pm, float cfra);
+ /* copies custom extradata to cache data */
+ void (*interpolate_extra_data)(
+ void *calldata, struct PTCacheMem *pm, float cfra, float cfra1, float cfra2);
+
+ /* total number of simulated points (the cfra parameter is just for using same function pointer with totwrite) */
+ int (*totpoint)(void *calldata, int cfra);
+ /* report error if number of points does not match */
+ void (*error)(void *calldata, const char *message);
+ /* number of points written for current cache frame */
+ int (*totwrite)(void *calldata, int cfra);
+
+ int (*write_header)(PTCacheFile *pf);
+ int (*read_header)(PTCacheFile *pf);
+
+ struct PointCache *cache;
+ /* used for setting the current cache from ptcaches list */
+ struct PointCache **cache_ptr;
+ struct ListBase *ptcaches;
} PTCacheID;
typedef struct PTCacheBaker {
- struct Main *bmain;
- struct Scene *scene;
- struct ViewLayer *view_layer;
- struct Depsgraph *depsgraph;
- int bake;
- int render;
- int anim_init;
- int quick_step;
- struct PTCacheID pid;
-
- void (*update_progress)(void *data, float progress, int *cancel);
- void *bake_job;
+ struct Main *bmain;
+ struct Scene *scene;
+ struct ViewLayer *view_layer;
+ struct Depsgraph *depsgraph;
+ int bake;
+ int render;
+ int anim_init;
+ int quick_step;
+ struct PTCacheID pid;
+
+ void (*update_progress)(void *data, float progress, int *cancel);
+ void *bake_job;
} PTCacheBaker;
/* PTCacheEditKey->flag */
-#define PEK_SELECT 1
-#define PEK_TAG 2
-#define PEK_HIDE 4
-#define PEK_USE_WCO 8
+#define PEK_SELECT 1
+#define PEK_TAG 2
+#define PEK_HIDE 4
+#define PEK_USE_WCO 8
typedef struct PTCacheEditKey {
- float *co;
- float *vel;
- float *rot;
- float *time;
-
- float world_co[3];
- float ftime;
- float length;
- short flag;
+ float *co;
+ float *vel;
+ float *rot;
+ float *time;
+
+ float world_co[3];
+ float ftime;
+ float length;
+ short flag;
} PTCacheEditKey;
/* PTCacheEditPoint->flag */
-#define PEP_TAG 1
-#define PEP_EDIT_RECALC 2
-#define PEP_TRANSFORM 4
-#define PEP_HIDE 8
+#define PEP_TAG 1
+#define PEP_EDIT_RECALC 2
+#define PEP_TRANSFORM 4
+#define PEP_HIDE 8
typedef struct PTCacheEditPoint {
- struct PTCacheEditKey *keys;
- int totkey;
- short flag;
+ struct PTCacheEditKey *keys;
+ int totkey;
+ short flag;
} PTCacheEditPoint;
typedef struct PTCacheUndo {
- struct PTCacheEditPoint *points;
+ struct PTCacheEditPoint *points;
- /* particles stuff */
- struct ParticleData *particles;
- struct KDTree_3d *emitter_field;
- float *emitter_cosnos;
- int psys_flag;
+ /* particles stuff */
+ struct ParticleData *particles;
+ struct KDTree_3d *emitter_field;
+ float *emitter_cosnos;
+ int psys_flag;
- /* cache stuff */
- struct ListBase mem_cache;
+ /* cache stuff */
+ struct ListBase mem_cache;
- int totpoint;
+ int totpoint;
- size_t undo_size;
+ size_t undo_size;
} PTCacheUndo;
enum {
- /* Modifier stack got evaluated during particle edit mode, need to copy
- * new evaluated particles to the edit struct.
- */
- PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL = (1 << 0),
+ /* Modifier stack got evaluated during particle edit mode, need to copy
+ * new evaluated particles to the edit struct.
+ */
+ PT_CACHE_EDIT_UPDATE_PARTICLE_FROM_EVAL = (1 << 0),
};
typedef struct PTCacheEdit {
- int flags;
+ int flags;
- PTCacheEditPoint *points;
+ PTCacheEditPoint *points;
- struct PTCacheID pid;
+ struct PTCacheID pid;
- /* particles stuff */
- struct ParticleSystem *psys;
- struct ParticleSystem *psys_eval;
- struct ParticleSystemModifierData *psmd;
- struct ParticleSystemModifierData *psmd_eval;
- struct KDTree_3d *emitter_field;
- float *emitter_cosnos; /* localspace face centers and normals (average of its verts), from the derived mesh */
- int *mirror_cache;
+ /* particles stuff */
+ struct ParticleSystem *psys;
+ struct ParticleSystem *psys_eval;
+ struct ParticleSystemModifierData *psmd;
+ struct ParticleSystemModifierData *psmd_eval;
+ struct KDTree_3d *emitter_field;
+ float *
+ emitter_cosnos; /* localspace face centers and normals (average of its verts), from the derived mesh */
+ int *mirror_cache;
- struct ParticleCacheKey **pathcache; /* path cache (runtime) */
- ListBase pathcachebufs;
+ struct ParticleCacheKey **pathcache; /* path cache (runtime) */
+ ListBase pathcachebufs;
- int totpoint, totframes, totcached, edited;
+ int totpoint, totframes, totcached, edited;
- unsigned char sel_col[3];
- unsigned char nosel_col[3];
+ unsigned char sel_col[3];
+ unsigned char nosel_col[3];
} PTCacheEdit;
/* Particle functions */
@@ -278,12 +286,16 @@ void BKE_ptcache_id_from_softbody(PTCacheID *pid, struct Object *ob, struct Soft
void BKE_ptcache_id_from_particles(PTCacheID *pid, struct Object *ob, struct ParticleSystem *psys);
void BKE_ptcache_id_from_cloth(PTCacheID *pid, struct Object *ob, struct ClothModifierData *clmd);
void BKE_ptcache_id_from_smoke(PTCacheID *pid, struct Object *ob, struct SmokeModifierData *smd);
-void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid, struct Object *ob, struct DynamicPaintSurface *surface);
+void BKE_ptcache_id_from_dynamicpaint(PTCacheID *pid,
+ struct Object *ob,
+ struct DynamicPaintSurface *surface);
void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, struct Object *ob, struct RigidBodyWorld *rbw);
PTCacheID BKE_ptcache_id_find(struct Object *ob, struct Scene *scene, struct PointCache *cache);
-void BKE_ptcache_ids_from_object(
- struct ListBase *lb, struct Object *ob, struct Scene *scene, int duplis);
+void BKE_ptcache_ids_from_object(struct ListBase *lb,
+ struct Object *ob,
+ struct Scene *scene,
+ int duplis);
/****************** Query funcs ****************************/
@@ -294,18 +306,23 @@ bool BKE_ptcache_object_has(struct Scene *scene, struct Object *ob, int duplis);
void BKE_ptcache_remove(void);
/************ ID specific functions ************************/
-void BKE_ptcache_id_clear(PTCacheID *id, int mode, unsigned int cfra);
-int BKE_ptcache_id_exist(PTCacheID *id, int cfra);
-int BKE_ptcache_id_reset(struct Scene *scene, PTCacheID *id, int mode);
-void BKE_ptcache_id_time(PTCacheID *pid, struct Scene *scene, float cfra, int *startframe, int *endframe, float *timescale);
-int BKE_ptcache_object_reset(struct Scene *scene, struct Object *ob, int mode);
+void BKE_ptcache_id_clear(PTCacheID *id, int mode, unsigned int cfra);
+int BKE_ptcache_id_exist(PTCacheID *id, int cfra);
+int BKE_ptcache_id_reset(struct Scene *scene, PTCacheID *id, int mode);
+void BKE_ptcache_id_time(PTCacheID *pid,
+ struct Scene *scene,
+ float cfra,
+ int *startframe,
+ int *endframe,
+ float *timescale);
+int BKE_ptcache_object_reset(struct Scene *scene, struct Object *ob, int mode);
void BKE_ptcache_update_info(PTCacheID *pid);
/*********** General cache reading/writing ******************/
/* Size of cache data type. */
-int BKE_ptcache_data_size(int data_type);
+int BKE_ptcache_data_size(int data_type);
/* Is point with index in memory cache */
int BKE_ptcache_mem_index_find(struct PTCacheMem *pm, unsigned int index);
@@ -313,25 +330,29 @@ int BKE_ptcache_mem_index_find(struct PTCacheMem *pm, unsigned int index);
/* Memory cache read/write helpers. */
void BKE_ptcache_mem_pointers_init(struct PTCacheMem *pm);
void BKE_ptcache_mem_pointers_incr(struct PTCacheMem *pm);
-int BKE_ptcache_mem_pointers_seek(int point_index, struct PTCacheMem *pm);
+int BKE_ptcache_mem_pointers_seek(int point_index, struct PTCacheMem *pm);
/* Main cache reading call. */
-int BKE_ptcache_read(PTCacheID *pid, float cfra, bool no_extrapolate_old);
+int BKE_ptcache_read(PTCacheID *pid, float cfra, bool no_extrapolate_old);
/* Main cache writing call. */
-int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra);
+int BKE_ptcache_write(PTCacheID *pid, unsigned int cfra);
/******************* Allocate & free ***************/
struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches);
void BKE_ptcache_free_mem(struct ListBase *mem_cache);
void BKE_ptcache_free(struct PointCache *cache);
void BKE_ptcache_free_list(struct ListBase *ptcaches);
-struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, const struct ListBase *ptcaches_old, const int flag);
+struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new,
+ const struct ListBase *ptcaches_old,
+ const int flag);
/********************** Baking *********************/
/* Bakes cache with cache_step sized jumps in time, not accurate but very fast. */
-void BKE_ptcache_quick_cache_all(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer);
+void BKE_ptcache_quick_cache_all(struct Main *bmain,
+ struct Scene *scene,
+ struct ViewLayer *view_layer);
/* Bake cache or simulate to current frame with settings defined in the baker. */
void BKE_ptcache_bake(struct PTCacheBaker *baker);
@@ -346,7 +367,9 @@ void BKE_ptcache_mem_to_disk(struct PTCacheID *pid);
void BKE_ptcache_toggle_disk_cache(struct PTCacheID *pid);
/* Rename all disk cache files with a new name. Doesn't touch the actual content of the files. */
-void BKE_ptcache_disk_cache_rename(struct PTCacheID *pid, const char *name_src, const char *name_dst);
+void BKE_ptcache_disk_cache_rename(struct PTCacheID *pid,
+ const char *name_src,
+ const char *name_dst);
/* Loads simulation from external (disk) cache files. */
void BKE_ptcache_load_external(struct PTCacheID *pid);