diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_effect.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/boids.c | 126 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 24 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fluidsim.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 83 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh.c | 5 | ||||
-rw-r--r-- | source/blender/render/intern/source/occlusion.c | 6 |
10 files changed, 137 insertions, 136 deletions
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 59a361c010d..7f4e809718c 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -129,7 +129,7 @@ void pd_point_from_soft(struct Scene *scene, float *loc, float *vel, int index, /* needed for boids */ float effector_falloff(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, struct EffectorWeights *weights); -int closest_point_on_surface(struct SurfaceModifierData *surmd, float *co, float *surface_co, float *surface_nor, float *surface_vel); +int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3]); int get_effector_data(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, int real_velocity); /* required for particle_system.c */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 0c99735f73e..aaed0381b2e 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -292,7 +292,7 @@ void DM_to_meshkey(DerivedMesh *dm, Mesh *me, KeyBlock *kb) mvert=dm->getVertDataArray(dm, CD_MVERT); for(a=0; a<kb->totelem; a++, fp+=3, mvert++) { - VECCOPY(fp, mvert->co); + copy_v3_v3(fp, mvert->co); } } @@ -604,12 +604,12 @@ static void emDM_drawUVEdges(DerivedMesh *dm) static void emDM__calcFaceCent(EditFace *efa, float cent[3], float (*vertexCos)[3]) { if (vertexCos) { - VECCOPY(cent, vertexCos[(int) efa->v1->tmp.l]); + copy_v3_v3(cent, vertexCos[(int) efa->v1->tmp.l]); add_v3_v3(cent, vertexCos[(int) efa->v2->tmp.l]); add_v3_v3(cent, vertexCos[(int) efa->v3->tmp.l]); if (efa->v4) add_v3_v3(cent, vertexCos[(int) efa->v4->tmp.l]); } else { - VECCOPY(cent, efa->v1->co); + copy_v3_v3(cent, efa->v1->co); add_v3_v3(cent, efa->v2->co); add_v3_v3(cent, efa->v3->co); if (efa->v4) add_v3_v3(cent, efa->v4->co); @@ -1184,7 +1184,7 @@ static void emDM_getVert(DerivedMesh *dm, int index, MVert *vert_r) for(i = 0; i < index; ++i) ev = ev->next; - VECCOPY(vert_r->co, ev->co); + copy_v3_v3(vert_r->co, ev->co); normal_float_to_short_v3(vert_r->no, ev->no); @@ -1539,8 +1539,9 @@ static float *get_editmesh_orco_verts(EditMesh *em) orco = MEM_mallocN(sizeof(float)*3*totvert, "EditMesh Orco"); - for(a=0, eve=em->verts.first; eve; eve=eve->next, a+=3) - VECCOPY(orco+a, eve->co); + for(a=0, eve=em->verts.first; eve; eve=eve->next, a+=3) { + copy_v3_v3(orco+a, eve->co); + } return orco; } @@ -2146,7 +2147,7 @@ float (*editmesh_get_vertex_cos(EditMesh *em, int *numVerts_r))[3] cos = MEM_mallocN(sizeof(*cos)*numVerts, "vertexcos"); for (i=0,eve=em->verts.first; i<numVerts; i++,eve=eve->next) { - VECCOPY(cos[i], eve->co); + copy_v3_v3(cos[i], eve->co); } return cos; @@ -2654,7 +2655,7 @@ static void GetPosition(const SMikkTSpaceContext * pContext, float fPos[], const //assert(vert_index>=0 && vert_index<4); SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; const float *co= pMesh->mvert[(&pMesh->mface[face_num].v1)[vert_index]].co; - VECCOPY(fPos, co); + copy_v3_v3(fPos, co); } static void GetTextureCoordinate(const SMikkTSpaceContext * pContext, float fUV[], const int face_num, const int vert_index) @@ -2680,7 +2681,7 @@ static void GetNormal(const SMikkTSpaceContext * pContext, float fNorm[], const const int smoothnormal = (pMesh->mface[face_num].flag & ME_SMOOTH); if(!smoothnormal) { // flat if(pMesh->precomputedFaceNormals) { - VECCOPY(fNorm, &pMesh->precomputedFaceNormals[3*face_num]); + copy_v3_v3(fNorm, &pMesh->precomputedFaceNormals[3*face_num]); } else { MFace *mf= &pMesh->mface[face_num]; @@ -2707,7 +2708,7 @@ static void SetTSpace(const SMikkTSpaceContext * pContext, const float fvTangent //assert(vert_index>=0 && vert_index<4); SGLSLMeshToTangent * pMesh = (SGLSLMeshToTangent *) pContext->m_pUserData; float * pRes = pMesh->tangent[4*face_num+iVert]; - VECCOPY(pRes, fvTangent); + copy_v3_v3(pRes, fvTangent); pRes[3]=fSign; } diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 3ae81c70d4f..c9868bd900f 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -162,7 +162,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, negate_v3_v3(efd.vec_to_point, bpa->gravity); } - VECCOPY(bbd->wanted_co, efd.vec_to_point); + copy_v3_v3(bbd->wanted_co, efd.vec_to_point); mul_v3_fl(bbd->wanted_co, mul); bbd->wanted_speed = val->max_speed * priority; @@ -204,7 +204,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * BVHTreeRayHit hit; float radius = val->personal_space * pa->size, ray_dir[3]; - VECCOPY(col.co1, pa->prev_state.co); + copy_v3_v3(col.co1, pa->prev_state.co); add_v3_v3v3(col.co2, pa->prev_state.co, pa->prev_state.vel); sub_v3_v3v3(ray_dir, col.co2, col.co1); mul_v3_fl(ray_dir, acbr->look_ahead); @@ -254,10 +254,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * { neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn); if(neighbors > 1) for(n=1; n<neighbors; n++) { - VECCOPY(co1, pa->prev_state.co); - VECCOPY(vel1, pa->prev_state.vel); - VECCOPY(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co); - VECCOPY(vel2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.vel); + copy_v3_v3(co1, pa->prev_state.co); + copy_v3_v3(vel1, pa->prev_state.vel); + copy_v3_v3(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co); + copy_v3_v3(vel2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.vel); sub_v3_v3v3(loc, co1, co2); @@ -270,8 +270,8 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * t = -dot_v3v3(loc, vec)/inp; /* cpa is not too far in the future so investigate further */ if(t > 0.0f && t < t_min) { - VECADDFAC(co1, co1, vel1, t); - VECADDFAC(co2, co2, vel2, t); + madd_v3_v3fl(co1, vel1, t); + madd_v3_v3fl(co2, vel2, t); sub_v3_v3v3(vec, co2, co1); @@ -300,10 +300,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * if(epsys) { neighbors = BLI_kdtree_range_search(epsys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn); if(neighbors > 0) for(n=0; n<neighbors; n++) { - VECCOPY(co1, pa->prev_state.co); - VECCOPY(vel1, pa->prev_state.vel); - VECCOPY(co2, (epsys->particles + ptn[n].index)->prev_state.co); - VECCOPY(vel2, (epsys->particles + ptn[n].index)->prev_state.vel); + copy_v3_v3(co1, pa->prev_state.co); + copy_v3_v3(vel1, pa->prev_state.vel); + copy_v3_v3(co2, (epsys->particles + ptn[n].index)->prev_state.co); + copy_v3_v3(vel2, (epsys->particles + ptn[n].index)->prev_state.vel); sub_v3_v3v3(loc, co1, co2); @@ -316,8 +316,8 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues * t = -dot_v3v3(loc, vec)/inp; /* cpa is not too far in the future so investigate further */ if(t > 0.0f && t < t_min) { - VECADDFAC(co1, co1, vel1, t); - VECADDFAC(co2, co2, vel2, t); + madd_v3_v3fl(co1, vel1, t); + madd_v3_v3fl(co2, vel2, t); sub_v3_v3v3(vec, co2, co1); @@ -439,7 +439,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va len = len_v3(loc); /* too close to leader */ if(len < 2.0f * val->personal_space * pa->size) { - VECCOPY(bbd->wanted_co, loc); + copy_v3_v3(bbd->wanted_co, loc); bbd->wanted_speed = val->max_speed; return 1; } @@ -449,7 +449,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va /* possible blocking of leader in near future */ if(t > 0.0f && t < 3.0f) { - VECCOPY(vec2, vec); + copy_v3_v3(vec2, vec); mul_v3_fl(vec2, t); sub_v3_v3v3(vec2, loc, vec2); @@ -457,7 +457,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va len = len_v3(vec2); if(len < 2.0f * val->personal_space * pa->size) { - VECCOPY(bbd->wanted_co, vec2); + copy_v3_v3(bbd->wanted_co, vec2); bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f; return 1; } @@ -466,17 +466,17 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va /* not blocking so try to follow leader */ if(p && flbr->options & BRULE_LEADER_IN_LINE) { - VECCOPY(vec, bbd->sim->psys->particles[p-1].prev_state.vel); - VECCOPY(loc, bbd->sim->psys->particles[p-1].prev_state.co); + copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel); + copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co); } else { - VECCOPY(loc, flbr->oloc); + copy_v3_v3(loc, flbr->oloc); sub_v3_v3v3(vec, flbr->loc, flbr->oloc); mul_v3_fl(vec, 1.0f/bbd->timestep); } /* fac is seconds behind leader */ - VECADDFAC(loc, loc, vec, -flbr->distance); + madd_v3_v3fl(loc, vec, -flbr->distance); sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co); bbd->wanted_speed = len_v3(bbd->wanted_co); @@ -488,7 +488,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va /* first check we're not blocking any leaders */ for(i = 0; i< bbd->sim->psys->totpart; i+=n){ - VECCOPY(vec, bbd->sim->psys->particles[i].prev_state.vel); + copy_v3_v3(vec, bbd->sim->psys->particles[i].prev_state.vel); sub_v3_v3v3(loc, pa->prev_state.co, bbd->sim->psys->particles[i].prev_state.co); @@ -499,7 +499,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va len = len_v3(loc); /* too close to leader */ if(len < 2.0f * val->personal_space * pa->size) { - VECCOPY(bbd->wanted_co, loc); + copy_v3_v3(bbd->wanted_co, loc); bbd->wanted_speed = val->max_speed; return 1; } @@ -509,7 +509,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va /* possible blocking of leader in near future */ if(t > 0.0f && t < t_min) { - VECCOPY(vec2, vec); + copy_v3_v3(vec2, vec); mul_v3_fl(vec2, t); sub_v3_v3v3(vec2, loc, vec2); @@ -518,7 +518,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va if(len < 2.0f * val->personal_space * pa->size) { t_min = t; - VECCOPY(bbd->wanted_co, loc); + copy_v3_v3(bbd->wanted_co, loc); bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f; ret = 1; } @@ -530,16 +530,16 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va /* not blocking so try to follow leader */ if(flbr->options & BRULE_LEADER_IN_LINE) { - VECCOPY(vec, bbd->sim->psys->particles[p-1].prev_state.vel); - VECCOPY(loc, bbd->sim->psys->particles[p-1].prev_state.co); + copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel); + copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co); } else { - VECCOPY(vec, bbd->sim->psys->particles[p - p%n].prev_state.vel); - VECCOPY(loc, bbd->sim->psys->particles[p - p%n].prev_state.co); + copy_v3_v3(vec, bbd->sim->psys->particles[p - p%n].prev_state.vel); + copy_v3_v3(loc, bbd->sim->psys->particles[p - p%n].prev_state.co); } /* fac is seconds behind leader */ - VECADDFAC(loc, loc, vec, -flbr->distance); + madd_v3_v3fl(loc, vec, -flbr->distance); sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co); bbd->wanted_speed = len_v3(bbd->wanted_co); @@ -563,11 +563,11 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va normalize_v3(bpa->wander); - VECCOPY(vec, bpa->wander); + copy_v3_v3(vec, bpa->wander); mul_qt_v3(pa->prev_state.rot, vec); - VECCOPY(bbd->wanted_co, pa->prev_state.ave); + copy_v3_v3(bbd->wanted_co, pa->prev_state.ave); mul_v3_fl(bbd->wanted_co, 1.1f); @@ -581,7 +581,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va } } else { - VECCOPY(bbd->wanted_co, pa->prev_state.ave); + copy_v3_v3(bbd->wanted_co, pa->prev_state.ave); /* may happen at birth */ if(dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) { @@ -643,7 +643,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti health += bpa->data.health; if(n==0 && pt->mode==PTARGET_MODE_ENEMY && ptn[n].dist < closest_dist) { - VECCOPY(closest_enemy, ptn[n].co); + copy_v3_v3(closest_enemy, ptn[n].co); closest_dist = ptn[n].dist; enemy_pa = epars + ptn[n].index; } @@ -741,7 +741,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData * } } -static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *ground_co, float *ground_nor) +static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float ground_co[3], float ground_nor[3]) { BoidParticle *bpa = pa->boid; @@ -820,7 +820,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro } /* default to z=0 */ - VECCOPY(ground_co, pa->state.co); + copy_v3_v3(ground_co, pa->state.co); ground_co[2] = 0; ground_nor[0] = ground_nor[1] = 0.0f; ground_nor[2] = 1.0f; @@ -853,8 +853,8 @@ void boids_precalc_rules(ParticleSettings *part, float cfra) if(flbr->ob && flbr->cfra != cfra) { /* save object locations for velocity calculations */ - VECCOPY(flbr->oloc, flbr->loc); - VECCOPY(flbr->loc, flbr->ob->obmat[3]); + copy_v3_v3(flbr->oloc, flbr->loc); + copy_v3_v3(flbr->loc, flbr->ob->obmat[3]); flbr->cfra = cfra; } } @@ -868,7 +868,7 @@ static void boid_climb(BoidSettings *boids, ParticleData *pa, float *surface_co, copy_v3_v3(nor, surface_nor); /* gather apparent gravity */ - VECADDFAC(bpa->gravity, bpa->gravity, surface_nor, -1.0f); + madd_v3_v3fl(bpa->gravity, surface_nor, -1.0f); normalize_v3(bpa->gravity); /* raise boid it's size from surface */ @@ -997,7 +997,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) wanted_speed /= (float)n; } - VECCOPY(bbd->wanted_co, wanted_co); + copy_v3_v3(bbd->wanted_co, wanted_co); bbd->wanted_speed = wanted_speed; break; } @@ -1012,10 +1012,10 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) { float cvel[3], dir[3]; - VECCOPY(dir, pa->prev_state.ave); + copy_v3_v3(dir, pa->prev_state.ave); normalize_v2(dir); - VECCOPY(cvel, bbd->wanted_co); + copy_v3_v3(cvel, bbd->wanted_co); normalize_v2(cvel); if(dot_v2v2(cvel, dir) > 0.95f / mul) @@ -1031,10 +1031,10 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) float z_v, ground_v, cur_v; float len; - VECCOPY(dir, pa->prev_state.ave); + copy_v3_v3(dir, pa->prev_state.ave); normalize_v2(dir); - VECCOPY(cvel, bbd->wanted_co); + copy_v3_v3(cvel, bbd->wanted_co); normalize_v2(cvel); len = len_v2(pa->prev_state.vel); @@ -1054,7 +1054,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) len = MIN2(len, val.jump_speed); - VECCOPY(jump_v, dir); + copy_v3_v3(jump_v, dir); jump_v[2] = z_v; mul_v3_fl(jump_v, ground_v); @@ -1071,7 +1071,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) } if(jump) { - VECCOPY(pa->prev_state.vel, jump_v); + copy_v3_v3(pa->prev_state.vel, jump_v); bpa->data.mode = eBoidMode_Falling; } } @@ -1143,12 +1143,12 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) } } - VECCOPY(old_dir, pa->prev_state.ave); + copy_v3_v3(old_dir, pa->prev_state.ave); new_speed = normalize_v3_v3(wanted_dir, bbd->wanted_co); /* first check if we have valid direction we want to go towards */ if(new_speed == 0.0f) { - VECCOPY(new_dir, old_dir); + copy_v3_v3(new_dir, old_dir); } else { float old_dir2[2], wanted_dir2[2], nor[3], angle; @@ -1172,13 +1172,13 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) cross_v3_v3v3(nor, old_dir, wanted_dir); axis_angle_to_quat( q,nor, angle); - VECCOPY(new_dir, old_dir); + copy_v3_v3(new_dir, old_dir); mul_qt_v3(q, new_dir); normalize_v3(new_dir); /* save direction in case resulting velocity too small */ axis_angle_to_quat( q,nor, angle*dtime); - VECCOPY(pa->state.ave, old_dir); + copy_v3_v3(pa->state.ave, old_dir); mul_qt_v3(q, pa->state.ave); normalize_v3(pa->state.ave); } @@ -1192,7 +1192,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) new_speed = MIN2(bbd->wanted_speed, old_speed + val.max_acc); /* combine direction and speed */ - VECCOPY(new_vel, new_dir); + copy_v3_v3(new_vel, new_dir); mul_v3_fl(new_vel, new_speed); /* maintain minimum flying velocity if not landing */ @@ -1236,7 +1236,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) add_v3_v3(acc, force); /* store smoothed acceleration for nice banking etc. */ - VECADDFAC(bpa->data.acc, bpa->data.acc, acc, dtime); + madd_v3_v3fl(bpa->data.acc, acc, dtime); mul_v3_fl(bpa->data.acc, 1.0f / (1.0f + dtime)); /* integrate new location & velocity */ @@ -1245,15 +1245,15 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* can get better control allthough it's a bit unphysical */ mul_v3_fl(acc, 1.0f/pa_mass); - VECCOPY(dvec, acc); + copy_v3_v3(dvec, acc); mul_v3_fl(dvec, dtime*dtime*0.5f); - VECCOPY(bvec, pa->prev_state.vel); + copy_v3_v3(bvec, pa->prev_state.vel); mul_v3_fl(bvec, dtime); add_v3_v3(dvec, bvec); add_v3_v3(pa->state.co, dvec); - VECADDFAC(pa->state.vel, pa->state.vel, acc, dtime); + madd_v3_v3fl(pa->state.vel, acc, dtime); //if(bpa->data.mode != eBoidMode_InAir) bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor); @@ -1274,11 +1274,11 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) sub_v3_v3v3(dvec, bpa->data.acc, dvec); } else { - VECCOPY(dvec, bpa->data.acc); + copy_v3_v3(dvec, bpa->data.acc); } /* gather apparent gravity */ - VECADDFAC(bpa->gravity, grav, dvec, -boids->banking); + madd_v3_v3v3fl(bpa->gravity, grav, dvec, -boids->banking); normalize_v3(bpa->gravity); /* stick boid on goal when close enough */ @@ -1313,7 +1313,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* gather apparent gravity */ - VECADDFAC(bpa->gravity, bpa->gravity, grav, dtime); + madd_v3_v3fl(bpa->gravity, grav, dtime); normalize_v3(bpa->gravity); if(boids->options & BOID_ALLOW_LAND) { @@ -1345,7 +1345,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) //copy_v3_v3(nor, ground_nor); ///* gather apparent gravity to r_ve */ - //VECADDFAC(pa->r_ve, pa->r_ve, ground_nor, -1.0); + //madd_v3_v3fl(pa->r_ve, ground_nor, -1.0); //normalize_v3(pa->r_ve); ///* raise boid it's size from surface */ @@ -1385,12 +1385,12 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) sub_v3_v3v3(dvec, bpa->data.acc, dvec); /* gather apparent gravity */ - VECADDFAC(bpa->gravity, grav, dvec, -boids->banking); + madd_v3_v3v3fl(bpa->gravity, grav, dvec, -boids->banking); normalize_v3(bpa->gravity); } else { /* gather negative surface normal */ - VECADDFAC(bpa->gravity, bpa->gravity, ground_nor, -1.0f); + madd_v3_v3fl(bpa->gravity, ground_nor, -1.0f); normalize_v3(bpa->gravity); } break; @@ -1411,7 +1411,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) /* calculate rotation matrix based on forward & down vectors */ if(bpa->data.mode == eBoidMode_InAir) { - VECCOPY(mat[0], pa->state.ave); + copy_v3_v3(mat[0], pa->state.ave); project_v3_v3v3(dvec, bpa->gravity, pa->state.ave); sub_v3_v3v3(mat[2], bpa->gravity, dvec); @@ -1422,7 +1422,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa) sub_v3_v3v3(mat[0], pa->state.ave, dvec); normalize_v3(mat[0]); - VECCOPY(mat[2], bpa->gravity); + copy_v3_v3(mat[2], bpa->gravity); } negate_v3(mat[2]); cross_v3_v3v3(mat[1], mat[2], mat[0]); diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 444d17ad004..f917a0fe68c 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -190,7 +190,7 @@ static BVHTree *bvhselftree_build_from_cloth (ClothModifierData *clmd, float eps // fill tree for(i = 0; i < cloth->numverts; i++, verts++) { - VECCOPY(&co[0*3], verts->xold); + copy_v3_v3(&co[0*3], verts->xold); BLI_bvhtree_insert(bvhtree, i, co, 1); } diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index bb14a1ddeaf..7b58c0bc00b 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -555,7 +555,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU if(falloff == 0.0f) break; - VECADDFAC(temp, efd->vec_to_point, efd->nor, -fac); + madd_v3_v3v3fl(temp, efd->vec_to_point, efd->nor, -fac); r_fac= len_v3(temp); falloff*= falloff_func_rad(eff->pd, r_fac); break; @@ -573,7 +573,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU return falloff; } -int closest_point_on_surface(SurfaceModifierData *surmd, float *co, float *surface_co, float *surface_nor, float *surface_vel) +int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3]) { BVHTreeNearest nearest; @@ -797,7 +797,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP if(eff->pd->flag & PFIELD_TEX_2D) { float fac=-dot_v3v3(tex_co, efd->nor); - VECADDFAC(tex_co, tex_co, efd->nor, fac); + madd_v3_v3fl(tex_co, efd->nor, fac); } if(eff->pd->flag & PFIELD_TEX_OBJECT) { @@ -848,7 +848,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP if(eff->pd->flag & PFIELD_TEX_2D){ float fac = -dot_v3v3(force, efd->nor); - VECADDFAC(force, force, efd->nor, fac); + madd_v3_v3fl(force, efd->nor, fac); } add_v3_v3(total_force, force); @@ -897,7 +897,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected cross_v3_v3v3(force, efd->nor2, temp); mul_v3_fl(force, strength * efd->falloff); - VECADDFAC(temp, temp, point->vel, -point->vel_to_sec); + madd_v3_v3fl(temp, point->vel, -point->vel_to_sec); add_v3_v3(force, temp); } break; @@ -940,7 +940,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected copy_v3_v3(temp, point->loc); } else { - VECADD(temp, efd->vec_to_point2, efd->nor2); + add_v3_v3v3(temp, efd->vec_to_point2, efd->nor2); } force[0] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[0], temp[1], temp[2], 2,0,2); force[1] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[1], temp[2], temp[0], 2,0,2); @@ -959,10 +959,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected } if(pd->flag & PFIELD_DO_LOCATION) { - VECADDFAC(total_force, total_force, force, 1.0f/point->vel_to_sec); + madd_v3_v3fl(total_force, force, 1.0f/point->vel_to_sec); if(ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) { - VECADDFAC(total_force, total_force, point->vel, -pd->f_flow * efd->falloff); + madd_v3_v3fl(total_force, point->vel, -pd->f_flow * efd->falloff); } } @@ -972,7 +972,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected mul_qt_v3(point->rot, xvec); cross_v3_v3v3(dave, xvec, force); if(pd->f_flow != 0.0f) { - VECADDFAC(dave, dave, point->ave, -pd->f_flow * efd->falloff); + madd_v3_v3fl(dave, point->ave, -pd->f_flow * efd->falloff); } add_v3_v3(point->ave, dave); } @@ -1038,14 +1038,14 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we // for softbody backward compatibility if(point->flag & PE_WIND_AS_SPEED && impulse){ - VECSUB(temp2, force, temp1); - VECSUB(impulse, impulse, temp2); + sub_v3_v3v3(temp2, force, temp1); + sub_v3_v3v3(impulse, impulse, temp2); } } } else if(eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) { /* special case for harmonic effector */ - VECADD(impulse, impulse, efd.vel); + add_v3_v3v3(impulse, impulse, efd.vel); } } } diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index bf432785064..cdb2b194b43 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -92,7 +92,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob, *numVertices = totvert; verts = MEM_callocN( totvert*3*sizeof(float), "elbeemmesh_vertices"); for(i=0; i<totvert; i++) { - VECCOPY( &verts[i*3], mvert[i].co); + copy_v3_v3(&verts[i*3], mvert[i].co); if(useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i*3]); } } *vertices = verts; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 7174126a00c..60941ef78a3 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -172,7 +172,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, { float tmp[3]; - VECCOPY(tmp, verts[i].co); + copy_v3_v3(tmp, verts[i].co); mul_m4_v3(ob->obmat, tmp); // min BB @@ -186,11 +186,11 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, max[2] = MAX2(max[2], tmp[2]); } - VECCOPY(smd->domain->p0, min); - VECCOPY(smd->domain->p1, max); + copy_v3_v3(smd->domain->p0, min); + copy_v3_v3(smd->domain->p1, max); // calc other res with max_res provided - VECSUB(size, max, min); + sub_v3_v3v3(size, max, min); // printf("size: %f, %f, %f\n", size[0], size[1], size[2]); @@ -354,9 +354,9 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) for(i = 0; i < dm->getNumVerts(dm); i++) { float tmpvec[3]; - VECCOPY(tmpvec, mvert[i].co); + copy_v3_v3(tmpvec, mvert[i].co); mul_m4_v3(ob->obmat, tmpvec); - VECCOPY(&scs->points[i * 3], tmpvec); + copy_v3_v3(&scs->points[i * 3], tmpvec); } for(i = 0, facecounter = 0; i < dm->getNumFaces(dm); i++) @@ -372,18 +372,18 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) if(again == 1 && mface[i].v4) { - VECSUB(side1, mvert[ mface[i].v3 ].co, mvert[ mface[i].v1 ].co); - VECSUB(side2, mvert[ mface[i].v4 ].co, mvert[ mface[i].v1 ].co); + sub_v3_v3v3(side1, mvert[ mface[i].v3 ].co, mvert[ mface[i].v1 ].co); + sub_v3_v3v3(side2, mvert[ mface[i].v4 ].co, mvert[ mface[i].v1 ].co); } else { - VECSUB(side1, mvert[ mface[i].v2 ].co, mvert[ mface[i].v1 ].co); - VECSUB(side2, mvert[ mface[i].v3 ].co, mvert[ mface[i].v1 ].co); + sub_v3_v3v3(side1, mvert[ mface[i].v2 ].co, mvert[ mface[i].v1 ].co); + sub_v3_v3v3(side2, mvert[ mface[i].v3 ].co, mvert[ mface[i].v1 ].co); } cross_v3_v3v3(trinormorg, side1, side2); normalize_v3(trinormorg); - VECCOPY(trinorm, trinormorg); + copy_v3_v3(trinorm, trinormorg); mul_v3_fl(trinorm, 0.25 * cell_len); for(j = 0; j <= divs1; j++) @@ -401,43 +401,42 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) continue; } - VECCOPY(p1, mvert[ mface[i].v1 ].co); + copy_v3_v3(p1, mvert[ mface[i].v1 ].co); if(again == 1 && mface[i].v4) { - VECCOPY(p2, mvert[ mface[i].v3 ].co); - VECCOPY(p3, mvert[ mface[i].v4 ].co); + copy_v3_v3(p2, mvert[ mface[i].v3 ].co); + copy_v3_v3(p3, mvert[ mface[i].v4 ].co); } else { - VECCOPY(p2, mvert[ mface[i].v2 ].co); - VECCOPY(p3, mvert[ mface[i].v3 ].co); + copy_v3_v3(p2, mvert[ mface[i].v2 ].co); + copy_v3_v3(p3, mvert[ mface[i].v3 ].co); } mul_v3_fl(p1, (1.0-uf-vf)); mul_v3_fl(p2, uf); mul_v3_fl(p3, vf); - VECADD(p, p1, p2); - VECADD(p, p, p3); + add_v3_v3v3(p, p1, p2); + add_v3_v3(p, p3); if(newdivs > divs) printf("mem problem\n"); // mMovPoints.push_back(p + trinorm); - VECCOPY(tmpvec, p); - VECADD(tmpvec, tmpvec, trinorm); + add_v3_v3v3(tmpvec, p, trinorm); mul_m4_v3(ob->obmat, tmpvec); - VECCOPY(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec); + copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec); newdivs++; if(newdivs > divs) printf("mem problem\n"); // mMovPoints.push_back(p - trinorm); - VECCOPY(tmpvec, p); - VECSUB(tmpvec, tmpvec, trinorm); + copy_v3_v3(tmpvec, p); + sub_v3_v3(tmpvec, trinorm); mul_m4_v3(ob->obmat, tmpvec); - VECCOPY(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec); + copy_v3_v3(&scs->points[3 * (dm->getNumVerts(dm) + newdivs)], tmpvec); newdivs++; } } @@ -488,23 +487,23 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa float side3[3]; int divs1=0, divs2=0, divs3=0; - VECCOPY(p0, verts[faces[i].v1].co); + copy_v3_v3(p0, verts[faces[i].v1].co); mul_m4_v3(ob->obmat, p0); - VECCOPY(p1, verts[faces[i].v2].co); + copy_v3_v3(p1, verts[faces[i].v2].co); mul_m4_v3(ob->obmat, p1); - VECCOPY(p2, verts[faces[i].v3].co); + copy_v3_v3(p2, verts[faces[i].v3].co); mul_m4_v3(ob->obmat, p2); - VECSUB(side1, p1, p0); - VECSUB(side2, p2, p0); - VECSUB(side3, p1, p2); + sub_v3_v3v3(side1, p1, p0); + sub_v3_v3v3(side2, p2, p0); + sub_v3_v3v3(side3, p1, p2); - if(INPR(side1, side1) > fsTri*fsTri) + if(dot_v3v3(side1, side1) > fsTri*fsTri) { float tmp = normalize_v3(side1); divs1 = (int)ceil(tmp/fsTri); } - if(INPR(side2, side2) > fsTri*fsTri) + if(dot_v3v3(side2, side2) > fsTri*fsTri) { float tmp = normalize_v3(side2); divs2 = (int)ceil(tmp/fsTri); @@ -527,23 +526,23 @@ static void calcTriangleDivs(Object *ob, MVert *verts, int UNUSED(numverts), MFa facecounter++; - VECCOPY(p0, verts[faces[i].v3].co); + copy_v3_v3(p0, verts[faces[i].v3].co); mul_m4_v3(ob->obmat, p0); - VECCOPY(p1, verts[faces[i].v4].co); + copy_v3_v3(p1, verts[faces[i].v4].co); mul_m4_v3(ob->obmat, p1); - VECCOPY(p2, verts[faces[i].v1].co); + copy_v3_v3(p2, verts[faces[i].v1].co); mul_m4_v3(ob->obmat, p2); - VECSUB(side1, p1, p0); - VECSUB(side2, p2, p0); - VECSUB(side3, p1, p2); + sub_v3_v3v3(side1, p1, p0); + sub_v3_v3v3(side2, p2, p0); + sub_v3_v3v3(side3, p1, p2); - if(INPR(side1, side1) > fsTri*fsTri) + if(dot_v3v3(side1, side1) > fsTri*fsTri) { float tmp = normalize_v3(side1); divs1 = (int)ceil(tmp/fsTri); } - if(INPR(side2, side2) > fsTri*fsTri) + if(dot_v3v3(side2, side2) > fsTri*fsTri) { float tmp = normalize_v3(side2); divs2 = (int)ceil(tmp/fsTri); @@ -1050,7 +1049,7 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) if(psys_get_particle_state(&sim, p, &state, 0) == 0) continue; - // VECCOPY(pos, pa->state.co); + // copy_v3_v3(pos, pa->state.co); // mul_m4_v3(ob->imat, pos); // 1. get corresponding cell get_cell(smd->domain->p0, smd->domain->res, smd->domain->dx, state.co, cell, 0); @@ -1589,7 +1588,7 @@ static void get_cell(float *p0, int res[3], float dx, float *pos, int *cell, int { float tmp[3]; - VECSUB(tmp, pos, p0); + sub_v3_v3v3(tmp, pos, p0); mul_v3_fl(tmp, 1.0 / dx); if(correct) diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 28925a7b170..accf3e442e8 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -2697,7 +2697,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa /* gravitation */ - VECADDFAC(bp->force, bp->force, gravity, _final_mass(ob,bp)); /* individual mass of node here */ + madd_v3_v3fl(bp->force, gravity, _final_mass(ob,bp)); /* individual mass of node here */ /* particle field & vortex */ diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index 85ac87d8bcb..f6aae0e20ae 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1181,8 +1181,9 @@ void load_editMesh(Scene *scene, Object *obedit) eve= em->verts.first; mvert = me->mvert; while(eve) { - if(eve->keyindex>=0) - VECSUB(ofs[i], mvert->co, fp[eve->keyindex]); + if(eve->keyindex>=0) { + sub_v3_v3v3(ofs[i], mvert->co, fp[eve->keyindex]); + } eve= eve->next; i++; diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index b0a6e428b18..7434425d24b 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1229,7 +1229,7 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float /* pop point off the stack */ node= stack[--totstack]; - VECSUB(v, node->co, p); + sub_v3_v3v3(v, node->co, p); d2= dot_v3v3(v, v) + 1e-16f; emitarea= MAX2(node->area, node->dco); @@ -1484,7 +1484,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int if(cache->sample && cache->step) { sample= &cache->sample[(y-cache->y)*cache->w + (x-cache->x)]; if(sample->filled) { - VECSUB(d, sample->co, co); + sub_v3_v3v3(d, sample->co, co); dist2= dot_v3v3(d, d); if(dist2 < 0.5f*sample->dist2 && dot_v3v3(sample->n, n) > 0.98f) { copy_v3_v3(ao, sample->ao); @@ -1534,7 +1534,7 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int wb[0]= tx*ty; for(i=0; i<4; i++) { - VECSUB(d, samples[i]->co, co); + sub_v3_v3v3(d, samples[i]->co, co); //dist2= dot_v3v3(d, d); wz[i]= 1.0f; //(samples[i]->dist2/(1e-4f + dist2)); |