svn merge -r41575:41602 ^/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Mon, 7 Nov 2011 07:01:24 +0000 (07:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 7 Nov 2011 07:01:24 +0000 (07:01 +0000)
149 files changed:
source/blender/blenkernel/BKE_effect.h
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/BKE_object.h
source/blender/blenkernel/BKE_particle.h
source/blender/blenkernel/BKE_scene.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/boids.c
source/blender/blenkernel/intern/brush.c
source/blender/blenkernel/intern/bvhutils.c
source/blender/blenkernel/intern/camera.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/colortools.c
source/blender/blenkernel/intern/curve.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/lamp.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/material.c
source/blender/blenkernel/intern/mball.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/pointcache.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/smoke.c
source/blender/blenkernel/intern/softbody.c
source/blender/blenkernel/intern/speaker.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/blenkernel/intern/text.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/world.c
source/blender/blenlib/BLI_kdopbvh.h
source/blender/blenlib/BLI_math_vector.h
source/blender/blenlib/intern/BLI_kdopbvh.c
source/blender/blenlib/intern/graph.c
source/blender/blenlib/intern/math_vector_inline.c
source/blender/blenloader/intern/readfile.c
source/blender/collada/AnimationExporter.cpp
source/blender/collada/AnimationExporter.h
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/armature/editarmature_retarget.c
source/blender/editors/armature/editarmature_sketch.c
source/blender/editors/armature/meshlaplacian.c
source/blender/editors/curve/editcurve.c
source/blender/editors/gpencil/gpencil_edit.c
source/blender/editors/gpencil/gpencil_paint.c
source/blender/editors/include/ED_particle.h
source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_regions.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/object/object_add.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_lattice.c
source/blender/editors/object/object_modifier.c
source/blender/editors/object/object_transform.c
source/blender/editors/physics/particle_edit.c
source/blender/editors/physics/particle_object.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_info/textview.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/drawvolume.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_input.c
source/blender/editors/transform/transform_orientations.c
source/blender/editors/util/crazyspace.c
source/blender/editors/uvedit/uvedit_draw.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/gpu/intern/gpu_material.c
source/blender/ikplugin/intern/iksolver_plugin.c
source/blender/ikplugin/intern/itasc_plugin.cpp
source/blender/makesrna/intern/rna_armature.c
source/blender/modifiers/intern/MOD_build.c
source/blender/modifiers/intern/MOD_particleinstance.c
source/blender/modifiers/intern/MOD_simpledeform.c
source/blender/nodes/composite/node_composite_util.c
source/blender/nodes/composite/nodes/node_composite_alphaOver.c
source/blender/nodes/composite/nodes/node_composite_blur.c
source/blender/nodes/composite/nodes/node_composite_colorMatte.c
source/blender/nodes/composite/nodes/node_composite_curves.c
source/blender/nodes/composite/nodes/node_composite_diffMatte.c
source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
source/blender/nodes/composite/nodes/node_composite_filter.c
source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
source/blender/nodes/composite/nodes/node_composite_invert.c
source/blender/nodes/composite/nodes/node_composite_mixrgb.c
source/blender/nodes/composite/nodes/node_composite_normal.c
source/blender/nodes/composite/nodes/node_composite_normalize.c
source/blender/nodes/composite/nodes/node_composite_rgb.c
source/blender/nodes/composite/nodes/node_composite_splitViewer.c
source/blender/nodes/composite/nodes/node_composite_texture.c
source/blender/nodes/composite/nodes/node_composite_zcombine.c
source/blender/nodes/shader/node_shader_util.c
source/blender/nodes/shader/nodes/node_shader_camera.c
source/blender/nodes/shader/nodes/node_shader_geom.c
source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
source/blender/nodes/shader/nodes/node_shader_invert.c
source/blender/nodes/shader/nodes/node_shader_material.c
source/blender/nodes/shader/nodes/node_shader_mixRgb.c
source/blender/nodes/shader/nodes/node_shader_normal.c
source/blender/nodes/shader/nodes/node_shader_output.c
source/blender/nodes/shader/nodes/node_shader_rgb.c
source/blender/nodes/shader/nodes/node_shader_texture.c
source/blender/nodes/texture/nodes/node_texture_bricks.c
source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
source/blender/nodes/texture/nodes/node_texture_image.c
source/blender/nodes/texture/nodes/node_texture_invert.c
source/blender/nodes/texture/nodes/node_texture_mixRgb.c
source/blender/nodes/texture/nodes/node_texture_proc.c
source/blender/nodes/texture/nodes/node_texture_texture.c
source/blender/python/mathutils/mathutils_geometry.c
source/blender/render/intern/include/rendercore.h
source/blender/render/intern/include/zbuf.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/envmap.c
source/blender/render/intern/source/imagetexture.c
source/blender/render/intern/source/occlusion.c
source/blender/render/intern/source/pixelshading.c
source/blender/render/intern/source/pointdensity.c
source/blender/render/intern/source/rayshade.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/rendercore.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/shadeinput.c
source/blender/render/intern/source/shadeoutput.c
source/blender/render/intern/source/sss.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/volume_precache.c
source/blender/render/intern/source/voxeldata.c
source/blender/render/intern/source/zbuf.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/Converter/BL_ActionActuator.cpp
source/gameengine/Converter/BL_ArmatureObject.cpp

index 59a361c010dba4da57111112c8b956a389a42ac2..7f4e809718c2288cf233ab3c2aba8cb7f45e217c 100644 (file)
@@ -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 */
index 9130cac6cd60f2feaa86769ef8e094db148627b9..308d7ff22c2633043ee0d7ed90812b7fd3b99355 100644 (file)
@@ -46,7 +46,7 @@ struct PointerRNA;
 struct PropertyRNA;
 
 void *alloc_libblock(struct ListBase *lb, short type, const char *name);
-void *copy_libblock(void *rt);
+void *copy_libblock(struct ID *id);
 void copy_libblock_data(struct ID *id, const struct ID *id_from, const short do_action);
 
 void BKE_id_lib_local_paths(struct Main *bmain, struct ID *id);
index 85a986d346075877db2093ec887c9aa942240cf6..9ccdd08015866799a62ab5dc166fa8451323b6bf 100644 (file)
@@ -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]);
index c4284d2cf0a341d79eec11859fd0ea218869783a..c66e49f29069e499cc1964e18aae1902048da0b6 100644 (file)
@@ -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);
 
index a6bd90c4fd277536ebc3e66c96ff0afff124e1a5..ad394f9fb1af5541004777cf972c65d488f67d95 100644 (file)
@@ -86,7 +86,7 @@ void scene_select_base(struct Scene *sce, struct Base *selbase);
 int scene_check_setscene(struct Main *bmain, struct Scene *sce);
 
 float BKE_curframe(struct Scene *scene);
-float BKE_nextframe(struct Scene *scene);
+float BKE_frame_to_ctime(struct Scene *scene, const float frame);
 
 void scene_update_tagged(struct Main *bmain, struct Scene *sce);
 void scene_clear_tagged(struct Main *bmain, struct Scene *sce);
index 7a03abb0c2749831591fa05e97444945803f5b4c..b981cb372a1e8e1a4b4cfa12bc914c25eb981695 100644 (file)
@@ -461,7 +461,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);
        }
 }
 
@@ -737,8 +737,9 @@ static float *get_editbmesh_orco_verts(BMEditMesh *em)
        orco = MEM_mallocN(sizeof(float)*3*totvert, "EditMesh Orco");
 
        eve = BMIter_New(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
-       for (a=0; eve; eve=BMIter_Step(&iter), a+=3)
-               VECCOPY(orco+a, eve->co);
+       for (a=0; eve; eve=BMIter_Step(&iter), a+=3) {
+               copy_v3_v3(orco+a, eve->co);
+       }
        
        return orco;
 }
@@ -1475,7 +1476,7 @@ float (*editbmesh_get_vertex_cos(BMEditMesh *em, int *numVerts_r))[3]
 
        eve = BMIter_New(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
        for (i=0; eve; eve=BMIter_Step(&iter), i++) {
-               VECCOPY(cos[i], eve->co);
+               copy_v3_v3(cos[i], eve->co);
        }
 
        return cos;
@@ -1984,7 +1985,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)
@@ -2010,7 +2011,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];
@@ -2037,7 +2038,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;
 }
 
index 944f7c6a0b627a3bda5ee895088d3d8c4bbee338..5fb03b7bbd00dd5199269a88ce1fc9b36ab3375a 100644 (file)
@@ -185,7 +185,7 @@ bAction *copy_action (bAction *src)
        
        if (src == NULL) 
                return NULL;
-       dst= copy_libblock(src);
+       dst= copy_libblock(&src->id);
        
        /* duplicate the lists of groups and markers */
        BLI_duplicatelist(&dst->groups, &src->groups);
index f19ed859064e313106cee8780e79a8d9a0ce4519..50f305e440012eab2c8e153a5a294d504eead48c 100644 (file)
@@ -204,7 +204,7 @@ bArmature *copy_armature(bArmature *arm)
        Bone            *oldBone, *newBone;
        Bone            *newActBone= NULL;
        
-       newArm= copy_libblock (arm);
+       newArm= copy_libblock(&arm->id);
        BLI_duplicatelist(&newArm->bonebase, &arm->bonebase);
        
        /*      Duplicate the childrens' lists*/
index 3ae81c70d4fabf0f382e9454c3fafba65df0487b..c9868bd900fce47bc3babc5f5276cacbbd936c38 100644 (file)
@@ -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]);
index e78b89441c908037af9a451f66c64d3bcb92c0ef..09021e71025f8ab0a2ab9a54b7c8bba5335b93e6 100644 (file)
@@ -144,7 +144,7 @@ Brush *copy_brush(Brush *brush)
 {
        Brush *brushn;
        
-       brushn= copy_libblock(brush);
+       brushn= copy_libblock(&brush->id);
 
        if (brush->mtex.tex)
                id_us_plus((ID*)brush->mtex.tex);
index f5113b3ef58c000290de85653c291cb2034ad516..c448407e05bcb83f26b00411cfd19dc000487dca 100644 (file)
 
 /* Math stuff for ray casting on mesh faces and for nearest surface */
 
-static float ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_dist), const float *v0, const float *v1, const float *v2)
+static float ray_tri_intersection(const BVHTreeRay *ray, const float UNUSED(m_dist), const float v0[3], const float v1[3], const float v2[3])
 {
        float dist;
 
-       if(isect_ray_tri_v3((float*)ray->origin, (float*)ray->direction, (float*)v0, (float*)v1, (float*)v2, &dist, NULL))
+       if(isect_ray_tri_v3(ray->origin, ray->direction, v0, v1, v2, &dist, NULL))
                return dist;
 
        return FLT_MAX;
 }
 
-static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, const float m_dist, const float *v0, const float *v1, const float *v2)
+static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, const float m_dist, const float v0[3], const float v1[3], const float v2[3])
 {
        
        float idist;
        float p1[3];
        float plane_normal[3], hit_point[3];
 
-       normal_tri_v3( plane_normal,(float*)v0, (float*)v1, (float*)v2);
+       normal_tri_v3(plane_normal, v0, v1, v2);
 
-       VECADDFAC( p1, ray->origin, ray->direction, m_dist);
-       if(isect_sweeping_sphere_tri_v3((float*)ray->origin, p1, radius, (float*)v0, (float*)v1, (float*)v2, &idist, hit_point))
+       madd_v3_v3v3fl(p1, ray->origin, ray->direction, m_dist);
+       if(isect_sweeping_sphere_tri_v3(ray->origin, p1, radius, v0, v1, v2, &idist, hit_point))
        {
                return idist * m_dist;
        }
@@ -81,7 +81,7 @@ static float sphereray_tri_intersection(const BVHTreeRay *ray, float radius, con
  * Function adapted from David Eberly's distance tools (LGPL)
  * http://www.geometrictools.com/LibFoundation/Distance/Distance.html
  */
-static float nearest_point_in_tri_surface(const float *v0,const float *v1,const float *v2,const float *p, int *v, int *e, float *nearest )
+static float nearest_point_in_tri_surface(const float v0[3], const float v1[3], const float v2[3], const float p[3], int *v, int *e, float nearest[3])
 {
        float diff[3];
        float e0[3];
@@ -98,16 +98,16 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const
        float sqrDist;
        int lv = -1, le = -1;
        
-       VECSUB(diff, v0, p);
-       VECSUB(e0, v1, v0);
-       VECSUB(e1, v2, v0);
+       sub_v3_v3v3(diff, v0, p);
+       sub_v3_v3v3(e0, v1, v0);
+       sub_v3_v3v3(e1, v2, v0);
        
-       A00 = INPR ( e0, e0 );
-       A01 = INPR( e0, e1 );
-       A11 = INPR ( e1, e1 );
-       B0 = INPR( diff, e0 );
-       B1 = INPR( diff, e1 );
-       C = INPR( diff, diff );
+       A00 = dot_v3v3(e0, e0);
+       A01 = dot_v3v3(e0, e1 );
+       A11 = dot_v3v3(e1, e1 );
+       B0 = dot_v3v3(diff, e0 );
+       B1 = dot_v3v3(diff, e1 );
+       C = dot_v3v3(diff, diff );
        Det = fabs( A00 * A11 - A01 * A01 );
        S = A01 * B1 - A11 * B0;
        T = A01 * B0 - A00 * B1;
@@ -123,7 +123,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const
                                        T = 0.0f;
                                        if ( -B0 >= A00 )
                                        {
-                                               S = (float)1.0;
+                                               S = 1.0f;
                                                sqrDist = A00 + 2.0f * B0 + C;
                                                lv = 1;
                                        }
@@ -379,15 +379,15 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const
        
        {
                float w[3], x[3], y[3], z[3];
-               VECCOPY(w, v0);
-               VECCOPY(x, e0);
+               copy_v3_v3(w, v0);
+               copy_v3_v3(x, e0);
                mul_v3_fl(x, S);
-               VECCOPY(y, e1);
+               copy_v3_v3(y, e1);
                mul_v3_fl(y, T);
-               VECADD(z, w, x);
-               VECADD(z, z, y);
-               //VECSUB(d, p, z);
-               VECCOPY(nearest, z);
+               add_v3_v3v3(z, w, x);
+               add_v3_v3v3(z, z, y);
+               //sub_v3_v3v3(d, p, z);
+               copy_v3_v3(nearest, z);
                // d = p - ( v0 + S * e0 + T * e1 );
        }
        *v = lv;
@@ -403,7 +403,7 @@ static float nearest_point_in_tri_surface(const float *v0,const float *v1,const
 
 // Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_faces.
 // userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
-static void mesh_faces_nearest_point(void *userdata, int index, const float *co, BVHTreeNearest *nearest)
+static void mesh_faces_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
 {
        const BVHTreeFromMesh *data = (BVHTreeFromMesh*) userdata;
        MVert *vert     = data->vert;
@@ -426,7 +426,7 @@ static void mesh_faces_nearest_point(void *userdata, int index, const float *co,
                {
                        nearest->index = index;
                        nearest->dist = dist;
-                       VECCOPY(nearest->co, nearest_tmp);
+                       copy_v3_v3(nearest->co, nearest_tmp);
                        normal_tri_v3( nearest->no,t0, t1, t2);
                }
 
@@ -464,7 +464,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
                {
                        hit->index = index;
                        hit->dist = dist;
-                       VECADDFAC(hit->co, ray->origin, ray->direction, dist);
+                       madd_v3_v3v3fl(hit->co, ray->origin, ray->direction, dist);
 
                        normal_tri_v3( hit->no,t0, t1, t2);
                }
@@ -478,7 +478,7 @@ static void mesh_faces_spherecast(void *userdata, int index, const BVHTreeRay *r
 
 // Callback to bvh tree nearest point. The tree must bust have been built using bvhtree_from_mesh_edges.
 // userdata must be a BVHMeshCallbackUserdata built from the same mesh as the tree.
-static void mesh_edges_nearest_point(void *userdata, int index, const float *co, BVHTreeNearest *nearest)
+static void mesh_edges_nearest_point(void *userdata, int index, const float co[3], BVHTreeNearest *nearest)
 {
        const BVHTreeFromMesh *data = (BVHTreeFromMesh*) userdata;
        MVert *vert     = data->vert;
@@ -488,16 +488,15 @@ static void mesh_edges_nearest_point(void *userdata, int index, const float *co,
        float *t0, *t1;
        t0 = vert[ edge->v1 ].co;
        t1 = vert[ edge->v2 ].co;
-       
-       // NOTE: casts to "float*" here are due to co being "const float*"
-       closest_to_line_segment_v3(nearest_tmp, (float*)co, t0, t1);
-       dist = len_squared_v3v3(nearest_tmp, (float*)co);
+
+       closest_to_line_segment_v3(nearest_tmp, co, t0, t1);
+       dist = len_squared_v3v3(nearest_tmp, co);
        
        if(dist < nearest->dist)
        {
                nearest->index = index;
                nearest->dist = dist;
-               VECCOPY(nearest->co, nearest_tmp);
+               copy_v3_v3(nearest->co, nearest_tmp);
                sub_v3_v3v3(nearest->no, t0, t1);
                normalize_v3(nearest->no);
        }
@@ -633,9 +632,9 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
                                                        /*No reason found to block hit-testing the triangle for snap,
                                                          so insert it now.*/
                                                        float co[4][3];
-                                                       VECCOPY(co[0], tri[0]->v->co);
-                                                       VECCOPY(co[1], tri[1]->v->co);
-                                                       VECCOPY(co[2], tri[2]->v->co);
+                                                       copy_v3_v3(co[0], tri[0]->v->co);
+                                                       copy_v3_v3(co[1], tri[1]->v->co);
+                                                       copy_v3_v3(co[2], tri[2]->v->co);
                                        
                                                        BLI_bvhtree_insert(tree, i, co[0], 3);
                                                }
@@ -648,11 +647,11 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float
                                        if (vert != NULL && face != NULL) {
                                                for(i = 0; i < numFaces; i++) {
                                                        float co[4][3];
-                                                       VECCOPY(co[0], vert[ face[i].v1 ].co);
-                                                       VECCOPY(co[1], vert[ face[i].v2 ].co);
-                                                       VECCOPY(co[2], vert[ face[i].v3 ].co);
+                                                       copy_v3_v3(co[0], vert[ face[i].v1 ].co);
+                                                       copy_v3_v3(co[1], vert[ face[i].v2 ].co);
+                                                       copy_v3_v3(co[2], vert[ face[i].v3 ].co);
                                                        if(face[i].v4)
-                                                               VECCOPY(co[3], vert[ face[i].v4 ].co);
+                                                               copy_v3_v3(co[3], vert[ face[i].v4 ].co);
                                
                                                        BLI_bvhtree_insert(tree, i, co[0], face[i].v4 ? 4 : 3);
                                                }
@@ -715,8 +714,8 @@ BVHTree* bvhtree_from_mesh_edges(BVHTreeFromMesh *data, DerivedMesh *mesh, float
                                for(i = 0; i < numEdges; i++)
                                {
                                        float co[4][3];
-                                       VECCOPY(co[0], vert[ edge[i].v1 ].co);
-                                       VECCOPY(co[1], vert[ edge[i].v2 ].co);
+                                       copy_v3_v3(co[0], vert[ edge[i].v1 ].co);
+                                       copy_v3_v3(co[1], vert[ edge[i].v2 ].co);
                        
                                        BLI_bvhtree_insert(tree, i, co[0], 2);
                                }
index eeec82c3beb79d321d1b60ef6fc9adb47f79b4cc..145eb9363e9b8e7a463e08030e47c68a975214aa 100644 (file)
@@ -68,7 +68,7 @@ Camera *copy_camera(Camera *cam)
 {
        Camera *camn;
        
-       camn= copy_libblock(cam);
+       camn= copy_libblock(&cam->id);
        
        return camn;
 }
index bdc1cda06e3e5d33f0168c2f74aefc7de953a9b6..1ce19ed315bc73251e304aae4e3b51c387e46f2b 100644 (file)
@@ -183,7 +183,7 @@ static void cdDM_getVertCo(DerivedMesh *dm, int index, float co_r[3])
 {
        CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
 
-       VECCOPY(co_r, cddm->mvert[index].co);
+       copy_v3_v3(co_r, cddm->mvert[index].co);
 }
 
 static void cdDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
@@ -192,7 +192,7 @@ static void cdDM_getVertCos(DerivedMesh *dm, float (*cos_r)[3])
        int i;
 
        for(i = 0; i < dm->numVertData; i++, mv++)
-               VECCOPY(cos_r[i], mv->co);
+               copy_v3_v3(cos_r[i], mv->co);
 }
 
 static void cdDM_getVertNo(DerivedMesh *dm, int index, float no_r[3])
@@ -1283,39 +1283,39 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
                                if( numdata != 0 ) {
                                        offset = 0;
                                        if(attribs.totorco) {
-                                               VECCOPY((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v1]);
-                                               VECCOPY((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v2]);
-                                               VECCOPY((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v3]);
+                                               copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v1]);
+                                               copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v2]);
+                                               copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v3]);
                                                offset += sizeof(float)*3;
                                        }
                                        for(b = 0; b < attribs.tottface; b++) {
                                                MTFace *tf = &attribs.tface[b].array[a];
-                                               VECCOPY2D((float *)&varray[elementsize*curface*3+offset],tf->uv[0]);
-                                               VECCOPY2D((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[1]);
+                                               copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[0]);
+                                               copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[1]);
 
-                                               VECCOPY2D((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[2]);
+                                               copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[2]);
                                                offset += sizeof(float)*2;
                                        }
                                        for(b = 0; b < attribs.totmcol; b++) {
                                                MCol *cp = &attribs.mcol[b].array[a*4 + 0];
                                                GLubyte col[4];
                                                col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
-                                               QUATCOPY((unsigned char *)&varray[elementsize*curface*3+offset], col);
+                                               copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset], (char *)col);
                                                cp = &attribs.mcol[b].array[a*4 + 1];
                                                col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
-                                               QUATCOPY((unsigned char *)&varray[elementsize*curface*3+offset+elementsize], col);
+                                               copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize], (char *)col);
                                                cp = &attribs.mcol[b].array[a*4 + 2];
                                                col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
-                                               QUATCOPY((unsigned char *)&varray[elementsize*curface*3+offset+elementsize*2], col);
+                                               copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize*2], (char *)col);
                                                offset += sizeof(unsigned char)*4;
                                        }       
                                        if(attribs.tottang) {
                                                float *tang = attribs.tang.array[a*4 + 0];
-                                               QUATCOPY((float *)&varray[elementsize*curface*3+offset], tang);
+                                               copy_v4_v4((float *)&varray[elementsize*curface*3+offset], tang);
                                                tang = attribs.tang.array[a*4 + 1];
-                                               QUATCOPY((float *)&varray[elementsize*curface*3+offset+elementsize], tang);
+                                               copy_v4_v4((float *)&varray[elementsize*curface*3+offset+elementsize], tang);
                                                tang = attribs.tang.array[a*4 + 2];
-                                               QUATCOPY((float *)&varray[elementsize*curface*3+offset+elementsize*2], tang);
+                                               copy_v4_v4((float *)&varray[elementsize*curface*3+offset+elementsize*2], tang);
                                                offset += sizeof(float)*4;
                                        }
                                        (void)offset;
@@ -1325,38 +1325,38 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
                                        if( numdata != 0 ) {
                                                offset = 0;
                                                if(attribs.totorco) {
-                                                       VECCOPY((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v3]);
-                                                       VECCOPY((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v4]);
-                                                       VECCOPY((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v1]);
+                                                       copy_v3_v3((float *)&varray[elementsize*curface*3],(float *)attribs.orco.array[mface->v3]);
+                                                       copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize],(float *)attribs.orco.array[mface->v4]);
+                                                       copy_v3_v3((float *)&varray[elementsize*curface*3+elementsize*2],(float *)attribs.orco.array[mface->v1]);
                                                        offset += sizeof(float)*3;
                                                }
                                                for(b = 0; b < attribs.tottface; b++) {
                                                        MTFace *tf = &attribs.tface[b].array[a];
-                                                       VECCOPY2D((float *)&varray[elementsize*curface*3+offset],tf->uv[2]);
-                                                       VECCOPY2D((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[3]);
-                                                       VECCOPY2D((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[0]);
+                                                       copy_v2_v2((float *)&varray[elementsize*curface*3+offset],tf->uv[2]);
+                                                       copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize],tf->uv[3]);
+                                                       copy_v2_v2((float *)&varray[elementsize*curface*3+offset+elementsize*2],tf->uv[0]);
                                                        offset += sizeof(float)*2;
                                                }
                                                for(b = 0; b < attribs.totmcol; b++) {
                                                        MCol *cp = &attribs.mcol[b].array[a*4 + 2];
                                                        GLubyte col[4];
                                                        col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
-                                                       QUATCOPY((unsigned char *)&varray[elementsize*curface*3+offset], col);
+                                                       copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset], (char *)col);
                                                        cp = &attribs.mcol[b].array[a*4 + 3];
                                                        col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
-                                                       QUATCOPY((unsigned char *)&varray[elementsize*curface*3+offset+elementsize], col);
+                                                       copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize], (char *)col);
                                                        cp = &attribs.mcol[b].array[a*4 + 0];
                                                        col[0]= cp->b; col[1]= cp->g; col[2]= cp->r; col[3]= cp->a;
-                                                       QUATCOPY((unsigned char *)&varray[elementsize*curface*3+offset+elementsize*2], col);
+                                                       copy_v4_v4_char((char *)&varray[elementsize*curface*3+offset+elementsize*2], (char *)col);
                                                        offset += sizeof(unsigned char)*4;
                                                }       
                                                if(attribs.tottang) {
                                                        float *tang = attribs.tang.array[a*4 + 2];
-                                                       QUATCOPY((float *)&varray[elementsize*curface*3+offset], tang);
+                                                       copy_v4_v4((float *)&varray[elementsize*curface*3+offset], tang);
                                                        tang = attribs.tang.array[a*4 + 3];
-                                                       QUATCOPY((float *)&varray[elementsize*curface*3+offset+elementsize], tang);
+                                                       copy_v4_v4((float *)&varray[elementsize*curface*3+offset+elementsize], tang);
                                                        tang = attribs.tang.array[a*4 + 0];
-                                                       QUATCOPY((float *)&varray[elementsize*curface*3+offset+elementsize*2], tang);
+                                                       copy_v4_v4((float *)&varray[elementsize*curface*3+offset+elementsize*2], tang);
                                                        offset += sizeof(float)*4;
                                                }
                                                (void)offset;
@@ -1727,7 +1727,7 @@ static DerivedMesh *disabled__CDDM_from_editmesh(EditMesh *em, Mesh *UNUSED(me))
                i++, eve = eve->next, index++) {
                MVert *mv = &mvert[i];
 
-               VECCOPY(mv->co, eve->co);
+               copy_v3_v3(mv->co, eve->co);
 
                normal_float_to_short_v3(mv->no, eve->no);
                mv->bweight = (unsigned char) (eve->bweight * 255.0f);
@@ -2126,7 +2126,7 @@ void CDDM_apply_vert_coords(DerivedMesh *dm, float (*vertCoords)[3])
        cddm->mvert = vert;
 
        for(i = 0; i < dm->numVertData; ++i, ++vert)
-               VECCOPY(vert->co, vertCoords[i]);
+               copy_v3_v3(vert->co, vertCoords[i]);
 }
 
 void CDDM_apply_vert_normals(DerivedMesh *dm, short (*vertNormals)[3])
index 00a31fb77a758870bfe944c85cbd9107de347e93..78f803be0d31649dd954bf8378d700c3f5d66708 100644 (file)
@@ -191,7 +191,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);
        }
@@ -232,12 +232,12 @@ static BVHTree *bvhtree_build_from_cloth (ClothModifierData *clmd, float epsilon
        // fill tree
        for(i = 0; i < cloth->numfaces; i++, mfaces++)
        {
-               VECCOPY(&co[0*3], verts[mfaces->v1].xold);
-               VECCOPY(&co[1*3], verts[mfaces->v2].xold);
-               VECCOPY(&co[2*3], verts[mfaces->v3].xold);
+               copy_v3_v3(&co[0*3], verts[mfaces->v1].xold);
+               copy_v3_v3(&co[1*3], verts[mfaces->v2].xold);
+               copy_v3_v3(&co[2*3], verts[mfaces->v3].xold);
                
                if(mfaces->v4)
-                       VECCOPY(&co[3*3], verts[mfaces->v4].xold);
+                       copy_v3_v3(&co[3*3], verts[mfaces->v4].xold);
                
                BLI_bvhtree_insert(bvhtree, i, co, (mfaces->v4 ? 4 : 3));
        }
@@ -268,23 +268,23 @@ void bvhtree_update_from_cloth(ClothModifierData *clmd, int moving)
        {
                for(i = 0; i < cloth->numfaces; i++, mfaces++)
                {
-                       VECCOPY(&co[0*3], verts[mfaces->v1].txold);
-                       VECCOPY(&co[1*3], verts[mfaces->v2].txold);
-                       VECCOPY(&co[2*3], verts[mfaces->v3].txold);
+                       copy_v3_v3(&co[0*3], verts[mfaces->v1].txold);
+                       copy_v3_v3(&co[1*3], verts[mfaces->v2].txold);
+                       copy_v3_v3(&co[2*3], verts[mfaces->v3].txold);
                        
                        if(mfaces->v4)
-                               VECCOPY(&co[3*3], verts[mfaces->v4].txold);
+                               copy_v3_v3(&co[3*3], verts[mfaces->v4].txold);
                
                        // copy new locations into array
                        if(moving)
                        {
                                // update moving positions
-                               VECCOPY(&co_moving[0*3], verts[mfaces->v1].tx);
-                               VECCOPY(&co_moving[1*3], verts[mfaces->v2].tx);
-                               VECCOPY(&co_moving[2*3], verts[mfaces->v3].tx);
+                               copy_v3_v3(&co_moving[0*3], verts[mfaces->v1].tx);
+                               copy_v3_v3(&co_moving[1*3], verts[mfaces->v2].tx);
+                               copy_v3_v3(&co_moving[2*3], verts[mfaces->v3].tx);
                                
                                if(mfaces->v4)
-                                       VECCOPY(&co_moving[3*3], verts[mfaces->v4].tx);
+                                       copy_v3_v3(&co_moving[3*3], verts[mfaces->v4].tx);
                                
                                ret = BLI_bvhtree_update_node(bvhtree, i, co, co_moving, (mfaces->v4 ? 4 : 3));
                        }
@@ -322,13 +322,13 @@ void bvhselftree_update_from_cloth(ClothModifierData *clmd, int moving)
        {
                for(i = 0; i < cloth->numverts; i++, verts++)
                {
-                       VECCOPY(&co[0*3], verts->txold);
+                       copy_v3_v3(&co[0*3], verts->txold);
                        
                        // copy new locations into array
                        if(moving)
                        {
                                // update moving positions
-                               VECCOPY(&co_moving[0*3], verts->tx);
+                               copy_v3_v3(&co_moving[0*3], verts->tx);
                                
                                ret = BLI_bvhtree_update_node(bvhtree, i, co, co_moving, 1);
                        }
@@ -400,11 +400,11 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul
        /* force any pinned verts to their constrained location. */
        for(i = 0; i < clmd->clothObject->numverts; i++, verts++) {
                /* save the previous position. */
-               VECCOPY(verts->xold, verts->xconst);
-               VECCOPY(verts->txold, verts->x);
+               copy_v3_v3(verts->xold, verts->xconst);
+               copy_v3_v3(verts->txold, verts->x);
 
                /* Get the current position. */
-               VECCOPY(verts->xconst, mvert[i].co);
+               copy_v3_v3(verts->xconst, mvert[i].co);
                mul_m4_v3(ob->obmat, verts->xconst);
        }
 
@@ -713,7 +713,7 @@ static void cloth_to_object (Object *ob,  ClothModifierData *clmd, DerivedMesh *
 
                for (i = 0; i < numverts; i++)
                {
-                       VECCOPY (mvert[i].co, cloth->verts[i].x);
+                       copy_v3_v3 (mvert[i].co, cloth->verts[i].x);
                        mul_m4_v3(ob->imat, mvert[i].co);       /* cloth is in global coords */
                }
        }
@@ -881,14 +881,14 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
                        verts->goal= 0.0f;
 
                verts->flags = 0;
-               VECCOPY ( verts->xold, verts->x );
-               VECCOPY ( verts->xconst, verts->x );
-               VECCOPY ( verts->txold, verts->x );
-               VECCOPY ( verts->tx, verts->x );
+               copy_v3_v3 ( verts->xold, verts->x );
+               copy_v3_v3 ( verts->xconst, verts->x );
+               copy_v3_v3 ( verts->txold, verts->x );
+               copy_v3_v3 ( verts->tx, verts->x );
                mul_v3_fl( verts->v, 0.0f );
 
                verts->impulse_count = 0;
-               VECCOPY ( verts->impulse, tnull );
+               copy_v3_v3 ( verts->impulse, tnull );
        }
        
        // apply / set vertex groups
@@ -1054,7 +1054,6 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
        LinkNode **edgelist = NULL;
        EdgeHash *edgehash = NULL;
        LinkNode *search = NULL, *search2 = NULL;
-       float temp[3];
        
        // error handling
        if ( numedges==0 )
@@ -1087,8 +1086,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
                {
                        spring->ij = MIN2(medge[i].v1, medge[i].v2);
                        spring->kl = MAX2(medge[i].v2, medge[i].v1);
-                       VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
-                       spring->restlen =  sqrt ( INPR ( temp, temp ) );
+                       spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
                        clmd->sim_parms->avg_spring_len += spring->restlen;
                        cloth->verts[spring->ij].avg_spring_len += spring->restlen;
                        cloth->verts[spring->kl].avg_spring_len += spring->restlen;
@@ -1133,8 +1131,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 
                spring->ij = MIN2(mface[i].v1, mface[i].v3);
                spring->kl = MAX2(mface[i].v3, mface[i].v1);
-               VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
-               spring->restlen =  sqrt ( INPR ( temp, temp ) );
+               spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
                spring->type = CLOTH_SPRING_TYPE_SHEAR;
                spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
 
@@ -1156,8 +1153,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 
                spring->ij = MIN2(mface[i].v2, mface[i].v4);
                spring->kl = MAX2(mface[i].v4, mface[i].v2);
-               VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
-               spring->restlen =  sqrt ( INPR ( temp, temp ) );
+               spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
                spring->type = CLOTH_SPRING_TYPE_SHEAR;
                spring->stiffness = (cloth->verts[spring->kl].shear_stiff + cloth->verts[spring->ij].shear_stiff) / 2.0;
 
@@ -1198,8 +1194,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 
                                        spring->ij = MIN2(tspring2->ij, index2);
                                        spring->kl = MAX2(tspring2->ij, index2);
-                                       VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
-                                       spring->restlen =  sqrt ( INPR ( temp, temp ) );
+                                       spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
                                        spring->type = CLOTH_SPRING_TYPE_BENDING;
                                        spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0;
                                        BLI_edgehash_insert ( edgehash, spring->ij, spring->kl, NULL );
@@ -1238,8 +1233,7 @@ static int cloth_build_springs ( ClothModifierData *clmd, DerivedMesh *dm )
 
                                spring->ij = tspring2->ij;
                                spring->kl = tspring->kl;
-                               VECSUB ( temp, cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest );
-                               spring->restlen =  sqrt ( INPR ( temp, temp ) );
+                               spring->restlen = len_v3v3(cloth->verts[spring->kl].xrest, cloth->verts[spring->ij].xrest);
                                spring->type = CLOTH_SPRING_TYPE_BENDING;
                                spring->stiffness = (cloth->verts[spring->kl].bend_stiff + cloth->verts[spring->ij].bend_stiff) / 2.0;
                                bend_springs++;
index 98a434a7d8bc441488b1905250a521ecf1f55b37..2f568aa01ebfd4ca9ca012eb3a60ff1bc9e3812d 100644 (file)
@@ -501,7 +501,7 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
                        
                        hlen= len_v3v3(bezt[0].vec[1], bezt[0].vec[2]); /* original handle length */
                        /* clip handle point */
-                       VECCOPY(vec, bezt[1].vec[0]);
+                       copy_v3_v3(vec, bezt[1].vec[0]);
                        if(vec[0] < bezt[0].vec[1][0])
                                vec[0]= bezt[0].vec[1][0];
                        
@@ -518,7 +518,7 @@ static void curvemap_make_table(CurveMap *cuma, rctf *clipr)
                        
                        hlen= len_v3v3(bezt[a].vec[1], bezt[a].vec[0]); /* original handle length */
                        /* clip handle point */
-                       VECCOPY(vec, bezt[a-1].vec[2]);
+                       copy_v3_v3(vec, bezt[a-1].vec[2]);
                        if(vec[0] > bezt[a].vec[1][0])
                                vec[0]= bezt[a].vec[1][0];
                        
index 6a5f412872445073487079651cc0040653560485..3f441361b0a976f6dc55501117ddab107502f9e0 100644 (file)
@@ -193,7 +193,7 @@ Curve *copy_curve(Curve *cu)
        Curve *cun;
        int a;
        
-       cun= copy_libblock(cu);
+       cun= copy_libblock(&cu->id);
        cun->nurb.first= cun->nurb.last= NULL;
        duplicateNurblist( &(cun->nurb), &(cu->nurb));
 
index 6603e67a306277d34685be2188c78537b9d26c34..8810dae9d70082d5fbd9ebd8d70f228e879171f1 100644 (file)
@@ -346,7 +346,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
                                        if(a==0 && dl->type== DL_POLY) bezt= nu->bezt;
                                        
                                        if(prevbezt->h2==HD_VECT && bezt->h1==HD_VECT) {
-                                               VECCOPY(data, prevbezt->vec[1]);
+                                               copy_v3_v3(data, prevbezt->vec[1]);
                                                data+= 3;
                                        }
                                        else {
@@ -363,7 +363,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
                                        }
                                        
                                        if(a==0 && dl->type==DL_SEGM) {
-                                               VECCOPY(data, bezt->vec[1]);
+                                               copy_v3_v3(data, bezt->vec[1]);
                                        }
                                        
                                        prevbezt= bezt;
@@ -404,7 +404,7 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
                                a= len;
                                bp= nu->bp;
                                while(a--) {
-                                       VECCOPY(data, bp->vec);
+                                       copy_v3_v3(data, bp->vec);
                                        bp++;
                                        data+= 3;
                                }
@@ -488,7 +488,7 @@ void filldisplist(ListBase *dispbase, ListBase *to, int flipnormal)
                                totvert= 0;
                                eve= fillvertbase.first;
                                while(eve) {
-                                       VECCOPY(f1, eve->co);
+                                       copy_v3_v3(f1, eve->co);
                                        f1+= 3;
        
                                        /* index number */
@@ -561,7 +561,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
                                        
                                        a= dl->parts;
                                        while(a--) {
-                                               VECCOPY(fp1, fp);
+                                               copy_v3_v3(fp1, fp);
                                                fp1+= 3;
                                                fp+= dpoly;
                                        }
@@ -581,7 +581,7 @@ static void bevels_to_filledpoly(Curve *cu, ListBase *dispbase)
                                        
                                        a= dl->parts;
                                        while(a--) {
-                                               VECCOPY(fp1, fp);
+                                               copy_v3_v3(fp1, fp);
                                                fp1+= 3;
                                                fp+= dpoly;
                                        }
index a3d48c188d849b6a09680310b1bfc8c4f0d40d0a..99a609f7ce218d69238c688f0ed5522e88b4af8c 100644 (file)
@@ -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);
                        }
                }
        }
index 42ddd63f072b45d4952730e7f6197a576554200b..587fe75031f53985f7c13eca5ff94ce326ea9e99 100644 (file)
@@ -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;
index cdc90cbb788470305d6143de60040f22ac390f6b..94868ffee87d95a0031aeb80db20d2615cde0696 100644 (file)
@@ -171,7 +171,7 @@ Key *copy_key(Key *key)
        
        if(key==NULL) return NULL;
        
-       keyn= copy_libblock(key);
+       keyn= copy_libblock(&key->id);
        
        BLI_duplicatelist(&keyn->block, &key->block);
        
index 974aa660e9fe7a04cabc31de89885660217aa32f..4edd032dc0445815cad306dd633a239f5b137166 100644 (file)
@@ -106,7 +106,7 @@ Lamp *copy_lamp(Lamp *la)
        Lamp *lan;
        int a;
        
-       lan= copy_libblock(la);
+       lan= copy_libblock(&la->id);
 
        for(a=0; a<MAX_MTEX; a++) {
                if(lan->mtex[a]) {
@@ -132,7 +132,7 @@ Lamp *localize_lamp(Lamp *la)
        Lamp *lan;
        int a;
        
-       lan= copy_libblock(la);
+       lan= copy_libblock(&la->id);
        BLI_remlink(&G.main->lamp, lan);
 
        for(a=0; a<MAX_MTEX; a++) {
index cef23ac38242fbebdddb02b89ef8fb7e8cd8ba01..7c9e2be4493befd2d73f3a32d4c2866f41bd0441 100644 (file)
@@ -204,7 +204,7 @@ Lattice *copy_lattice(Lattice *lt)
 {
        Lattice *ltn;
 
-       ltn= copy_libblock(lt);
+       ltn= copy_libblock(&lt->id);
        ltn->def= MEM_dupallocN(lt->def);
 
        ltn->key= copy_key(ltn->key);
index 4259e11d3400eff6234adef6c48bc65afb9eff65..64ab27ae47e014907663283be0052c7d569ebaa5 100644 (file)
@@ -717,14 +717,11 @@ void copy_libblock_data(ID *id, const ID *id_from, const short do_action)
 }
 
 /* used everywhere in blenkernel */
-void *copy_libblock(void *rt)
+void *copy_libblock(ID *id)
 {
-       ID *idn, *id;
+       ID *idn;
        ListBase *lb;
-       char *cp, *cpn;
        size_t idn_len;
-       
-       id= rt;
 
        lb= which_libbase(G.main, GS(id->name));
        idn= alloc_libblock(lb, GS(id->name), id->name+2);
@@ -733,8 +730,9 @@ void *copy_libblock(void *rt)
 
        idn_len= MEM_allocN_len(idn);
        if((int)idn_len - (int)sizeof(ID) > 0) { /* signed to allow neg result */
-               cp= (char *)id;
-               cpn= (char *)idn;
+               const char *cp= (const char *)id;
+               char *cpn= (char *)idn;
+
                memcpy(cpn+sizeof(ID), cp+sizeof(ID), idn_len - sizeof(ID));
        }
        
index 7be3514e0f2733792168907530cc092512452e58..48c6d6b2a19313efa95a663d77382fe6ffe40866 100644 (file)
@@ -215,7 +215,7 @@ Material *copy_material(Material *ma)
        Material *man;
        int a;
        
-       man= copy_libblock(ma);
+       man= copy_libblock(&ma->id);
        
        id_lib_extern((ID *)man->group);
        
@@ -247,7 +247,7 @@ Material *localize_material(Material *ma)
        Material *man;
        int a;
        
-       man= copy_libblock(ma);
+       man= copy_libblock(&ma->id);
        BLI_remlink(&G.main->mat, man);
 
        /* no increment for texture ID users, in previewrender.c it prevents decrement */
index 327306b32eed899a465ea75c5cb3bb13fc8a5b38..5c82acde99b1bef4d37a3e512acf0ff80d599abd 100644 (file)
@@ -120,7 +120,7 @@ MetaBall *copy_mball(MetaBall *mb)
        MetaBall *mbn;
        int a;
        
-       mbn= copy_libblock(mb);
+       mbn= copy_libblock(&mb->id);
 
        BLI_duplicatelist(&mbn->elems, &mb->elems);
        
index ea6fd3843dcabafb5967686214e269692cb51448..3aa35bed4e3c7063aea862ab820580af747ba5ce 100644 (file)
@@ -516,7 +516,7 @@ Mesh *copy_mesh(Mesh *me)
        MTexPoly *txface;
        int a, i;
        
-       men= copy_libblock(me);
+       men= copy_libblock(&me->id);
        
        men->mat= MEM_dupallocN(me->mat);
        for(a=0; a<men->totcol; a++) {
index 8f60929135103cb934248755f4bc3f294b6673c1..a9b2ffe7529c3fade47d5bd0131dc74d7c51cfe1 100644 (file)
@@ -629,7 +629,7 @@ bNodeTree *ntreeCopyTree(bNodeTree *ntree)
        for(newtree=G.main->nodetree.first; newtree; newtree= newtree->id.next)
                if(newtree==ntree) break;
        if(newtree) {
-               newtree= copy_libblock(ntree);
+               newtree= copy_libblock(&ntree->id);
        } else {
                newtree= MEM_dupallocN(ntree);
                copy_libblock_data(&newtree->id, &ntree->id, TRUE); /* copy animdata and ID props */
index 483eebb3dcb2f8db326323156e97909b5a4acd4f..43f199904d582d064f795b0fd7647fe0bf2c7894 100644 (file)
@@ -1085,7 +1085,7 @@ Object *copy_object(Object *ob)
        ModifierData *md;
        int a;
 
-       obn= copy_libblock(ob);
+       obn= copy_libblock(&ob->id);
        
        if(ob->totcol) {
                obn->mat= MEM_dupallocN(ob->mat);
@@ -2133,7 +2133,7 @@ void object_set_dimensions(Object *ob, const float *value)
        }
 }
 
-void minmax_object(Object *ob, float *min, float *max)
+void minmax_object(Object *ob, float min[3], float max[3])
 {
        BoundBox bb;
        float vec[3];
index d6c0638ba6263ad97d6d5a5da508f2ee7df8890c..6de1c12287cdad69fd9bb274f20926c902e5c1c0 100644 (file)
@@ -621,13 +621,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);
        
@@ -831,17 +831,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;
                        }
@@ -1000,7 +1000,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;
 
@@ -1031,12 +1031,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);
                        }
                }
        }
@@ -1182,21 +1182,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;
 }
 
@@ -1475,13 +1475,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];
@@ -1504,7 +1504,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;
 
@@ -1529,7 +1529,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;
@@ -1545,18 +1545,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];
 
@@ -1569,17 +1569,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;
@@ -1646,7 +1646,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;
@@ -1665,7 +1665,7 @@ static int psys_map_index_on_dm(DerivedMesh *dm, int from, int index, int index_
                                return 0;
 
                        *mapindex = index;
-                       QUATCOPY(mapfw, fw);
+                       copy_v4_v4(mapfw, fw);
                }
        } else {
                /* for other meshes that have been modified, we try to map the particle
@@ -1706,7 +1706,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];
@@ -1734,7 +1734,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);
@@ -1761,11 +1761,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);
@@ -1807,22 +1807,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);
        }
 }
 /************************************************/
@@ -1992,7 +1992,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));
@@ -2090,7 +2090,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);
 
@@ -2144,7 +2144,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 */
@@ -2169,16 +2169,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)
@@ -2189,12 +2189,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;
@@ -2207,15 +2207,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)
 {
@@ -2228,8 +2228,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)
 {
@@ -2241,9 +2241,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);
@@ -2266,7 +2266,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;
@@ -2366,8 +2366,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) {
@@ -2377,7 +2378,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)
@@ -2718,7 +2719,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);
                }
        }
@@ -2836,7 +2837,7 @@ static void cache_key_incremental_rotation(ParticleCacheKey *key0, ParticleCache
                * angle, since floating point accuracy makes it give
                * different results across platforms */
                if(cosangle > 0.999999f) {
-                       QUATCOPY(key1->rot, key2->rot);
+                       copy_v4_v4(key1->rot, key2->rot);
                }
                else {
                        angle= saacos(cosangle);
@@ -2901,7 +2902,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)
@@ -2935,9 +2936,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);
@@ -3191,7 +3192,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));
@@ -3204,7 +3205,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);
                                        }
                                }
                        }
@@ -3255,9 +3256,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-------*/
@@ -3265,13 +3266,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
@@ -3332,9 +3333,9 @@ static void psys_face_mat(Object *ob, DerivedMesh *dm, ParticleData *pa, float m
        osface=dm->getTessFaceData(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 */
@@ -3356,7 +3357,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])
@@ -3369,7 +3370,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)
@@ -3429,7 +3430,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
 
        psys->totpart=0;
        psys->flag = PSYS_ENABLED|PSYS_CURRENT;
-       psys->cfra = BKE_nextframe(scene);
+       psys->cfra = BKE_frame_to_ctime(scene, CFRA + 1);
 
        DAG_scene_sort(G.main, scene);
        DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
@@ -3570,7 +3571,7 @@ ParticleSettings *psys_copy_settings(ParticleSettings *part)
        ParticleSettings *partn;
        int a;
 
-       partn= copy_libblock(part);
+       partn= copy_libblock(&part->id);
        partn->pd= MEM_dupallocN(part->pd);
        partn->pd2= MEM_dupallocN(part->pd2);
        partn->effector_weights= MEM_dupallocN(part->effector_weights);
@@ -3659,7 +3660,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;
@@ -3703,7 +3704,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;
@@ -4072,7 +4073,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);
 
@@ -4143,7 +4144,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 */
@@ -4166,13 +4167,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);
                        }
 
@@ -4423,9 +4424,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);
@@ -4471,12 +4472,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);
 
@@ -4486,7 +4487,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);
@@ -4500,22 +4501,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]);
 }
 
 void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys) {
index 306e897fbc83168ad619e0cbb956b3f8f5214cb4..00abc331f0b954899bab4086ab7e044c13c27efb 100644 (file)
@@ -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);
@@ -815,7 +815,7 @@ static void distribute_threads_exec(ParticleThread *thread, ParticleData *pa, Ch
                        normalize_v3(nor);
                        mul_v3_fl(nor,-100.0);
 
-                       VECADD(co2,co1,nor);
+                       add_v3_v3v3(co2,co1,nor);
 
                        min_d=2.0;
                        intersect=0;
@@ -1099,11 +1099,11 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
 
                        for(p=0; p<totvert; p++) {
                                if(orcodata) {
-                                       VECCOPY(co,orcodata[p])
+                                       copy_v3_v3(co,orcodata[p]);
                                        transform_mesh_orco_verts((Mesh*)ob->data, &co, 1, 1);
                                }
                                else
-                                       VECCOPY(co,mv[p].co)
+                                       copy_v3_v3(co,mv[p].co);
                                BLI_kdtree_insert(tree,p,co,NULL);
                        }
 
@@ -1141,14 +1141,14 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
                        MFace *mf=dm->getTessFaceData(dm,i,CD_MFACE);
 
                        if(orcodata) {
-                               VECCOPY(co1, orcodata[mf->v1]);
-                               VECCOPY(co2, orcodata[mf->v2]);
-                               VECCOPY(co3, orcodata[mf->v3]);
+                               copy_v3_v3(co1, orcodata[mf->v1]);
+                               copy_v3_v3(co2, orcodata[mf->v2]);
+                               copy_v3_v3(co3, orcodata[mf->v3]);
                                transform_mesh_orco_verts((Mesh*)ob->data, &co1, 1, 1);
                                transform_mesh_orco_verts((Mesh*)ob->data, &co2, 1, 1);
                                transform_mesh_orco_verts((Mesh*)ob->data, &co3, 1, 1);
                                if(mf->v4) {
-                                       VECCOPY(co4, orcodata[mf->v4]);
+                                       copy_v3_v3(co4, orcodata[mf->v4]);
                                        transform_mesh_orco_verts((Mesh*)ob->data, &co4, 1, 1);
                                }
                        }
@@ -1156,12 +1156,12 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
                                v1= (MVert*)dm->getVertData(dm,mf->v1,CD_MVERT);
                                v2= (MVert*)dm->getVertData(dm,mf->v2,CD_MVERT);
                                v3= (MVert*)dm->getVertData(dm,mf->v3,CD_MVERT);
-                               VECCOPY(co1, v1->co);
-                               VECCOPY(co2, v2->co);
-                               VECCOPY(co3, v3->co);
+                               copy_v3_v3(co1, v1->co);
+                               copy_v3_v3(co2, v2->co);
+                               copy_v3_v3(co3, v3->co);
                                if(mf->v4) {
                                        v4= (MVert*)dm->getVertData(dm,mf->v4,CD_MVERT);
-                                       VECCOPY(co4, v4->co);
+                                       copy_v3_v3(co4, v4->co);
                                }
                        }
 
@@ -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);
        }
@@ -1648,7 +1648,7 @@ void psys_get_birth_coordinates(ParticleSimulationData *sim, ParticleData *pa, P
                        normalize_v3(state->ave);
                }
                else {
-                       VECCOPY(state->ave, nor);
+                       copy_v3_v3(state->ave, nor);
                }
 
                /* calculate rotation matrix */
@@ -2423,7 +2423,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa
                pfr.element_size = MAXFLOAT;
        }
        sphdata->element_size = pfr.element_size;
-       VECCOPY(sphdata->flow, pfr.flow);
+       copy_v3_v3(sphdata->flow, pfr.flow);
 
        pressure =  stiffness * (pfr.density - rest_density);
        near_pressure = stiffness_near_fac * pfr.near_density;
@@ -2520,7 +2520,7 @@ static void sph_integrate(ParticleSimulationData *sim, ParticleData *pa, float d
 
        integrate_particle(part, pa, dtime, effector_acceleration, sph_force_cb, &sphdata);
        *element_size = sphdata.element_size;
-       VECCOPY(flow, sphdata.flow);
+       copy_v3_v3(flow, sphdata.flow);
 }
 
 /************************************************/
@@ -2592,21 +2592,21 @@ static void basic_integrate(ParticleSimulationData *sim, int p, float dfra, floa
        if(part->dampfac != 0.f)
                mul_v3_fl(pa->state.vel, 1.f - part->dampfac * efdata.ptex.damp * 25.f * dtime);
 
-       //VECCOPY(pa->state.ave, states->ave);
+       //copy_v3_v3(pa->state.ave, states->ave);
 
        /* finally we do guides */
        time=(cfra-pa->time)/pa->lifetime;
        CLAMP(time, 0.0f, 1.0f);
 
-       VECCOPY(tkey.co,pa->state.co);
-       VECCOPY(tkey.vel,pa->state.vel);
+       copy_v3_v3(tkey.co,pa->state.co);
+       copy_v3_v3(tkey.vel,pa->state.vel);
        tkey.time=pa->state.time;
 
        if(part->type != PART_HAIR) {
                if(do_guides(sim->psys->effectors, &tkey, p, time)) {
-                       VECCOPY(pa->state.co,tkey.co);
+                       copy_v3_v3(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,9 +3471,9 @@ 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);
-                               VECCOPY(mvert->co, key->co);
-                               VECADD(mvert->co, mvert->co, temp);
+                               sub_v3_v3v3(temp, key->co, (key+1)->co);
+                               copy_v3_v3(mvert->co, key->co);
+                               add_v3_v3v3(mvert->co, mvert->co, temp);
                                mul_m4_v3(hairmat, mvert->co);
                                mvert++;
 
@@ -3492,7 +3492,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
                                }
                        }
 
-                       VECCOPY(mvert->co, key->co);
+                       copy_v3_v3(mvert->co, key->co);
                        mul_m4_v3(hairmat, mvert->co);
                        mvert++;
                        
@@ -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);
                }
 
index 7a8162391d55d351d359fd5b389e5c745bd4e31a..9deaa19429fbcfb543edced0be6597b8a1af9cd1 100644 (file)
@@ -183,8 +183,8 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f
        if(cfra1 == cfra2)
                return;
 
-       VECCOPY(keys[1].co, bp->pos);
-       VECCOPY(keys[1].vel, bp->vec);
+       copy_v3_v3(keys[1].co, bp->pos);
+       copy_v3_v3(keys[1].vel, bp->vec);
 
        if(old_data) {
                memcpy(keys[2].co, old_data, 3 * sizeof(float));
@@ -202,8 +202,8 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f
 
        mul_v3_fl(keys->vel, 1.0f / dfra);
 
-       VECCOPY(bp->pos, keys->co);
-       VECCOPY(bp->vec, keys->vel);
+       copy_v3_v3(bp->pos, keys->co);
+       copy_v3_v3(bp->vec, keys->vel);
 }
 static int  ptcache_softbody_totpoint(void *soft_v, int UNUSED(cfra))
 {
@@ -483,8 +483,8 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo
        if(cfra1 == cfra2)
                return;
 
-       VECCOPY(keys[1].co, vert->x);
-       VECCOPY(keys[1].vel, vert->v);
+       copy_v3_v3(keys[1].co, vert->x);
+       copy_v3_v3(keys[1].vel, vert->v);
 
        if(old_data) {
                memcpy(keys[2].co, old_data, 3 * sizeof(float));
@@ -502,8 +502,8 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo
 
        mul_v3_fl(keys->vel, 1.0f / dfra);
 
-       VECCOPY(vert->x, keys->co);
-       VECCOPY(vert->v, keys->vel);
+       copy_v3_v3(vert->x, keys->co);
+       copy_v3_v3(vert->v, keys->vel);
 
        /* should vert->xconst be interpolated somehow too? - jahka */
 }
@@ -2126,7 +2126,7 @@ int  BKE_ptcache_id_exist(PTCacheID *pid, int cfra)
 }
 void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startframe, int *endframe, float *timescale)
 {
-       Object *ob;
+       /* Object *ob; */ /* UNUSED */
        PointCache *cache;
        /* float offset; unused for now */
        float time, nexttime;
@@ -2143,13 +2143,13 @@ void BKE_ptcache_id_time(PTCacheID *pid, Scene *scene, float cfra, int *startfra
         *   is probably to interpolate results from two frames for that ..
         */
 
-       ob= pid->ob;
+       /* ob= pid->ob; */ /* UNUSED */
        cache= pid->cache;
 
        if(timescale) {
                time= BKE_curframe(scene);
-               nexttime= BKE_nextframe(scene);
-
+               nexttime= BKE_frame_to_ctime(scene, CFRA+1);
+               
                *timescale= MAX2(nexttime - time, 0.0f);
        }
 
index 2f24b7e735d1807197f1928e2c92fe45278f8f4f..14dfe015894c5d5f8b18b3cc58347e989d1cc926 100644 (file)
@@ -126,7 +126,7 @@ Scene *copy_scene(Scene *sce, int type)
                scen->r.layers= lb;
        }
        else {
-               scen= copy_libblock(sce);
+               scen= copy_libblock(&sce->id);
                BLI_duplicatelist(&(scen->base), &(sce->base));
                
                clear_id_newpoins();
@@ -914,20 +914,16 @@ int scene_check_setscene(Main *bmain, Scene *sce)
  */
 float BKE_curframe(Scene *scene)
 {
-       float ctime = scene->r.cfra;
-       ctime += scene->r.subframe;
-       ctime *= scene->r.framelen;     
-
-       return ctime;
+       return BKE_frame_to_ctime(scene, scene->r.cfra);
 }
 
-/* Similar to BKE_curframe(), but is used by physics sims to get "next time", which is defined as cfra+1 */
-float BKE_nextframe(Scene *scene)
+/* This function is used to obtain arbitrary fractional frames */
+float BKE_frame_to_ctime(Scene *scene, const float frame)
 {
-       float ctime = (float)(scene->r.cfra + 1);
+       float ctime = frame;
        ctime += scene->r.subframe;
        ctime *= scene->r.framelen;     
-
+       
        return ctime;
 }
 
index 5d47b127096f6d74619e358ee70c5f52da736248..fb8bb791f32c3993066f79a3a6cff7863d074559 100644 (file)
@@ -169,13 +169,11 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 
 
                //Convert the vertex to tree coordinates
-               if(calc->vert)
-               {
-                       VECCOPY(tmp_co, calc->vert[i].co);
+               if(calc->vert) {
+                       copy_v3_v3(tmp_co, calc->vert[i].co);
                }
-               else
-               {
-                       VECCOPY(tmp_co, co);
+               else {
+                       copy_v3_v3(tmp_co, co);
                }
                space_transform_apply(&calc->local2target, tmp_co);
 
@@ -200,7 +198,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
                        if(dist > FLT_EPSILON) weight *= (dist - calc->keepDist)/dist;
 
                        //Convert the coordinates back to mesh coordinates
-                       VECCOPY(tmp_co, nearest.co);
+                       copy_v3_v3(tmp_co, nearest.co);
                        space_transform_invert(&calc->local2target, tmp_co);
 
                        interp_v3_v3v3(co, co, tmp_co, weight); //linear interpolation
@@ -230,11 +228,11 @@ int normal_projection_project_vertex(char options, const float *vert, const floa
        //Apply space transform (TODO readjust dist)
        if(transf)
        {
-               VECCOPY( tmp_co, vert );
+               copy_v3_v3( tmp_co, vert );
                space_transform_apply( transf, tmp_co );
                co = tmp_co;
 
-               VECCOPY( tmp_no, dir );
+               copy_v3_v3( tmp_no, dir );
                space_transform_apply_normal( transf, tmp_no );
                no = tmp_no;
 
@@ -352,17 +350,17 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
                                /* this coordinated are deformed by vertexCos only for normal projection (to get correct normals) */
                                /* for other cases calc->varts contains undeformed coordinates and vertexCos should be used */
                                if(calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) {
-                                       VECCOPY(tmp_co, calc->vert[i].co);
+                                       copy_v3_v3(tmp_co, calc->vert[i].co);
                                        normal_short_to_float_v3(tmp_no, calc->vert[i].no);
                                } else {
-                                       VECCOPY(tmp_co, co);
-                                       VECCOPY(tmp_no, proj_axis);
+                                       copy_v3_v3(tmp_co, co);
+                                       copy_v3_v3(tmp_no, proj_axis);
                                }
                        }
                        else
                        {
-                               VECCOPY(tmp_co, co);
-                               VECCOPY(tmp_no, proj_axis);
+                               copy_v3_v3(tmp_co, co);
+                               copy_v3_v3(tmp_no, proj_axis);
                        }
 
 
@@ -445,11 +443,11 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
                //Convert the vertex to tree coordinates
                if(calc->vert)
                {
-                       VECCOPY(tmp_co, calc->vert[i].co);
+                       copy_v3_v3(tmp_co, calc->vert[i].co);
                }
                else
                {
-                       VECCOPY(tmp_co, co);
+                       copy_v3_v3(tmp_co, co);
                }
                space_transform_apply(&calc->local2target, tmp_co);
 
@@ -471,7 +469,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
                        if(calc->smd->shrinkOpts & MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE)
                        {
                                //Make the vertex stay on the front side of the face
-                               VECADDFAC(tmp_co, nearest.co, nearest.no, calc->keepDist);
+                               madd_v3_v3v3fl(tmp_co, nearest.co, nearest.no, calc->keepDist);
                        }
                        else
                        {
@@ -480,7 +478,7 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
                                if(dist > FLT_EPSILON)
                                        interp_v3_v3v3(tmp_co, tmp_co, nearest.co, (dist - calc->keepDist)/dist);       //linear interpolation
                                else
-                                       VECCOPY( tmp_co, nearest.co );
+                                       copy_v3_v3( tmp_co, nearest.co );
                        }
 
                        //Convert the coordinates back to mesh coordinates
index 0ddebb8d0e69cc7d5b18c6b921fc0eb8ad779cb1..038e48f5769506ae29b59a9be8904b656e7924de 100644 (file)
@@ -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->getNumTessFaces(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)
index 28925a7b17099fe02e47803b028be15894f57910..5b02731050ef629ee681d5c2dfac85baf910ca38 100644 (file)
@@ -321,7 +321,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
        /* determine the ortho BB */
        for(i=0; i < pccd_M->totvert; i++){
                /* evaluate limits */
-               VECCOPY(v,pccd_M->mvert[i].co);
+               copy_v3_v3(v,pccd_M->mvert[i].co);
                pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
                pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
                pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
@@ -345,7 +345,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
                mima->minx=mima->miny=mima->minz=1e30f;
                mima->maxx=mima->maxy=mima->maxz=-1e30f;
 
-               VECCOPY(v,pccd_M->mvert[mface->v1].co);
+               copy_v3_v3(v,pccd_M->mvert[mface->v1].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -353,7 +353,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
                mima->maxy = MAX2(mima->maxy,v[1]+hull);
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-               VECCOPY(v,pccd_M->mvert[mface->v2].co);
+               copy_v3_v3(v,pccd_M->mvert[mface->v2].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -361,7 +361,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
                mima->maxy = MAX2(mima->maxy,v[1]+hull);
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-               VECCOPY(v,pccd_M->mvert[mface->v3].co);
+               copy_v3_v3(v,pccd_M->mvert[mface->v3].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -370,7 +370,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob)
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
                if(mface->v4){
-                       VECCOPY(v,pccd_M->mvert[mface->v4].co);
+                       copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -419,7 +419,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
        /* determine the ortho BB */
        for(i=0; i < pccd_M->totvert; i++){
                /* evaluate limits */
-               VECCOPY(v,pccd_M->mvert[i].co);
+               copy_v3_v3(v,pccd_M->mvert[i].co);
                pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
                pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
                pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
@@ -429,7 +429,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                pccd_M->bbmax[2] = MAX2(pccd_M->bbmax[2],v[2]+hull);
 
                /* evaluate limits */
-               VECCOPY(v,pccd_M->mprevvert[i].co);
+               copy_v3_v3(v,pccd_M->mprevvert[i].co);
                pccd_M->bbmin[0] = MIN2(pccd_M->bbmin[0],v[0]-hull);
                pccd_M->bbmin[1] = MIN2(pccd_M->bbmin[1],v[1]-hull);
                pccd_M->bbmin[2] = MIN2(pccd_M->bbmin[2],v[2]-hull);
@@ -449,7 +449,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                mima->minx=mima->miny=mima->minz=1e30f;
                mima->maxx=mima->maxy=mima->maxz=-1e30f;
 
-               VECCOPY(v,pccd_M->mvert[mface->v1].co);
+               copy_v3_v3(v,pccd_M->mvert[mface->v1].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -457,7 +457,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                mima->maxy = MAX2(mima->maxy,v[1]+hull);
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-               VECCOPY(v,pccd_M->mvert[mface->v2].co);
+               copy_v3_v3(v,pccd_M->mvert[mface->v2].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -465,7 +465,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                mima->maxy = MAX2(mima->maxy,v[1]+hull);
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-               VECCOPY(v,pccd_M->mvert[mface->v3].co);
+               copy_v3_v3(v,pccd_M->mvert[mface->v3].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -474,7 +474,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
                if(mface->v4){
-                       VECCOPY(v,pccd_M->mvert[mface->v4].co);
+                       copy_v3_v3(v,pccd_M->mvert[mface->v4].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -484,7 +484,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                }
 
 
-               VECCOPY(v,pccd_M->mprevvert[mface->v1].co);
+               copy_v3_v3(v,pccd_M->mprevvert[mface->v1].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -492,7 +492,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                mima->maxy = MAX2(mima->maxy,v[1]+hull);
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-               VECCOPY(v,pccd_M->mprevvert[mface->v2].co);
+               copy_v3_v3(v,pccd_M->mprevvert[mface->v2].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -500,7 +500,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                mima->maxy = MAX2(mima->maxy,v[1]+hull);
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
-               VECCOPY(v,pccd_M->mprevvert[mface->v3].co);
+               copy_v3_v3(v,pccd_M->mprevvert[mface->v3].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -509,7 +509,7 @@ static void ccd_mesh_update(Object *ob,ccd_Mesh *pccd_M)
                mima->maxz = MAX2(mima->maxz,v[2]+hull);
 
                if(mface->v4){
-                       VECCOPY(v,pccd_M->mprevvert[mface->v4].co);
+                       copy_v3_v3(v,pccd_M->mprevvert[mface->v4].co);
                mima->minx = MIN2(mima->minx,v[0]-hull);
                mima->miny = MIN2(mima->miny,v[1]-hull);
                mima->minz = MIN2(mima->minz,v[2]-hull);
@@ -1024,8 +1024,8 @@ static int sb_detect_aabb_collisionCached(        float UNUSED(force[3]), unsigned int
 #endif
 
        if ((sb == NULL) || (sb->scratch ==NULL)) return 0;
-       VECCOPY(aabbmin,sb->scratch->aabbmin);
-       VECCOPY(aabbmax,sb->scratch->aabbmax);
+       copy_v3_v3(aabbmin,sb->scratch->aabbmin);
+       copy_v3_v3(aabbmax,sb->scratch->aabbmax);
 
        hash  = vertexowner->soft->scratch->colliderhash;
        ihash = BLI_ghashIterator_new(hash);
@@ -1099,8 +1099,8 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
        aabbmax[2] = MAX3(face_v1[2],face_v2[2],face_v3[2]);
 
        /* calculate face normal once again SIGH */
-       VECSUB(edge1, face_v1, face_v2);
-       VECSUB(edge2, face_v3, face_v2);
+       sub_v3_v3v3(edge1, face_v1, face_v2);
+       sub_v3_v3v3(edge2, face_v3, face_v2);
        cross_v3_v3v3(d_nvect, edge2, edge1);
        normalize_v3(d_nvect);
 
@@ -1143,13 +1143,13 @@ static int sb_detect_face_pointCached(float face_v1[3],float face_v2[3],float fa
                                /* use mesh*/
                                if (mvert) {
                                        while(a){
-                                               VECCOPY(nv1,mvert[a-1].co);
+                                               copy_v3_v3(nv1,mvert[a-1].co);
                                                if(mprevvert){
                                                        mul_v3_fl(nv1,time);
                                                        Vec3PlusStVec(nv1,(1.0f-time),mprevvert[a-1].co);
                                                }
                                                /* origin to face_v2*/
-                                               VECSUB(nv1, nv1, face_v2);
+                                               sub_v3_v3(nv1, face_v2);
                                                facedist = dot_v3v3(nv1,d_nvect);
                                                if (ABS(facedist)<outerfacethickness){
                                                        if (isect_point_tri_prism_v3(nv1, face_v1,face_v2,face_v3) ){
@@ -1253,11 +1253,11 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
 
                                        if (mvert){
 
-                                               VECCOPY(nv1,mvert[mface->v1].co);
-                                               VECCOPY(nv2,mvert[mface->v2].co);
-                                               VECCOPY(nv3,mvert[mface->v3].co);
+                                               copy_v3_v3(nv1,mvert[mface->v1].co);
+                                               copy_v3_v3(nv2,mvert[mface->v2].co);
+                                               copy_v3_v3(nv3,mvert[mface->v3].co);
                                                if (mface->v4){
-                                                       VECCOPY(nv4,mvert[mface->v4].co);
+                                                       copy_v3_v3(nv4,mvert[mface->v4].co);
                                                }
                                                if (mprevvert){
                                                        mul_v3_fl(nv1,time);
@@ -1277,8 +1277,8 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
                                        }
 
                                        /* switch origin to be nv2*/
-                                       VECSUB(edge1, nv1, nv2);
-                                       VECSUB(edge2, nv3, nv2);
+                                       sub_v3_v3v3(edge1, nv1, nv2);
+                                       sub_v3_v3v3(edge2, nv3, nv2);
                                        cross_v3_v3v3(d_nvect, edge2, edge1);
                                        normalize_v3(d_nvect);
                                        if (
@@ -1291,8 +1291,8 @@ static int sb_detect_face_collisionCached(float face_v1[3],float face_v2[3],floa
                                        }
                                        if (mface->v4){ /* quad */
                                                /* switch origin to be nv4 */
-                                               VECSUB(edge1, nv3, nv4);
-                                               VECSUB(edge2, nv1, nv4);
+                                               sub_v3_v3v3(edge1, nv3, nv4);
+                                               sub_v3_v3v3(edge2, nv1, nv4);
                                                cross_v3_v3v3(d_nvect, edge2, edge1);
                                                normalize_v3(d_nvect);
                                                if (
@@ -1481,11 +1481,11 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
 
                                        if (mvert){
 
-                                               VECCOPY(nv1,mvert[mface->v1].co);
-                                               VECCOPY(nv2,mvert[mface->v2].co);
-                                               VECCOPY(nv3,mvert[mface->v3].co);
+                                               copy_v3_v3(nv1,mvert[mface->v1].co);
+                                               copy_v3_v3(nv2,mvert[mface->v2].co);
+                                               copy_v3_v3(nv3,mvert[mface->v3].co);
                                                if (mface->v4){
-                                                       VECCOPY(nv4,mvert[mface->v4].co);
+                                                       copy_v3_v3(nv4,mvert[mface->v4].co);
                                                }
                                                if (mprevvert){
                                                        mul_v3_fl(nv1,time);
@@ -1505,16 +1505,16 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
                                        }
 
                                        /* switch origin to be nv2*/
-                                       VECSUB(edge1, nv1, nv2);
-                                       VECSUB(edge2, nv3, nv2);
+                                       sub_v3_v3v3(edge1, nv1, nv2);
+                                       sub_v3_v3v3(edge2, nv3, nv2);
 
                                        cross_v3_v3v3(d_nvect, edge2, edge1);
                                        normalize_v3(d_nvect);
                                        if ( isect_line_tri_v3(edge_v1, edge_v2, nv1, nv2, nv3, &t, NULL)){
                                                float v1[3],v2[3];
                                                float intrusiondepth,i1,i2;
-                                               VECSUB(v1, edge_v1, nv2);
-                                               VECSUB(v2, edge_v2, nv2);
+                                               sub_v3_v3v3(v1, edge_v1, nv2);
+                                               sub_v3_v3v3(v2, edge_v2, nv2);
                                                i1 = dot_v3v3(v1,d_nvect);
                                                i2 = dot_v3v3(v2,d_nvect);
                                                intrusiondepth = -MIN2(i1,i2)/el;
@@ -1524,16 +1524,16 @@ static int sb_detect_edge_collisionCached(float edge_v1[3],float edge_v2[3],floa
                                        }
                                        if (mface->v4){ /* quad */
                                                /* switch origin to be nv4 */
-                                               VECSUB(edge1, nv3, nv4);
-                                               VECSUB(edge2, nv1, nv4);
+                                               sub_v3_v3v3(edge1, nv3, nv4);
+                                               sub_v3_v3v3(edge2, nv1, nv4);
 
                                                cross_v3_v3v3(d_nvect, edge2, edge1);
                                                normalize_v3(d_nvect);
                                                if (isect_line_tri_v3( edge_v1, edge_v2,nv1, nv3, nv4, &t, NULL)){
                                                        float v1[3],v2[3];
                                                        float intrusiondepth,i1,i2;
-                                                       VECSUB(v1, edge_v1, nv4);
-                                                       VECSUB(v2, edge_v2, nv4);
+                                                       sub_v3_v3v3(v1, edge_v1, nv4);
+                                                       sub_v3_v3v3(v2, edge_v2, nv4);
                                                i1 = dot_v3v3(v1,d_nvect);
                                                i2 = dot_v3v3(v2,d_nvect);
                                                intrusiondepth = -MIN2(i1,i2)/el;
@@ -1602,16 +1602,16 @@ static void _scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow,
                                        }
                                        /* media in rest */
                                        else{
-                                               VECADD(vel, sb->bpoint[bs->v1].vec , sb->bpoint[bs->v2].vec);
+                                               add_v3_v3v3(vel, sb->bpoint[bs->v1].vec , sb->bpoint[bs->v2].vec);
                                        }
                                        f = normalize_v3(vel);
                                        f = -0.0001f*f*f*sb->aeroedge;
                                        /* (todo) add a nice angle dependant function done for now BUT */
                                        /* still there could be some nice drag/lift function, but who needs it */
 
-                                       VECSUB(sp, sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos);
+                                       sub_v3_v3v3(sp, sb->bpoint[bs->v1].pos , sb->bpoint[bs->v2].pos);
                                        project_v3_v3v3(pr,vel,sp);
-                                       VECSUB(vel,vel,pr);
+                                       sub_v3_v3(vel, pr);
                                        normalize_v3(vel);
                                        if (ob->softflag & OB_SB_AERO_ANGLE){
                                                normalize_v3(sp);
@@ -1725,9 +1725,9 @@ static int choose_winner(float*w, float* pos,float*a,float*b,float*c,float*ca,fl
                winner =3;
        }
        switch (winner){
-               case 1: VECCOPY(w,ca); break;
-               case 2: VECCOPY(w,cb); break;
-               case 3: VECCOPY(w,cc);
+               case 1: copy_v3_v3(w,ca); break;
+               case 2: copy_v3_v3(w,cb); break;
+               case 3: copy_v3_v3(w,cc);
        }
        return(winner);
 }
@@ -1824,11 +1824,11 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 
                                        if (mvert){
 
-                                               VECCOPY(nv1,mvert[mface->v1].co);
-                                               VECCOPY(nv2,mvert[mface->v2].co);
-                                               VECCOPY(nv3,mvert[mface->v3].co);
+                                               copy_v3_v3(nv1,mvert[mface->v1].co);
+                                               copy_v3_v3(nv2,mvert[mface->v2].co);
+                                               copy_v3_v3(nv3,mvert[mface->v3].co);
                                                if (mface->v4){
-                                                       VECCOPY(nv4,mvert[mface->v4].co);
+                                                       copy_v3_v3(nv4,mvert[mface->v4].co);
                                                }
 
                                                if (mprevvert){
@@ -1838,11 +1838,11 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
                                                        since the AABB reduced propabitlty to get here drasticallly
                                                        it might be a nice tradeof CPU <--> memory
                                                        */
-                                                       VECSUB(vv1,nv1,mprevvert[mface->v1].co);
-                                                       VECSUB(vv2,nv2,mprevvert[mface->v2].co);
-                                                       VECSUB(vv3,nv3,mprevvert[mface->v3].co);
+                                                       sub_v3_v3v3(vv1,nv1,mprevvert[mface->v1].co);
+                                                       sub_v3_v3v3(vv2,nv2,mprevvert[mface->v2].co);
+                                                       sub_v3_v3v3(vv3,nv3,mprevvert[mface->v3].co);
                                                        if (mface->v4){
-                                                               VECSUB(vv4,nv4,mprevvert[mface->v4].co);
+                                                               sub_v3_v3v3(vv4,nv4,mprevvert[mface->v4].co);
                                                        }
 
                                                        mul_v3_fl(nv1,time);
@@ -1862,9 +1862,9 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
                                        }
 
                                        /* switch origin to be nv2*/
-                                       VECSUB(edge1, nv1, nv2);
-                                       VECSUB(edge2, nv3, nv2);
-                                       VECSUB(dv1,opco,nv2); /* abuse dv1 to have vertex in question at *origin* of triangle */
+                                       sub_v3_v3v3(edge1, nv1, nv2);
+                                       sub_v3_v3v3(edge2, nv3, nv2);
+                                       sub_v3_v3v3(dv1,opco,nv2); /* abuse dv1 to have vertex in question at *origin* of triangle */
 
                                        cross_v3_v3v3(d_nvect, edge2, edge1);
                                        /* n_mag = */ /* UNUSED */ normalize_v3(d_nvect);
@@ -1890,7 +1890,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
                                                        }
                                                        if ((mprevvert) && (*damp > 0.0f)){
                                                                choose_winner(ve,opco,nv1,nv2,nv3,vv1,vv2,vv3);
-                                                               VECADD(avel,avel,ve);
+                                                               add_v3_v3(avel, ve);
                                                                cavel ++;
                                                        }
                                                        *intrusion += facedist;
@@ -1899,9 +1899,9 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
                                        }
                                        if (mface->v4){ /* quad */
                                                /* switch origin to be nv4 */
-                                               VECSUB(edge1, nv3, nv4);
-                                               VECSUB(edge2, nv1, nv4);
-                                               VECSUB(dv1,opco,nv4); /* abuse dv1 to have vertex in question at *origin* of triangle */
+                                               sub_v3_v3v3(edge1, nv3, nv4);
+                                               sub_v3_v3v3(edge2, nv1, nv4);
+                                               sub_v3_v3v3(dv1,opco,nv4); /* abuse dv1 to have vertex in question at *origin* of triangle */
 
                                                cross_v3_v3v3(d_nvect, edge2, edge1);
                                                /* n_mag = */ /* UNUSED */ normalize_v3(d_nvect);
@@ -1926,7 +1926,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 
                                                                if ((mprevvert) && (*damp > 0.0f)){
                                                                        choose_winner(ve,opco,nv1,nv3,nv4,vv1,vv3,vv4);
-                                                                       VECADD(avel,avel,ve);
+                                                                       add_v3_v3(avel, ve);
                                                                        cavel ++;
                                                                }
                                                                *intrusion += facedist;
@@ -1939,46 +1939,46 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
                                                        float dist;
 
                                                        closest_to_line_segment_v3(ve, opco, nv1, nv2);
-                                                        VECSUB(ve,opco,ve);
+                                                        sub_v3_v3v3(ve,opco,ve);
                                                        dist = normalize_v3(ve);
                                                        if ((dist < outerfacethickness)&&(dist < mindistedge )){
-                                                               VECCOPY(coledge,ve);
+                                                               copy_v3_v3(coledge,ve);
                                                                mindistedge = dist,
                                                                deflected=1;
                                                        }
 
                                                        closest_to_line_segment_v3(ve, opco, nv2, nv3);
-                                                        VECSUB(ve,opco,ve);
+                                                        sub_v3_v3v3(ve,opco,ve);
                                                        dist = normalize_v3(ve);
                                                        if ((dist < outerfacethickness)&&(dist < mindistedge )){
-                                                               VECCOPY(coledge,ve);
+                                                               copy_v3_v3(coledge,ve);
                                                                mindistedge = dist,
                                                                deflected=1;
                                                        }
 
                                                        closest_to_line_segment_v3(ve, opco, nv3, nv1);
-                                                        VECSUB(ve,opco,ve);
+                                                        sub_v3_v3v3(ve,opco,ve);
                                                        dist = normalize_v3(ve);
                                                        if ((dist < outerfacethickness)&&(dist < mindistedge )){
-                                                               VECCOPY(coledge,ve);
+                                                               copy_v3_v3(coledge,ve);
                                                                mindistedge = dist,
                                                                deflected=1;
                                                        }
                                                        if (mface->v4){ /* quad */
                                                                closest_to_line_segment_v3(ve, opco, nv3, nv4);
-                                                               VECSUB(ve,opco,ve);
+                                                               sub_v3_v3v3(ve,opco,ve);
                                                                dist = normalize_v3(ve);
                                                                if ((dist < outerfacethickness)&&(dist < mindistedge )){
-                                                                       VECCOPY(coledge,ve);
+                                                                       copy_v3_v3(coledge,ve);
                                                                        mindistedge = dist,
                                                                                deflected=1;
                                                                }
 
                                                                closest_to_line_segment_v3(ve, opco, nv1, nv4);
-                                                               VECSUB(ve,opco,ve);
+                                                               sub_v3_v3v3(ve,opco,ve);
                                                                dist = normalize_v3(ve);
                                                                if ((dist < outerfacethickness)&&(dist < mindistedge )){
-                                                                       VECCOPY(coledge,ve);
+                                                                       copy_v3_v3(coledge,ve);
                                                                        mindistedge = dist,
                                                                                deflected=1;
                                                                }
@@ -2007,15 +2007,15 @@ static int sb_detect_vertex_collisionCached(float opco[3], float facenormal[3],
 
        }
        if (deflected == 2){ //  face inner detected
-               VECADD(force,force,innerforceaccu);
+               add_v3_v3(force, innerforceaccu);
        }
        if (deflected == 3){ //  face outer detected
-               VECADD(force,force,outerforceaccu);
+               add_v3_v3(force, outerforceaccu);
        }
 
        BLI_ghashIterator_free(ihash);
        if (cavel) mul_v3_fl(avel,1.0f/(float)cavel);
-       VECCOPY(vel,avel);
+       copy_v3_v3(vel,avel);
        if (ci) *intrusion /= ci;
        if (deflected){
                normalize_v3_v3(facenormal, force);
@@ -2029,7 +2029,7 @@ static int sb_deflect_face(Object *ob,float *actpos,float *facenormal,float *for
 {
        float s_actpos[3];
        int deflected;
-       VECCOPY(s_actpos,actpos);
+       copy_v3_v3(s_actpos,actpos);
        deflected= sb_detect_vertex_collisionCached(s_actpos, facenormal, cf, force , ob->lay, ob,time,vel,intrusion);
        //deflected= sb_detect_vertex_collisionCachedEx(s_actpos, facenormal, cf, force , ob->lay, ob,time,vel,intrusion);
        return(deflected);
@@ -2286,7 +2286,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
                        /* gravitation */
                        if (sb && scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY){
                                float gravity[3];
-                               VECCOPY(gravity, scene->physics_settings.gravity);
+                               copy_v3_v3(gravity, scene->physics_settings.gravity);
                                mul_v3_fl(gravity, sb_grav_force_scale(ob)*_final_mass(ob,bp)*sb->effector_weights->global_gravity); /* individual mass of node here */
                                add_v3_v3(bp->force, gravity);
                        }
@@ -2303,7 +2303,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
 
                                /* apply forcefield*/
                                mul_v3_fl(force,fieldfactor* eval_sb_fric_force_scale);
-                               VECADD(bp->force, bp->force, force);
+                               add_v3_v3(bp->force, force);
 
                                /* BP friction in moving media */
                                kd= sb->mediafrict* eval_sb_fric_force_scale;
@@ -2337,7 +2337,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, Object *ob, flo
                                                        bp->choke = sb->choke*0.01f;
                                                }
 
-                                                       VECSUB(cfforce,bp->vec,vel);
+                                                       sub_v3_v3v3(cfforce,bp->vec,vel);
                                                        Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
 
                                        Vec3PlusStVec(bp->force,kd,defforce);
@@ -2524,7 +2524,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 
 
                if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY){
-                       VECCOPY(gravity, scene->physics_settings.gravity);
+                       copy_v3_v3(gravity, scene->physics_settings.gravity);
                        mul_v3_fl(gravity, sb_grav_force_scale(ob)*sb->effector_weights->global_gravity);
                }
 
@@ -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 */
@@ -2711,7 +2711,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
 
                                        /* apply forcefield*/
                                        mul_v3_fl(force,fieldfactor* eval_sb_fric_force_scale);
-                                       VECADD(bp->force, bp->force, force);
+                                       add_v3_v3(bp->force, force);
 
                                        /* BP friction in moving media */
                                        kd= sb->mediafrict* eval_sb_fric_force_scale;
@@ -2764,7 +2764,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
                                                        }
                                                        else{
 
-                                                               VECSUB(cfforce,bp->vec,vel);
+                                                               sub_v3_v3v3(cfforce,bp->vec,vel);
                                                                Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
                                                        }
 
@@ -2774,7 +2774,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
                                                        bp->choke = sb->choke*0.01f;
                                                }
                                                else{
-                                                       VECSUB(cfforce,bp->vec,vel);
+                                                       sub_v3_v3v3(cfforce,bp->vec,vel);
                                                        Vec3PlusStVec(bp->force,-cf*50.0f,cfforce);
                                                }
                                                Vec3PlusStVec(bp->force,kd,defforce);
@@ -2876,7 +2876,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa
                        else{
                                printf("Matrix inversion failed \n");
                                for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
-                                       VECCOPY(bp->impdv,bp->force);
+                                       copy_v3_v3(bp->impdv,bp->force);
                                }
 
                        }
@@ -2923,7 +2923,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 
                if(_final_goal(ob,bp) < SOFTGOALSNAP){
                        /* this makes t~ = t */
-                       if(mid_flags & MID_PRESERVE) VECCOPY(dx,bp->vec);
+                       if(mid_flags & MID_PRESERVE) copy_v3_v3(dx,bp->vec);
 
                        /* so here is (v)' = a(cceleration) = sum(F_springs)/m + gravitation + some friction forces  + more forces*/
                        /* the ( ... )' operator denotes derivate respective time */
@@ -2931,11 +2931,11 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
                        /* v(t + dt) = v(t) + a(t) * dt */
                        mul_v3_fl(bp->force,timeovermass);/* individual mass of node here */
                        /* some nasty if's to have heun in here too */
-                       VECCOPY(dv,bp->force);
+                       copy_v3_v3(dv,bp->force);
 
                        if (mode == 1){
-                               VECCOPY(bp->prevvec, bp->vec);
-                               VECCOPY(bp->prevdv, dv);
+                               copy_v3_v3(bp->prevvec, bp->vec);
+                               copy_v3_v3(bp->prevdv, dv);
                        }
 
                        if (mode ==2){
@@ -2948,10 +2948,10 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
                                maxerrvel = MAX2(maxerrvel,ABS(dv[1] - bp->prevdv[1]));
                                maxerrvel = MAX2(maxerrvel,ABS(dv[2] - bp->prevdv[2]));
                        }
-                       else {VECADD(bp->vec, bp->vec, bp->force);}
+                       else { add_v3_v3(bp->vec, bp->force); }
 
                        /* this makes t~ = t+dt */
-                       if(!(mid_flags & MID_PRESERVE)) VECCOPY(dx,bp->vec);
+                       if(!(mid_flags & MID_PRESERVE)) copy_v3_v3(dx,bp->vec);
 
                        /* so here is (x)'= v(elocity) */
                        /* the euler step for location then becomes */
@@ -2970,8 +2970,8 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
                        */
                        /* again some nasty if's to have heun in here too */
                        if (mode ==1){
-                               VECCOPY(bp->prevpos,bp->pos);
-                               VECCOPY(bp->prevdx ,dx);
+                               copy_v3_v3(bp->prevpos,bp->pos);
+                               copy_v3_v3(bp->prevdx ,dx);
                        }
 
                        if (mode ==2){
@@ -2994,7 +2994,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
                                }
 
                        }
-                       else { VECADD(bp->pos, bp->pos, dx);}
+                       else { add_v3_v3(bp->pos, dx);}
                }/*snap*/
                /* so while we are looping BPs anyway do statistics on the fly */
                aabbmin[0] = MIN2(aabbmin[0],bp->pos[0]);
@@ -3008,8 +3008,8 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float *
 
        if (sb->totpoint) mul_v3_fl(cm,1.0f/sb->totpoint);
        if (sb->scratch){
-               VECCOPY(sb->scratch->aabbmin,aabbmin);
-               VECCOPY(sb->scratch->aabbmax,aabbmax);
+               copy_v3_v3(sb->scratch->aabbmin,aabbmin);
+               copy_v3_v3(sb->scratch->aabbmax,aabbmax);
        }
 
        if (err){ /* so step size will be controlled by biggest difference in slope */
@@ -3032,8 +3032,8 @@ static void softbody_restore_prev_step(Object *ob)
        int a;
 
        for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
-               VECCOPY(bp->vec, bp->prevvec);
-               VECCOPY(bp->pos, bp->prevpos);
+               copy_v3_v3(bp->vec, bp->prevvec);
+               copy_v3_v3(bp->pos, bp->prevpos);
        }
 }
 
@@ -3045,8 +3045,8 @@ static void softbody_store_step(Object *ob)
        int a;
 
        for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
-               VECCOPY(bp->prevvec,bp->vec);
-               VECCOPY(bp->prevpos,bp->pos);
+               copy_v3_v3(bp->prevvec,bp->vec);
+               copy_v3_v3(bp->prevpos,bp->pos);
        }
 }
 
@@ -3061,10 +3061,10 @@ static void softbody_store_state(Object *ob,float *ppos,float *pvel)
 
        for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 
-               VECCOPY(pv, bp->vec);
+               copy_v3_v3(pv, bp->vec);
                pv+=3;
 
-               VECCOPY(pp, bp->pos);
+               copy_v3_v3(pp, bp->pos);
                pp+=3;
        }
 }
@@ -3079,10 +3079,10 @@ static void softbody_retrieve_state(Object *ob,float *ppos,float *pvel)
 
        for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 
-               VECCOPY(bp->vec,pv);
+               copy_v3_v3(bp->vec,pv);
                pv+=3;
 
-               VECCOPY(bp->pos,pp);
+               copy_v3_v3(bp->pos,pp);
                pp+=3;
        }
 }
@@ -3098,14 +3098,14 @@ static void softbody_swap_state(Object *ob,float *ppos,float *pvel)
 
        for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
 
-               VECCOPY(temp, bp->vec);
-               VECCOPY(bp->vec,pv);
-               VECCOPY(pv,temp);
+               copy_v3_v3(temp, bp->vec);
+               copy_v3_v3(bp->vec,pv);
+               copy_v3_v3(pv,temp);
                pv+=3;
 
-               VECCOPY(temp, bp->pos);
-               VECCOPY(bp->pos,pp);
-               VECCOPY(pp,temp);
+               copy_v3_v3(temp, bp->pos);
+               copy_v3_v3(bp->pos,pp);
+               copy_v3_v3(pp,temp);
                pp+=3;
        }
 }
@@ -3126,8 +3126,8 @@ static void softbody_apply_goalsnap(Object *ob)
 
        for(a=sb->totpoint, bp= sb->bpoint; a>0; a--, bp++) {
                if (_final_goal(ob,bp) >= SOFTGOALSNAP){
-                       VECCOPY(bp->prevpos,bp->pos);
-                       VECCOPY(bp->pos,bp->origT);
+                       copy_v3_v3(bp->prevpos,bp->pos);
+                       copy_v3_v3(bp->pos,bp->origT);
                }
        }
 }
@@ -3238,7 +3238,7 @@ static void springs_from_mesh(Object *ob)
                if(me->totvert) {
                        bp= ob->soft->bpoint;
                        for(a=0; a<me->totvert; a++, bp++) {
-                               VECCOPY(bp->origS, me->mvert[a].co);
+                               copy_v3_v3(bp->origS, me->mvert[a].co);
                                mul_m4_v3(ob->obmat, bp->origS);
                        }
 
@@ -3399,12 +3399,12 @@ static void reference_to_scratch(Object *ob)
        bp= ob->soft->bpoint;
        rp= sb->scratch->Ref.ivert;
        for(a=0; a<sb->totpoint; a++, rp++, bp++) {
-               VECCOPY(rp->pos,bp->pos);
-               VECADD(accu_pos,accu_pos,bp->pos);
+               copy_v3_v3(rp->pos,bp->pos);
+               add_v3_v3(accu_pos, bp->pos);
                accu_mass += _final_mass(ob,bp);
        }
        mul_v3_fl(accu_pos,1.0f/accu_mass);
-       VECCOPY(sb->scratch->Ref.com,accu_pos);
+       copy_v3_v3(sb->scratch->Ref.com,accu_pos);
        /* printf("reference_to_scratch \n"); */
 }
 
@@ -3415,9 +3415,9 @@ when object is rescaled
 static float globallen(float *v1,float *v2,Object *ob)
 {
        float p1[3],p2[3];
-       VECCOPY(p1,v1);
+       copy_v3_v3(p1,v1);
        mul_m4_v3(ob->obmat, p1);
-       VECCOPY(p2,v2);
+       copy_v3_v3(p2,v2);
        mul_m4_v3(ob->obmat, p2);
        return len_v3v3(p1,p2);
 }
@@ -3656,7 +3656,7 @@ static void softbody_to_object(Object *ob, float (*vertexCos)[3], int numVerts,
                invert_m4_m4(ob->imat, ob->obmat);
 
                for(a=0; a<numVerts; a++, bp++) {
-                       VECCOPY(vertexCos[a], bp->pos);
+                       copy_v3_v3(vertexCos[a], bp->pos);
                        if(local==0)
                                mul_m4_v3(ob->imat, vertexCos[a]);      /* softbody is in global coords, baked optionally not */
                }
@@ -3784,14 +3784,14 @@ static void softbody_update_positions(Object *ob, SoftBody *sb, float (*vertexCo
 
        for(a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
                /* store where goals are now */
-               VECCOPY(bp->origS, bp->origE);
+               copy_v3_v3(bp->origS, bp->origE);
                /* copy the position of the goals at desired end time */
-               VECCOPY(bp->origE, vertexCos[a]);
+               copy_v3_v3(bp->origE, vertexCos[a]);
                /* vertexCos came from local world, go global */
                mul_m4_v3(ob->obmat, bp->origE);
                /* just to be save give bp->origT a defined value
                will be calulated in interpolate_exciter()*/
-               VECCOPY(bp->origT, bp->origE);
+               copy_v3_v3(bp->origT, bp->origE);
        }
 }
 
@@ -3828,14 +3828,14 @@ void SB_estimate_transform(Object *ob,float lloc[3],float lrot[3][3],float lscal
        rpos= MEM_callocN( (sb->totpoint)*3*sizeof(float), "SB_RPOS");
        /* might filter vertex selection with a vertex group */
        for(a=0, bp=sb->bpoint, rp=sb->scratch->Ref.ivert; a<sb->totpoint; a++, bp++, rp++) {
-               VECCOPY(rpos[a],rp->pos);
-               VECCOPY(opos[a],bp->pos);
+               copy_v3_v3(rpos[a],rp->pos);
+               copy_v3_v3(opos[a],bp->pos);
        }
 
        vcloud_estimate_transform(sb->totpoint, opos, NULL, rpos, NULL, com, rcom,lrot,lscale);
-       //VECSUB(com,com,rcom);
-       if (lloc) VECCOPY(lloc,com);
-       VECCOPY(sb->lcom,com);
+       //sub_v3_v3(com,rcom);
+       if (lloc) copy_v3_v3(lloc,com);
+       copy_v3_v3(sb->lcom,com);
        if (lscale) copy_m3_m3(sb->lscale,lscale);
        if (lrot)   copy_m3_m3(sb->lrot,lrot);
 
@@ -3850,11 +3850,11 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
        int a;
 
        for(a=0,bp=sb->bpoint; a<numVerts; a++, bp++) {
-               VECCOPY(bp->pos, vertexCos[a]);
+               copy_v3_v3(bp->pos, vertexCos[a]);
                mul_m4_v3(ob->obmat, bp->pos);  /* yep, sofbody is global coords*/
-               VECCOPY(bp->origS, bp->pos);
-               VECCOPY(bp->origE, bp->pos);
-               VECCOPY(bp->origT, bp->pos);
+               copy_v3_v3(bp->origS, bp->pos);
+               copy_v3_v3(bp->origE, bp->pos);
+               copy_v3_v3(bp->origT, bp->pos);
                bp->vec[0]= bp->vec[1]= bp->vec[2]= 0.0f;
 
                /* the bp->prev*'s are for rolling back from a canceled try to propagate in time
@@ -3869,10 +3869,10 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int
                4.b yup we're done
                */
 
-               VECCOPY(bp->prevpos, bp->pos);
-               VECCOPY(bp->prevvec, bp->vec);
-               VECCOPY(bp->prevdx, bp->vec);
-               VECCOPY(bp->prevdv, bp->vec);
+               copy_v3_v3(bp->prevpos, bp->pos);
+               copy_v3_v3(bp->prevvec, bp->vec);
+               copy_v3_v3(bp->prevdx, bp->vec);
+               copy_v3_v3(bp->prevdv, bp->vec);
        }
 
        /* make a nice clean scratch struc */
index 018c7a197ffdb701c8d3b174ae0a6b49dac5f7ee..a14233e9179ff7b6410b7fb6f80af97421cb3ca9 100644 (file)
@@ -69,7 +69,7 @@ Speaker *copy_speaker(Speaker *spk)
 {
        Speaker *spkn;
 
-       spkn= copy_libblock(spk);
+       spkn= copy_libblock(&spk->id);
        if(spkn->sound)
                spkn->sound->id.us++;
 
index ee849b4fd8d9f3a872bd9d08354bf09efd59876f..663107290afe5af67614c24773175c42ab817c9e 100644 (file)
@@ -763,7 +763,7 @@ static void ccgDM_getFinalVertCo(DerivedMesh *dm, int vertNum, float co_r[3])
        MVert mvert;
 
        ccgDM_getFinalVert(dm, vertNum, &mvert);
-       VECCOPY(co_r, mvert.co);
+       copy_v3_v3(co_r, mvert.co);
 }
 
 static void ccgDM_getFinalVertNo(DerivedMesh *dm, int vertNum, float no_r[3])
index 955127a8000667e9497a84c9251030295c3ef9a7..e8be0bb2608f069527960c43f3a1d7cf09edfe92 100644 (file)
@@ -431,7 +431,7 @@ Text *copy_text(Text *ta)
        Text *tan;
        TextLine *line, *tmp;
        
-       tan= copy_libblock(ta);
+       tan= copy_libblock(&ta->id);
        
        /* file name can be NULL */
        if(ta->name) {
index d3bd7d7b766a351b94dc1c47fa3a55e1277ae059..377eeef117e6114cb1fcb15629de4651b0275a16 100644 (file)
@@ -227,7 +227,7 @@ void init_mapping(TexMapping *texmap)
        mul_m3_m3m3(mat, rmat, smat);
        
        copy_m4_m3(texmap->mat, mat);
-       VECCOPY(texmap->mat[3], texmap->loc);
+       copy_v3_v3(texmap->mat[3], texmap->loc);
 
 }
 
@@ -751,7 +751,7 @@ Tex *copy_texture(Tex *tex)
 {
        Tex *texn;
        
-       texn= copy_libblock(tex);
+       texn= copy_libblock(&tex->id);
        if(texn->type==TEX_IMAGE) id_us_plus((ID *)texn->ima);
        else texn->ima= NULL;
        
@@ -781,7 +781,7 @@ Tex *localize_texture(Tex *tex)
 {
        Tex *texn;
        
-       texn= copy_libblock(tex);
+       texn= copy_libblock(&tex->id);
        BLI_remlink(&G.main->tex, texn);
        
        /* image texture: free_texture also doesn't decrease */
index c7d2763774d83fc65467dace6da0e235f515eca3..1d6972b9d611cafe8771a1378fdd2c6bb4666cfa 100644 (file)
@@ -118,7 +118,7 @@ World *copy_world(World *wrld)
        World *wrldn;
        int a;
        
-       wrldn= copy_libblock(wrld);
+       wrldn= copy_libblock(&wrld->id);
        
        for(a=0; a<MAX_MTEX; a++) {
                if(wrld->mtex[a]) {
@@ -142,7 +142,7 @@ World *localize_world(World *wrld)
        World *wrldn;
        int a;
        
-       wrldn= copy_libblock(wrld);
+       wrldn= copy_libblock(&wrld->id);
        BLI_remlink(&G.main->world, wrldn);
        
        for(a=0; a<MAX_MTEX; a++) {
index 4daa27a5c72673a4c77b803e46871a26c8c2f4aa..8ead7bf5f171f8bf2317a54da6335281ae2228a1 100644 (file)
@@ -85,11 +85,11 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis);
 void BLI_bvhtree_free(BVHTree *tree);
 
 /* construct: first insert points, then call balance */
-int BLI_bvhtree_insert(BVHTree *tree, int index, float *co, int numpoints);
+int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints);
 void BLI_bvhtree_balance(BVHTree *tree);
 
 /* update: first update points/nodes, then call update_tree to refit the bounding volumes */
-int BLI_bvhtree_update_node(BVHTree *tree, int index, float *co, float *co_moving, int numpoints);
+int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const float *co_moving, int numpoints);
 void BLI_bvhtree_update_tree(BVHTree *tree);
 
 /* collision/overlap: check two trees if they overlap, alloc's *overlap with length of the int return value */
@@ -98,14 +98,14 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
 float BLI_bvhtree_getepsilon(BVHTree *tree);
 
 /* find nearest node to the given coordinates (if nearest is given it will only search nodes where square distance is smaller than nearest->dist) */
-int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata);
+int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata);
 
-int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata);
+int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float *dir, float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata);
 
-float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, float *pos);
+float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float light_end[3], float pos[3]);
 
 /* range query */
-int BLI_bvhtree_range_query(BVHTree *tree, const float *co, float radius, BVHTree_RangeQuery callback, void *userdata);
+int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata);
 
 #ifdef __cplusplus
 }
index 0c72db0742cf899992dff74dc9c6119bb42d4c03..cb15c6a597c9419cb426bef73b54fbe64ad68e50 100644 (file)
@@ -56,11 +56,18 @@ MINLINE void swap_v2_v2(float a[2], float b[2]);
 MINLINE void swap_v3_v3(float a[3], float b[3]);
 MINLINE void swap_v4_v4(float a[4], float b[4]);
 
+/* char */
+MINLINE void copy_v2_v2_char(char r[2], const char a[2]);
+MINLINE void copy_v3_v3_char(char r[3], const char a[3]);
+MINLINE void copy_v4_v4_char(char r[4], const char a[4]);
 /* short */
 MINLINE void copy_v2_v2_short(short r[2], const short a[2]);
 MINLINE void copy_v3_v3_short(short r[3], const short a[3]);
 MINLINE void copy_v4_v4_short(short r[4], const short a[4]);
-
+/* int */
+MINLINE void copy_v2_v2_int(int r[2], const int a[2]);
+MINLINE void copy_v3_v3_int(int r[3], const int a[3]);
+MINLINE void copy_v4_v4_int(int r[4], const int a[4]);
 
 /********************************* Arithmetic ********************************/
 
index d1734151b4a7c1151bf9ee9c463da9c5c12d649e..f01777bdce1559aed9f4206a9cf63106050dd94c 100644 (file)
@@ -387,7 +387,7 @@ static void build_skip_links(BVHTree *tree, BVHNode *node, BVHNode *left, BVHNod
 /*
  * BVHTree bounding volumes functions
  */
-static void create_kdop_hull(BVHTree *tree, BVHNode *node, float *co, int numpoints, int moving)
+static void create_kdop_hull(BVHTree *tree, BVHNode *node, const float *co, int numpoints, int moving)
 {
        float newminmax;
        float *bv = node->bv;
@@ -973,7 +973,7 @@ void BLI_bvhtree_balance(BVHTree *tree)
        //bvhtree_info(tree);
 }
 
-int BLI_bvhtree_insert(BVHTree *tree, int index, float *co, int numpoints)
+int BLI_bvhtree_insert(BVHTree *tree, int index, const float *co, int numpoints)
 {
        int i;
        BVHNode *node = NULL;
@@ -1005,7 +1005,7 @@ int BLI_bvhtree_insert(BVHTree *tree, int index, float *co, int numpoints)
 
 
 // call before BLI_bvhtree_update_tree()
-int BLI_bvhtree_update_node(BVHTree *tree, int index, float *co, float *co_moving, int numpoints)
+int BLI_bvhtree_update_node(BVHTree *tree, int index, const float *co, const float *co_moving, int numpoints)
 {
        int i;
        BVHNode *node= NULL;
@@ -1194,7 +1194,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
 }
 
 //Determines the nearest point of the given node BV. Returns the squared distance to that point.
-static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest)
+static float calc_nearest_point(const float proj[3], BVHNode *node, float *nearest)
 {
        int i;
        const float *bv = node->bv;
@@ -1212,7 +1212,7 @@ static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest
 
 /*
        //nearest on a general hull
-       VECCOPY(nearest, data->co);
+       copy_v3_v3(nearest, data->co);
        for(i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv+=2)
        {
                float proj = dot_v3v3( nearest, KDOP_AXES[i]);
@@ -1221,11 +1221,11 @@ static float calc_nearest_point(const float *proj, BVHNode *node, float *nearest
 
                if(dl > 0)
                {
-                       VECADDFAC(nearest, nearest, KDOP_AXES[i], dl);
+                       madd_v3_v3fl(nearest, KDOP_AXES[i], dl);
                }
                else if(du < 0)
                {
-                       VECADDFAC(nearest, nearest, KDOP_AXES[i], du);
+                       madd_v3_v3fl(nearest, KDOP_AXES[i], du);
                }
        }
 */
@@ -1377,7 +1377,7 @@ static void bfs_find_nearest(BVHNearestData *data, BVHNode *node)
 #endif
 
 
-int BLI_bvhtree_find_nearest(BVHTree *tree, const float *co, BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
+int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *nearest, BVHTree_NearestPointCallback callback, void *userdata)
 {
        int i;
 
@@ -1510,7 +1510,7 @@ static void dfs_raycast(BVHRayCastData *data, BVHNode *node)
                {
                        data->hit.index = node->index;
                        data->hit.dist  = dist;
-                       VECADDFAC(data->hit.co, data->ray.origin, data->ray.direction, dist);
+                       madd_v3_v3v3fl(data->hit.co, data->ray.origin, data->ray.direction, dist);
                }
        }
        else
@@ -1553,7 +1553,7 @@ static void iterative_raycast(BVHRayCastData *data, BVHNode *node)
                        {
                                data->hit.index = node->index;
                                data->hit.dist  = dist;
-                               VECADDFAC(data->hit.co, data->ray.origin, data->ray.direction, dist);
+                               madd_v3_v3v3fl(data->hit.co, data->ray.origin, data->ray.direction, dist);
                        }
                        
                        node = node->skip[1];
@@ -1566,7 +1566,7 @@ static void iterative_raycast(BVHRayCastData *data, BVHNode *node)
 }
 #endif
 
-int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
+int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], float radius, BVHTreeRayHit *hit, BVHTree_RayCastCallback callback, void *userdata)
 {
        int i;
        BVHRayCastData data;
@@ -1577,8 +1577,8 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float
        data.callback = callback;
        data.userdata = userdata;
 
-       VECCOPY(data.ray.origin,    co);
-       VECCOPY(data.ray.direction, dir);
+       copy_v3_v3(data.ray.origin,    co);
+       copy_v3_v3(data.ray.direction, dir);
        data.ray.radius = radius;
 
        normalize_v3(data.ray.direction);
@@ -1620,7 +1620,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float *co, const float *dir, float
        return data.hit.index;
 }
 
-float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, float *pos)
+float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float light_end[3], float pos[3])
 {
        BVHRayCastData data;
        float dist = 0.0;
@@ -1639,13 +1639,13 @@ float BLI_bvhtree_bb_raycast(float *bv, float *light_start, float *light_end, fl
        data.ray.origin[2] = light_start[2];
        
        normalize_v3(data.ray.direction);
-       VECCOPY(data.ray_dot_axis, data.ray.direction);
+       copy_v3_v3(data.ray_dot_axis, data.ray.direction);
        
        dist = ray_nearest_hit(&data, bv);
        
        if(dist > 0.0f)
        {
-               VECADDFAC(pos, light_start, data.ray.direction, dist);
+               madd_v3_v3v3fl(pos, light_start, data.ray.direction, dist);
        }
        return dist;
        
@@ -1706,7 +1706,7 @@ static void dfs_range_query(RangeQueryData *data, BVHNode *node)
        }
 }
 
-int BLI_bvhtree_range_query(BVHTree *tree, const float *co, float radius, BVHTree_RangeQuery callback, void *userdata)
+int BLI_bvhtree_range_query(BVHTree *tree, const float co[3], float radius, BVHTree_RangeQuery callback, void *userdata)
 {
        BVHNode * root = tree->nodes[tree->totleaf];
 
index 6dd278ed777f779d54f16cb5b65ee392e60d2103..d0d3d0e137e32681284fe13e3ffac3246cf183c2 100644 (file)
@@ -823,14 +823,14 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
        }
        
        /* mirror node2 along axis */
-       VECCOPY(p, node2->p);
+       copy_v3_v3(p, node2->p);
        BLI_mirrorAlongAxis(p, root_node->p, nor);
        
        /* check if it's within limit before continuing */
        if (len_v3v3(node1->p, p) <= limit)
        {
                /* mark node as symmetric physically */
-               VECCOPY(root_node->symmetry_axis, nor);
+               copy_v3_v3(root_node->symmetry_axis, nor);
                root_node->symmetry_flag |= SYM_PHYSICAL;
                root_node->symmetry_flag |= SYM_AXIAL;
 
index 5550a0e6b909f5d814d40b4b2280608593dce05d..f6ba4ec43adfbbdc4f2db5af3a40547d35513f90 100644 (file)
@@ -77,6 +77,28 @@ MINLINE void copy_v4_v4(float r[4], const float a[4])
        r[3]= a[3];
 }
 
+/* short */
+MINLINE void copy_v2_v2_char(char r[2], const char a[2])
+{
+       r[0]= a[0];
+       r[1]= a[1];
+}
+
+MINLINE void copy_v3_v3_char(char r[3], const char a[3])
+{
+       r[0]= a[0];
+       r[1]= a[1];
+       r[2]= a[2];
+}
+
+MINLINE void copy_v4_v4_char(char r[4], const char a[4])
+{
+       r[0]= a[0];
+       r[1]= a[1];
+       r[2]= a[2];
+       r[3]= a[3];
+}
+
 /* short */
 MINLINE void copy_v2_v2_short(short r[2], const short a[2])
 {
@@ -99,6 +121,28 @@ MINLINE void copy_v4_v4_short(short r[4], const short a[4])
        r[3]= a[3];
 }
 
+/* int */
+MINLINE void copy_v2_v2_int(int r[2], const int a[2])
+{
+       r[0]= a[0];
+       r[1]= a[1];
+}
+
+MINLINE void copy_v3_v3_int(int r[3], const int a[3])
+{
+       r[0]= a[0];
+       r[1]= a[1];
+       r[2]= a[2];
+}
+
+MINLINE void copy_v4_v4_int(int r[4], const int a[4])
+{
+       r[0]= a[0];
+       r[1]= a[1];
+       r[2]= a[2];
+       r[3]= a[3];
+}
+
 MINLINE void swap_v2_v2(float a[2], float b[2])
 {
        SWAP(float, a[0], b[0]);
index 9e6344573bbf4b22ead8efadc794170d0fd538b3..506e931cecf9515efd4d3fda9eb56a217d3b6939 100644 (file)
@@ -4478,7 +4478,7 @@ static void direct_link_object(FileData *fd, Object *ob)
                         * a hook we need to make sure it gets converted
                         * and free'd, regardless of version.
                         */
-               VECCOPY(hmd->cent, hook->cent);
+               copy_v3_v3(hmd->cent, hook->cent);
                hmd->falloff = hook->falloff;
                hmd->force = hook->force;
                hmd->indexar = hook->indexar;
@@ -9673,7 +9673,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                part->obfac = paf->obfac;
                                part->randfac = paf->randfac * 25.0f;
                                part->dampfac = paf->damp;
-                               VECCOPY(part->acc, paf->force);
+                               copy_v3_v3(part->acc, paf->force);
 
                                /* flags */
                                if(paf->stype & PAF_VECT) {
@@ -10724,7 +10724,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                tot= MIN2(me->totvert, key->refkey->totelem);
 
                                for(a=0; a<tot; a++, data+=3)
-                                       VECCOPY(me->mvert[a].co, data)
+                                       copy_v3_v3(me->mvert[a].co, data);
                        }
                }
 
@@ -10734,7 +10734,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                tot= MIN2(lt->pntsu*lt->pntsv*lt->pntsw, key->refkey->totelem);
 
                                for(a=0; a<tot; a++, data+=3)
-                                       VECCOPY(lt->def[a].vec, data)
+                                       copy_v3_v3(lt->def[a].vec, data);
                        }
                }
 
@@ -10747,9 +10747,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                                BezTriple *bezt = nu->bezt;
 
                                                for(a=0; a<nu->pntsu; a++, bezt++) {
-                                                       VECCOPY(bezt->vec[0], data); data+=3;
-                                                       VECCOPY(bezt->vec[1], data); data+=3;
-                                                       VECCOPY(bezt->vec[2], data); data+=3;
+                                                       copy_v3_v3(bezt->vec[0], data); data+=3;
+                                                       copy_v3_v3(bezt->vec[1], data); data+=3;
+                                                       copy_v3_v3(bezt->vec[2], data); data+=3;
                                                        bezt->alfa= *data; data++;
                                                }
                                        }
@@ -10757,7 +10757,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                                BPoint *bp = nu->bp;
 
                                                for(a=0; a<nu->pntsu*nu->pntsv; a++, bp++) {
-                                                       VECCOPY(bp->vec, data); data+=3;
+                                                       copy_v3_v3(bp->vec, data); data+=3;
                                                        bp->alfa= *data; data++;
                                                }
                                        }
@@ -13442,7 +13442,7 @@ static void give_base_to_groups(Main *mainvar, Scene *scene)
                        ob->dup_group= group;
                        ob->transflag |= OB_DUPLIGROUP;
                        rename_id(&ob->id, group->id.name+2);
-                       VECCOPY(ob->loc, scene->cursor);
+                       copy_v3_v3(ob->loc, scene->cursor);
                }
        }
 }
index b115a96cfa1e4b3f754ae0507dd22d660ba57f92..7bd70e9f289a664104044e5c4365bb86caa8e1d8 100644 (file)
@@ -759,7 +759,7 @@ std::string AnimationExporter::create_4x4_source(std::vector<float> &frames , Ob
        for (it = frames.begin(); it != frames.end(); it++) {
                float mat[4][4], ipar[4][4];
 
-               float ctime = bsystem_time(scene, ob_arm, *it, 0.0f);
+               float ctime = BKE_frame_to_ctime(scene, *it);
 
                BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
                where_is_pose_bone(scene, ob_arm, pchan, ctime, 1);
@@ -1265,7 +1265,7 @@ void AnimationExporter::sample_animation(float *v, std::vector<float> &frames, i
        for (it = frames.begin(); it != frames.end(); it++) {
                float mat[4][4], ipar[4][4];
 
-               float ctime = bsystem_time(scene, ob_arm, *it, 0.0f);
+               float ctime = BKE_frame_to_ctime(scene, *it);
 
 
                BKE_animsys_evaluate_animdata(scene , &ob_arm->id, ob_arm->adt, ctime, ADT_RECALC_ANIM);
index 7f6c99b108fd98a0c660794349b14777b24837e4..c3a5c7a5383d1515331124d282df7c5a599554dc 100644 (file)
@@ -38,6 +38,7 @@ extern "C"
 #include "BKE_DerivedMesh.h"
 #include "BKE_fcurve.h"
 #include "BKE_animsys.h"
+#include "BKE_scene.h"
 #ifdef NAN_BUILDINFO
 extern char build_rev[];
 #endif
index e8af5a8f290ae3ef00462755c72289be291116b3..f0f3b8f4123e0db1cffce43df35a3b98711873f0 100644 (file)
@@ -176,13 +176,13 @@ static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, floa
                unsigned char cp[3];
                
                if (indent == 2) {
-                       VECCOPY(cp, grp->cs.solid);
+                       copy_v3_v3_char((char *)cp, grp->cs.solid);
                }
                else if (indent == 1) {
-                       VECCOPY(cp, grp->cs.select);
+                       copy_v3_v3_char((char *)cp, grp->cs.select);
                }
                else {
-                       VECCOPY(cp, grp->cs.active);
+                       copy_v3_v3_char((char *)cp, grp->cs.active);
                }
                
                /* copy the colors over, transforming from bytes to floats */
index 6f1da5757c699136db1ce74aa78ec1a5617d31bb..b1651886620bdb035297704857db061cc337aa33 100644 (file)
@@ -157,14 +157,14 @@ static void getEditBoneRollUpAxis(EditBone *bone, float roll, float up_axis[3])
        sub_v3_v3v3(nor, bone->tail, bone->head);
        
        vec_roll_to_mat3(nor, roll, mat);
-       VECCOPY(up_axis, mat[2]);
+       copy_v3_v3(up_axis, mat[2]);
 }
 
 static float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4], float qroll[4], float aligned_axis[3])
 {
        float nor[3], new_up_axis[3], x_axis[3], z_axis[3];
        
-       VECCOPY(new_up_axis, old_up_axis);
+       copy_v3_v3(new_up_axis, old_up_axis);
        mul_qt_v3(qrot, new_up_axis);
        
        sub_v3_v3v3(nor, bone->tail, bone->head);
@@ -236,7 +236,7 @@ static float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4]
                
                mul_qt_v3(qroll, normal);
                        
-               VECCOPY(new_up_axis, edge->up_axis);
+               copy_v3_v3(new_up_axis, edge->up_axis);
                mul_qt_v3(qrot, new_up_axis);
                
                normalize_v3(new_up_axis);
@@ -252,7 +252,7 @@ float rollBoneByQuat(EditBone *bone, float old_up_axis[3], float qrot[4])
 {
        float new_up_axis[3];
        
-       VECCOPY(new_up_axis, old_up_axis);
+       copy_v3_v3(new_up_axis, old_up_axis);
        mul_qt_v3(qrot, new_up_axis);
        
        return ED_rollBoneToVector(bone, new_up_axis, FALSE);
@@ -367,7 +367,7 @@ static RigNode *newRigNodeHead(RigGraph *rg, RigArc *arc, float p[3])
        node = MEM_callocN(sizeof(RigNode), "rig node");
        BLI_addtail(&rg->nodes, node);
 
-       VECCOPY(node->p, p);
+       copy_v3_v3(node->p, p);
        node->degree = 1;
        node->arcs = NULL;
        
@@ -389,7 +389,7 @@ static RigNode *newRigNode(RigGraph *rg, float p[3])
        node = MEM_callocN(sizeof(RigNode), "rig node");
        BLI_addtail(&rg->nodes, node);
 
-       VECCOPY(node->p, p);
+       copy_v3_v3(node->p, p);
        node->degree = 0;
        node->arcs = NULL;