diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_object.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 197 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 18 | ||||
-rw-r--r-- | source/blender/editors/include/ED_particle.h | 2 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 182 | ||||
-rw-r--r-- | source/blender/editors/physics/particle_object.c | 4 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_build.c | 2 |
8 files changed, 210 insertions, 205 deletions
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index 85a986d3460..9ccdd080158 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -106,7 +106,7 @@ struct BoundBox *object_get_boundbox(struct Object *ob); 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]); diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index c4284d2cf0a..c66e49f2906 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -254,8 +254,8 @@ void psys_render_restore(struct Object *ob, struct ParticleSystem *psys); 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 @@ void psys_get_from_key(struct ParticleKey *key, float *loc, float *vel, float *r /* 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); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 76d08f6fff2..3b6fc09ad4f 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -619,13 +619,13 @@ static float psys_render_viewport_falloff(double rate, float dist, float width) return pow(rate, dist/width); } -static float psys_render_projected_area(ParticleSystem *psys, float *center, float area, double vprate, float *viewport) +static float psys_render_projected_area(ParticleSystem *psys, const float center[3], float area, double vprate, float *viewport) { ParticleRenderData *data= psys->renderdata; float co[4], view[3], ortho1[3], ortho2[3], w, dx, dy, radius; /* transform to view space */ - VECCOPY(co, center); + copy_v3_v3(co, center); co[3]= 1.0f; mul_m4_v4(data->viewmat, co); @@ -829,17 +829,17 @@ int psys_render_simplify_distribution(ParticleThreadContext *ctx, int tot) b= (origindex)? origindex[a]: a; if(b != -1) { - VECCOPY(co1, mvert[mf->v1].co); - VECCOPY(co2, mvert[mf->v2].co); - VECCOPY(co3, mvert[mf->v3].co); + copy_v3_v3(co1, mvert[mf->v1].co); + copy_v3_v3(co2, mvert[mf->v2].co); + copy_v3_v3(co3, mvert[mf->v3].co); - VECADD(facecenter[b], facecenter[b], co1); - VECADD(facecenter[b], facecenter[b], co2); - VECADD(facecenter[b], facecenter[b], co3); + add_v3_v3(facecenter[b], co1); + add_v3_v3(facecenter[b], co2); + add_v3_v3(facecenter[b], co3); if(mf->v4) { - VECCOPY(co4, mvert[mf->v4].co); - VECADD(facecenter[b], facecenter[b], co4); + copy_v3_v3(co4, mvert[mf->v4].co); + add_v3_v3(facecenter[b], co4); facearea[b] += area_quad_v3(co1, co2, co3, co4); facetotvert[b] += 4; } @@ -998,7 +998,7 @@ int psys_render_simplify_params(ParticleSystem *psys, ChildParticle *cpa, float /************************************************/ /* Interpolation */ /************************************************/ -static float interpolate_particle_value(float v1, float v2, float v3, float v4, float *w, int four) +static float interpolate_particle_value(float v1, float v2, float v3, float v4, const float w[4], int four) { float value; @@ -1029,12 +1029,12 @@ void psys_interpolate_particle(short type, ParticleKey keys[4], float dt, Partic if(dt>0.999f){ key_curve_position_weights(dt-0.001f, t, type); interp_v3_v3v3v3v3(temp, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t); - VECSUB(result->vel, result->co, temp); + sub_v3_v3v3(result->vel, result->co, temp); } else{ key_curve_position_weights(dt+0.001f, t, type); interp_v3_v3v3v3v3(temp, keys[0].co, keys[1].co, keys[2].co, keys[3].co, t); - VECSUB(result->vel, temp, result->co); + sub_v3_v3v3(result->vel, temp, result->co); } } } @@ -1180,21 +1180,21 @@ static void init_particle_interpolation(Object *ob, ParticleSystem *psys, Partic } static void edit_to_particle(ParticleKey *key, PTCacheEditKey *ekey) { - VECCOPY(key->co, ekey->co); + copy_v3_v3(key->co, ekey->co); if(ekey->vel) { - VECCOPY(key->vel, ekey->vel); + copy_v3_v3(key->vel, ekey->vel); } key->time = *(ekey->time); } static void hair_to_particle(ParticleKey *key, HairKey *hkey) { - VECCOPY(key->co, hkey->co); + copy_v3_v3(key->co, hkey->co); key->time = hkey->time; } static void mvert_to_particle(ParticleKey *key, MVert *mvert, HairKey *hkey) { - VECCOPY(key->co, mvert->co); + copy_v3_v3(key->co, mvert->co); key->time = hkey->time; } @@ -1473,13 +1473,13 @@ void psys_interpolate_face(MVert *mvert, MFace *mface, MTFace *tface, float (*or } } else { - VECCOPY(orco, vec); + copy_v3_v3(orco, vec); if(ornor && nor) - VECCOPY(ornor, nor); + copy_v3_v3(ornor, nor); } } } -void psys_interpolate_uvs(MTFace *tface, int quad, float *w, float *uvco) +void psys_interpolate_uvs(const MTFace *tface, int quad, const float w[4], float uvco[2]) { float v10= tface->uv[0][0]; float v11= tface->uv[0][1]; @@ -1502,7 +1502,7 @@ void psys_interpolate_uvs(MTFace *tface, int quad, float *w, float *uvco) } } -void psys_interpolate_mcol(MCol *mcol, int quad, float *w, MCol *mc) +void psys_interpolate_mcol(const MCol *mcol, int quad, const float w[4], MCol *mc) { char *cp, *cp1, *cp2, *cp3, *cp4; @@ -1527,7 +1527,7 @@ void psys_interpolate_mcol(MCol *mcol, int quad, float *w, MCol *mc) } } -static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int index, float *fw, float *values) +static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int index, const float fw[4], const float *values) { if(values==0 || index==-1) return 0.0; @@ -1543,18 +1543,18 @@ static float psys_interpolate_value_from_verts(DerivedMesh *dm, short from, int } } - return 0.0; + return 0.0f; } /* conversion of pa->fw to origspace layer coordinates */ -static void psys_w_to_origspace(float *w, float *uv) +static void psys_w_to_origspace(const float w[4], float uv[2]) { uv[0]= w[1] + w[2]; uv[1]= w[2] + w[3]; } /* conversion of pa->fw to weights in face from origspace */ -static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, float *w, float *neww) +static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, const float w[4], float neww[4]) { float v[4][3], co[3]; @@ -1567,17 +1567,17 @@ static void psys_origspace_to_w(OrigSpaceFace *osface, int quad, float *w, float if(quad) { v[3][0]= osface->uv[3][0]; v[3][1]= osface->uv[3][1]; v[3][2]= 0.0f; - interp_weights_poly_v3( neww,v, 4, co); + interp_weights_poly_v3(neww, v, 4, co); } else { - interp_weights_poly_v3( neww,v, 3, co); + interp_weights_poly_v3(neww, v, 3, co); neww[3]= 0.0f; } } /* find the derived mesh face for a particle, set the mf passed. this is slow * and can be optimized but only for many lookups. returns the face index. */ -int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float *fw, struct LinkNode *node) +int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const float fw[4], struct LinkNode *node) { Mesh *me= (Mesh*)ob->data; MFace *mface; @@ -1644,7 +1644,7 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, float * return DMCACHE_NOTFOUND; } -static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float UNUSED(foffset), int *mapindex, float *mapfw) +static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache, const float fw[4], float UNUSED(foffset), int *mapindex, float mapfw[4]) { if(index < 0) return 0; @@ -1704,7 +1704,7 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_ } /* interprets particle data to get a point on a mesh in object space */ -void psys_particle_on_dm(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(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]) { float tmpnor[3], mapfw[4]; float (*orcodata)[3]; @@ -1732,7 +1732,7 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache } if(orco) - VECCOPY(orco, orcodata[mapindex]) + copy_v3_v3(orco, orcodata[mapindex]); if(ornor) { dm->getVertNo(dm,mapindex,nor); @@ -1759,11 +1759,11 @@ void psys_particle_on_dm(DerivedMesh *dm, int from, int index, int index_dmcache if(from==PART_FROM_VOLUME) { psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,tmpnor,utan,vtan,orco,ornor); if(nor) - VECCOPY(nor,tmpnor); + copy_v3_v3(nor,tmpnor); normalize_v3(tmpnor); mul_v3_fl(tmpnor,-foffset); - VECADD(vec,vec,tmpnor); + add_v3_v3(vec, tmpnor); } else psys_interpolate_face(mvert,mface,mtface,orcodata,mapfw,vec,nor,utan,vtan,orco,ornor); @@ -1805,22 +1805,22 @@ static void psys_particle_on_shape(int UNUSED(distr), int UNUSED(index), float * /* TODO */ float zerovec[3]={0.0f,0.0f,0.0f}; if(vec){ - VECCOPY(vec,zerovec); + copy_v3_v3(vec,zerovec); } if(nor){ - VECCOPY(nor,zerovec); + copy_v3_v3(nor,zerovec); } if(utan){ - VECCOPY(utan,zerovec); + copy_v3_v3(utan,zerovec); } if(vtan){ - VECCOPY(vtan,zerovec); + copy_v3_v3(vtan,zerovec); } if(orco){ - VECCOPY(orco,zerovec); + copy_v3_v3(orco,zerovec); } if(ornor){ - VECCOPY(ornor,zerovec); + copy_v3_v3(ornor,zerovec); } } /************************************************/ @@ -1990,7 +1990,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float } else if(inp_z > 0.0f){ mul_v3_v3fl(state_co, z_vec, (float)sin((float)M_PI/3.f)); - VECADDFAC(state_co,state_co,y_vec,-0.5f); + madd_v3_v3fl(state_co, y_vec, -0.5f); mul_v3_fl(y_vec, -amplitude * (float)cos(t + (float)M_PI/3.f)); mul_v3_fl(z_vec, amplitude/2.f * (float)cos(2.f*t + (float)M_PI/6.f)); @@ -2088,7 +2088,7 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors) data = eff->guide_data + p; - VECSUB(efd.vec_to_point, state.co, eff->guide_loc); + sub_v3_v3v3(efd.vec_to_point, state.co, eff->guide_loc); copy_v3_v3(efd.nor, eff->guide_dir); efd.distance = len_v3(efd.vec_to_point); @@ -2142,7 +2142,7 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) normalize_v3(guidedir); - VECCOPY(vec_to_point, data->vec_to_point); + copy_v3_v3(vec_to_point, data->vec_to_point); if(guidetime != 0.0f) { /* curve direction */ @@ -2167,16 +2167,16 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) } } par.co[0] = par.co[1] = par.co[2] = 0.0f; - VECCOPY(key.co, vec_to_point); + copy_v3_v3(key.co, vec_to_point); do_kink(&key, &par, 0, guidetime, pd->kink_freq, pd->kink_shape, pd->kink_amp, 0.f, pd->kink, pd->kink_axis, 0, 0); do_clump(&key, &par, guidetime, pd->clump_fac, pd->clump_pow, 1.0f); - VECCOPY(vec_to_point, key.co); + copy_v3_v3(vec_to_point, key.co); - VECADD(vec_to_point, vec_to_point, guidevec); + add_v3_v3(vec_to_point, guidevec); - //VECSUB(pa_loc,pa_loc,pa_zero); - VECADDFAC(effect, effect, vec_to_point, data->strength); - VECADDFAC(veffect, veffect, guidedir, data->strength); + //sub_v3_v3v3(pa_loc,pa_loc,pa_zero); + madd_v3_v3fl(effect, vec_to_point, data->strength); + madd_v3_v3fl(veffect, guidedir, data->strength); totstrength += data->strength; if(pd->flag & PFIELD_GUIDE_PATH_WEIGHT) @@ -2187,12 +2187,12 @@ int do_guides(ListBase *effectors, ParticleKey *state, int index, float time) if(totstrength > 1.0f) mul_v3_fl(effect, 1.0f / totstrength); CLAMP(totstrength, 0.0f, 1.0f); - //VECADD(effect,effect,pa_zero); + //add_v3_v3(effect,pa_zero); interp_v3_v3v3(state->co, state->co, effect, totstrength); normalize_v3(veffect); mul_v3_fl(veffect, len_v3(state->vel)); - VECCOPY(state->vel, veffect); + copy_v3_v3(state->vel, veffect); return 1; } return 0; @@ -2205,15 +2205,15 @@ static void do_rough(float *loc, float mat[4][4], float t, float fac, float size if(thres != 0.0f) if((float)fabs((float)(-1.5f+loc[0]+loc[1]+loc[2]))<1.5f*thres) return; - VECCOPY(rco,loc); + copy_v3_v3(rco,loc); mul_v3_fl(rco,t); rough[0]=-1.0f+2.0f*BLI_gTurbulence(size, rco[0], rco[1], rco[2], 2,0,2); rough[1]=-1.0f+2.0f*BLI_gTurbulence(size, rco[1], rco[2], rco[0], 2,0,2); rough[2]=-1.0f+2.0f*BLI_gTurbulence(size, rco[2], rco[0], rco[1], 2,0,2); - VECADDFAC(state->co,state->co,mat[0],fac*rough[0]); - VECADDFAC(state->co,state->co,mat[1],fac*rough[1]); - VECADDFAC(state->co,state->co,mat[2],fac*rough[2]); + madd_v3_v3fl(state->co, mat[0], fac * rough[0]); + madd_v3_v3fl(state->co, mat[1], fac * rough[1]); + madd_v3_v3fl(state->co, mat[2], fac * rough[2]); } static void do_rough_end(float *loc, float mat[4][4], float t, float fac, float shape, ParticleKey *state) { @@ -2226,8 +2226,8 @@ static void do_rough_end(float *loc, float mat[4][4], float t, float fac, float rough[1]=-1.0f+2.0f*rough[1]; mul_v2_fl(rough,roughfac); - VECADDFAC(state->co,state->co,mat[0],rough[0]); - VECADDFAC(state->co,state->co,mat[1],rough[1]); + madd_v3_v3fl(state->co, mat[0], rough[0]); + madd_v3_v3fl(state->co, mat[1], rough[1]); } static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheKey *ca, int k, int steps, float *UNUSED(rootco), float effector, float UNUSED(dfra), float UNUSED(cfra), float *length, float *vec) { @@ -2239,9 +2239,9 @@ static void do_path_effectors(ParticleSimulationData *sim, int i, ParticleCacheK if(sim->psys->flag & PSYS_HAIR_DYNAMICS) return; - VECCOPY(eff_key.co,(ca-1)->co); - VECCOPY(eff_key.vel,(ca-1)->vel); - QUATCOPY(eff_key.rot,(ca-1)->rot); + copy_v3_v3(eff_key.co,(ca-1)->co); + copy_v3_v3(eff_key.vel,(ca-1)->vel); + copy_qt_qt(eff_key.rot,(ca-1)->rot); pd_point_from_particle(sim, sim->psys->particles+i, &eff_key, &epoint); pdDoEffectors(sim->psys->effectors, sim->colliders, sim->psys->part->effector_weights, &epoint, force, NULL); @@ -2264,7 +2264,7 @@ static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *st { if(*cur_length + length > max_length){ mul_v3_fl(dvec, (max_length - *cur_length) / length); - VECADD(state->co, (state - 1)->co, dvec); + add_v3_v3v3(state->co, (state - 1)->co, dvec); keys->steps = k; /* something over the maximum step value */ return k=100000; @@ -2364,8 +2364,9 @@ static void get_strand_normal(Material *ma, float *surfnor, float surfdist, floa interp_v3_v3v3(vnor, nstrand, surfnor, blend); normalize_v3(vnor); } - else - VECCOPY(vnor, nor) + else { + copy_v3_v3(vnor, nor); + } if(ma->strand_surfnor > 0.0f) { if(ma->strand_surfnor > surfdist) { @@ -2375,7 +2376,7 @@ static void get_strand_normal(Material *ma, float *surfnor, float surfdist, floa } } - VECCOPY(nor, vnor); + copy_v3_v3(nor, vnor); } static int psys_threads_init_path(ParticleThread *threads, Scene *scene, float cfra, int editupdate) @@ -2716,7 +2717,7 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle } if(ctx->ma && (part->draw_col == PART_DRAW_COL_MAT)) { - VECCOPY(child->col, &ctx->ma->r) + copy_v3_v3(child->col, &ctx->ma->r); get_strand_normal(ctx->ma, ornor, cur_length, child->vel); } } @@ -2899,7 +2900,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) psys->lattice = psys_get_lattice(sim); ma= give_current_material(sim->ob, psys->part->omat); if(ma && (psys->part->draw_col == PART_DRAW_COL_MAT)) - VECCOPY(col, &ma->r) + copy_v3_v3(col, &ma->r); if((psys->flag & PSYS_GLOBAL_HAIR)==0) { if((psys->part->flag & PART_CHILD_EFFECT)==0) @@ -2933,9 +2934,9 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra) /* hairmat is needed for for non-hair particle too so we get proper rotations */ psys_mat_hair_to_global(sim->ob, psmd->dm, psys->part->from, pa, hairmat); - VECCOPY(rotmat[0], hairmat[2]); - VECCOPY(rotmat[1], hairmat[1]); - VECCOPY(rotmat[2], hairmat[0]); + copy_v3_v3(rotmat[0], hairmat[2]); + copy_v3_v3(rotmat[1], hairmat[1]); + copy_v3_v3(rotmat[2], hairmat[0]); if(part->draw & PART_ABS_PATH_TIME) { birthtime = MAX2(pind.birthtime, part->path_start); @@ -3189,7 +3190,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf else { if((ekey + (pind.ekey[0] - point->keys))->flag & PEK_SELECT){ if((ekey + (pind.ekey[1] - point->keys))->flag & PEK_SELECT){ - VECCOPY(ca->col, sel_col); + copy_v3_v3(ca->col, sel_col); } else{ keytime = (t - (*pind.ekey[0]->time))/((*pind.ekey[1]->time) - (*pind.ekey[0]->time)); @@ -3202,7 +3203,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf interp_v3_v3v3(ca->col, nosel_col, sel_col, keytime); } else{ - VECCOPY(ca->col, nosel_col); + copy_v3_v3(ca->col, nosel_col); } } } @@ -3253,9 +3254,9 @@ void copy_particle_key(ParticleKey *to, ParticleKey *from, int time){ } } void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, float *time){ - if(loc) VECCOPY(loc,key->co); - if(vel) VECCOPY(vel,key->vel); - if(rot) QUATCOPY(rot,key->rot); + if(loc) copy_v3_v3(loc,key->co); + if(vel) copy_v3_v3(vel,key->vel); + if(rot) copy_qt_qt(rot,key->rot); if(time) *time=key->time; } /*-------changing particle keys from space to another-------*/ @@ -3263,13 +3264,13 @@ void psys_get_from_key(ParticleKey *key, float *loc, float *vel, float *rot, flo static void key_from_object(Object *ob, ParticleKey *key){ float q[4]; - VECADD(key->vel,key->vel,key->co); + add_v3_v3(key->vel, key->co); mul_m4_v3(ob->obmat,key->co); mul_m4_v3(ob->obmat,key->vel); mat4_to_quat(q,ob->obmat); - VECSUB(key->vel,key->vel,key->co); + sub_v3_v3v3(key->vel,key->vel,key->co); mul_qt_qtqt(key->rot,q,key->rot); } #endif @@ -3330,9 +3331,9 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m osface=dm->getFaceData(dm,i,CD_ORIGSPACE); if(orco && (orcodata=dm->getVertDataArray(dm, CD_ORCO))) { - VECCOPY(v[0], orcodata[mface->v1]); - VECCOPY(v[1], orcodata[mface->v2]); - VECCOPY(v[2], orcodata[mface->v3]); + copy_v3_v3(v[0], orcodata[mface->v1]); + copy_v3_v3(v[1], orcodata[mface->v2]); + copy_v3_v3(v[2], orcodata[mface->v3]); /* ugly hack to use non-transformed orcos, since only those * give symmetric results for mirroring in particle mode */ @@ -3354,7 +3355,7 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, Pa psys_face_mat(0, dm, pa, hairmat, 0); psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0); - VECCOPY(hairmat[3],vec); + copy_v3_v3(hairmat[3],vec); } void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData *pa, float hairmat[][4]) @@ -3367,7 +3368,7 @@ void psys_mat_hair_to_orco(Object *ob, DerivedMesh *dm, short from, ParticleData /* see psys_face_mat for why this function is called */ if(DM_get_vert_data_layer(dm, CD_ORIGINDEX)) transform_mesh_orco_verts(ob->data, &orco, 1, 1); - VECCOPY(hairmat[3],orco); + copy_v3_v3(hairmat[3],orco); } void psys_vec_rot_to_face(DerivedMesh *dm, ParticleData *pa, float *vec) @@ -3658,7 +3659,7 @@ void make_local_particlesettings(ParticleSettings *part) /* Textures */ /************************************************/ -static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, float *fuv, char *name, float *texco) +static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, const float fuv[4], char *name, float *texco) { MFace *mf; MTFace *tf; @@ -3702,7 +3703,7 @@ static int get_particle_uv(DerivedMesh *dm, ParticleData *pa, int face_index, fl #define CLAMP_PARTICLE_TEXTURE_POS(type, pvalue) if(event & type) { if(pvalue < 0.f) pvalue = 1.f+pvalue; CLAMP(pvalue, 0.0f, 1.0f); } #define CLAMP_PARTICLE_TEXTURE_POSNEG(type, pvalue) if(event & type) { CLAMP(pvalue, -1.0f, 1.0f); } -static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, float *fw, float *orco, ParticleTexture *ptex, int event, float cfra) +static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSettings *part, ParticleData *par, int child_index, int face_index, const float fw[4], float *orco, ParticleTexture *ptex, int event, float cfra) { MTex *mtex, **mtexp = part->mtex; int m; @@ -4071,7 +4072,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * psys_particle_on_emitter(psmd,cpa_from,cpa_num,DMCACHE_ISCHILD,cpa->fuv,foffset,co,0,0,0,orco,0); /* we need to save the actual root position of the child for positioning it accurately to the surface of the emitter */ - //VECCOPY(cpa_1st,co); + //copy_v3_v3(cpa_1st,co); //mul_m4_v3(ob->obmat,cpa_1st); @@ -4142,7 +4143,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * w++; } /* apply offset for correct positioning */ - //VECADD(state->co,state->co,cpa_1st); + //add_v3_v3(state->co, cpa_1st); } else{ /* offset the child from the parent position */ @@ -4165,13 +4166,13 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey * if(t>=0.001f){ tstate.time=t-0.001f; psys_get_particle_on_path(sim,p,&tstate,0); - VECSUB(state->vel,state->co,tstate.co); + sub_v3_v3v3(state->vel,state->co,tstate.co); normalize_v3(state->vel); } else{ tstate.time=t+0.001f; psys_get_particle_on_path(sim,p,&tstate,0); - VECSUB(state->vel,tstate.co,state->co); + sub_v3_v3v3(state->vel,tstate.co,state->co); normalize_v3(state->vel); } @@ -4422,9 +4423,9 @@ void psys_get_dupli_path_transform(ParticleSimulationData *sim, ParticleData *pa cross_v3_v3v3(nor, vec, side); unit_m4(mat); - VECCOPY(mat[0], vec); - VECCOPY(mat[1], side); - VECCOPY(mat[2], nor); + copy_v3_v3(mat[0], vec); + copy_v3_v3(mat[1], side); + copy_v3_v3(mat[2], nor); } else { quat_to_mat4(mat, pa->state.rot); @@ -4470,12 +4471,12 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] normalize_v3_v3(temp, bb->vel); - VECSUB(zvec, bb->ob->obmat[3], bb->vec); + sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec); if(bb->lock) { float fac = -dot_v3v3(zvec, temp); - VECADDFAC(zvec, zvec, temp, fac); + madd_v3_v3fl(zvec, temp, fac); } normalize_v3(zvec); @@ -4485,7 +4486,7 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] cross_v3_v3v3(yvec,zvec,xvec); } else { - VECSUB(zvec, bb->ob->obmat[3], bb->vec); + sub_v3_v3v3(zvec, bb->ob->obmat[3], bb->vec); if(bb->lock) zvec[bb->align] = 0.0f; normalize_v3(zvec); @@ -4499,22 +4500,22 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3] cross_v3_v3v3(yvec,zvec,xvec); } - VECCOPY(tvec, xvec); - VECCOPY(tvec2, yvec); + copy_v3_v3(tvec, xvec); + copy_v3_v3(tvec2, yvec); mul_v3_fl(xvec, cos(bb->tilt * (float)M_PI)); mul_v3_fl(tvec2, sin(bb->tilt * (float)M_PI)); - VECADD(xvec, xvec, tvec2); + add_v3_v3(xvec, tvec2); mul_v3_fl(yvec, cos(bb->tilt * (float)M_PI)); mul_v3_fl(tvec, -sin(bb->tilt * (float)M_PI)); - VECADD(yvec, yvec, tvec); + add_v3_v3(yvec, tvec); mul_v3_fl(xvec, bb->size[0]); mul_v3_fl(yvec, bb->size[1]); - VECADDFAC(center, bb->vec, xvec, bb->offset[0]); - VECADDFAC(center, center, yvec, bb->offset[1]); + madd_v3_v3v3fl(center, bb->vec, xvec, bb->offset[0]); + madd_v3_v3fl(center, yvec, bb->offset[1]); } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index ec058b23050..f92fb4444cc 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -454,7 +454,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys) max[2]=MAX2(max[2],mv->co[2]); } - VECSUB(delta,max,min); + sub_v3_v3v3(delta, max, min); /* determine major axis */ axis = (delta[0]>=delta[1]) ? 0 : ((delta[1]>=delta[2]) ? 1 : 2); @@ -1588,15 +1588,15 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P if(part->tanfac!=0.0f){ //float phase=vg_rot?2.0f*(psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_rot)-0.5f):0.0f; float phase=0.0f; - mul_v3_fl(vtan,-(float)cos((float)M_PI*(part->tanphase+phase))); - fac=-(float)sin((float)M_PI*(part->tanphase+phase)); - VECADDFAC(vtan,vtan,utan,fac); + mul_v3_fl(vtan,-cosf((float)M_PI*(part->tanphase+phase))); + fac= -sinf((float)M_PI*(part->tanphase+phase)); + madd_v3_v3fl(vtan, utan, fac); mul_mat3_m4_v3(ob->obmat,vtan); - VECCOPY(utan,nor); + copy_v3_v3(utan, nor); mul_v3_fl(utan,dot_v3v3(vtan,nor)); - VECSUB(vtan,vtan,utan); + sub_v3_v3(vtan, utan); normalize_v3(vtan); } @@ -2606,7 +2606,7 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa if(do_guides(sim->psys->effectors, &tkey, p, time)) { VECCOPY(pa->state.co,tkey.co); /* guides don't produce valid velocity */ - VECSUB(pa->state.vel,tkey.co,pa->prev_state.co); + sub_v3_v3v3(pa->state.vel, tkey.co, pa->prev_state.co); mul_v3_fl(pa->state.vel,1.0f/dtime); pa->state.time=tkey.time; } @@ -3471,7 +3471,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) /* create fake root before actual root to resist bending */ if(k==0) { float temp[3]; - VECSUB(temp, key->co, (key+1)->co); + sub_v3_v3v3(temp, key->co, (key+1)->co); VECCOPY(mvert->co, key->co); VECADD(mvert->co, mvert->co, temp); mul_m4_v3(hairmat, mvert->co); @@ -3589,7 +3589,7 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)){ mul_m4_v3(ob->imat, key->co); if(pa->totkey) { - VECSUB(key->co, key->co, root->co); + sub_v3_v3(key->co, root->co); psys_vec_rot_to_face(sim->psmd->dm, pa, key->co); } diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index d1da9f308fb..3035aa44735 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -51,7 +51,7 @@ int PE_start_edit(struct PTCacheEdit *edit); 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 */ diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index b0a17c6f9a9..52e6d4f6ab8 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -390,7 +390,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data) /*************************** 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 @@ static int key_test_depth(PEData *data, float co[3]) 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 @@ static int key_test_depth(PEData *data, float co[3]) 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 @@ static int key_inside_circle(PEData *data, float rad, float co[3], float *distan 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 @@ static int key_inside_rect(PEData *data, float co[3]) 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 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) 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 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys) 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 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys 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 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit) 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 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit) add_v3_v3((key-1)->co, dv1); } - VECADD(dv1,dv0,dv2); + add_v3_v3v3(dv1, dv0, dv2); } } } @@ -1071,20 +1071,20 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys) 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 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit) 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 @@ static void update_velocities(PTCacheEdit *edit) 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 @@ static void update_velocities(PTCacheEdit *edit) 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 @@ static void update_velocities(PTCacheEdit *edit) 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 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho 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 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho 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 @@ static void rekey_particle(PEData *data, int pa_index) 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 @@ static void rekey_particle(PEData *data, int pa_index) 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 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float 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 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys) } 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; nhkey->weight= hkey->weight; @@ -2199,7 +2199,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys) nkey->flag = key->flag; nkey->ftime = key->ftime; nkey->length = key->length; - VECCOPY(nkey->world_co, key->world_co); + copy_v3_v3(nkey->world_co, key->world_co); } nkey++; nhkey++; @@ -2275,7 +2275,7 @@ static void subdivide_particle(PEData *data, int pa_index) nkey->time= (key->time + (key+1)->time)*0.5f; state.time= (endtime != 0.0f)? nkey->time/endtime: 0.0f; psys_get_particle_on_path(&sim, pa_index, &state, 0); - VECCOPY(nkey->co, state.co); + copy_v3_v3(nkey->co, state.co); nekey->co= nkey->co; nekey->time= &nkey->time; @@ -2365,7 +2365,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) /* insert particles into kd tree */ LOOP_SELECTED_POINTS { psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat); - VECCOPY(co, point->keys->co); + copy_v3_v3(co, point->keys->co); mul_m4_v3(mat, co); BLI_kdtree_insert(tree, p, co, NULL); } @@ -2375,7 +2375,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op) /* tag particles to be removed */ LOOP_SELECTED_POINTS { psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat); - VECCOPY(co, point->keys->co); + copy_v3_v3(co, point->keys->co); mul_m4_v3(mat, co); totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest); @@ -2747,10 +2747,10 @@ static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], in fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac); - VECCOPY(cvec,data->dvec); + copy_v3_v3(cvec,data->dvec); mul_mat3_m4_v3(imat,cvec); mul_v3_fl(cvec, fac); - VECADD(key->co, key->co, cvec); + add_v3_v3(key->co, cvec); (data->edit->points + point_index)->flag |= PEP_EDIT_RECALC; } @@ -2861,13 +2861,13 @@ static void brush_length(PEData *data, int point_index) LOOP_KEYS { if(k==0) { - VECCOPY(pvec,key->co); + copy_v3_v3(pvec,key->co); } else { - VECSUB(dvec,key->co,pvec); - VECCOPY(pvec,key->co); + sub_v3_v3v3(dvec,key->co,pvec); + copy_v3_v3(pvec,key->co); mul_v3_fl(dvec,data->growfac); - VECADD(key->co,(key-1)->co,dvec); + add_v3_v3v3(key->co,(key-1)->co,dvec); } } @@ -2904,14 +2904,14 @@ static void brush_puff(PEData *data, int point_index) LOOP_KEYS { if(k==0) { /* find root coordinate and normal on emitter */ - VECCOPY(co, key->co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); mul_v3_m4v3(kco, data->ob->imat, co); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */ point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL); if(point_index == -1) return; - VECCOPY(rootco, co); + copy_v3_v3(rootco, co); copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]); mul_mat3_m4_v3(data->ob->obmat, nor); /* normal into worldspace */ @@ -2926,19 +2926,19 @@ static void brush_puff(PEData *data, int point_index) else { /* compute position as if hair was standing up straight. * */ - VECCOPY(lastco, co); - VECCOPY(co, key->co); + copy_v3_v3(lastco, co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); length += len_v3v3(lastco, co); if((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) { - VECADDFAC(kco, rootco, nor, length); + madd_v3_v3v3fl(kco, rootco, nor, length); /* blend between the current and straight position */ - VECSUB(dco, kco, co); - VECADDFAC(co, co, dco, fac); + sub_v3_v3v3(dco, kco, co); + madd_v3_v3fl(co, dco, fac); /* re-use dco to compare before and after translation and add to the offset */ - VECCOPY(dco, key->co); + copy_v3_v3(dco, key->co); mul_v3_m4v3(key->co, imat, co); @@ -2965,7 +2965,7 @@ static void brush_puff(PEData *data, int point_index) /* Move the unselected point on a vector based on the * hair direction and the offset */ float c1[3], c2[3]; - VECSUB(dco, lastco, co); + sub_v3_v3v3(dco, lastco, co); mul_mat3_m4_v3(imat, dco); /* into particle space */ /* move the point along a vector perpendicular to the @@ -2979,7 +2979,7 @@ static void brush_puff(PEData *data, int point_index) /* Move the unselected point on a vector based on the * the normal of the closest geometry */ float oco[3], onor[3]; - VECCOPY(oco, key->co); + copy_v3_v3(oco, key->co); mul_m4_v3(mat, oco); mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */ @@ -3028,7 +3028,7 @@ static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4 sub_v3_v3v3(dvec,key->co,(key-1)->co); mul_mat3_m4_v3(mat,dvec); - VECADD(data->vec,data->vec,dvec); + add_v3_v3(data->vec, dvec); data->tot++; } } @@ -3038,57 +3038,61 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4 float vec[3], dvec[3]; if(key_index) { - VECCOPY(vec,data->vec); + copy_v3_v3(vec, data->vec); mul_mat3_m4_v3(imat,vec); sub_v3_v3v3(dvec,key->co,(key-1)->co); - VECSUB(dvec,vec,dvec); + sub_v3_v3v3(dvec,vec,dvec); mul_v3_fl(dvec,data->smoothfac); - VECADD(key->co,key->co,dvec); + add_v3_v3(key->co, dvec); } (data->edit->points + point_index)->flag |= PEP_EDIT_RECALC; } /* convert from triangle barycentric weights to quad mean value weights */ -static void intersect_dm_quad_weights(float *v1, float *v2, float *v3, float *v4, float *w) +static void intersect_dm_quad_weights(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float w[4]) { float co[3], vert[4][3]; - VECCOPY(vert[0], v1); - VECCOPY(vert[1], v2); - VECCOPY(vert[2], v3); - VECCOPY(vert[3], v4); + copy_v3_v3(vert[0], v1); + copy_v3_v3(vert[1], v2); + copy_v3_v3(vert[2], v3); + copy_v3_v3(vert[3], v4); co[0]= v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3]; co[1]= v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3]; co[2]= v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3]; - interp_weights_poly_v3( w,vert, 4, co); + interp_weights_poly_v3(w, vert, 4, co); } /* check intersection with a derivedmesh */ -static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, float *vert_cos, float *co1, float* co2, float *min_d, int *min_face, float *min_w, - float *face_minmax, float *pa_minmax, float radius, float *ipoint) +static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, + float *vert_cos, + const float co1[3], const float co2[3], + float *min_d, int *min_face, float *min_w, + float *face_minmax, float *pa_minmax, + float radius, float *ipoint) { - MFace *mface=0; - MVert *mvert=0; + MFace *mface= NULL; + MVert *mvert= NULL; int i, totface, intersect=0; float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3],p_max[3]; float cur_ipoint[3]; - if(dm==0){ + if(dm == NULL){ psys_disable_all(ob); dm=mesh_get_derived_final(scene, ob, 0); - if(dm==0) + if(dm == NULL) dm=mesh_get_derived_deform(scene, ob, 0); psys_enable_all(ob); - if(dm==0) + if(dm == NULL) return 0; } @@ -3100,8 +3104,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa DO_MINMAX(co2,p_min,p_max); } else{ - VECCOPY(p_min,pa_minmax); - VECCOPY(p_max,pa_minmax+3); + copy_v3_v3(p_min,pa_minmax); + copy_v3_v3(p_max,pa_minmax+3); } totface=dm->getNumFaces(dm); @@ -3111,18 +3115,18 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa /* lets intersect the faces */ for(i=0; i<totface; i++,mface++){ if(vert_cos){ - VECCOPY(v1,vert_cos+3*mface->v1); - VECCOPY(v2,vert_cos+3*mface->v2); - VECCOPY(v3,vert_cos+3*mface->v3); + copy_v3_v3(v1,vert_cos+3*mface->v1); + copy_v3_v3(v2,vert_cos+3*mface->v2); + copy_v3_v3(v3,vert_cos+3*mface->v3); if(mface->v4) - VECCOPY(v4,vert_cos+3*mface->v4) + copy_v3_v3(v4,vert_cos+3*mface->v4); } else{ - VECCOPY(v1,mvert[mface->v1].co); - VECCOPY(v2,mvert[mface->v2].co); - VECCOPY(v3,mvert[mface->v3].co); + copy_v3_v3(v1,mvert[mface->v1].co); + copy_v3_v3(v2,mvert[mface->v2].co); + copy_v3_v3(v3,mvert[mface->v3].co); if(mface->v4) - VECCOPY(v4,mvert[mface->v4].co) + copy_v3_v3(v4,mvert[mface->v4].co); } if(face_minmax==0){ @@ -3136,8 +3140,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa continue; } else{ - VECCOPY(min, face_minmax+6*i); - VECCOPY(max, face_minmax+6*i+3); + copy_v3_v3(min, face_minmax+6*i); + copy_v3_v3(max, face_minmax+6*i+3); if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0) continue; } @@ -3146,7 +3150,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)){ if(cur_d<*min_d){ *min_d=cur_d; - VECCOPY(ipoint,cur_ipoint); + copy_v3_v3(ipoint,cur_ipoint); *min_face=i; intersect=1; } @@ -3155,7 +3159,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)){ if(cur_d<*min_d){ *min_d=cur_d; - VECCOPY(ipoint,cur_ipoint); + copy_v3_v3(ipoint,cur_ipoint); *min_face=i; intersect=1; } @@ -3363,27 +3367,27 @@ static int brush_add(PEData *data, short number) key3[1].time= key3[0].time; psys_get_particle_on_path(&sim, ptn[1].index, &key3[1], 0); mul_v3_fl(key3[1].co, weight[1]); - VECADD(key3[0].co, key3[0].co, key3[1].co); + add_v3_v3(key3[0].co, key3[1].co); if(maxw>2) { key3[2].time= key3[0].time; psys_get_particle_on_path(&sim, ptn[2].index, &key3[2], 0); mul_v3_fl(key3[2].co, weight[2]); - VECADD(key3[0].co, key3[0].co, key3[2].co); + add_v3_v3(key3[0].co, key3[2].co); } } if(k==0) - VECSUB(co1, pa->state.co, key3[0].co); + sub_v3_v3v3(co1, pa->state.co, key3[0].co); - VECADD(thkey->co, key3[0].co, co1); + add_v3_v3v3(thkey->co, key3[0].co, co1); thkey->time= key3[0].time; } } else { for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) { - VECADDFAC(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep); + madd_v3_v3v3fl(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep); hkey->time += k * framestep; hkey->weight = 1.f - (float)k/(float)(pset->totaddkey-1); } @@ -4043,7 +4047,7 @@ const char *PE_undo_get_name(Scene *scene, int nr, int *active) /************************ utilities ******************************/ -int PE_minmax(Scene *scene, float *min, float *max) +int PE_minmax(Scene *scene, float min[3], float max[3]) { Object *ob= OBACT; PTCacheEdit *edit= PE_get_current(scene, ob); @@ -4065,7 +4069,7 @@ int PE_minmax(Scene *scene, float *min, float *max) psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, mat); LOOP_SELECTED_KEYS { - VECCOPY(co, key->co); + copy_v3_v3(co, key->co); mul_m4_v3(mat, co); DO_MINMAX(co, min, max); ok= 1; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 101a6744e9a..bbff2239a38 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -688,7 +688,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys) psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat); invert_m4_m4(imat,hairmat); - VECSUB(vec, nearest.co, key->co); + sub_v3_v3v3(vec, nearest.co, key->co); if(point) { ekey = point->keys; @@ -696,7 +696,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys) } for(k=0,key=pa->hair; k<pa->totkey; k++,key++) { - VECADD(key->co, key->co, vec); + add_v3_v3(key->co, vec); mul_m4_v3(imat,key->co); if(ekey) { diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index 10f5645ca3b..266bff35bbd 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -75,7 +75,7 @@ static int dependsOnTime(ModifierData *UNUSED(md)) return 1; } -static DerivedMesh *applyModifier(ModifierData *md, Object *ob, +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), DerivedMesh *derivedData, int UNUSED(useRenderParams), int UNUSED(isFinalCalc)) |