[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41585] trunk/blender/source/blender: replace macros with bli math functions for particles code
Campbell Barton
ideasman42 at gmail.com
Sun Nov 6 15:00:55 CET 2011
Revision: 41585
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41585
Author: campbellbarton
Date: 2011-11-06 14:00:55 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
replace macros with bli math functions for particles code
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_object.h
trunk/blender/source/blender/blenkernel/BKE_particle.h
trunk/blender/source/blender/editors/include/ED_particle.h
trunk/blender/source/blender/editors/physics/particle_edit.c
trunk/blender/source/blender/editors/physics/particle_object.c
Modified: trunk/blender/source/blender/blenkernel/BKE_object.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_object.h 2011-11-06 13:10:45 UTC (rev 41584)
+++ trunk/blender/source/blender/blenkernel/BKE_object.h 2011-11-06 14:00:55 UTC (rev 41585)
@@ -106,7 +106,7 @@
void object_get_dimensions(struct Object *ob, float *value);
void object_set_dimensions(struct Object *ob, const float *value);
void object_boundbox_flag(struct Object *ob, int flag, int set);
-void minmax_object(struct Object *ob, float *min, float *max);
+void minmax_object(struct Object *ob, float min[3], float max[3]);
int minmax_object_duplis(struct Scene *scene, struct Object *ob, float *min, float *max);
void solve_tracking (struct Object *ob, float targetmat[][4]);
int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]);
Modified: trunk/blender/source/blender/blenkernel/BKE_particle.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_particle.h 2011-11-06 13:10:45 UTC (rev 41584)
+++ trunk/blender/source/blender/blenkernel/BKE_particle.h 2011-11-06 14:00:55 UTC (rev 41585)
@@ -254,8 +254,8 @@
int psys_render_simplify_distribution(struct ParticleThreadContext *ctx, int tot);
int psys_render_simplify_params(struct ParticleSystem *psys, struct ChildParticle *cpa, float *params);
-void psys_interpolate_uvs(struct MTFace *tface, int quad, float *uv, float *uvco);
-void psys_interpolate_mcol(struct MCol *mcol, int quad, float *uv, struct MCol *mc);
+void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2]);
+void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc);
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
@@ -335,12 +335,12 @@
/* BLI_bvhtree_ray_cast callback */
void BKE_psys_collision_neartest_cb(void *userdata, int index, const struct BVHTreeRay *ray, struct BVHTreeRayHit *hit);
-void psys_particle_on_dm(struct DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
+void psys_particle_on_dm(struct DerivedMesh *dm, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3], float ornor[3]);
/* particle_system.c */
void initialize_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, int p);
void psys_calc_dmcache(struct Object *ob, struct DerivedMesh *dm, struct ParticleSystem *psys);
-int psys_particle_dm_face_lookup(struct Object *ob, struct DerivedMesh *dm, int index, float *fw, struct LinkNode *node);
+int psys_particle_dm_face_lookup(struct Object *ob, struct DerivedMesh *dm, int index, const float fw[4], struct LinkNode *node);
void reset_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra);
Modified: trunk/blender/source/blender/editors/include/ED_particle.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_particle.h 2011-11-06 13:10:45 UTC (rev 41584)
+++ trunk/blender/source/blender/editors/include/ED_particle.h 2011-11-06 14:00:55 UTC (rev 41585)
@@ -51,7 +51,7 @@
struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob);
struct PTCacheEdit *PE_create_current(struct Scene *scene, struct Object *ob);
void PE_current_changed(struct Scene *scene, struct Object *ob);
-int PE_minmax(struct Scene *scene, float *min, float *max);
+int PE_minmax(struct Scene *scene, float min[3], float max[3]);
struct ParticleEditSettings *PE_settings(struct Scene *scene);
/* update calls */
Modified: trunk/blender/source/blender/editors/physics/particle_edit.c
===================================================================
--- trunk/blender/source/blender/editors/physics/particle_edit.c 2011-11-06 13:10:45 UTC (rev 41584)
+++ trunk/blender/source/blender/editors/physics/particle_edit.c 2011-11-06 14:00:55 UTC (rev 41585)
@@ -390,7 +390,7 @@
/*************************** selection utilities *******************************/
-static int key_test_depth(PEData *data, float co[3])
+static int key_test_depth(PEData *data, const float co[3])
{
View3D *v3d= data->vc.v3d;
double ux, uy, uz;
@@ -407,7 +407,7 @@
return 0;
gluProject(co[0],co[1],co[2], data->mats.modelview, data->mats.projection,
- (GLint *)data->mats.viewport, &ux, &uy, &uz);
+ (GLint *)data->mats.viewport, &ux, &uy, &uz);
x=wco[0];
y=wco[1];
@@ -434,7 +434,7 @@
return 1;
}
-static int key_inside_circle(PEData *data, float rad, float co[3], float *distance)
+static int key_inside_circle(PEData *data, float rad, const float co[3], float *distance)
{
float dx, dy, dist;
int sco[2];
@@ -461,7 +461,7 @@
return 0;
}
-static int key_inside_rect(PEData *data, float co[3])
+static int key_inside_rect(PEData *data, const float co[3])
{
int sco[2];
@@ -477,7 +477,7 @@
return 0;
}
-static int key_inside_test(PEData *data, float co[3])
+static int key_inside_test(PEData *data, const float co[3])
{
if(data->mval)
return key_inside_circle(data, data->rad, co, NULL);
@@ -719,7 +719,7 @@
LOOP_PARTICLES {
key = pa->hair;
psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
BLI_kdtree_insert(tree, p, co, NULL);
}
@@ -733,7 +733,7 @@
LOOP_PARTICLES {
key = pa->hair;
psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
co[0]= -co[0];
@@ -818,7 +818,7 @@
key= point->keys;
mkey= mpoint->keys;
for(k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
- VECCOPY(mhkey->co, hkey->co);
+ copy_v3_v3(mhkey->co, hkey->co);
mul_m4_v3(mat, mhkey->co);
mhkey->co[0]= -mhkey->co[0];
mul_m4_v3(immat, mhkey->co);
@@ -918,7 +918,7 @@
sub_v3_v3v3(dvec, key->co, vec);
dot=dot_v3v3(dvec,nor);
- VECCOPY(dvec,nor);
+ copy_v3_v3(dvec,nor);
if(dot>0.0f) {
if(dot<dist_1st) {
@@ -1019,7 +1019,7 @@
add_v3_v3((key-1)->co, dv1);
}
- VECADD(dv1,dv0,dv2);
+ add_v3_v3v3(dv1, dv0, dv2);
}
}
}
@@ -1071,20 +1071,20 @@
MVert *mvert;
mvert=dm->getVertData(dm,mface->v1,CD_MVERT);
- VECCOPY(vec,mvert->co);
+ copy_v3_v3(vec,mvert->co);
VECCOPY(nor,mvert->no);
mvert=dm->getVertData(dm,mface->v2,CD_MVERT);
- VECADD(vec,vec,mvert->co);
+ add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
mvert=dm->getVertData(dm,mface->v3,CD_MVERT);
- VECADD(vec,vec,mvert->co);
+ add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
if(mface->v4) {
mvert=dm->getVertData(dm,mface->v4,CD_MVERT);
- VECADD(vec,vec,mvert->co);
+ add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
mul_v3_fl(vec,0.25);
@@ -1144,7 +1144,7 @@
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, hairmat);
LOOP_KEYS {
- VECCOPY(key->world_co,key->co);
+ copy_v3_v3(key->world_co,key->co);
if(!(psys->flag & PSYS_GLOBAL_HAIR))
mul_m4_v3(hairmat, key->world_co);
}
@@ -1170,13 +1170,13 @@
if(dfra <= 0.0f)
continue;
- VECSUB(key->vel, (key+1)->co, key->co);
+ sub_v3_v3v3(key->vel, (key+1)->co, key->co);
if(point->totkey>2) {
- VECSUB(vec1, (key+1)->co, (key+2)->co);
+ sub_v3_v3v3(vec1, (key+1)->co, (key+2)->co);
project_v3_v3v3(vec2, vec1, key->vel);
- VECSUB(vec2, vec1, vec2);
- VECADDFAC(key->vel, key->vel, vec2, 0.5f);
+ sub_v3_v3v3(vec2, vec1, vec2);
+ madd_v3_v3fl(key->vel, vec2, 0.5f);
}
}
else if(k==point->totkey-1) {
@@ -1185,13 +1185,13 @@
if(dfra <= 0.0f)
continue;
- VECSUB(key->vel, key->co, (key-1)->co);
+ sub_v3_v3v3(key->vel, key->co, (key-1)->co);
if(point->totkey>2) {
- VECSUB(vec1, (key-2)->co, (key-1)->co);
+ sub_v3_v3v3(vec1, (key-2)->co, (key-1)->co);
project_v3_v3v3(vec2, vec1, key->vel);
- VECSUB(vec2, vec1, vec2);
- VECADDFAC(key->vel, key->vel, vec2, 0.5f);
+ sub_v3_v3v3(vec2, vec1, vec2);
+ madd_v3_v3fl(key->vel, vec2, 0.5f);
}
}
else {
@@ -1200,7 +1200,7 @@
if(dfra <= 0.0f)
continue;
- VECSUB(key->vel, (key+1)->co, (key-1)->co);
+ sub_v3_v3v3(key->vel, (key+1)->co, (key-1)->co);
}
mul_v3_fl(key->vel, frs_sec/dfra);
}
@@ -1623,7 +1623,7 @@
if(pset->selectmode==SCE_SELECT_POINT) {
LOOP_KEYS {
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co, vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
@@ -1641,7 +1641,7 @@
else if(pset->selectmode==SCE_SELECT_END) {
key= point->keys + point->totkey - 1;
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co,vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
@@ -1934,8 +1934,8 @@
okey = pa->hair;
/* root and tip stay the same */
- VECCOPY(key->co, okey->co);
- VECCOPY((key + data->totrekey - 1)->co, (okey + pa->totkey - 1)->co);
+ copy_v3_v3(key->co, okey->co);
+ copy_v3_v3((key + data->totrekey - 1)->co, (okey + pa->totkey - 1)->co);
sta= key->time= okey->time;
end= (key + data->totrekey - 1)->time= (okey + pa->totkey - 1)->time;
@@ -1945,7 +1945,7 @@
for(k=1,key++; k<data->totrekey-1; k++,key++) {
state.time= (float)k / (float)(data->totrekey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
- VECCOPY(key->co, state.co);
+ copy_v3_v3(key->co, state.co);
key->time= sta + k * dval;
}
@@ -2038,7 +2038,7 @@
for(k=1, key++; k < pa->totkey; k++, key++) {
state.time= path_time * (float)k / (float)(pa->totkey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
- VECCOPY(key->co, state.co);
+ copy_v3_v3(key->co, state.co);
}
/* replace hair keys */
@@ -2188,7 +2188,7 @@
}
if(hkey < pa->hair + pa->totkey) {
- VECCOPY(nhkey->co, hkey->co);
+ copy_v3_v3(nhkey->co, hkey->co);
nhkey->editflag = hkey->editflag;
nhkey->time= hkey->time;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list