diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-30 11:55:15 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-30 11:55:15 +0400 |
commit | 6d965f4493871c9bd4550939b8263d0c509b7c41 (patch) | |
tree | eb5fecdc3fc376d056d9e4ea7366c3a8e0dea8b7 /source/blender/blenkernel | |
parent | ca629d5ccc65da456babba6c5bdbfa0de737ac7b (diff) |
style edits for function declarations
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_array_mallocn.h | 38 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/depsgraph.c | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 31 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 18 |
4 files changed, 64 insertions, 41 deletions
diff --git a/source/blender/blenkernel/BKE_array_mallocn.h b/source/blender/blenkernel/BKE_array_mallocn.h index 45ca4a5e694..0f312360521 100644 --- a/source/blender/blenkernel/BKE_array_mallocn.h +++ b/source/blender/blenkernel/BKE_array_mallocn.h @@ -34,28 +34,28 @@ */ /* example of usage: - -int *arr = NULL; -V_DECLARE(arr); -int i; - -for (i=0; i<10; i++) { - V_GROW(arr); - arr[i] = something; -} -V_FREE(arr); - -arrays are buffered, using double-buffering (so on each reallocation, -the array size is doubled). supposedly this should give good Big Oh -behaviour, though it may not be the best in practice. -*/ + * + * int *arr = NULL; + * V_DECLARE(arr); + * int i; + * + * for (i=0; i<10; i++) { + * V_GROW(arr); + * arr[i] = something; + * } + * V_FREE(arr); + * + * arrays are buffered, using double-buffering (so on each reallocation, + * the array size is doubled). supposedly this should give good Big Oh + * behaviour, though it may not be the best in practice. + */ #define V_DECLARE(vec) int _##vec##_count=0; void *_##vec##_tmp -/*in the future, I plan on having V_DECLARE allocate stack memory it'll - use at first, and switch over to heap when it needs more. that'll mess - up cases where you'd want to use this API to build a dynamic list for - non-local use, so all such cases should use this macro.*/ +/* in the future, I plan on having V_DECLARE allocate stack memory it'll + * use at first, and switch over to heap when it needs more. that'll mess + * up cases where you'd want to use this API to build a dynamic list for + * non-local use, so all such cases should use this macro.*/ #define V_DYNDECLARE(vec) V_DECLARE(vec) /*this returns the entire size of the array, including any buffering.*/ diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index e17566b7d55..a76fa8e8579 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -269,7 +269,8 @@ DagNode * pop_queue(DagNodeQueue *queue) } } -void *pop_ob_queue(struct DagNodeQueue *queue) { +void *pop_ob_queue(struct DagNodeQueue *queue) +{ return(pop_queue(queue)->ob); } @@ -278,7 +279,8 @@ DagNode * get_top_node_queue(DagNodeQueue *queue) return queue->first->node; } -int queue_count(struct DagNodeQueue *queue){ +int queue_count(struct DagNodeQueue *queue) +{ return queue->count; } @@ -1155,7 +1157,8 @@ void graph_bfs(void) queue_delete(nqueue); } -int pre_and_post_BFS(DagForest *dag, short mask, graph_action_func pre_func, graph_action_func post_func, void **data) { +int pre_and_post_BFS(DagForest *dag, short mask, graph_action_func pre_func, graph_action_func post_func, void **data) +{ DagNode *node; node = dag->DagNode.first; @@ -1341,7 +1344,8 @@ DagNodeQueue * graph_dfs(void) } /* unused */ -int pre_and_post_DFS(DagForest *dag, short mask, graph_action_func pre_func, graph_action_func post_func, void **data) { +int pre_and_post_DFS(DagForest *dag, short mask, graph_action_func pre_func, graph_action_func post_func, void **data) +{ DagNode *node; node = dag->DagNode.first; @@ -1552,7 +1556,8 @@ struct DagNodeQueue *get_all_childs(struct DagForest *dag, void *ob) } /* unused */ -short are_obs_related(struct DagForest *dag, void *ob1, void *ob2) { +short are_obs_related(struct DagForest *dag, void *ob1, void *ob2) +{ DagNode * node; DagAdjList *itA; @@ -1568,7 +1573,8 @@ short are_obs_related(struct DagForest *dag, void *ob1, void *ob2) { return DAG_NO_RELATION; } -int is_acyclic( DagForest *dag) { +int is_acyclic( DagForest *dag) +{ return dag->is_acyclic; } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index a3e13b48fe4..ce50c58a6e1 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -90,7 +90,8 @@ static void do_child_modifiers(ParticleSimulationData *sim, float *orco, float mat[4][4], ParticleKey *state, float t); /* few helpers for countall etc. */ -int count_particles(ParticleSystem *psys){ +int count_particles(ParticleSystem *psys) +{ ParticleSettings *part=psys->part; PARTICLE_P; int tot=0; @@ -102,7 +103,8 @@ int count_particles(ParticleSystem *psys){ } return tot; } -int count_particles_mod(ParticleSystem *psys, int totgr, int cur){ +int count_particles_mod(ParticleSystem *psys, int totgr, int cur) +{ ParticleSettings *part=psys->part; PARTICLE_P; int tot=0; @@ -1123,7 +1125,8 @@ static int get_pointcache_times_for_particle(PointCache *cache, int index, float return ret == 2; } -float psys_get_dietime_from_cache(PointCache *cache, int index) { +float psys_get_dietime_from_cache(PointCache *cache, int index) +{ PTCacheMem *pm; int dietime = 10000000; /* some max value so that we can default to pa->time+lifetime */ @@ -1366,7 +1369,9 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData /* Particles on a dm */ /************************************************/ /* interpolate a location on a face based on face coordinates */ -void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*orcodata)[3], float *w, float *vec, float *nor, float *utan, float *vtan, float *orco,float *ornor){ +void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*orcodata)[3], + float *w, float *vec, float *nor, float *utan, float *vtan, float *orco,float *ornor) +{ float *v1=0, *v2=0, *v3=0, *v4=0; float e1[3],e2[3],s1,s2,t1,t2; float *uv1, *uv2, *uv3, *uv4; @@ -1828,7 +1833,8 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float * /************************************************/ /* Particles on emitter */ /************************************************/ -void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor){ +void psys_particle_on_emitter(ParticleSystemModifierData *psmd, int from, int index, int index_dmcache, float *fuv, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor) +{ if(psmd){ if(psmd->psys->part->distr==PART_DISTR_GRID && psmd->psys->part->from != PART_FROM_VERT){ if(vec) @@ -3231,7 +3237,8 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf /************************************************/ /* Particle Key handling */ /************************************************/ -void copy_particle_key(ParticleKey *to, ParticleKey *from, int time){ +void copy_particle_key(ParticleKey *to, ParticleKey *from, int time) +{ if(time){ memcpy(to,from,sizeof(ParticleKey)); } @@ -3241,7 +3248,8 @@ void copy_particle_key(ParticleKey *to, ParticleKey *from, int time){ to->time=to_time; } } -void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, float *time){ +void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, float *time) +{ if(loc) copy_v3_v3(loc,key->co); if(vel) copy_v3_v3(vel,key->vel); if(rot) copy_qt_qt(rot,key->rot); @@ -3249,7 +3257,8 @@ void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, flo } /*-------changing particle keys from space to another-------*/ #if 0 -static void key_from_object(Object *ob, ParticleKey *key){ +static void key_from_object(Object *ob, ParticleKey *key) +{ float q[4]; add_v3_v3(key->vel, key->co); @@ -4177,7 +4186,8 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * } } /* gets particle's state at a time, returns 1 if particle exists and can be seen and 0 if not */ -int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *state, int always){ +int psys_get_particle_state(ParticleSimulationData *sim, int p, ParticleKey *state, int always) +{ ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; ParticleData *pa = NULL; @@ -4515,7 +4525,8 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] } -void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys) { +void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys) +{ ParticleSimulationData sim= {0}; sim.scene= scene; sim.ob= ob; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index a955643cbcc..e4dcfcf1354 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -107,7 +107,8 @@ /* Reacting to system events */ /************************************************/ -static int particles_are_dynamic(ParticleSystem *psys) { +static int particles_are_dynamic(ParticleSystem *psys) +{ if(psys->pointcache->flag & PTCACHE_BAKED) return 0; @@ -2240,7 +2241,8 @@ static void sph_spring_delete(ParticleSystem *psys, int j) psys->fluid_springs = (ParticleSpring*)MEM_reallocN(psys->fluid_springs, psys->alloc_fluidsprings * sizeof(ParticleSpring)); } } -static void sph_springs_modify(ParticleSystem *psys, float dtime){ +static void sph_springs_modify(ParticleSystem *psys, float dtime) +{ SPHFluidSettings *fluid = psys->part->fluid; ParticleData *pa1, *pa2; ParticleSpring *spring = psys->fluid_springs; @@ -2490,7 +2492,8 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa madd_v3_v3fl(force, gravity, fluid->buoyancy * (pfr.density-rest_density)); } -static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash, float *element_size, float flow[3]) { +static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float dfra, float *gravity, EdgeHash *springhash, float *element_size, float flow[3]) +{ ParticleTarget *pt; int i; @@ -3293,7 +3296,8 @@ static void collision_fail(ParticleData *pa, ParticleCollision *col) * -uses Newton-Rhapson iteration to find the collisions * -handles spherical particles and (nearly) point like particles */ -static void collision_check(ParticleSimulationData *sim, int p, float dfra, float cfra){ +static void collision_check(ParticleSimulationData *sim, int p, float dfra, float cfra) +{ ParticleSettings *part = sim->psys->part; ParticleData *pa = sim->psys->particles + p; ParticleCollision col; @@ -3561,7 +3565,8 @@ static void hair_step(ParticleSimulationData *sim, float cfra) psys->flag |= PSYS_HAIR_UPDATED; } -static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){ +static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)) +{ Object *ob = sim->ob; ParticleSystem *psys = sim->psys; HairKey *key, *root; @@ -4241,7 +4246,8 @@ void psys_check_boid_data(ParticleSystem *psys) } } -static void fluid_default_settings(ParticleSettings *part){ +static void fluid_default_settings(ParticleSettings *part) +{ SPHFluidSettings *fluid = part->fluid; fluid->spring_k = 0.f; |