Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/blenkernel/BKE_effect.h2
-rw-r--r--source/blender/blenkernel/BKE_library.h2
-rw-r--r--source/blender/blenkernel/BKE_object.h2
-rw-r--r--source/blender/blenkernel/BKE_particle.h8
-rw-r--r--source/blender/blenkernel/BKE_scene.h2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c15
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c2
-rw-r--r--source/blender/blenkernel/intern/boids.c126
-rw-r--r--source/blender/blenkernel/intern/brush.c2
-rw-r--r--source/blender/blenkernel/intern/bvhutils.c83
-rw-r--r--source/blender/blenkernel/intern/camera.c2
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c56
-rw-r--r--source/blender/blenkernel/intern/cloth.c64
-rw-r--r--source/blender/blenkernel/intern/colortools.c4
-rw-r--r--source/blender/blenkernel/intern/curve.c2
-rw-r--r--source/blender/blenkernel/intern/displist.c12
-rw-r--r--source/blender/blenkernel/intern/effect.c24
-rw-r--r--source/blender/blenkernel/intern/fluidsim.c2
-rw-r--r--source/blender/blenkernel/intern/key.c2
-rw-r--r--source/blender/blenkernel/intern/lamp.c4
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/library.c12
-rw-r--r--source/blender/blenkernel/intern/material.c4
-rw-r--r--source/blender/blenkernel/intern/mball.c2
-rw-r--r--source/blender/blenkernel/intern/mesh.c2
-rw-r--r--source/blender/blenkernel/intern/node.c2
-rw-r--r--source/blender/blenkernel/intern/object.c4
-rw-r--r--source/blender/blenkernel/intern/particle.c205
-rw-r--r--source/blender/blenkernel/intern/particle_system.c60
-rw-r--r--source/blender/blenkernel/intern/pointcache.c24
-rw-r--r--source/blender/blenkernel/intern/scene.c16
-rw-r--r--source/blender/blenkernel/intern/shrinkwrap.c34
-rw-r--r--source/blender/blenkernel/intern/smoke.c83
-rw-r--r--source/blender/blenkernel/intern/softbody.c272
-rw-r--r--source/blender/blenkernel/intern/speaker.c2
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c2
-rw-r--r--source/blender/blenkernel/intern/text.c2
-rw-r--r--source/blender/blenkernel/intern/texture.c6
-rw-r--r--source/blender/blenkernel/intern/world.c4
-rw-r--r--source/blender/blenlib/BLI_kdopbvh.h12
-rw-r--r--source/blender/blenlib/BLI_math_vector.h9
-rw-r--r--source/blender/blenlib/intern/BLI_kdopbvh.c34
-rw-r--r--source/blender/blenlib/intern/graph.c4
-rw-r--r--source/blender/blenlib/intern/math_vector_inline.c44
-rw-r--r--source/blender/blenloader/intern/readfile.c18
-rw-r--r--source/blender/collada/AnimationExporter.cpp4
-rw-r--r--source/blender/collada/AnimationExporter.h1
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c6
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c54
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c36
-rw-r--r--source/blender/editors/armature/meshlaplacian.c4
-rw-r--r--source/blender/editors/curve/editcurve.c56
-rw-r--r--source/blender/editors/gpencil/gpencil_edit.c19
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/include/ED_particle.h2
-rw-r--r--source/blender/editors/interface/interface.c4
-rw-r--r--source/blender/editors/interface/interface_handlers.c6
-rw-r--r--source/blender/editors/interface/interface_regions.c2
-rw-r--r--source/blender/editors/interface/interface_widgets.c80
-rw-r--r--source/blender/editors/object/object_add.c87
-rw-r--r--source/blender/editors/object/object_edit.c18
-rw-r--r--source/blender/editors/object/object_lattice.c3
-rw-r--r--source/blender/editors/object/object_modifier.c4
-rw-r--r--source/blender/editors/object/object_transform.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c182
-rw-r--r--source/blender/editors/physics/particle_object.c4
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c104
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c7
-rw-r--r--source/blender/editors/space_info/textview.c5
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c18
-rw-r--r--source/blender/editors/space_view3d/drawobject.c8
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c4
-rw-r--r--source/blender/editors/transform/transform.c8
-rw-r--r--source/blender/editors/transform/transform_conversions.c8
-rw-r--r--source/blender/editors/transform/transform_generics.c2
-rw-r--r--source/blender/editors/transform/transform_input.c2
-rw-r--r--source/blender/editors/transform/transform_orientations.c8
-rw-r--r--source/blender/editors/util/crazyspace.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_draw.c28
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c2
-rw-r--r--source/blender/gpu/intern/gpu_material.c12
-rw-r--r--source/blender/ikplugin/intern/iksolver_plugin.c12
-rw-r--r--source/blender/ikplugin/intern/itasc_plugin.cpp10
-rw-r--r--source/blender/makesrna/intern/rna_armature.c12
-rw-r--r--source/blender/modifiers/intern/MOD_build.c2
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c2
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c4
-rw-r--r--source/blender/nodes/composite/node_composite_util.c10
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_alphaOver.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_blur.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_colorMatte.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_curves.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_diffMatte.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_distanceMatte.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.c12
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_hueSatVal.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_invert.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normal.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_normalize.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_rgb.c2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_splitViewer.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_texture.c14
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_zcombine.c4
-rw-r--r--source/blender/nodes/shader/node_shader_util.c20
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_camera.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_geom.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_hueSatVal.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_invert.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_material.c14
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mixRgb.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_normal.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_output.c4
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_rgb.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_texture.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_bricks.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_hueSatVal.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_invert.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_mixRgb.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_proc.c4
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_texture.c6
-rw-r--r--source/blender/python/mathutils/mathutils_geometry.c18
-rw-r--r--source/blender/render/intern/include/rendercore.h1
-rw-r--r--source/blender/render/intern/include/zbuf.h2
-rw-r--r--source/blender/render/intern/source/convertblender.c54
-rw-r--r--source/blender/render/intern/source/envmap.c2
-rw-r--r--source/blender/render/intern/source/imagetexture.c4
-rw-r--r--source/blender/render/intern/source/occlusion.c262
-rw-r--r--source/blender/render/intern/source/pixelshading.c10
-rw-r--r--source/blender/render/intern/source/pointdensity.c12
-rw-r--r--source/blender/render/intern/source/rayshade.c2
-rw-r--r--source/blender/render/intern/source/render_texture.c2
-rw-r--r--source/blender/render/intern/source/rendercore.c57
-rw-r--r--source/blender/render/intern/source/shadbuf.c8
-rw-r--r--source/blender/render/intern/source/shadeinput.c4
-rw-r--r--source/blender/render/intern/source/shadeoutput.c18
-rw-r--r--source/blender/render/intern/source/sss.c16
-rw-r--r--source/blender/render/intern/source/strand.c35
-rw-r--r--source/blender/render/intern/source/volume_precache.c6
-rw-r--r--source/blender/render/intern/source/voxeldata.c6
-rw-r--r--source/blender/render/intern/source/zbuf.c88
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c19
-rw-r--r--source/gameengine/Converter/BL_ActionActuator.cpp6
-rw-r--r--source/gameengine/Converter/BL_ArmatureObject.cpp4
149 files changed, 1521 insertions, 1402 deletions
diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h
index 59a361c010d..7f4e809718c 100644
--- a/source/blender/blenkernel/BKE_effect.h
+++ b/source/blender/blenkernel/BKE_effect.h
@@ -129,7 +129,7 @@ void pd_point_from_soft(struct Scene *scene, float *loc, float *vel, int index,
/* needed for boids */
float effector_falloff(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, struct EffectorWeights *weights);
-int closest_point_on_surface(struct SurfaceModifierData *surmd, float *co, float *surface_co, float *surface_nor, float *surface_vel);
+int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3]);
int get_effector_data(struct EffectorCache *eff, struct EffectorData *efd, struct EffectedPoint *point, int real_velocity);
/* required for particle_system.c */
diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h
index 9130cac6cd6..308d7ff22c2 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -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);
diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 85a986d3460..9ccdd080158 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -106,7 +106,7 @@ struct BoundBox *object_get_boundbox(struct Object *ob);
void object_get_dimensions(struct Object *ob, float *value);
void object_set_dimensions(struct Object *ob, const float *value);
void object_boundbox_flag(struct Object *ob, int flag, int set);
-void minmax_object(struct Object *ob, float *min, float *max);
+void minmax_object(struct Object *ob, float min[3], float max[3]);
int minmax_object_duplis(struct Scene *scene, struct Object *ob, float *min, float *max);
void solve_tracking (struct Object *ob, float targetmat[][4]);
int ray_hit_boundbox(struct BoundBox *bb, float ray_start[3], float ray_normal[3]);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index c4284d2cf0a..c66e49f2906 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -254,8 +254,8 @@ void psys_render_restore(struct Object *ob, struct ParticleSystem *psys);
int psys_render_simplify_distribution(struct ParticleThreadContext *ctx, int tot);
int psys_render_simplify_params(struct ParticleSystem *psys, struct ChildParticle *cpa, float *params);
-void psys_interpolate_uvs(struct MTFace *tface, int quad, float *uv, float *uvco);
-void psys_interpolate_mcol(struct MCol *mcol, int quad, float *uv, struct MCol *mc);
+void psys_interpolate_uvs(const struct MTFace *tface, int quad, const float w[4], float uvco[2]);
+void psys_interpolate_mcol(const struct MCol *mcol, int quad, const float w[4], struct MCol *mc);
void copy_particle_key(struct ParticleKey *to, struct ParticleKey *from, int time);
@@ -335,12 +335,12 @@ void psys_get_from_key(struct ParticleKey *key, float *loc, float *vel, float *r
/* BLI_bvhtree_ray_cast callback */
void BKE_psys_collision_neartest_cb(void *userdata, int index, const struct BVHTreeRay *ray, struct BVHTreeRayHit *hit);
-void psys_particle_on_dm(struct DerivedMesh *dm, int from, int index, int index_dmcache, float *fw, float foffset, float *vec, float *nor, float *utan, float *vtan, float *orco, float *ornor);
+void psys_particle_on_dm(struct DerivedMesh *dm, int from, int index, int index_dmcache, const float fw[4], float foffset, float vec[3], float nor[3], float utan[3], float vtan[3], float orco[3], float ornor[3]);
/* particle_system.c */
void initialize_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, int p);
void psys_calc_dmcache(struct Object *ob, struct DerivedMesh *dm, struct ParticleSystem *psys);
-int psys_particle_dm_face_lookup(struct Object *ob, struct DerivedMesh *dm, int index, float *fw, struct LinkNode *node);
+int psys_particle_dm_face_lookup(struct Object *ob, struct DerivedMesh *dm, int index, const float fw[4], struct LinkNode *node);
void reset_particle(struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra);
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h
index a6bd90c4fd2..ad394f9fb1a 100644
--- a/source/blender/blenkernel/BKE_scene.h
+++ b/source/blender/blenkernel/BKE_scene.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 7a03abb0c27..b981cb372a1 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -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;
}
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 944f7c6a0b6..5fb03b7bbd0 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index f19ed859064..50f305e4400 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -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*/
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 3ae81c70d4f..c9868bd900f 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -162,7 +162,7 @@ static int rule_goal_avoid(BoidRule *rule, BoidBrainData *bbd, BoidValues *val,
negate_v3_v3(efd.vec_to_point, bpa->gravity);
}
- VECCOPY(bbd->wanted_co, efd.vec_to_point);
+ copy_v3_v3(bbd->wanted_co, efd.vec_to_point);
mul_v3_fl(bbd->wanted_co, mul);
bbd->wanted_speed = val->max_speed * priority;
@@ -204,7 +204,7 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
BVHTreeRayHit hit;
float radius = val->personal_space * pa->size, ray_dir[3];
- VECCOPY(col.co1, pa->prev_state.co);
+ copy_v3_v3(col.co1, pa->prev_state.co);
add_v3_v3v3(col.co2, pa->prev_state.co, pa->prev_state.vel);
sub_v3_v3v3(ray_dir, col.co2, col.co1);
mul_v3_fl(ray_dir, acbr->look_ahead);
@@ -254,10 +254,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
{
neighbors = BLI_kdtree_range_search(bbd->sim->psys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
if(neighbors > 1) for(n=1; n<neighbors; n++) {
- VECCOPY(co1, pa->prev_state.co);
- VECCOPY(vel1, pa->prev_state.vel);
- VECCOPY(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co);
- VECCOPY(vel2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.vel);
+ copy_v3_v3(co1, pa->prev_state.co);
+ copy_v3_v3(vel1, pa->prev_state.vel);
+ copy_v3_v3(co2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.co);
+ copy_v3_v3(vel2, (bbd->sim->psys->particles + ptn[n].index)->prev_state.vel);
sub_v3_v3v3(loc, co1, co2);
@@ -270,8 +270,8 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
t = -dot_v3v3(loc, vec)/inp;
/* cpa is not too far in the future so investigate further */
if(t > 0.0f && t < t_min) {
- VECADDFAC(co1, co1, vel1, t);
- VECADDFAC(co2, co2, vel2, t);
+ madd_v3_v3fl(co1, vel1, t);
+ madd_v3_v3fl(co2, vel2, t);
sub_v3_v3v3(vec, co2, co1);
@@ -300,10 +300,10 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
if(epsys) {
neighbors = BLI_kdtree_range_search(epsys->tree, acbr->look_ahead * len_v3(pa->prev_state.vel), pa->prev_state.co, pa->prev_state.ave, &ptn);
if(neighbors > 0) for(n=0; n<neighbors; n++) {
- VECCOPY(co1, pa->prev_state.co);
- VECCOPY(vel1, pa->prev_state.vel);
- VECCOPY(co2, (epsys->particles + ptn[n].index)->prev_state.co);
- VECCOPY(vel2, (epsys->particles + ptn[n].index)->prev_state.vel);
+ copy_v3_v3(co1, pa->prev_state.co);
+ copy_v3_v3(vel1, pa->prev_state.vel);
+ copy_v3_v3(co2, (epsys->particles + ptn[n].index)->prev_state.co);
+ copy_v3_v3(vel2, (epsys->particles + ptn[n].index)->prev_state.vel);
sub_v3_v3v3(loc, co1, co2);
@@ -316,8 +316,8 @@ static int rule_avoid_collision(BoidRule *rule, BoidBrainData *bbd, BoidValues *
t = -dot_v3v3(loc, vec)/inp;
/* cpa is not too far in the future so investigate further */
if(t > 0.0f && t < t_min) {
- VECADDFAC(co1, co1, vel1, t);
- VECADDFAC(co2, co2, vel2, t);
+ madd_v3_v3fl(co1, vel1, t);
+ madd_v3_v3fl(co2, vel2, t);
sub_v3_v3v3(vec, co2, co1);
@@ -439,7 +439,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
len = len_v3(loc);
/* too close to leader */
if(len < 2.0f * val->personal_space * pa->size) {
- VECCOPY(bbd->wanted_co, loc);
+ copy_v3_v3(bbd->wanted_co, loc);
bbd->wanted_speed = val->max_speed;
return 1;
}
@@ -449,7 +449,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
/* possible blocking of leader in near future */
if(t > 0.0f && t < 3.0f) {
- VECCOPY(vec2, vec);
+ copy_v3_v3(vec2, vec);
mul_v3_fl(vec2, t);
sub_v3_v3v3(vec2, loc, vec2);
@@ -457,7 +457,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
len = len_v3(vec2);
if(len < 2.0f * val->personal_space * pa->size) {
- VECCOPY(bbd->wanted_co, vec2);
+ copy_v3_v3(bbd->wanted_co, vec2);
bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f;
return 1;
}
@@ -466,17 +466,17 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
/* not blocking so try to follow leader */
if(p && flbr->options & BRULE_LEADER_IN_LINE) {
- VECCOPY(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
- VECCOPY(loc, bbd->sim->psys->particles[p-1].prev_state.co);
+ copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
+ copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co);
}
else {
- VECCOPY(loc, flbr->oloc);
+ copy_v3_v3(loc, flbr->oloc);
sub_v3_v3v3(vec, flbr->loc, flbr->oloc);
mul_v3_fl(vec, 1.0f/bbd->timestep);
}
/* fac is seconds behind leader */
- VECADDFAC(loc, loc, vec, -flbr->distance);
+ madd_v3_v3fl(loc, vec, -flbr->distance);
sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co);
bbd->wanted_speed = len_v3(bbd->wanted_co);
@@ -488,7 +488,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
/* first check we're not blocking any leaders */
for(i = 0; i< bbd->sim->psys->totpart; i+=n){
- VECCOPY(vec, bbd->sim->psys->particles[i].prev_state.vel);
+ copy_v3_v3(vec, bbd->sim->psys->particles[i].prev_state.vel);
sub_v3_v3v3(loc, pa->prev_state.co, bbd->sim->psys->particles[i].prev_state.co);
@@ -499,7 +499,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
len = len_v3(loc);
/* too close to leader */
if(len < 2.0f * val->personal_space * pa->size) {
- VECCOPY(bbd->wanted_co, loc);
+ copy_v3_v3(bbd->wanted_co, loc);
bbd->wanted_speed = val->max_speed;
return 1;
}
@@ -509,7 +509,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
/* possible blocking of leader in near future */
if(t > 0.0f && t < t_min) {
- VECCOPY(vec2, vec);
+ copy_v3_v3(vec2, vec);
mul_v3_fl(vec2, t);
sub_v3_v3v3(vec2, loc, vec2);
@@ -518,7 +518,7 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
if(len < 2.0f * val->personal_space * pa->size) {
t_min = t;
- VECCOPY(bbd->wanted_co, loc);
+ copy_v3_v3(bbd->wanted_co, loc);
bbd->wanted_speed = val->max_speed * (3.0f - t)/3.0f;
ret = 1;
}
@@ -530,16 +530,16 @@ static int rule_follow_leader(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
/* not blocking so try to follow leader */
if(flbr->options & BRULE_LEADER_IN_LINE) {
- VECCOPY(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
- VECCOPY(loc, bbd->sim->psys->particles[p-1].prev_state.co);
+ copy_v3_v3(vec, bbd->sim->psys->particles[p-1].prev_state.vel);
+ copy_v3_v3(loc, bbd->sim->psys->particles[p-1].prev_state.co);
}
else {
- VECCOPY(vec, bbd->sim->psys->particles[p - p%n].prev_state.vel);
- VECCOPY(loc, bbd->sim->psys->particles[p - p%n].prev_state.co);
+ copy_v3_v3(vec, bbd->sim->psys->particles[p - p%n].prev_state.vel);
+ copy_v3_v3(loc, bbd->sim->psys->particles[p - p%n].prev_state.co);
}
/* fac is seconds behind leader */
- VECADDFAC(loc, loc, vec, -flbr->distance);
+ madd_v3_v3fl(loc, vec, -flbr->distance);
sub_v3_v3v3(bbd->wanted_co, loc, pa->prev_state.co);
bbd->wanted_speed = len_v3(bbd->wanted_co);
@@ -563,11 +563,11 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
normalize_v3(bpa->wander);
- VECCOPY(vec, bpa->wander);
+ copy_v3_v3(vec, bpa->wander);
mul_qt_v3(pa->prev_state.rot, vec);
- VECCOPY(bbd->wanted_co, pa->prev_state.ave);
+ copy_v3_v3(bbd->wanted_co, pa->prev_state.ave);
mul_v3_fl(bbd->wanted_co, 1.1f);
@@ -581,7 +581,7 @@ static int rule_average_speed(BoidRule *rule, BoidBrainData *bbd, BoidValues *va
}
}
else {
- VECCOPY(bbd->wanted_co, pa->prev_state.ave);
+ copy_v3_v3(bbd->wanted_co, pa->prev_state.ave);
/* may happen at birth */
if(dot_v2v2(bbd->wanted_co,bbd->wanted_co)==0.0f) {
@@ -643,7 +643,7 @@ static int rule_fight(BoidRule *rule, BoidBrainData *bbd, BoidValues *val, Parti
health += bpa->data.health;
if(n==0 && pt->mode==PTARGET_MODE_ENEMY && ptn[n].dist < closest_dist) {
- VECCOPY(closest_enemy, ptn[n].co);
+ copy_v3_v3(closest_enemy, ptn[n].co);
closest_dist = ptn[n].dist;
enemy_pa = epars + ptn[n].index;
}
@@ -741,7 +741,7 @@ static void set_boid_values(BoidValues *val, BoidSettings *boids, ParticleData *
}
}
-static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *ground_co, float *ground_nor)
+static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float ground_co[3], float ground_nor[3])
{
BoidParticle *bpa = pa->boid;
@@ -820,7 +820,7 @@ static Object *boid_find_ground(BoidBrainData *bbd, ParticleData *pa, float *gro
}
/* default to z=0 */
- VECCOPY(ground_co, pa->state.co);
+ copy_v3_v3(ground_co, pa->state.co);
ground_co[2] = 0;
ground_nor[0] = ground_nor[1] = 0.0f;
ground_nor[2] = 1.0f;
@@ -853,8 +853,8 @@ void boids_precalc_rules(ParticleSettings *part, float cfra)
if(flbr->ob && flbr->cfra != cfra) {
/* save object locations for velocity calculations */
- VECCOPY(flbr->oloc, flbr->loc);
- VECCOPY(flbr->loc, flbr->ob->obmat[3]);
+ copy_v3_v3(flbr->oloc, flbr->loc);
+ copy_v3_v3(flbr->loc, flbr->ob->obmat[3]);
flbr->cfra = cfra;
}
}
@@ -868,7 +868,7 @@ static void boid_climb(BoidSettings *boids, ParticleData *pa, float *surface_co,
copy_v3_v3(nor, surface_nor);
/* gather apparent gravity */
- VECADDFAC(bpa->gravity, bpa->gravity, surface_nor, -1.0f);
+ madd_v3_v3fl(bpa->gravity, surface_nor, -1.0f);
normalize_v3(bpa->gravity);
/* raise boid it's size from surface */
@@ -997,7 +997,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
wanted_speed /= (float)n;
}
- VECCOPY(bbd->wanted_co, wanted_co);
+ copy_v3_v3(bbd->wanted_co, wanted_co);
bbd->wanted_speed = wanted_speed;
break;
}
@@ -1012,10 +1012,10 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
if(boids->options & BOID_ALLOW_FLIGHT && bbd->wanted_co[2] > 0.0f) {
float cvel[3], dir[3];
- VECCOPY(dir, pa->prev_state.ave);
+ copy_v3_v3(dir, pa->prev_state.ave);
normalize_v2(dir);
- VECCOPY(cvel, bbd->wanted_co);
+ copy_v3_v3(cvel, bbd->wanted_co);
normalize_v2(cvel);
if(dot_v2v2(cvel, dir) > 0.95f / mul)
@@ -1031,10 +1031,10 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
float z_v, ground_v, cur_v;
float len;
- VECCOPY(dir, pa->prev_state.ave);
+ copy_v3_v3(dir, pa->prev_state.ave);
normalize_v2(dir);
- VECCOPY(cvel, bbd->wanted_co);
+ copy_v3_v3(cvel, bbd->wanted_co);
normalize_v2(cvel);
len = len_v2(pa->prev_state.vel);
@@ -1054,7 +1054,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
len = MIN2(len, val.jump_speed);
- VECCOPY(jump_v, dir);
+ copy_v3_v3(jump_v, dir);
jump_v[2] = z_v;
mul_v3_fl(jump_v, ground_v);
@@ -1071,7 +1071,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
}
if(jump) {
- VECCOPY(pa->prev_state.vel, jump_v);
+ copy_v3_v3(pa->prev_state.vel, jump_v);
bpa->data.mode = eBoidMode_Falling;
}
}
@@ -1143,12 +1143,12 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
}
}
- VECCOPY(old_dir, pa->prev_state.ave);
+ copy_v3_v3(old_dir, pa->prev_state.ave);
new_speed = normalize_v3_v3(wanted_dir, bbd->wanted_co);
/* first check if we have valid direction we want to go towards */
if(new_speed == 0.0f) {
- VECCOPY(new_dir, old_dir);
+ copy_v3_v3(new_dir, old_dir);
}
else {
float old_dir2[2], wanted_dir2[2], nor[3], angle;
@@ -1172,13 +1172,13 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
cross_v3_v3v3(nor, old_dir, wanted_dir);
axis_angle_to_quat( q,nor, angle);
- VECCOPY(new_dir, old_dir);
+ copy_v3_v3(new_dir, old_dir);
mul_qt_v3(q, new_dir);
normalize_v3(new_dir);
/* save direction in case resulting velocity too small */
axis_angle_to_quat( q,nor, angle*dtime);
- VECCOPY(pa->state.ave, old_dir);
+ copy_v3_v3(pa->state.ave, old_dir);
mul_qt_v3(q, pa->state.ave);
normalize_v3(pa->state.ave);
}
@@ -1192,7 +1192,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
new_speed = MIN2(bbd->wanted_speed, old_speed + val.max_acc);
/* combine direction and speed */
- VECCOPY(new_vel, new_dir);
+ copy_v3_v3(new_vel, new_dir);
mul_v3_fl(new_vel, new_speed);
/* maintain minimum flying velocity if not landing */
@@ -1236,7 +1236,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
add_v3_v3(acc, force);
/* store smoothed acceleration for nice banking etc. */
- VECADDFAC(bpa->data.acc, bpa->data.acc, acc, dtime);
+ madd_v3_v3fl(bpa->data.acc, acc, dtime);
mul_v3_fl(bpa->data.acc, 1.0f / (1.0f + dtime));
/* integrate new location & velocity */
@@ -1245,15 +1245,15 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* can get better control allthough it's a bit unphysical */
mul_v3_fl(acc, 1.0f/pa_mass);
- VECCOPY(dvec, acc);
+ copy_v3_v3(dvec, acc);
mul_v3_fl(dvec, dtime*dtime*0.5f);
- VECCOPY(bvec, pa->prev_state.vel);
+ copy_v3_v3(bvec, pa->prev_state.vel);
mul_v3_fl(bvec, dtime);
add_v3_v3(dvec, bvec);
add_v3_v3(pa->state.co, dvec);
- VECADDFAC(pa->state.vel, pa->state.vel, acc, dtime);
+ madd_v3_v3fl(pa->state.vel, acc, dtime);
//if(bpa->data.mode != eBoidMode_InAir)
bpa->ground = boid_find_ground(bbd, pa, ground_co, ground_nor);
@@ -1274,11 +1274,11 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
sub_v3_v3v3(dvec, bpa->data.acc, dvec);
}
else {
- VECCOPY(dvec, bpa->data.acc);
+ copy_v3_v3(dvec, bpa->data.acc);
}
/* gather apparent gravity */
- VECADDFAC(bpa->gravity, grav, dvec, -boids->banking);
+ madd_v3_v3v3fl(bpa->gravity, grav, dvec, -boids->banking);
normalize_v3(bpa->gravity);
/* stick boid on goal when close enough */
@@ -1313,7 +1313,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* gather apparent gravity */
- VECADDFAC(bpa->gravity, bpa->gravity, grav, dtime);
+ madd_v3_v3fl(bpa->gravity, grav, dtime);
normalize_v3(bpa->gravity);
if(boids->options & BOID_ALLOW_LAND) {
@@ -1345,7 +1345,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
//copy_v3_v3(nor, ground_nor);
///* gather apparent gravity to r_ve */
- //VECADDFAC(pa->r_ve, pa->r_ve, ground_nor, -1.0);
+ //madd_v3_v3fl(pa->r_ve, ground_nor, -1.0);
//normalize_v3(pa->r_ve);
///* raise boid it's size from surface */
@@ -1385,12 +1385,12 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
sub_v3_v3v3(dvec, bpa->data.acc, dvec);
/* gather apparent gravity */
- VECADDFAC(bpa->gravity, grav, dvec, -boids->banking);
+ madd_v3_v3v3fl(bpa->gravity, grav, dvec, -boids->banking);
normalize_v3(bpa->gravity);
}
else {
/* gather negative surface normal */
- VECADDFAC(bpa->gravity, bpa->gravity, ground_nor, -1.0f);
+ madd_v3_v3fl(bpa->gravity, ground_nor, -1.0f);
normalize_v3(bpa->gravity);
}
break;
@@ -1411,7 +1411,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
/* calculate rotation matrix based on forward & down vectors */
if(bpa->data.mode == eBoidMode_InAir) {
- VECCOPY(mat[0], pa->state.ave);
+ copy_v3_v3(mat[0], pa->state.ave);
project_v3_v3v3(dvec, bpa->gravity, pa->state.ave);
sub_v3_v3v3(mat[2], bpa->gravity, dvec);
@@ -1422,7 +1422,7 @@ void boid_body(BoidBrainData *bbd, ParticleData *pa)
sub_v3_v3v3(mat[0], pa->state.ave, dvec);
normalize_v3(mat[0]);
- VECCOPY(mat[2], bpa->gravity);
+ copy_v3_v3(mat[2], bpa->gravity);
}
negate_v3(mat[2]);
cross_v3_v3v3(mat[1], mat[2], mat[0]);
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index e78b89441c9..09021e71025 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c
index f5113b3ef58..c448407e05b 100644
--- a/source/blender/blenkernel/intern/bvhutils.c
+++ b/source/blender/blenkernel/intern/bvhutils.c
@@ -48,27 +48,27 @@
/* 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);
}
diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c
index eeec82c3beb..145eb9363e9 100644
--- a/source/blender/blenkernel/intern/camera.c
+++ b/source/blender/blenkernel/intern/camera.c
@@ -68,7 +68,7 @@ Camera *copy_camera(Camera *cam)
{
Camera *camn;
- camn= copy_libblock(cam);
+ camn= copy_libblock(&cam->id);
return camn;
}
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index bdc1cda06e3..1ce19ed315b 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -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])
diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c
index 00a31fb77a7..78f803be0d3 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -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++;
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 98a434a7d8b..2f568aa01eb 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -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];
diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c
index 6a5f4128724..3f441361b0a 100644
--- a/source/blender/blenkernel/intern/curve.c
+++ b/source/blender/blenkernel/intern/curve.c
@@ -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));
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 6603e67a306..8810dae9d70 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -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;
}
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c
index a3d48c188d8..99a609f7ce2 100644
--- a/source/blender/blenkernel/intern/effect.c
+++ b/source/blender/blenkernel/intern/effect.c
@@ -555,7 +555,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
if(falloff == 0.0f)
break;
- VECADDFAC(temp, efd->vec_to_point, efd->nor, -fac);
+ madd_v3_v3v3fl(temp, efd->vec_to_point, efd->nor, -fac);
r_fac= len_v3(temp);
falloff*= falloff_func_rad(eff->pd, r_fac);
break;
@@ -573,7 +573,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *UNU
return falloff;
}
-int closest_point_on_surface(SurfaceModifierData *surmd, float *co, float *surface_co, float *surface_nor, float *surface_vel)
+int closest_point_on_surface(SurfaceModifierData *surmd, const float co[3], float surface_co[3], float surface_nor[3], float surface_vel[3])
{
BVHTreeNearest nearest;
@@ -797,7 +797,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
if(eff->pd->flag & PFIELD_TEX_2D) {
float fac=-dot_v3v3(tex_co, efd->nor);
- VECADDFAC(tex_co, tex_co, efd->nor, fac);
+ madd_v3_v3fl(tex_co, efd->nor, fac);
}
if(eff->pd->flag & PFIELD_TEX_OBJECT) {
@@ -848,7 +848,7 @@ static void do_texture_effector(EffectorCache *eff, EffectorData *efd, EffectedP
if(eff->pd->flag & PFIELD_TEX_2D){
float fac = -dot_v3v3(force, efd->nor);
- VECADDFAC(force, force, efd->nor, fac);
+ madd_v3_v3fl(force, efd->nor, fac);
}
add_v3_v3(total_force, force);
@@ -897,7 +897,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
cross_v3_v3v3(force, efd->nor2, temp);
mul_v3_fl(force, strength * efd->falloff);
- VECADDFAC(temp, temp, point->vel, -point->vel_to_sec);
+ madd_v3_v3fl(temp, point->vel, -point->vel_to_sec);
add_v3_v3(force, temp);
}
break;
@@ -940,7 +940,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
copy_v3_v3(temp, point->loc);
}
else {
- VECADD(temp, efd->vec_to_point2, efd->nor2);
+ add_v3_v3v3(temp, efd->vec_to_point2, efd->nor2);
}
force[0] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[0], temp[1], temp[2], 2,0,2);
force[1] = -1.0f + 2.0f * BLI_gTurbulence(pd->f_size, temp[1], temp[2], temp[0], 2,0,2);
@@ -959,10 +959,10 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
}
if(pd->flag & PFIELD_DO_LOCATION) {
- VECADDFAC(total_force, total_force, force, 1.0f/point->vel_to_sec);
+ madd_v3_v3fl(total_force, force, 1.0f/point->vel_to_sec);
if(ELEM(pd->forcefield, PFIELD_HARMONIC, PFIELD_DRAG)==0 && pd->f_flow != 0.0f) {
- VECADDFAC(total_force, total_force, point->vel, -pd->f_flow * efd->falloff);
+ madd_v3_v3fl(total_force, point->vel, -pd->f_flow * efd->falloff);
}
}
@@ -972,7 +972,7 @@ static void do_physical_effector(EffectorCache *eff, EffectorData *efd, Effected
mul_qt_v3(point->rot, xvec);
cross_v3_v3v3(dave, xvec, force);
if(pd->f_flow != 0.0f) {
- VECADDFAC(dave, dave, point->ave, -pd->f_flow * efd->falloff);
+ madd_v3_v3fl(dave, point->ave, -pd->f_flow * efd->falloff);
}
add_v3_v3(point->ave, dave);
}
@@ -1038,14 +1038,14 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we
// for softbody backward compatibility
if(point->flag & PE_WIND_AS_SPEED && impulse){
- VECSUB(temp2, force, temp1);
- VECSUB(impulse, impulse, temp2);
+ sub_v3_v3v3(temp2, force, temp1);
+ sub_v3_v3v3(impulse, impulse, temp2);
}
}
}
else if(eff->flag & PE_VELOCITY_TO_IMPULSE && impulse) {
/* special case for harmonic effector */
- VECADD(impulse, impulse, efd.vel);
+ add_v3_v3v3(impulse, impulse, efd.vel);
}
}
}
diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c
index 42ddd63f072..587fe75031f 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -92,7 +92,7 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
*numVertices = totvert;
verts = MEM_callocN( totvert*3*sizeof(float), "elbeemmesh_vertices");
for(i=0; i<totvert; i++) {
- VECCOPY( &verts[i*3], mvert[i].co);
+ copy_v3_v3(&verts[i*3], mvert[i].co);
if(useGlobalCoords) { mul_m4_v3(ob->obmat, &verts[i*3]); }
}
*vertices = verts;
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index cdc90cbb788..94868ffee87 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/lamp.c b/source/blender/blenkernel/intern/lamp.c
index 974aa660e9f..4edd032dc04 100644
--- a/source/blender/blenkernel/intern/lamp.c
+++ b/source/blender/blenkernel/intern/lamp.c
@@ -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++) {
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index cef23ac3824..7c9e2be4493 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 4259e11d340..64ab27ae47e 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -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));
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 7be3514e0f2..48c6d6b2a19 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 327306b32ee..5c82acde99b 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c
index ea6fd3843dc..3aa35bed4e3 100644
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@ -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++) {
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 8f609291351..a9b2ffe7529 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 483eebb3dcb..43f199904d5 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -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];
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index d6c0638ba62..6de1c12287c 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -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) {
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 306e897fbc8..00abc331f0b 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -454,7 +454,7 @@ static void distribute_grid(DerivedMesh *dm, ParticleSystem *psys)
max[2]=MAX2(max[2],mv->co[2]);
}
- VECSUB(delta,max,min);
+ sub_v3_v3v3(delta, max, min);
/* determine major axis */
axis = (delta[0]>=delta[1]) ? 0 : ((delta[1]>=delta[2]) ? 1 : 2);
@@ -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);
}
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 7a8162391d5..9deaa19429f 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -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);
}
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 2f24b7e735d..14dfe015894 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -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;
}
diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c
index 5d47b127096..fb8bb791f32 100644
--- a/source/blender/blenkernel/intern/shrinkwrap.c
+++ b/source/blender/blenkernel/intern/shrinkwrap.c
@@ -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
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 0ddebb8d0e6..038e48f5769 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -172,7 +172,7 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
{
float tmp[3];
- VECCOPY(tmp, verts[i].co);
+ copy_v3_v3(tmp, verts[i].co);
mul_m4_v3(ob->obmat, tmp);
// min BB
@@ -186,11 +186,11 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
max[2] = MAX2(max[2], tmp[2]);
}
- VECCOPY(smd->domain->p0, min);
- VECCOPY(smd->domain->p1, max);
+ copy_v3_v3(smd->domain->p0, min);
+ copy_v3_v3(smd->domain->p1, max);
// calc other res with max_res provided
- VECSUB(size, max, min);
+ sub_v3_v3v3(size, max, min);
// printf("size: %f, %f, %f\n", size[0], size[1], size[2]);
@@ -354,9 +354,9 @@ static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs)
for(i = 0; i < dm->getNumVerts(dm); i++)
{
float tmpvec[3];
- VECCOPY(tmpvec, mvert[i].co);
+ copy_v3_v3(tmpvec, mvert[i].co);
mul_m4_v3(ob->obmat, tmpvec);
- VECCOPY(&scs->points[i * 3], tmpvec);
+ copy_v3_v3(&scs->points[i * 3], tmpvec);
}
for(i = 0, facecounter = 0; i < dm->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)
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 28925a7b170..5b02731050e 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/speaker.c b/source/blender/blenkernel/intern/speaker.c
index 018c7a197ff..a14233e9179 100644
--- a/source/blender/blenkernel/intern/speaker.c
+++ b/source/blender/blenkernel/intern/speaker.c
@@ -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++;
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index ee849b4fd8d..663107290af 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -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])
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 955127a8000..e8be0bb2608 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -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) {
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index d3bd7d7b766..377eeef117e 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -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 */
diff --git a/source/blender/blenkernel/intern/world.c b/source/blender/blenkernel/intern/world.c
index c7d2763774d..1d6972b9d61 100644
--- a/source/blender/blenkernel/intern/world.c
+++ b/source/blender/blenkernel/intern/world.c
@@ -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++) {
diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h
index 4daa27a5c72..8ead7bf5f17 100644
--- a/source/blender/blenlib/BLI_kdopbvh.h
+++ b/source/blender/blenlib/BLI_kdopbvh.h
@@ -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
}
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 0c72db0742c..cb15c6a597c 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -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 ********************************/
diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c
index d1734151b4a..f01777bdce1 100644
--- a/source/blender/blenlib/intern/BLI_kdopbvh.c
+++ b/source/blender/blenlib/intern/BLI_kdopbvh.c
@@ -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];
diff --git a/source/blender/blenlib/intern/graph.c b/source/blender/blenlib/intern/graph.c
index 6dd278ed777..d0d3d0e137e 100644
--- a/source/blender/blenlib/intern/graph.c
+++ b/source/blender/blenlib/intern/graph.c
@@ -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;
diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c
index 5550a0e6b90..f6ba4ec43ad 100644
--- a/source/blender/blenlib/intern/math_vector_inline.c
+++ b/source/blender/blenlib/intern/math_vector_inline.c
@@ -78,6 +78,28 @@ MINLINE void copy_v4_v4(float r[4], const float a[4])
}
/* 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])
{
r[0]= a[0];
@@ -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]);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 9e6344573bb..506e931cecf 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -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);
}
}
}
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp
index b115a96cfa1..7bd70e9f289 100644
--- a/source/blender/collada/AnimationExporter.cpp
+++ b/source/blender/collada/AnimationExporter.cpp
@@ -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);
diff --git a/source/blender/collada/AnimationExporter.h b/source/blender/collada/AnimationExporter.h
index 7f6c99b108f..c3a5c7a5383 100644
--- a/source/blender/collada/AnimationExporter.h
+++ b/source/blender/collada/AnimationExporter.h
@@ -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
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index e8af5a8f290..f0f3b8f4123 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -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 */
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 6f1da5757c6..b1651886620 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -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;
@@ -412,12 +412,12 @@ static void RIG_appendEdgeToArc(RigArc *arc, RigEdge *edge)
if (edge->prev == NULL)
{
- VECCOPY(edge->head, arc->head->p);
+ copy_v3_v3(edge->head, arc->head->p);
}
else
{
RigEdge *last_edge = edge->prev;
- VECCOPY(edge->head, last_edge->tail);
+ copy_v3_v3(edge->head, last_edge->tail);
RIG_calculateEdgeAngles(last_edge, edge);
}
@@ -434,7 +434,7 @@ static void RIG_addEdgeToArc(RigArc *arc, float tail[3], EditBone *bone)
edge = MEM_callocN(sizeof(RigEdge), "rig edge");
- VECCOPY(edge->tail, tail);
+ copy_v3_v3(edge->tail, tail);
edge->bone = bone;
if (bone)
@@ -489,10 +489,10 @@ static RigControl *cloneControl(RigGraph *rg, RigGraph *src_rg, RigControl *src_
ctrl = newRigControl(rg);
- VECCOPY(ctrl->head, src_ctrl->head);
- VECCOPY(ctrl->tail, src_ctrl->tail);
- VECCOPY(ctrl->up_axis, src_ctrl->up_axis);
- VECCOPY(ctrl->offset, src_ctrl->offset);
+ copy_v3_v3(ctrl->head, src_ctrl->head);
+ copy_v3_v3(ctrl->tail, src_ctrl->tail);
+ copy_v3_v3(ctrl->up_axis, src_ctrl->up_axis);
+ copy_v3_v3(ctrl->offset, src_ctrl->offset);
ctrl->tail_mode = src_ctrl->tail_mode;
ctrl->flag = src_ctrl->flag;
@@ -531,9 +531,9 @@ static RigArc *cloneArc(RigGraph *rg, RigGraph *src_rg, RigArc *src_arc, GHash *
edge = MEM_callocN(sizeof(RigEdge), "rig edge");
- VECCOPY(edge->head, src_edge->head);
- VECCOPY(edge->tail, src_edge->tail);
- VECCOPY(edge->up_axis, src_edge->up_axis);
+ copy_v3_v3(edge->head, src_edge->head);
+ copy_v3_v3(edge->tail, src_edge->tail);
+ copy_v3_v3(edge->up_axis, src_edge->up_axis);
edge->length = src_edge->length;
edge->angle = src_edge->angle;
@@ -690,8 +690,8 @@ static void RIG_addControlBone(RigGraph *rg, EditBone *bone)
{
RigControl *ctrl = newRigControl(rg);
ctrl->bone = bone;
- VECCOPY(ctrl->head, bone->head);
- VECCOPY(ctrl->tail, bone->tail);
+ copy_v3_v3(ctrl->head, bone->head);
+ copy_v3_v3(ctrl->tail, bone->tail);
getEditBoneRollUpAxis(bone, bone->roll, ctrl->up_axis);
ctrl->tail_mode = TL_NONE;
@@ -765,7 +765,7 @@ static int RIG_parentControl(RigControl *ctrl, EditBone *link)
ctrl->link = link;
ctrl->flag = flag;
- VECCOPY(ctrl->offset, offset);
+ copy_v3_v3(ctrl->offset, offset);
return 1;
}
@@ -1146,7 +1146,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
- VECCOPY(arc->head->p, next_edge->head);
+ copy_v3_v3(arc->head->p, next_edge->head);
}
}
}
@@ -1222,7 +1222,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
BLI_remlink(&arc->edges, first_edge);
MEM_freeN(first_edge);
- VECCOPY(arc->head->p, next_edge->head);
+ copy_v3_v3(arc->head->p, next_edge->head);
/* remove null edge in other arcs too */
for (other_arc = rg->arcs.first; other_arc; other_arc = other_arc->next)
@@ -1284,7 +1284,7 @@ static void RIG_removeUneededOffsets(RigGraph *rg)
BLI_remlink(&arc->edges, last_edge);
MEM_freeN(last_edge);
- VECCOPY(arc->tail->p, previous_edge->tail);
+ copy_v3_v3(arc->tail->p, previous_edge->tail);
previous_edge->angle = 0;
}
}
@@ -1755,7 +1755,7 @@ static void finalizeControl(RigGraph *rigg, RigControl *ctrl, float resize)
sub_v3_v3v3(v1, ctrl->bone->tail, ctrl->bone->head);
sub_v3_v3v3(v2, tail_vec, ctrl->bone->head);
- VECCOPY(ctrl->bone->tail, tail_vec);
+ copy_v3_v3(ctrl->bone->tail, tail_vec);
rotation_between_vecs_to_quat(qtail, v1, v2);
mul_qt_qtqt(ctrl->qrot, qtail, ctrl->qrot);
@@ -1791,7 +1791,7 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f
{
float parent_offset[3], tail_offset[3];
- VECCOPY(parent_offset, ctrl->offset);
+ copy_v3_v3(parent_offset, ctrl->offset);
mul_v3_fl(parent_offset, resize);
mul_qt_v3(qrot, parent_offset);
@@ -1799,7 +1799,7 @@ static void repositionControl(RigGraph *rigg, RigControl *ctrl, float head[3], f
ctrl->flag |= RIG_CTRL_HEAD_DONE;
- QUATCOPY(ctrl->qrot, qrot);
+ copy_qt_qt(ctrl->qrot, qrot);
if (ctrl->tail_mode == TL_NONE)
{
@@ -1836,8 +1836,8 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec
rotation_between_vecs_to_quat(qrot, v1, v2);
- VECCOPY(bone->head, vec0);
- VECCOPY(bone->tail, vec1);
+ copy_v3_v3(bone->head, vec0);
+ copy_v3_v3(bone->tail, vec1);
if (!is_zero_v3(up_axis))
{
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index d228d4d3772..b97e843529a 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -624,7 +624,7 @@ static void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *ite
gluQuadricNormals(quad, GLU_SMOOTH);
iter->head(iter);
- VECCOPY(head, iter->p);
+ copy_v3_v3(head, iter->p);
index = next_subdividion(toolsettings, iter, bone_start, end, head, tail);
while (index != -1)
@@ -640,7 +640,7 @@ static void drawSubdividedStrokeBy(ToolSettings *toolsettings, BArcIterator *ite
glPopMatrix();
- VECCOPY(head, tail);
+ copy_v3_v3(head, tail);
bone_start = index; // start next bone from current index
index = next_subdividion(toolsettings, iter, bone_start, end, head, tail);
@@ -748,7 +748,7 @@ static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones,
if ((bone->flag & BONE_CONNECTED) == 0)
{
- VECCOPY(vec, bone->head);
+ copy_v3_v3(vec, bone->head);
mul_m4_v3(ob->obmat, vec);
project_short_noclip(ar, vec, pval);
@@ -758,13 +758,13 @@ static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones,
{
*dist = pdist;
pt = &boneSnap;
- VECCOPY(pt->p, vec);
+ copy_v3_v3(pt->p, vec);
pt->type = PT_EXACT;
}
}
- VECCOPY(vec, bone->tail);
+ copy_v3_v3(vec, bone->tail);
mul_m4_v3(ob->obmat, vec);
project_short_noclip(ar, vec, pval);
@@ -774,7 +774,7 @@ static SK_Point *sk_snapPointArmature(bContext *C, Object *ob, ListBase *ebones,
{
*dist = pdist;
pt = &boneSnap;
- VECCOPY(pt->p, vec);
+ copy_v3_v3(pt->p, vec);
pt->type = PT_EXACT;
}
}
@@ -1024,7 +1024,7 @@ static void sk_projectDrawPoint(bContext *C, float vec[3], SK_Stroke *stk, SK_Dr
if (last != NULL)
{
- VECCOPY(fp, last->p);
+ copy_v3_v3(fp, last->p);
}
initgrabz(ar->regiondata, fp[0], fp[1], fp[2]);
@@ -1134,12 +1134,12 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
}
else
{
- VECCOPY(vec, p1->p);
+ copy_v3_v3(vec, p1->p);
}
if (last_p == NULL)
{
- VECCOPY(p, vec);
+ copy_v3_v3(p, vec);
size = new_size;
dist = 0;
break;
@@ -1149,7 +1149,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
if (new_dist < dist)
{
- VECCOPY(p, vec);
+ copy_v3_v3(p, vec);
dist = new_dist;
size = new_size;
}
@@ -1161,7 +1161,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
pt->type = dd->type;
pt->mode = PT_SNAP;
pt->size = size / 2;
- VECCOPY(pt->p, p);
+ copy_v3_v3(pt->p, p);
point_added = 1;
}
@@ -1193,7 +1193,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
if (spt != NULL)
{
- VECCOPY(pt->p, spt->p);
+ copy_v3_v3(pt->p, spt->p);
point_added = 1;
}
}
@@ -1207,7 +1207,7 @@ static int sk_getStrokeSnapPoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, S
{
pt->type = dd->type;
pt->mode = PT_SNAP;
- VECCOPY(pt->p, vec);
+ copy_v3_v3(pt->p, vec);
point_added = 1;
}
@@ -1234,7 +1234,7 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk,
int total;
int i;
- VECCOPY(final_p, pt.p);
+ copy_v3_v3(final_p, pt.p);
sk_projectDrawPoint(C, pt.p, stk, dd);
sk_appendStrokePoint(stk, &pt);
@@ -1259,7 +1259,7 @@ static int sk_addStrokeSnapPoint(bContext *C, SK_Sketch *sketch, SK_Stroke *stk,
sk_interpolateDepth(C, stk, i + 1, stk->nb_points - 2, length, distance);
}
- VECCOPY(stk->points[stk->nb_points - 1].p, final_p);
+ copy_v3_v3(stk->points[stk->nb_points - 1].p, final_p);
point_added = 1;
}
@@ -1296,7 +1296,7 @@ static void sk_getStrokePoint(bContext *C, SK_Point *pt, SK_Sketch *sketch, SK_S
{
point_added = sk_getStrokeSnapPoint(C, pt, sketch, stk, dd);
LAST_SNAP_POINT_VALID = 1;
- VECCOPY(LAST_SNAP_POINT, pt->p);
+ copy_v3_v3(LAST_SNAP_POINT, pt->p);
}
else
{
@@ -1536,8 +1536,8 @@ static void sk_convertStroke(bContext *C, SK_Stroke *stk)
{
bone = ED_armature_edit_bone_add(arm, "Bone");
- VECCOPY(bone->head, head->p);
- VECCOPY(bone->tail, pt->p);
+ copy_v3_v3(bone->head, head->p);
+ copy_v3_v3(bone->tail, pt->p);
mul_m4_v3(invmat, bone->head);
mul_m4_v3(invmat, bone->tail);
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index 86720a9bbf4..ed37f2056ad 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1245,8 +1245,8 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
memset(&isec, 0, sizeof(isec));
isec.labda= 1e10f;
- VECADD(isec.start, co1, epsilon);
- VECADD(end, co2, epsilon);
+ add_v3_v3v3(isec.start, co1, epsilon);
+ add_v3_v3v3(end, co2, epsilon);
sub_v3_v3v3(isec.vec, end, isec.start);
if(meshdeform_intersect(mdb, &isec)) {
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index c010ce7fbf7..07f365b2294 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -816,7 +816,7 @@ static void calc_shapeKeys(Object *obedit)
if (oldbezt) {
int j;
for (j= 0; j < 3; ++j) {
- VECSUB(ofs[i], bezt->vec[j], oldbezt->vec[j]);
+ sub_v3_v3v3(ofs[i], bezt->vec[j], oldbezt->vec[j]);
i++;
}
ofs[i++][0]= bezt->alfa - oldbezt->alfa;
@@ -832,7 +832,7 @@ static void calc_shapeKeys(Object *obedit)
while(a--) {
oldbp= getKeyIndexOrig_bp(editnurb, bp);
if (oldbp) {
- VECSUB(ofs[i], bp->vec, oldbp->vec);
+ sub_v3_v3v3(ofs[i], bp->vec, oldbp->vec);
ofs[i+1][0]= bp->alfa - oldbp->alfa;
}
i += 2;
@@ -866,10 +866,10 @@ static void calc_shapeKeys(Object *obedit)
oldbezt= getKeyIndexOrig_bezt(editnurb, bezt);
for (j= 0; j < 3; ++j, ++i) {
- VECCOPY(fp, bezt->vec[j]);
+ copy_v3_v3(fp, bezt->vec[j]);
if (restore && oldbezt) {
- VECCOPY(bezt->vec[j], oldbezt->vec[j]);
+ copy_v3_v3(bezt->vec[j], oldbezt->vec[j]);
}
fp+= 3;
@@ -890,12 +890,12 @@ static void calc_shapeKeys(Object *obedit)
while(a--) {
oldbp= getKeyIndexOrig_bp(editnurb, bp);
- VECCOPY(fp, bp->vec);
+ copy_v3_v3(fp, bp->vec);
fp[3]= bp->alfa;
if(restore && oldbp) {
- VECCOPY(bp->vec, oldbp->vec);
+ copy_v3_v3(bp->vec, oldbp->vec);
bp->alfa= oldbp->alfa;
}
@@ -921,10 +921,10 @@ static void calc_shapeKeys(Object *obedit)
curofp= ofp + index;
for (j= 0; j < 3; ++j, ++i) {
- VECCOPY(fp, curofp);
+ copy_v3_v3(fp, curofp);
if(apply_offset) {
- VECADD(fp, fp, ofs[i]);
+ add_v3_v3(fp, ofs[i]);
}
fp+= 3; curofp+= 3;
@@ -933,7 +933,7 @@ static void calc_shapeKeys(Object *obedit)
if(apply_offset) {
/* apply alfa offsets */
- VECADD(fp, fp, ofs[i]);
+ add_v3_v3(fp, ofs[i]);
++i;
}
@@ -941,7 +941,7 @@ static void calc_shapeKeys(Object *obedit)
} else {
int j;
for (j= 0; j < 3; ++j, ++i) {
- VECCOPY(fp, bezt->vec[j]);
+ copy_v3_v3(fp, bezt->vec[j]);
fp+= 3;
}
fp[0]= bezt->alfa;
@@ -959,15 +959,15 @@ static void calc_shapeKeys(Object *obedit)
if (index >= 0) {
curofp= ofp + index;
- VECCOPY(fp, curofp);
+ copy_v3_v3(fp, curofp);
fp[3]= curofp[3];
if(apply_offset) {
- VECADD(fp, fp, ofs[i]);
+ add_v3_v3(fp, ofs[i]);
fp[3]+=ofs[i+1][0];
}
} else {
- VECCOPY(fp, bp->vec);
+ copy_v3_v3(fp, bp->vec);
fp[3]= bp->alfa;
}
@@ -2890,14 +2890,14 @@ static void subdividenurb(Object *obedit, int number_cuts)
interp_v3_v3v3(vec+12, vec+3, vec+6, factor);
/* change handle of prev beztn */
- VECCOPY((beztn-1)->vec[2], vec);
+ copy_v3_v3((beztn-1)->vec[2], vec);
/* new point */
- VECCOPY(beztn->vec[0], vec+9);
+ copy_v3_v3(beztn->vec[0], vec+9);
interp_v3_v3v3(beztn->vec[1], vec+9, vec+12, factor);
- VECCOPY(beztn->vec[2], vec+12);
+ copy_v3_v3(beztn->vec[2], vec+12);
/* handle of next bezt */
- if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {VECCOPY(beztnew->vec[0], vec+6);}
- else {VECCOPY(bezt->vec[0], vec+6);}
+ if(a==0 && i == number_cuts - 1 && (nu->flagu & CU_NURB_CYCLIC)) {copy_v3_v3(beztnew->vec[0], vec+6);}
+ else {copy_v3_v3(bezt->vec[0], vec+6);}
beztn->radius = (prevbezt->radius + bezt->radius)/2;
beztn->weight = (prevbezt->weight + bezt->weight)/2;
@@ -3381,7 +3381,7 @@ static int convertspline(short type, Nurb *nu)
a= nr;
bp= nu->bp;
while(a--) {
- VECCOPY(bezt->vec[1], bp->vec);
+ copy_v3_v3(bezt->vec[1], bp->vec);
bezt->f1=bezt->f2=bezt->f3= bp->f1;
bezt->h1= bezt->h2= HD_VECT;
bezt->weight= bp->weight;
@@ -3418,7 +3418,7 @@ static int convertspline(short type, Nurb *nu)
while(a--) {
if(type==CU_POLY && bezt->h1==HD_VECT && bezt->h2==HD_VECT) {
/* vector handle becomes 1 poly vertice */
- VECCOPY(bp->vec, bezt->vec[1]);
+ copy_v3_v3(bp->vec, bezt->vec[1]);
bp->vec[3]= 1.0;
bp->f1= bezt->f2;
nr-= 2;
@@ -3428,7 +3428,7 @@ static int convertspline(short type, Nurb *nu)
}
else {
for(c=0;c<3;c++) {
- VECCOPY(bp->vec, bezt->vec[c]);
+ copy_v3_v3(bp->vec, bezt->vec[c]);
bp->vec[3]= 1.0;
if(c==0) bp->f1= bezt->f1;
else if(c==1) bp->f1= bezt->f2;
@@ -3475,13 +3475,13 @@ static int convertspline(short type, Nurb *nu)
a= nr;
bp= nu->bp;
while(a--) {
- VECCOPY(bezt->vec[0], bp->vec);
+ copy_v3_v3(bezt->vec[0], bp->vec);
bezt->f1= bp->f1;
bp++;
- VECCOPY(bezt->vec[1], bp->vec);
+ copy_v3_v3(bezt->vec[1], bp->vec);
bezt->f2= bp->f1;
bp++;
- VECCOPY(bezt->vec[2], bp->vec);
+ copy_v3_v3(bezt->vec[2], bp->vec);
bezt->f3= bp->f1;
bezt->radius= bp->radius;
bezt->weight= bp->weight;
@@ -4472,7 +4472,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
ED_curve_beztcpy(editnurb, newbezt, nu->bezt, nu->pntsu);
*(newbezt+nu->pntsu)= *bezt;
- VECCOPY(temp, bezt->vec[1]);
+ copy_v3_v3(temp, bezt->vec[1]);
MEM_freeN(nu->bezt);
nu->bezt= newbezt;
newbezt+= nu->pntsu;
@@ -4491,7 +4491,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
BEZ_SEL(newbezt);
cu->lastsel= newbezt;
newbezt->h2= newbezt->h1;
- VECCOPY(temp, bezt->vec[1]);
+ copy_v3_v3(temp, bezt->vec[1]);
MEM_freeN(nu->bezt);
nu->bezt= newbezt;
bezt= newbezt+1;
@@ -4503,7 +4503,7 @@ static int addvert_Nurb(bContext *C, short mode, float location[3])
*newbezt= *bezt;
BEZ_SEL(newbezt);
newbezt->h2= newbezt->h1;
- VECCOPY(temp, bezt->vec[1]);
+ copy_v3_v3(temp, bezt->vec[1]);
newnu= (Nurb*)MEM_mallocN(sizeof(Nurb), "addvert_Nurb newnu");
memcpy(newnu, nu, sizeof(Nurb));
@@ -6189,7 +6189,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newob)
if(rv3d) {
copy_m4_m4(viewmat, rv3d->viewmat);
- VECCOPY(zvec, rv3d->viewinv[2]);
+ copy_v3_v3(zvec, rv3d->viewinv[2]);
}
setflagsNurb(editnurb, 0);
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index d481be94bcc..7b79384fbb4 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -555,8 +555,8 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
* - must clear transforms set on object, as those skew our results
*/
ob= add_object(scene, OB_CURVE);
- ob->loc[0]= ob->loc[1]= ob->loc[2]= 0;
- ob->rot[0]= ob->rot[1]= ob->rot[2]= 0;
+ zero_v3(ob->loc);
+ zero_v3(ob->rot);
cu= ob->data;
cu->flag |= CU_3D;
@@ -573,6 +573,9 @@ static void gp_layer_to_curve (bContext *C, bGPdata *gpd, bGPDlayer *gpl, short
case GP_STROKECONVERT_CURVE:
gp_stroke_to_bezier(C, gpl, gps, cu, subrect_ptr);
break;
+ default:
+ BLI_assert(!"invalid mode");
+ break;
}
}
}
@@ -602,17 +605,7 @@ static int gp_convert_layer_exec (bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- /* handle conversion modes */
- switch (mode) {
- case GP_STROKECONVERT_PATH:
- case GP_STROKECONVERT_CURVE:
- gp_layer_to_curve(C, gpd, gpl, mode);
- break;
-
- default: /* unsupoorted */
- BKE_report(op->reports, RPT_ERROR, "Unknown conversion option");
- return OPERATOR_CANCELLED;
- }
+ gp_layer_to_curve(C, gpd, gpl, mode);
/* notifiers */
WM_event_add_notifier(C, NC_OBJECT|NA_ADDED, NULL);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index ff3b69c2bf6..12f03f7341c 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -658,7 +658,7 @@ static void gp_stroke_newfrombuffer (tGPsdata *p)
found_depth= TRUE;
}
- VECCOPY2D(mval_prev, mval);
+ copy_v2_v2_int(mval_prev, mval);
}
if (found_depth == FALSE) {
diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h
index d1da9f308fb..3035aa44735 100644
--- a/source/blender/editors/include/ED_particle.h
+++ b/source/blender/editors/include/ED_particle.h
@@ -51,7 +51,7 @@ int PE_start_edit(struct PTCacheEdit *edit);
struct PTCacheEdit *PE_get_current(struct Scene *scene, struct Object *ob);
struct PTCacheEdit *PE_create_current(struct Scene *scene, struct Object *ob);
void PE_current_changed(struct Scene *scene, struct Object *ob);
-int PE_minmax(struct Scene *scene, float *min, float *max);
+int PE_minmax(struct Scene *scene, float min[3], float max[3]);
struct ParticleEditSettings *PE_settings(struct Scene *scene);
/* update calls */
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index dd75f506be8..e5092c82304 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1224,7 +1224,7 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
int a, tot;
if(but->editvec) {
- VECCOPY(vec, but->editvec);
+ copy_v3_v3(vec, but->editvec);
}
if(but->rnaprop) {
@@ -1248,7 +1248,7 @@ void ui_get_but_vectorf(uiBut *but, float vec[3])
}
else if(but->pointype == FLO) {
float *fp= (float *)but->poin;
- VECCOPY(vec, fp);
+ copy_v3_v3(vec, fp);
}
else {
if (but->editvec==NULL) {
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 0ba141163b3..c34c10bf1a7 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -944,7 +944,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
data->origstr= NULL;
data->value= data->origvalue;
data->origvalue= 0.0;
- VECCOPY(data->vec, data->origvec);
+ copy_v3_v3(data->vec, data->origvec);
data->origvec[0]= data->origvec[1]= data->origvec[2]= 0.0f;
}
else {
@@ -2121,7 +2121,7 @@ static void ui_blockopen_begin(bContext *C, uiBut *but, uiHandleButtonData *data
break;
case COL:
ui_get_but_vectorf(but, data->origvec);
- VECCOPY(data->vec, data->origvec);
+ copy_v3_v3(data->vec, data->origvec);
but->editvec= data->vec;
handlefunc= ui_block_func_COL;
@@ -5727,7 +5727,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
/* copy over return values from the closing menu */
if(menu->menuretval == UI_RETURN_OK || menu->menuretval == UI_RETURN_UPDATE) {
if(but->type == COL)
- VECCOPY(data->vec, menu->retvec)
+ copy_v3_v3(data->vec, menu->retvec);
else if(ELEM3(but->type, MENU, ICONROW, ICONTEXTROW))
data->value= menu->retvalue;
}
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 4791d2652dc..edbd5c5684e 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2126,7 +2126,7 @@ uiBlock *ui_block_func_COL(bContext *C, uiPopupBlockHandle *handle, void *arg_bu
uiBlockSetFlag(block, UI_BLOCK_MOVEMOUSE_QUIT);
- VECCOPY(handle->retvec, but->editvec);
+ copy_v3_v3(handle->retvec, but->editvec);
uiBlockPicker(block, handle->retvec, &but->rnapoin, but->rnaprop);
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index c5ac4f5aa88..878d1bc36a4 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1510,7 +1510,7 @@ static void widget_state(uiWidgetType *wt, int state)
wt->wcol= *(wt->wcol_theme);
if(state & UI_SELECT) {
- QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel)
+ copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
if(state & UI_BUT_ANIMATED_KEY)
widget_state_blend(wt->wcol.inner, wcol_state->inner_key_sel, wcol_state->blend);
@@ -1519,7 +1519,7 @@ static void widget_state(uiWidgetType *wt, int state)
else if(state & UI_BUT_DRIVEN)
widget_state_blend(wt->wcol.inner, wcol_state->inner_driven_sel, wcol_state->blend);
- VECCOPY(wt->wcol.text, wt->wcol.text_sel);
+ copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
if(state & UI_SELECT)
SWAP(short, wt->wcol.shadetop, wt->wcol.shadedown);
@@ -1604,7 +1604,7 @@ static void widget_state_option_menu(uiWidgetType *wt, int state)
else {
bTheme *btheme= U.themes.first; /* XXX */
- VECCOPY(wt->wcol.text, btheme->tui.wcol_menu_back.text);
+ copy_v3_v3_char(wt->wcol.text, btheme->tui.wcol_menu_back.text);
}
}
@@ -1619,11 +1619,11 @@ static void widget_state_pulldown(uiWidgetType *wt, int state)
{
wt->wcol= *(wt->wcol_theme);
- QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel);
- VECCOPY(wt->wcol.outline, wt->wcol.inner);
+ copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
+ copy_v3_v3_char(wt->wcol.outline, wt->wcol.inner);
if(state & UI_ACTIVE)
- VECCOPY(wt->wcol.text, wt->wcol.text_sel);
+ copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
}
/* special case, menu items */
@@ -1637,8 +1637,8 @@ static void widget_state_menu_item(uiWidgetType *wt, int state)
wt->wcol.text[2]= 0.5f*(wt->wcol.text[2]+wt->wcol.text_sel[2]);
}
else if(state & UI_ACTIVE) {
- QUATCOPY(wt->wcol.inner, wt->wcol.inner_sel);
- VECCOPY(wt->wcol.text, wt->wcol.text_sel);
+ copy_v4_v4_char(wt->wcol.inner, wt->wcol.inner_sel);
+ copy_v3_v3_char(wt->wcol.text, wt->wcol.text_sel);
}
}
@@ -1874,38 +1874,38 @@ void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha)
break;
case UI_GRAD_H:
hsv_to_rgb(0.0, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
- VECCOPY(col1[1], col1[0]);
- VECCOPY(col1[2], col1[0]);
- VECCOPY(col1[3], col1[0]);
+ copy_v3_v3(col1[1], col1[0]);
+ copy_v3_v3(col1[2], col1[0]);
+ copy_v3_v3(col1[3], col1[0]);
break;
case UI_GRAD_S:
hsv_to_rgb(1.0, 0.0, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
- VECCOPY(col1[0], col1[1]);
- VECCOPY(col1[2], col1[1]);
- VECCOPY(col1[3], col1[1]);
+ copy_v3_v3(col1[0], col1[1]);
+ copy_v3_v3(col1[2], col1[1]);
+ copy_v3_v3(col1[3], col1[1]);
break;
case UI_GRAD_V:
hsv_to_rgb(1.0, 1.0, 0.0, &col1[2][0], &col1[2][1], &col1[2][2]);
- VECCOPY(col1[0], col1[2]);
- VECCOPY(col1[1], col1[2]);
- VECCOPY(col1[3], col1[2]);
+ copy_v3_v3(col1[0], col1[2]);
+ copy_v3_v3(col1[1], col1[2]);
+ copy_v3_v3(col1[3], col1[2]);
break;
default:
assert(!"invalid 'type' argument");
hsv_to_rgb(1.0, 1.0, 1.0, &col1[2][0], &col1[2][1], &col1[2][2]);
- VECCOPY(col1[0], col1[2]);
- VECCOPY(col1[1], col1[2]);
- VECCOPY(col1[3], col1[2]);
+ copy_v3_v3(col1[0], col1[2]);
+ copy_v3_v3(col1[1], col1[2]);
+ copy_v3_v3(col1[3], col1[2]);
}
/* old below */
for(dx=0.0f; dx<1.0f; dx+= 0.05f) {
// previous color
- VECCOPY(col0[0], col1[0]);
- VECCOPY(col0[1], col1[1]);
- VECCOPY(col0[2], col1[2]);
- VECCOPY(col0[3], col1[3]);
+ copy_v3_v3(col0[0], col1[0]);
+ copy_v3_v3(col0[1], col1[1]);
+ copy_v3_v3(col0[2], col1[2]);
+ copy_v3_v3(col0[3], col1[3]);
// new color
switch(type) {
@@ -1929,21 +1929,21 @@ void ui_draw_gradient(rcti *rect, float *hsv, int type, float alpha)
break;
case UI_GRAD_H:
hsv_to_rgb(dx, 1.0, 1.0, &col1[0][0], &col1[0][1], &col1[0][2]);
- VECCOPY(col1[1], col1[0]);
- VECCOPY(col1[2], col1[0]);
- VECCOPY(col1[3], col1[0]);
+ copy_v3_v3(col1[1], col1[0]);
+ copy_v3_v3(col1[2], col1[0]);
+ copy_v3_v3(col1[3], col1[0]);
break;
case UI_GRAD_S:
hsv_to_rgb(h, dx, 1.0, &col1[1][0], &col1[1][1], &col1[1][2]);
- VECCOPY(col1[0], col1[1]);
- VECCOPY(col1[2], col1[1]);
- VECCOPY(col1[3], col1[1]);
+ copy_v3_v3(col1[0], col1[1]);
+ copy_v3_v3(col1[2], col1[1]);
+ copy_v3_v3(col1[3], col1[1]);
break;
case UI_GRAD_V:
hsv_to_rgb(h, 1.0, dx, &col1[2][0], &col1[2][1], &col1[2][2]);
- VECCOPY(col1[0], col1[2]);
- VECCOPY(col1[1], col1[2]);
- VECCOPY(col1[3], col1[2]);
+ copy_v3_v3(col1[0], col1[2]);
+ copy_v3_v3(col1[1], col1[2]);
+ copy_v3_v3(col1[3], col1[2]);
break;
}
@@ -2197,7 +2197,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat
SWAP(short, wcol->shadetop, wcol->shadedown);
- QUATCOPY(wcol->inner, wcol->item);
+ copy_v4_v4_char(wcol->inner, wcol->item);
if(wcol->shadetop>wcol->shadedown)
wcol->shadetop+= 20; /* XXX violates themes... */
@@ -2369,9 +2369,9 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
if(!(state & UI_TEXTINPUT)) {
/* slider part */
- VECCOPY(outline, wcol->outline);
- VECCOPY(wcol->outline, wcol->item);
- VECCOPY(wcol->inner, wcol->item);
+ copy_v3_v3_char(outline, wcol->outline);
+ copy_v3_v3_char(wcol->outline, wcol->item);
+ copy_v3_v3_char(wcol->inner, wcol->item);
if(!(state & UI_SELECT))
SWAP(short, wcol->shadetop, wcol->shadedown);
@@ -2397,7 +2397,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s
round_box_edges(&wtb1, roundboxalign & ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT), &rect1, offs);
widgetbase_draw(&wtb1, wcol);
- VECCOPY(wcol->outline, outline);
+ copy_v3_v3_char(wcol->outline, outline);
if(!(state & UI_SELECT))
SWAP(short, wcol->shadetop, wcol->shadedown);
@@ -2624,7 +2624,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(
widget_init(&wtb);
- VECCOPY(old_col, wcol->inner);
+ copy_v3_v3_char(old_col, wcol->inner);
/* abuse but->hsv - if it's non-zero, use this color as the box's background */
if (but->col[3]) {
@@ -2643,7 +2643,7 @@ static void widget_box(uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(
/* XXX, this doesnt work right since the color applies to buttons outside the box too. */
glClearColor(wcol->inner[0]/255.0, wcol->inner[1]/255.0, wcol->inner[2]/255.0, 1.0);
- VECCOPY(wcol->inner, old_col);
+ copy_v3_v3_char(wcol->inner, old_col);
}
static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign)
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index b135aae30d5..2c4fdb61db5 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -48,6 +48,7 @@
#include "DNA_vfont_types.h"
#include "BLI_math.h"
+#include "BLI_string.h"
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
@@ -1012,23 +1013,21 @@ static void copy_object_set_idnew(bContext *C, int dupflag)
/********************* Make Duplicates Real ************************/
-static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
+static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base,
+ const short use_base_parent,
+ const short use_hierarchy)
{
- Base *basen;
- Object *ob;
ListBase *lb;
DupliObject *dob;
-
- if(!base && !(base = BASACT))
- return;
-
+
if(!(base->object->transflag & OB_DUPLI))
return;
lb= object_duplilist(scene, base->object);
for(dob= lb->first; dob; dob= dob->next) {
- ob= copy_object(dob->ob);
+ Base *basen;
+ Object *ob= copy_object(dob->ob);
/* font duplis can have a totcol without material, we get them from parent
* should be implemented better...
*/
@@ -1055,22 +1054,85 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base)
object_apply_mat4(ob, ob->obmat, FALSE, FALSE);
}
+ if (use_hierarchy) {
+ for(dob= lb->first; dob; dob= dob->next) {
+ /* original parents */
+ Object *ob_src= dob->ob;
+ Object *ob_src_par= ob_src->parent;
+
+ Object *ob_dst= (Object *)ob_src->id.newid;
+
+ if (ob_src_par && ob_src_par->id.newid) {
+ /* the parent was also made real, parent newly real duplis */
+ Object *ob_dst_par= (Object *)ob_src_par->id.newid;
+
+ /* allow for all possible parent types */
+ ob_dst->partype= ob_src->partype;
+ BLI_strncpy(ob_dst->parsubstr, ob_src->parsubstr, sizeof(ob_dst->parsubstr));
+ ob_dst->par1= ob_src->par1;
+ ob_dst->par2= ob_src->par2;
+ ob_dst->par3= ob_src->par3;
+
+ copy_m4_m4(ob_dst->parentinv, ob_src->parentinv);
+
+ ob_dst->parent= ob_dst_par;
+ }
+ else if (use_base_parent) {
+ ob_dst->parent= base->object;
+ ob_dst->partype= PAROBJECT;
+ }
+
+ if (ob_dst->parent) {
+ invert_m4_m4(ob_dst->parentinv, dob->mat);
+
+ /* note, this may be the parent of other objects, but it should
+ * still work out ok */
+ object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE);
+
+ /* to set ob_dst->orig and incase theres any other discrepicies */
+ DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB);
+ }
+ }
+ }
+ else if (use_base_parent) {
+ /* since we are ignoring the internal hierarchy - parent all to the
+ * base object */
+ for(dob= lb->first; dob; dob= dob->next) {
+ /* original parents */
+ Object *ob_src= dob->ob;
+ Object *ob_dst= (Object *)ob_src->id.newid;
+
+ ob_dst->parent= base->object;
+ ob_dst->partype= PAROBJECT;
+
+ /* similer to the code above, see comments */
+ invert_m4_m4(ob_dst->parentinv, dob->mat);
+ object_apply_mat4(ob_dst, dob->mat, FALSE, TRUE);
+ DAG_id_tag_update(&ob_dst->id, OB_RECALC_OB);
+
+
+ }
+ }
+
copy_object_set_idnew(C, 0);
free_object_duplilist(lb);
- base->object->transflag &= ~OB_DUPLI;
+ base->object->transflag &= ~OB_DUPLI;
}
-static int object_duplicates_make_real_exec(bContext *C, wmOperator *UNUSED(op))
+static int object_duplicates_make_real_exec(bContext *C, wmOperator *op)
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
+
+ const short use_base_parent= RNA_boolean_get(op->ptr, "use_base_parent");
+ const short use_hierarchy= RNA_boolean_get(op->ptr, "use_hierarchy");
clear_id_newpoins();
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- make_object_duplilist_real(C, scene, base);
+ make_object_duplilist_real(C, scene, base, use_base_parent, use_hierarchy);
/* dependencies were changed */
WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, base->object);
@@ -1100,6 +1162,9 @@ void OBJECT_OT_duplicates_make_real(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+
+ RNA_def_boolean(ot->srna, "use_base_parent", 0, "Parent", "Parent newly created objects to the original duplicator");
+ RNA_def_boolean(ot->srna, "use_hierarchy", 0, "Keep Hierarchy", "Maintain parent child relationships");
}
/**************************** Convert **************************/
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 1c94ba1afbb..28b9d9ba817 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1131,19 +1131,19 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
base->object->recalc |= OB_RECALC_OB;
if(event==1) { /* loc */
- VECCOPY(base->object->loc, ob->loc);
- VECCOPY(base->object->dloc, ob->dloc);
+ copy_v3_v3(base->object->loc, ob->loc);
+ copy_v3_v3(base->object->dloc, ob->dloc);
}
else if(event==2) { /* rot */
- VECCOPY(base->object->rot, ob->rot);
- VECCOPY(base->object->drot, ob->drot);
+ copy_v3_v3(base->object->rot, ob->rot);
+ copy_v3_v3(base->object->drot, ob->drot);
- QUATCOPY(base->object->quat, ob->quat);
- QUATCOPY(base->object->dquat, ob->dquat);
+ copy_qt_qt(base->object->quat, ob->quat);
+ copy_qt_qt(base->object->dquat, ob->dquat);
}
else if(event==3) { /* size */
- VECCOPY(base->object->size, ob->size);
- VECCOPY(base->object->dsize, ob->dsize);
+ copy_v3_v3(base->object->size, ob->size);
+ copy_v3_v3(base->object->dsize, ob->dsize);
}
else if(event==4) { /* drawtype */
base->object->dt= ob->dt;
@@ -1332,7 +1332,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event)
base->object->index= ob->index;
}
else if(event==31) { /* object color */
- QUATCOPY(base->object->col, ob->col);
+ copy_v4_v4(base->object->col, ob->col);
}
}
}
diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c
index c1ba0b207cb..9f3bc9bbf37 100644
--- a/source/blender/editors/object/object_lattice.c
+++ b/source/blender/editors/object/object_lattice.c
@@ -35,6 +35,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_listbase.h"
+#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "DNA_curve_types.h"
@@ -132,7 +133,7 @@ void load_editLatt(Object *obedit)
bp= editlt->def;
while(tot--) {
- VECCOPY(fp, bp->vec);
+ copy_v3_v3(fp, bp->vec);
fp+= 3;
bp++;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 00faf86c866..d84d5ea6537 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -358,7 +358,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
key= cache[a];
kmax= key->steps;
for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- VECCOPY(mvert->co,key->co);
+ copy_v3_v3(mvert->co,key->co);
if(k) {
medge->v1= cvert-1;
medge->v2= cvert;
@@ -377,7 +377,7 @@ int ED_object_modifier_convert(ReportList *UNUSED(reports), Main *bmain, Scene *
key=cache[a];
kmax=key->steps;
for(k=0; k<=kmax; k++,key++,cvert++,mvert++) {
- VECCOPY(mvert->co,key->co);
+ copy_v3_v3(mvert->co,key->co);
if(k) {
medge->v1=cvert-1;
medge->v2=cvert;
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index d60b7b31bf4..b4fee991bb2 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -134,7 +134,7 @@ static void object_clear_rot(Object *ob)
float eul[3], oldeul[3], quat1[4] = {0};
if (ob->rotmode == ROT_MODE_QUAT) {
- QUATCOPY(quat1, ob->quat);
+ copy_qt_qt(quat1, ob->quat);
quat_to_eul(oldeul, ob->quat);
}
else if (ob->rotmode == ROT_MODE_AXISANGLE) {
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index 2852c57338a..b9e9005dd25 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -390,7 +390,7 @@ static void PE_set_view3d_data(bContext *C, PEData *data)
/*************************** selection utilities *******************************/
-static int key_test_depth(PEData *data, float co[3])
+static int key_test_depth(PEData *data, const float co[3])
{
View3D *v3d= data->vc.v3d;
double ux, uy, uz;
@@ -407,7 +407,7 @@ static int key_test_depth(PEData *data, float co[3])
return 0;
gluProject(co[0],co[1],co[2], data->mats.modelview, data->mats.projection,
- (GLint *)data->mats.viewport, &ux, &uy, &uz);
+ (GLint *)data->mats.viewport, &ux, &uy, &uz);
x=wco[0];
y=wco[1];
@@ -434,7 +434,7 @@ static int key_test_depth(PEData *data, float co[3])
return 1;
}
-static int key_inside_circle(PEData *data, float rad, float co[3], float *distance)
+static int key_inside_circle(PEData *data, float rad, const float co[3], float *distance)
{
float dx, dy, dist;
int sco[2];
@@ -461,7 +461,7 @@ static int key_inside_circle(PEData *data, float rad, float co[3], float *distan
return 0;
}
-static int key_inside_rect(PEData *data, float co[3])
+static int key_inside_rect(PEData *data, const float co[3])
{
int sco[2];
@@ -477,7 +477,7 @@ static int key_inside_rect(PEData *data, float co[3])
return 0;
}
-static int key_inside_test(PEData *data, float co[3])
+static int key_inside_test(PEData *data, const float co[3])
{
if(data->mval)
return key_inside_circle(data, data->rad, co, NULL);
@@ -719,7 +719,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
LOOP_PARTICLES {
key = pa->hair;
psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
BLI_kdtree_insert(tree, p, co, NULL);
}
@@ -733,7 +733,7 @@ static void PE_update_mirror_cache(Object *ob, ParticleSystem *psys)
LOOP_PARTICLES {
key = pa->hair;
psys_mat_hair_to_orco(ob, psmd->dm, psys->part->from, pa, mat);
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
co[0]= -co[0];
@@ -818,7 +818,7 @@ static void PE_mirror_particle(Object *ob, DerivedMesh *dm, ParticleSystem *psys
key= point->keys;
mkey= mpoint->keys;
for(k=0; k<pa->totkey; k++, hkey++, mhkey++, key++, mkey++) {
- VECCOPY(mhkey->co, hkey->co);
+ copy_v3_v3(mhkey->co, hkey->co);
mul_m4_v3(mat, mhkey->co);
mhkey->co[0]= -mhkey->co[0];
mul_m4_v3(immat, mhkey->co);
@@ -918,7 +918,7 @@ static void pe_deflect_emitter(Scene *scene, Object *ob, PTCacheEdit *edit)
sub_v3_v3v3(dvec, key->co, vec);
dot=dot_v3v3(dvec,nor);
- VECCOPY(dvec,nor);
+ copy_v3_v3(dvec,nor);
if(dot>0.0f) {
if(dot<dist_1st) {
@@ -1019,7 +1019,7 @@ static void pe_iterate_lengths(Scene *scene, PTCacheEdit *edit)
add_v3_v3((key-1)->co, dv1);
}
- VECADD(dv1,dv0,dv2);
+ add_v3_v3v3(dv1, dv0, dv2);
}
}
}
@@ -1071,20 +1071,20 @@ static void recalc_emitter_field(Object *ob, ParticleSystem *psys)
MVert *mvert;
mvert=dm->getVertData(dm,mface->v1,CD_MVERT);
- VECCOPY(vec,mvert->co);
+ copy_v3_v3(vec,mvert->co);
VECCOPY(nor,mvert->no);
mvert=dm->getVertData(dm,mface->v2,CD_MVERT);
- VECADD(vec,vec,mvert->co);
+ add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
mvert=dm->getVertData(dm,mface->v3,CD_MVERT);
- VECADD(vec,vec,mvert->co);
+ add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
if(mface->v4) {
mvert=dm->getVertData(dm,mface->v4,CD_MVERT);
- VECADD(vec,vec,mvert->co);
+ add_v3_v3v3(vec,vec,mvert->co);
VECADD(nor,nor,mvert->no);
mul_v3_fl(vec,0.25);
@@ -1144,7 +1144,7 @@ static void update_world_cos(Object *ob, PTCacheEdit *edit)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, hairmat);
LOOP_KEYS {
- VECCOPY(key->world_co,key->co);
+ copy_v3_v3(key->world_co,key->co);
if(!(psys->flag & PSYS_GLOBAL_HAIR))
mul_m4_v3(hairmat, key->world_co);
}
@@ -1170,13 +1170,13 @@ static void update_velocities(PTCacheEdit *edit)
if(dfra <= 0.0f)
continue;
- VECSUB(key->vel, (key+1)->co, key->co);
+ sub_v3_v3v3(key->vel, (key+1)->co, key->co);
if(point->totkey>2) {
- VECSUB(vec1, (key+1)->co, (key+2)->co);
+ sub_v3_v3v3(vec1, (key+1)->co, (key+2)->co);
project_v3_v3v3(vec2, vec1, key->vel);
- VECSUB(vec2, vec1, vec2);
- VECADDFAC(key->vel, key->vel, vec2, 0.5f);
+ sub_v3_v3v3(vec2, vec1, vec2);
+ madd_v3_v3fl(key->vel, vec2, 0.5f);
}
}
else if(k==point->totkey-1) {
@@ -1185,13 +1185,13 @@ static void update_velocities(PTCacheEdit *edit)
if(dfra <= 0.0f)
continue;
- VECSUB(key->vel, key->co, (key-1)->co);
+ sub_v3_v3v3(key->vel, key->co, (key-1)->co);
if(point->totkey>2) {
- VECSUB(vec1, (key-2)->co, (key-1)->co);
+ sub_v3_v3v3(vec1, (key-2)->co, (key-1)->co);
project_v3_v3v3(vec2, vec1, key->vel);
- VECSUB(vec2, vec1, vec2);
- VECADDFAC(key->vel, key->vel, vec2, 0.5f);
+ sub_v3_v3v3(vec2, vec1, vec2);
+ madd_v3_v3fl(key->vel, vec2, 0.5f);
}
}
else {
@@ -1200,7 +1200,7 @@ static void update_velocities(PTCacheEdit *edit)
if(dfra <= 0.0f)
continue;
- VECSUB(key->vel, (key+1)->co, (key-1)->co);
+ sub_v3_v3v3(key->vel, (key+1)->co, (key-1)->co);
}
mul_v3_fl(key->vel, frs_sec/dfra);
}
@@ -1623,7 +1623,7 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
if(pset->selectmode==SCE_SELECT_POINT) {
LOOP_KEYS {
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co, vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
@@ -1641,7 +1641,7 @@ int PE_lasso_select(bContext *C, int mcords[][2], short moves, short extend, sho
else if(pset->selectmode==SCE_SELECT_END) {
key= point->keys + point->totkey - 1;
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
project_int(ar, co,vertco);
if((vertco[0] != IS_CLIPPED) && lasso_inside(mcords,moves,vertco[0],vertco[1]) && key_test_depth(&data, co)) {
@@ -1934,8 +1934,8 @@ static void rekey_particle(PEData *data, int pa_index)
okey = pa->hair;
/* root and tip stay the same */
- VECCOPY(key->co, okey->co);
- VECCOPY((key + data->totrekey - 1)->co, (okey + pa->totkey - 1)->co);
+ copy_v3_v3(key->co, okey->co);
+ copy_v3_v3((key + data->totrekey - 1)->co, (okey + pa->totkey - 1)->co);
sta= key->time= okey->time;
end= (key + data->totrekey - 1)->time= (okey + pa->totkey - 1)->time;
@@ -1945,7 +1945,7 @@ static void rekey_particle(PEData *data, int pa_index)
for(k=1,key++; k<data->totrekey-1; k++,key++) {
state.time= (float)k / (float)(data->totrekey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
- VECCOPY(key->co, state.co);
+ copy_v3_v3(key->co, state.co);
key->time= sta + k * dval;
}
@@ -2038,7 +2038,7 @@ static void rekey_particle_to_time(Scene *scene, Object *ob, int pa_index, float
for(k=1, key++; k < pa->totkey; k++, key++) {
state.time= path_time * (float)k / (float)(pa->totkey-1);
psys_get_particle_on_path(&sim, pa_index, &state, 0);
- VECCOPY(key->co, state.co);
+ copy_v3_v3(key->co, state.co);
}
/* replace hair keys */
@@ -2188,7 +2188,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
}
if(hkey < pa->hair + pa->totkey) {
- VECCOPY(nhkey->co, hkey->co);
+ copy_v3_v3(nhkey->co, hkey->co);
nhkey->editflag = hkey->editflag;
nhkey->time= hkey->time;
nhkey->weight= hkey->weight;
@@ -2199,7 +2199,7 @@ static void remove_tagged_keys(Object *ob, ParticleSystem *psys)
nkey->flag = key->flag;
nkey->ftime = key->ftime;
nkey->length = key->length;
- VECCOPY(nkey->world_co, key->world_co);
+ copy_v3_v3(nkey->world_co, key->world_co);
}
nkey++;
nhkey++;
@@ -2275,7 +2275,7 @@ static void subdivide_particle(PEData *data, int pa_index)
nkey->time= (key->time + (key+1)->time)*0.5f;
state.time= (endtime != 0.0f)? nkey->time/endtime: 0.0f;
psys_get_particle_on_path(&sim, pa_index, &state, 0);
- VECCOPY(nkey->co, state.co);
+ copy_v3_v3(nkey->co, state.co);
nekey->co= nkey->co;
nekey->time= &nkey->time;
@@ -2365,7 +2365,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
/* insert particles into kd tree */
LOOP_SELECTED_POINTS {
psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat);
- VECCOPY(co, point->keys->co);
+ copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
BLI_kdtree_insert(tree, p, co, NULL);
}
@@ -2375,7 +2375,7 @@ static int remove_doubles_exec(bContext *C, wmOperator *op)
/* tag particles to be removed */
LOOP_SELECTED_POINTS {
psys_mat_hair_to_object(ob, psmd->dm, psys->part->from, psys->particles+p, mat);
- VECCOPY(co, point->keys->co);
+ copy_v3_v3(co, point->keys->co);
mul_m4_v3(mat, co);
totn= BLI_kdtree_find_n_nearest(tree,10,co,NULL,nearest);
@@ -2748,10 +2748,10 @@ static void brush_comb(PEData *data, float UNUSED(mat[][4]), float imat[][4], in
fac= (float)pow((double)(1.0f - data->dist / data->rad), (double)data->combfac);
- VECCOPY(cvec,data->dvec);
+ copy_v3_v3(cvec,data->dvec);
mul_mat3_m4_v3(imat,cvec);
mul_v3_fl(cvec, fac);
- VECADD(key->co, key->co, cvec);
+ add_v3_v3(key->co, cvec);
(data->edit->points + point_index)->flag |= PEP_EDIT_RECALC;
}
@@ -2862,13 +2862,13 @@ static void brush_length(PEData *data, int point_index)
LOOP_KEYS {
if(k==0) {
- VECCOPY(pvec,key->co);
+ copy_v3_v3(pvec,key->co);
}
else {
- VECSUB(dvec,key->co,pvec);
- VECCOPY(pvec,key->co);
+ sub_v3_v3v3(dvec,key->co,pvec);
+ copy_v3_v3(pvec,key->co);
mul_v3_fl(dvec,data->growfac);
- VECADD(key->co,(key-1)->co,dvec);
+ add_v3_v3v3(key->co,(key-1)->co,dvec);
}
}
@@ -2905,14 +2905,14 @@ static void brush_puff(PEData *data, int point_index)
LOOP_KEYS {
if(k==0) {
/* find root coordinate and normal on emitter */
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
mul_v3_m4v3(kco, data->ob->imat, co); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
point_index= BLI_kdtree_find_nearest(edit->emitter_field, kco, NULL, NULL);
if(point_index == -1) return;
- VECCOPY(rootco, co);
+ copy_v3_v3(rootco, co);
copy_v3_v3(nor, &edit->emitter_cosnos[point_index*6+3]);
mul_mat3_m4_v3(data->ob->obmat, nor); /* normal into worldspace */
@@ -2927,19 +2927,19 @@ static void brush_puff(PEData *data, int point_index)
else {
/* compute position as if hair was standing up straight.
* */
- VECCOPY(lastco, co);
- VECCOPY(co, key->co);
+ copy_v3_v3(lastco, co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
length += len_v3v3(lastco, co);
if((data->select==0 || (key->flag & PEK_SELECT)) && !(key->flag & PEK_HIDE)) {
- VECADDFAC(kco, rootco, nor, length);
+ madd_v3_v3v3fl(kco, rootco, nor, length);
/* blend between the current and straight position */
- VECSUB(dco, kco, co);
- VECADDFAC(co, co, dco, fac);
+ sub_v3_v3v3(dco, kco, co);
+ madd_v3_v3fl(co, dco, fac);
/* re-use dco to compare before and after translation and add to the offset */
- VECCOPY(dco, key->co);
+ copy_v3_v3(dco, key->co);
mul_v3_m4v3(key->co, imat, co);
@@ -2966,7 +2966,7 @@ static void brush_puff(PEData *data, int point_index)
/* Move the unselected point on a vector based on the
* hair direction and the offset */
float c1[3], c2[3];
- VECSUB(dco, lastco, co);
+ sub_v3_v3v3(dco, lastco, co);
mul_mat3_m4_v3(imat, dco); /* into particle space */
/* move the point along a vector perpendicular to the
@@ -2980,7 +2980,7 @@ static void brush_puff(PEData *data, int point_index)
/* Move the unselected point on a vector based on the
* the normal of the closest geometry */
float oco[3], onor[3];
- VECCOPY(oco, key->co);
+ copy_v3_v3(oco, key->co);
mul_m4_v3(mat, oco);
mul_v3_m4v3(kco, data->ob->imat, oco); /* use 'kco' as the object space version of worldspace 'co', ob->imat is set before calling */
@@ -3029,7 +3029,7 @@ static void brush_smooth_get(PEData *data, float mat[][4], float UNUSED(imat[][4
sub_v3_v3v3(dvec,key->co,(key-1)->co);
mul_mat3_m4_v3(mat,dvec);
- VECADD(data->vec,data->vec,dvec);
+ add_v3_v3(data->vec, dvec);
data->tot++;
}
}
@@ -3039,57 +3039,61 @@ static void brush_smooth_do(PEData *data, float UNUSED(mat[][4]), float imat[][4
float vec[3], dvec[3];
if(key_index) {
- VECCOPY(vec,data->vec);
+ copy_v3_v3(vec, data->vec);
mul_mat3_m4_v3(imat,vec);
sub_v3_v3v3(dvec,key->co,(key-1)->co);
- VECSUB(dvec,vec,dvec);
+ sub_v3_v3v3(dvec,vec,dvec);
mul_v3_fl(dvec,data->smoothfac);
- VECADD(key->co,key->co,dvec);
+ add_v3_v3(key->co, dvec);
}
(data->edit->points + point_index)->flag |= PEP_EDIT_RECALC;
}
/* convert from triangle barycentric weights to quad mean value weights */
-static void intersect_dm_quad_weights(float *v1, float *v2, float *v3, float *v4, float *w)
+static void intersect_dm_quad_weights(const float v1[3], const float v2[3], const float v3[3], const float v4[3], float w[4])
{
float co[3], vert[4][3];
- VECCOPY(vert[0], v1);
- VECCOPY(vert[1], v2);
- VECCOPY(vert[2], v3);
- VECCOPY(vert[3], v4);
+ copy_v3_v3(vert[0], v1);
+ copy_v3_v3(vert[1], v2);
+ copy_v3_v3(vert[2], v3);
+ copy_v3_v3(vert[3], v4);
co[0]= v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2] + v4[0]*w[3];
co[1]= v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2] + v4[1]*w[3];
co[2]= v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3];
- interp_weights_poly_v3( w,vert, 4, co);
+ interp_weights_poly_v3(w, vert, 4, co);
}
/* check intersection with a derivedmesh */
-static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, float *vert_cos, float *co1, float* co2, float *min_d, int *min_face, float *min_w,
- float *face_minmax, float *pa_minmax, float radius, float *ipoint)
+static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm,
+ float *vert_cos,
+ const float co1[3], const float co2[3],
+ float *min_d, int *min_face, float *min_w,
+ float *face_minmax, float *pa_minmax,
+ float radius, float *ipoint)
{
- MFace *mface=0;
- MVert *mvert=0;
+ MFace *mface= NULL;
+ MVert *mvert= NULL;
int i, totface, intersect=0;
float cur_d, cur_uv[2], v1[3], v2[3], v3[3], v4[3], min[3], max[3], p_min[3],p_max[3];
float cur_ipoint[3];
- if(dm==0){
+ if(dm == NULL){
psys_disable_all(ob);
dm=mesh_get_derived_final(scene, ob, 0);
- if(dm==0)
+ if(dm == NULL)
dm=mesh_get_derived_deform(scene, ob, 0);
psys_enable_all(ob);
- if(dm==0)
+ if(dm == NULL)
return 0;
}
@@ -3101,8 +3105,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
DO_MINMAX(co2,p_min,p_max);
}
else{
- VECCOPY(p_min,pa_minmax);
- VECCOPY(p_max,pa_minmax+3);
+ copy_v3_v3(p_min,pa_minmax);
+ copy_v3_v3(p_max,pa_minmax+3);
}
totface=dm->getNumTessFaces(dm);
@@ -3112,18 +3116,18 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
/* lets intersect the faces */
for(i=0; i<totface; i++,mface++){
if(vert_cos){
- VECCOPY(v1,vert_cos+3*mface->v1);
- VECCOPY(v2,vert_cos+3*mface->v2);
- VECCOPY(v3,vert_cos+3*mface->v3);
+ copy_v3_v3(v1,vert_cos+3*mface->v1);
+ copy_v3_v3(v2,vert_cos+3*mface->v2);
+ copy_v3_v3(v3,vert_cos+3*mface->v3);
if(mface->v4)
- VECCOPY(v4,vert_cos+3*mface->v4)
+ copy_v3_v3(v4,vert_cos+3*mface->v4);
}
else{
- VECCOPY(v1,mvert[mface->v1].co);
- VECCOPY(v2,mvert[mface->v2].co);
- VECCOPY(v3,mvert[mface->v3].co);
+ copy_v3_v3(v1,mvert[mface->v1].co);
+ copy_v3_v3(v2,mvert[mface->v2].co);
+ copy_v3_v3(v3,mvert[mface->v3].co);
if(mface->v4)
- VECCOPY(v4,mvert[mface->v4].co)
+ copy_v3_v3(v4,mvert[mface->v4].co);
}
if(face_minmax==0){
@@ -3137,8 +3141,8 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
continue;
}
else{
- VECCOPY(min, face_minmax+6*i);
- VECCOPY(max, face_minmax+6*i+3);
+ copy_v3_v3(min, face_minmax+6*i);
+ copy_v3_v3(max, face_minmax+6*i+3);
if(isect_aabb_aabb_v3(min,max,p_min,p_max)==0)
continue;
}
@@ -3147,7 +3151,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v2, v3, v1, &cur_d, cur_ipoint)){
if(cur_d<*min_d){
*min_d=cur_d;
- VECCOPY(ipoint,cur_ipoint);
+ copy_v3_v3(ipoint,cur_ipoint);
*min_face=i;
intersect=1;
}
@@ -3156,7 +3160,7 @@ static int particle_intersect_dm(Scene *scene, Object *ob, DerivedMesh *dm, floa
if(isect_sweeping_sphere_tri_v3(co1, co2, radius, v4, v1, v3, &cur_d, cur_ipoint)){
if(cur_d<*min_d){
*min_d=cur_d;
- VECCOPY(ipoint,cur_ipoint);
+ copy_v3_v3(ipoint,cur_ipoint);
*min_face=i;
intersect=1;
}
@@ -3364,27 +3368,27 @@ static int brush_add(PEData *data, short number)
key3[1].time= key3[0].time;
psys_get_particle_on_path(&sim, ptn[1].index, &key3[1], 0);
mul_v3_fl(key3[1].co, weight[1]);
- VECADD(key3[0].co, key3[0].co, key3[1].co);
+ add_v3_v3(key3[0].co, key3[1].co);
if(maxw>2) {
key3[2].time= key3[0].time;
psys_get_particle_on_path(&sim, ptn[2].index, &key3[2], 0);
mul_v3_fl(key3[2].co, weight[2]);
- VECADD(key3[0].co, key3[0].co, key3[2].co);
+ add_v3_v3(key3[0].co, key3[2].co);
}
}
if(k==0)
- VECSUB(co1, pa->state.co, key3[0].co);
+ sub_v3_v3v3(co1, pa->state.co, key3[0].co);
- VECADD(thkey->co, key3[0].co, co1);
+ add_v3_v3v3(thkey->co, key3[0].co, co1);
thkey->time= key3[0].time;
}
}
else {
for(k=0, hkey=pa->hair; k<pset->totaddkey; k++, hkey++) {
- VECADDFAC(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep);
+ madd_v3_v3v3fl(hkey->co, pa->state.co, pa->state.vel, k * framestep * timestep);
hkey->time += k * framestep;
hkey->weight = 1.f - (float)k/(float)(pset->totaddkey-1);
}
@@ -4044,7 +4048,7 @@ const char *PE_undo_get_name(Scene *scene, int nr, int *active)
/************************ utilities ******************************/
-int PE_minmax(Scene *scene, float *min, float *max)
+int PE_minmax(Scene *scene, float min[3], float max[3])
{
Object *ob= OBACT;
PTCacheEdit *edit= PE_get_current(scene, ob);
@@ -4066,7 +4070,7 @@ int PE_minmax(Scene *scene, float *min, float *max)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, psys->particles+p, mat);
LOOP_SELECTED_KEYS {
- VECCOPY(co, key->co);
+ copy_v3_v3(co, key->co);
mul_m4_v3(mat, co);
DO_MINMAX(co, min, max);
ok= 1;
diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c
index 7071e5d3720..dd46910fbc1 100644
--- a/source/blender/editors/physics/particle_object.c
+++ b/source/blender/editors/physics/particle_object.c
@@ -688,7 +688,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
psys_mat_hair_to_global(ob, psmd->dm, psys->part->from, pa, hairmat);
invert_m4_m4(imat,hairmat);
- VECSUB(vec, nearest.co, key->co);
+ sub_v3_v3v3(vec, nearest.co, key->co);
if(point) {
ekey = point->keys;
@@ -696,7 +696,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
}
for(k=0,key=pa->hair; k<pa->totkey; k++,key++) {
- VECADD(key->co, key->co, vec);
+ add_v3_v3(key->co, vec);
mul_m4_v3(imat,key->co);
if(ekey) {
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index bf4d081508f..85d46d9e627 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -105,12 +105,30 @@
#define IMAPAINT_CHAR_TO_FLOAT(c) ((c)/255.0f)
-#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { (c)[0]=FTOCHAR((f)[0]); (c)[1]=FTOCHAR((f)[1]); (c)[2]=FTOCHAR((f)[2]); }
-#define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { (c)[0]=FTOCHAR((f)[0]); (c)[1]=FTOCHAR((f)[1]); (c)[2]=FTOCHAR((f)[2]); (c)[3]=FTOCHAR((f)[3]); }
+#define IMAPAINT_FLOAT_RGB_TO_CHAR(c, f) { \
+ (c)[0]= FTOCHAR((f)[0]); \
+ (c)[1]= FTOCHAR((f)[1]); \
+ (c)[2]= FTOCHAR((f)[2]); \
+}
+#define IMAPAINT_FLOAT_RGBA_TO_CHAR(c, f) { \
+ (c)[0]= FTOCHAR((f)[0]); \
+ (c)[1]= FTOCHAR((f)[1]); \
+ (c)[2]= FTOCHAR((f)[2]); \
+ (c)[3]= FTOCHAR((f)[3]); \
+}
+#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { \
+ (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
+ (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
+ (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
+}
+#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { \
+ (f)[0]= IMAPAINT_CHAR_TO_FLOAT((c)[0]); \
+ (f)[1]= IMAPAINT_CHAR_TO_FLOAT((c)[1]); \
+ (f)[2]= IMAPAINT_CHAR_TO_FLOAT((c)[2]); \
+ (f)[3]= IMAPAINT_CHAR_TO_FLOAT((c)[3]); \
+}
-#define IMAPAINT_CHAR_RGB_TO_FLOAT(f, c) { (f)[0]=IMAPAINT_CHAR_TO_FLOAT((c)[0]); (f)[1]=IMAPAINT_CHAR_TO_FLOAT((c)[1]); (f)[2]=IMAPAINT_CHAR_TO_FLOAT((c)[2]); }
-#define IMAPAINT_CHAR_RGBA_TO_FLOAT(f, c) { (f)[0]=IMAPAINT_CHAR_TO_FLOAT((c)[0]); (f)[1]=IMAPAINT_CHAR_TO_FLOAT((c)[1]); (f)[2]=IMAPAINT_CHAR_TO_FLOAT((c)[2]); (f)[3]=IMAPAINT_CHAR_TO_FLOAT((c)[3]); }
-#define IMAPAINT_FLOAT_RGB_COPY(a, b) VECCOPY(a, b)
+#define IMAPAINT_FLOAT_RGB_COPY(a, b) copy_v3_v3(a, b)
#define IMAPAINT_TILE_BITS 6
#define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS)
@@ -607,7 +625,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
best_face_index = face_index;
best_side = 0;
z_depth_best = z_depth;
- VECCOPY(w, w_tmp);
+ copy_v3_v3(w, w_tmp);
}
}
else if (mf->v4) {
@@ -621,7 +639,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, float pt[2], float w
best_face_index = face_index;
best_side= 1;
z_depth_best = z_depth;
- VECCOPY(w, w_tmp);
+ copy_v3_v3(w, w_tmp);
}
}
}
@@ -722,7 +740,7 @@ static int project_paint_PickColor(const ProjPaintState *ps, float pt[2], float
if (rgba_fp) {
if (ibuf->rect_float) {
- QUATCOPY(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4)));
+ copy_v4_v4(rgba_fp, ((float *)ibuf->rect_float + ((xi + yi * ibuf->x) * 4)));
}
else {
char *tmp_ch= ((char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4);
@@ -1431,7 +1449,7 @@ static ProjPixel *project_paint_uvpixel_init(
}
/* screenspace unclamped, we could keep its z and w values but dont need them at the moment */
- VECCOPY2D(projPixel->projCoSS, pixelScreenCo);
+ copy_v2_v2(projPixel->projCoSS, pixelScreenCo);
projPixel->x_px = x_px;
projPixel->y_px = y_px;
@@ -1530,8 +1548,8 @@ static int line_clip_rect2f(
if (fabsf(l1[0]-l2[0]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
if (BLI_in_rctf(rect, l1[0], l1[1])) {
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
return 1;
}
else {
@@ -1539,8 +1557,8 @@ static int line_clip_rect2f(
}
}
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
CLAMP(l1_clip[0], rect->xmin, rect->xmax);
CLAMP(l2_clip[0], rect->xmin, rect->xmax);
return 1;
@@ -1558,8 +1576,8 @@ static int line_clip_rect2f(
if (fabsf(l1[1]-l2[1]) < PROJ_GEOM_TOLERANCE) { /* this is a single point (or close to)*/
if (BLI_in_rctf(rect, l1[0], l1[1])) {
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
return 1;
}
else {
@@ -1567,8 +1585,8 @@ static int line_clip_rect2f(
}
}
- VECCOPY2D(l1_clip, l1);
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l1_clip, l1);
+ copy_v2_v2(l2_clip, l2);
CLAMP(l1_clip[1], rect->ymin, rect->ymax);
CLAMP(l2_clip[1], rect->ymin, rect->ymax);
return 1;
@@ -1582,12 +1600,12 @@ static int line_clip_rect2f(
/* are either of the points inside the rectangle ? */
if (BLI_in_rctf(rect, l1[0], l1[1])) {
- VECCOPY2D(l1_clip, l1);
+ copy_v2_v2(l1_clip, l1);
ok1 = 1;
}
if (BLI_in_rctf(rect, l2[0], l2[1])) {
- VECCOPY2D(l2_clip, l2);
+ copy_v2_v2(l2_clip, l2);
ok2 = 1;
}
@@ -1912,14 +1930,14 @@ static void project_bucket_clip_face(
if (inside_bucket_flag == ISECT_ALL3) {
/* all screenspace points are inside the bucket bounding box, this means we dont need to clip and can simply return the UVs */
if (flip) { /* facing the back? */
- VECCOPY2D(bucket_bounds_uv[0], uv3co);
- VECCOPY2D(bucket_bounds_uv[1], uv2co);
- VECCOPY2D(bucket_bounds_uv[2], uv1co);
+ copy_v2_v2(bucket_bounds_uv[0], uv3co);
+ copy_v2_v2(bucket_bounds_uv[1], uv2co);
+ copy_v2_v2(bucket_bounds_uv[2], uv1co);
}
else {
- VECCOPY2D(bucket_bounds_uv[0], uv1co);
- VECCOPY2D(bucket_bounds_uv[1], uv2co);
- VECCOPY2D(bucket_bounds_uv[2], uv3co);
+ copy_v2_v2(bucket_bounds_uv[0], uv1co);
+ copy_v2_v2(bucket_bounds_uv[1], uv2co);
+ copy_v2_v2(bucket_bounds_uv[2], uv3co);
}
*tot = 3;
@@ -1983,33 +2001,33 @@ static void project_bucket_clip_face(
(*tot) = 0;
- if (inside_face_flag & ISECT_1) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; }
- if (inside_face_flag & ISECT_2) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; }
- if (inside_face_flag & ISECT_3) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; }
- if (inside_face_flag & ISECT_4) { VECCOPY2D(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; }
+ if (inside_face_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[0]); (*tot)++; }
+ if (inside_face_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[1]); (*tot)++; }
+ if (inside_face_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[2]); (*tot)++; }
+ if (inside_face_flag & ISECT_4) { copy_v2_v2(isectVCosSS[*tot], bucket_bounds_ss[3]); (*tot)++; }
- if (inside_bucket_flag & ISECT_1) { VECCOPY2D(isectVCosSS[*tot], v1coSS); (*tot)++; }
- if (inside_bucket_flag & ISECT_2) { VECCOPY2D(isectVCosSS[*tot], v2coSS); (*tot)++; }
- if (inside_bucket_flag & ISECT_3) { VECCOPY2D(isectVCosSS[*tot], v3coSS); (*tot)++; }
+ if (inside_bucket_flag & ISECT_1) { copy_v2_v2(isectVCosSS[*tot], v1coSS); (*tot)++; }
+ if (inside_bucket_flag & ISECT_2) { copy_v2_v2(isectVCosSS[*tot], v2coSS); (*tot)++; }
+ if (inside_bucket_flag & ISECT_3) { copy_v2_v2(isectVCosSS[*tot], v3coSS); (*tot)++; }
if ((inside_bucket_flag & (ISECT_1|ISECT_2)) != (ISECT_1|ISECT_2)) {
if (line_clip_rect2f(bucket_bounds, v1coSS, v2coSS, v1_clipSS, v2_clipSS)) {
- if ((inside_bucket_flag & ISECT_1)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
- if ((inside_bucket_flag & ISECT_2)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_2)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
}
}
if ((inside_bucket_flag & (ISECT_2|ISECT_3)) != (ISECT_2|ISECT_3)) {
if (line_clip_rect2f(bucket_bounds, v2coSS, v3coSS, v1_clipSS, v2_clipSS)) {
- if ((inside_bucket_flag & ISECT_2)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
- if ((inside_bucket_flag & ISECT_3)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_2)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_3)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
}
}
if ((inside_bucket_flag & (ISECT_3|ISECT_1)) != (ISECT_3|ISECT_1)) {
if (line_clip_rect2f(bucket_bounds, v3coSS, v1coSS, v1_clipSS, v2_clipSS)) {
- if ((inside_bucket_flag & ISECT_3)==0) { VECCOPY2D(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
- if ((inside_bucket_flag & ISECT_1)==0) { VECCOPY2D(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_3)==0) { copy_v2_v2(isectVCosSS[*tot], v1_clipSS); (*tot)++; }
+ if ((inside_bucket_flag & ISECT_1)==0) { copy_v2_v2(isectVCosSS[*tot], v2_clipSS); (*tot)++; }
}
}
@@ -2538,8 +2556,8 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
//fac = line_point_factor_v2(uv, uv_seam_quad[0], uv_seam_quad[1]);
fac = line_point_factor_v2(uv, seam_subsection[0], seam_subsection[1]);
- if (fac < 0.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[0]); }
- else if (fac > 1.0f) { VECCOPY(pixelScreenCo, edge_verts_inset_clip[1]); }
+ if (fac < 0.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[0]); }
+ else if (fac > 1.0f) { copy_v3_v3(pixelScreenCo, edge_verts_inset_clip[1]); }
else { interp_v3_v3v3(pixelScreenCo, edge_verts_inset_clip[0], edge_verts_inset_clip[1], fac); }
if (!is_ortho) {
@@ -3038,7 +3056,7 @@ static void project_paint_begin(ProjPaintState *ps)
normalize_v3(ps->viewDir);
/* viewPos - object relative */
- VECCOPY(ps->viewPos, viewinv[3]);
+ copy_v3_v3(ps->viewPos, viewinv[3]);
copy_m3_m4(mat, ps->ob->imat);
mul_m3_v3(mat, ps->viewPos);
add_v3_v3(ps->viewPos, ps->ob->imat[3]);
@@ -3396,7 +3414,7 @@ static void project_paint_end(ProjPaintState *ps)
if (is_float) {
float *rgba_fp = (float *)tilerect + (((projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE)) * 4;
- QUATCOPY(rgba_fp, projPixel->origColor.f);
+ copy_v4_v4(rgba_fp, projPixel->origColor.f);
}
else {
((unsigned int *)tilerect)[ (projPixel->x_px - x_round) + (projPixel->y_px - y_round) * IMAPAINT_TILE_SIZE ] = projPixel->origColor.uint;
@@ -3732,7 +3750,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, ProjPixel *projPixel, flo
srgb_to_linearrgb_v3_v3(rgba, ps->brush->rgb);
}
else {
- VECCOPY(rgba, ps->brush->rgb);
+ copy_v3_v3(rgba, ps->brush->rgb);
}
rgba[3] = 1.0;
}
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 5ac72d71109..f79ccbb9a55 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -124,7 +124,7 @@ float paint_get_tex_pixel(Brush* br, float u, float v)
static void imapaint_project(Object *ob, float *model, float *proj, float *co, float *pco)
{
- VECCOPY(pco, co);
+ copy_v3_v3(pco, co);
pco[3]= 1.0f;
mul_m4_v3(ob->obmat, pco);
@@ -166,7 +166,7 @@ static void imapaint_tri_weights(Object *ob, float *v1, float *v2, float *v3, fl
invert_m3_m3(invwmat, wmat);
mul_m3_v3(invwmat, h);
- VECCOPY(w, h);
+ copy_v3_v3(w, h);
/* w is still divided by perspdiv, make it sum to one */
divw= w[0] + w[1] + w[2];
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c682e42c35b..d6b3d6809d5 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2315,8 +2315,9 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
ofs= key_to_vertcos(ob, kb);
/* calculate key coord offsets (from previous location) */
- for (a= 0; a < me->totvert; a++)
- VECSUB(ofs[a], vertCos[a], ofs[a]);
+ for (a= 0; a < me->totvert; a++) {
+ sub_v3_v3v3(ofs[a], vertCos[a], ofs[a]);
+ }
/* apply offsets on other keys */
currkey = me->key->block.first;
@@ -2337,7 +2338,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
MVert *mvert= me->mvert;
for (a= 0; a < me->totvert; a++, mvert++)
- VECCOPY(mvert->co, vertCos[a]);
+ copy_v3_v3(mvert->co, vertCos[a]);
mesh_calc_normals(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
}
diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c
index 70c4ebd445a..177b72567e5 100644
--- a/source/blender/editors/space_info/textview.c
+++ b/source/blender/editors/space_info/textview.c
@@ -33,6 +33,7 @@
#include "BLF_api.h"
+#include "BLI_math.h"
#include "BLI_utildefines.h"
@@ -131,7 +132,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
const char *line_stride= str + initial_offset; /* advance to the last line and draw it first */
int sel_orig[2];
- VECCOPY2D(sel_orig, cdc->sel);
+ copy_v2_v2_int(sel_orig, cdc->sel);
/* invert and swap for wrapping */
cdc->sel[0] = str_len - sel_orig[1];
@@ -178,7 +179,7 @@ static int console_draw_string(ConsoleDrawContext *cdc, const char *str, int str
return 0;
}
- VECCOPY2D(cdc->sel, sel_orig);
+ copy_v2_v2_int(cdc->sel, sel_orig);
STEP_SEL(-(str_len + 1));
}
else { /* simple, no wrap */
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index a7bb1fb3ee6..c0046b089af 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -153,17 +153,17 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
unsigned char cp[3];
if (boneflag & BONE_DRAW_ACTIVE) {
- VECCOPY(cp, bcolor->active);
+ copy_v3_v3_char((char *)cp, bcolor->active);
if(!(boneflag & BONE_SELECTED)) {
cp_shade_color3ub(cp, -80);
}
}
else if (boneflag & BONE_SELECTED) {
- VECCOPY(cp, bcolor->select);
+ copy_v3_v3_char((char *)cp, bcolor->select);
}
else {
/* a bit darker than solid */
- VECCOPY(cp, bcolor->solid);
+ copy_v3_v3_char((char *)cp, bcolor->solid);
cp_shade_color3ub(cp, -50);
}
@@ -213,13 +213,13 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
unsigned char cp[3];
if (boneflag & BONE_DRAW_ACTIVE) {
- VECCOPY(cp, bcolor->active);
+ copy_v3_v3_char((char *)cp, bcolor->active);
}
else if (boneflag & BONE_SELECTED) {
- VECCOPY(cp, bcolor->select);
+ copy_v3_v3_char((char *)cp, bcolor->select);
}
else {
- VECCOPY(cp, bcolor->solid);
+ copy_v3_v3_char((char *)cp, bcolor->solid);
}
glColor3ubv(cp);
@@ -239,15 +239,15 @@ static short set_pchan_glColor (short colCode, int boneflag, short constflag)
unsigned char cp[3];
if (boneflag & BONE_DRAW_ACTIVE) {
- VECCOPY(cp, bcolor->active);
+ copy_v3_v3_char((char *)cp, bcolor->active);
cp_shade_color3ub(cp, 10);
}
else if (boneflag & BONE_SELECTED) {
- VECCOPY(cp, bcolor->select);
+ copy_v3_v3_char((char *)cp, bcolor->select);
cp_shade_color3ub(cp, -30);
}
else {
- VECCOPY(cp, bcolor->solid);
+ copy_v3_v3_char((char *)cp, bcolor->solid);
cp_shade_color3ub(cp, -30);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 920494dcec2..6f40f28ea5c 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5005,7 +5005,7 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
int skip= nu->resolu/16;
while (nr-->0) { /* accounts for empty bevel lists */
- float fac= bevp->radius * ts->normalsize;
+ const float fac= bevp->radius * ts->normalsize;
float vec_a[3]; // Offset perpendicular to the curve
float vec_b[3]; // Delta along the curve
@@ -5021,9 +5021,9 @@ static void drawnurb(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
mul_qt_v3(bevp->quat, vec_b);
add_v3_v3(vec_a, bevp->vec);
add_v3_v3(vec_b, bevp->vec);
-
- VECSUBFAC(vec_a, vec_a, bevp->dir, fac);
- VECSUBFAC(vec_b, vec_b, bevp->dir, fac);
+
+ madd_v3_v3fl(vec_a, bevp->dir, -fac);
+ madd_v3_v3fl(vec_b, bevp->dir, -fac);
glBegin(GL_LINE_STRIP);
glVertex3fv(vec_a);
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 97311035939..df3e83fed15 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -243,7 +243,7 @@ void draw_volume(ARegion *ar, GPUTexture *tex, float *min, float *max, int res[3
tstart();
- VECSUB(size, max, min);
+ sub_v3_v3v3(size, max, min);
// maxx, maxy, maxz
cv[0][0] = max[0];
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index e7fbdaf1deb..b677a8fd7cf 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -3462,8 +3462,8 @@ int ED_view3d_autodist_depth_seg(struct ARegion *ar, const int mval_sta[2], cons
data.margin= margin;
data.depth= FLT_MAX;
- VECCOPY2D(p1, mval_sta);
- VECCOPY2D(p2, mval_end);
+ copy_v2_v2_int(p1, mval_sta);
+ copy_v2_v2_int(p2, mval_end);
plot_line_v2v2i(p1, p2, depth_segment_cb, &data);
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index e9db9fe1d7e..0cdb7a19995 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -314,7 +314,7 @@ static int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *even
fly->timer= WM_event_add_timer(CTX_wm_manager(C), CTX_wm_window(C), TIMER, 0.01f);
- VECCOPY2D(fly->mval, event->mval)
+ copy_v2_v2_int(fly->mval, event->mval);
fly->ndof = NULL;
fly->time_lastdraw= fly->time_lastwheel= PIL_check_seconds_timer();
@@ -475,7 +475,7 @@ static void flyEvent(FlyInfo *fly, wmEvent *event)
fly->redraw = 1;
}
else if (event->type == MOUSEMOVE) {
- VECCOPY2D(fly->mval, event->mval);
+ copy_v2_v2_int(fly->mval, event->mval);
}
else if (event->type == NDOF_MOTION) {
// do these automagically get delivered? yes.
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 345172a1c00..99d7017258f 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -552,7 +552,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
if (t->modifiers & MOD_CONSTRAINT_SELECT)
t->con.mode |= CON_SELECT;
- VECCOPY2D(t->mval, event->mval);
+ copy_v2_v2_int(t->mval, event->mval);
// t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
t->redraw |= TREDRAW_HARD;
@@ -3887,7 +3887,7 @@ int Bevel(TransInfo *t, const int UNUSED(mval[2]))
else {
d = distance;
}
- VECADDFAC(td->loc,td->center,td->axismtx[0],(*td->val)*d);
+ madd_v3_v3v3fl(td->loc, td->center, td->axismtx[0], (*td->val) * d);
}
recalcData(t);
@@ -4439,9 +4439,9 @@ static int createSlideVerts(TransInfo *t)
sv->v = v;
sv->origvert = *v;
- VECCOPY(sv->upvec, vec);
+ copy_v3_v3(sv->upvec, vec);
if (l2)
- VECCOPY(sv->downvec, vec2);
+ copy_v3_v3(sv->downvec, vec2);
l = BM_OtherFaceLoop(l1->e, l1->f, v);
sv->up = BM_OtherEdgeVert(l->e, v);
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 5b8b1ada1dd..d391289df15 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -3097,8 +3097,8 @@ static TransData *ActionFCurveToTransData(TransData *td, TransData2D **td2dv, FC
td2d->h1 = bezt->vec[0];
td2d->h2 = bezt->vec[2];
- VECCOPY2D(td2d->ih1, td2d->h1);
- VECCOPY2D(td2d->ih2, td2d->h2);
+ copy_v2_v2(td2d->ih1, td2d->h1);
+ copy_v2_v2(td2d->ih2, td2d->h2);
td++;
td2d++;
@@ -3354,14 +3354,14 @@ static void bezt_to_transdata (TransData *td, TransData2D *td2d, AnimData *adt,
if (td->flag & TD_MOVEHANDLE1) {
td2d->h1 = bezt->vec[0];
- VECCOPY2D(td2d->ih1, td2d->h1);
+ copy_v2_v2(td2d->ih1, td2d->h1);
}
else
td2d->h1 = NULL;
if (td->flag & TD_MOVEHANDLE2) {
td2d->h2 = bezt->vec[2];
- VECCOPY2D(td2d->ih2, td2d->h2);
+ copy_v2_v2(td2d->ih2, td2d->h2);
}
else
td2d->h2 = NULL;
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 5a90d9866d1..09a4e366611 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -943,7 +943,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (event)
{
- VECCOPY2D(t->imval, event->mval);
+ copy_v2_v2_int(t->imval, event->mval);
t->event_type = event->type;
}
else
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index cc3ffe086f1..3de68a6e312 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -409,7 +409,7 @@ int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)
t->modifiers |= MOD_PRECISION;
/* shift is modifier for higher precision transform
* store the mouse position where the normal movement ended */
- VECCOPY2D(mi->precision_mval, event->mval);
+ copy_v2_v2_int(mi->precision_mval, event->mval);
mi->precision = 1;
}
else
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index d532d7d350b..69753032f42 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -606,11 +606,11 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
if(BM_TestHFlag(efa, BM_SELECT)) {
- VECADD(normal, normal, efa->no);
+ add_v3_v3(normal, efa->no);
sub_v3_v3v3(vec,
((BMLoopList*)efa->loops.first)->first->v->co,
(((BMLoopList*)efa->loops.first)->first->next)->v->co);
- VECADD(plane, plane, vec);
+ add_v3_v3(plane, vec);
}
}
@@ -666,7 +666,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
if(BM_TestHFlag(eed, BM_SELECT)) {
/* use average vert normals as plane and edge vector as normal */
copy_v3_v3(plane, eed->v1->no);
- VECADD(plane, plane, eed->v2->no);
+ add_v3_v3(plane, eed->v2->no);
sub_v3_v3v3(normal, eed->v2->co, eed->v1->co);
break;
}
@@ -687,7 +687,7 @@ int getTransformOrientation(const bContext *C, float normal[3], float plane[3],
v2 = eve;
copy_v3_v3(plane, v1->no);
- VECADD(plane, plane, v2->no);
+ add_v3_v3(plane, v2->no);
sub_v3_v3v3(normal, v2->co, v1->co);
break;
}
diff --git a/source/blender/editors/util/crazyspace.c b/source/blender/editors/util/crazyspace.c
index f4e1773db49..8c5d7d6990b 100644
--- a/source/blender/editors/util/crazyspace.c
+++ b/source/blender/editors/util/crazyspace.c
@@ -81,7 +81,7 @@ static void make_vertexcos__mapFunc(void *userData, int index, float *co, float
if(!mappedData->flags[index]) {
/* we need coord from prototype vertex, not it clones or images,
suppose they stored in the beginning of vertex array stored in DM */
- VECCOPY(vec, co);
+ copy_v3_v3(vec, co);
mappedData->flags[index]= 1;
}
}
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c
index 048bb17b183..04eb940393f 100644
--- a/source/blender/editors/uvedit/uvedit_draw.c
+++ b/source/blender/editors/uvedit/uvedit_draw.c
@@ -312,10 +312,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
#endif
/* uv angles */
- VECSUB2D(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1);
- VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
- VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
- VECSUB2D(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4);
+ sub_v2_v2v2(av1, tf_uv[3], tf_uv[0]); normalize_v2(av1);
+ sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
+ sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
+ sub_v2_v2v2(av4, tf_uv[2], tf_uv[3]); normalize_v2(av4);
/* This is the correct angle however we are only comparing angles
* uvang1 = 90-((angle_normalized_v2v2(av1, av2) * RAD2DEGF(1.0f))-90);*/
@@ -325,10 +325,10 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
uvang4 = angle_normalized_v2v2(av4, av1);
/* 3d angles */
- VECSUB(av1, efa->v4->co, efa->v1->co); normalize_v3(av1);
- VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
- VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
- VECSUB(av4, efa->v3->co, efa->v4->co); normalize_v3(av4);
+ sub_v3_v3v3(av1, efa->v4->co, efa->v1->co); normalize_v3(av1);
+ sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
+ sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
+ sub_v3_v3v3(av4, efa->v3->co, efa->v4->co); normalize_v3(av4);
/* This is the correct angle however we are only comparing angles
* ang1 = 90-((angle_normalized_v3v3(av1, av2) * RAD2DEGF(1.0f))-90);*/
@@ -373,9 +373,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
#endif
/* uv angles */
- VECSUB2D(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1);
- VECSUB2D(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
- VECSUB2D(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
+ sub_v2_v2v2(av1, tf_uv[2], tf_uv[0]); normalize_v2(av1);
+ sub_v2_v2v2(av2, tf_uv[0], tf_uv[1]); normalize_v2(av2);
+ sub_v2_v2v2(av3, tf_uv[1], tf_uv[2]); normalize_v2(av3);
/* This is the correct angle however we are only comparing angles
* uvang1 = 90-((angle_normalized_v2v2(av1, av2) * 180.0/M_PI)-90); */
@@ -384,9 +384,9 @@ static void draw_uvs_stretch(SpaceImage *sima, Scene *scene, BMEditMesh *em, MTe
uvang3 = angle_normalized_v2v2(av3, av1);
/* 3d angles */
- VECSUB(av1, efa->v3->co, efa->v1->co); normalize_v3(av1);
- VECSUB(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
- VECSUB(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
+ sub_v3_v3v3(av1, efa->v3->co, efa->v1->co); normalize_v3(av1);
+ sub_v3_v3v3(av2, efa->v1->co, efa->v2->co); normalize_v3(av2);
+ sub_v3_v3v3(av3, efa->v2->co, efa->v3->co); normalize_v3(av3);
/* This is the correct angle however we are only comparing angles
* ang1 = 90-((angle_normalized_v3v3(av1, av2) * 180.0/M_PI)-90); */
ang1 = angle_normalized_v3v3(av1, av2);
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 72f49ebabe8..a5ab889417a 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -2799,7 +2799,7 @@ static int snap_uvs_to_cursor(Scene *scene, Image *ima, Object *obedit, SpaceIma
BM_ITER(l, &liter, em->bm, BM_LOOPS_OF_FACE, efa) {
if(uvedit_uv_selected(em, scene, l)) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
- VECCOPY2D(luv->uv, sima->cursor);
+ copy_v2_v2(luv->uv, sima->cursor);
change= 1;
}
}
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 26c08f6cae5..9344b4e680a 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -260,7 +260,7 @@ void GPU_material_bind(GPUMaterial *material, int oblay, int viewlay, double tim
if(!lamp->hide && (lamp->lay & viewlay) && (!(lamp->mode & LA_LAYER) || (lamp->lay & oblay))) {
lamp->dynenergy = lamp->energy;
- VECCOPY(lamp->dyncol, lamp->col);
+ copy_v3_v3(lamp->dyncol, lamp->col);
}
else {
lamp->dynenergy = 0.0f;
@@ -296,7 +296,7 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float v
GPU_shader_uniform_vector(shader, material->invobmatloc, 16, 1, (float*)invmat);
}
if(material->builtins & GPU_OBCOLOR) {
- QUATCOPY(col, obcol);
+ copy_v4_v4(col, obcol);
CLAMP(col[3], 0.0f, 1.0f);
GPU_shader_uniform_vector(shader, material->obcolloc, 4, 1, col);
}
@@ -306,14 +306,14 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float v
lamp= nlink->data;
if(material->dynproperty & DYN_LAMP_VEC) {
- VECCOPY(lamp->dynvec, lamp->vec);
+ copy_v3_v3(lamp->dynvec, lamp->vec);
normalize_v3(lamp->dynvec);
negate_v3(lamp->dynvec);
mul_mat3_m4_v3(viewmat, lamp->dynvec);
}
if(material->dynproperty & DYN_LAMP_CO) {
- VECCOPY(lamp->dynco, lamp->co);
+ copy_v3_v3(lamp->dynco, lamp->co);
mul_m4_v3(viewmat, lamp->dynco);
}
@@ -1472,8 +1472,8 @@ void GPU_lamp_update(GPULamp *lamp, int lay, int hide, float obmat[][4])
copy_m4_m4(mat, obmat);
normalize_m4(mat);
- VECCOPY(lamp->vec, mat[2]);
- VECCOPY(lamp->co, mat[3]);
+ copy_v3_v3(lamp->vec, mat[2]);
+ copy_v3_v3(lamp->co, mat[3]);
copy_m4_m4(lamp->obmat, mat);
invert_m4_m4(lamp->imat, mat);
}
diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c
index cfaafe9bf5c..787766f0fa6 100644
--- a/source/blender/ikplugin/intern/iksolver_plugin.c
+++ b/source/blender/ikplugin/intern/iksolver_plugin.c
@@ -205,9 +205,9 @@ static void where_is_ik_bone(bPoseChannel *pchan, float ik_mat[][3]) // nr = t
mul_m4_m4m4(pchan->pose_mat, ikmat, pchan->chan_mat);
/* calculate head */
- VECCOPY(pchan->pose_head, pchan->pose_mat[3]);
+ copy_v3_v3(pchan->pose_head, pchan->pose_mat[3]);
/* calculate tail */
- VECCOPY(vec, pchan->pose_mat[1]);
+ copy_v3_v3(vec, pchan->pose_mat[1]);
mul_v3_fl(vec, pchan->bone->length);
add_v3_v3v3(pchan->pose_tail, pchan->pose_head, vec);
@@ -340,7 +340,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
copy_m4_m4(rootmat, pchan->parent->pose_mat);
else
unit_m4(rootmat);
- VECCOPY(rootmat[3], pchan->pose_head);
+ copy_v3_v3(rootmat[3], pchan->pose_head);
mul_m4_m4m4(imat, rootmat, ob->obmat);
invert_m4_m4(goalinv, imat);
@@ -359,7 +359,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
/* and set and transform goal */
mul_m4_m4m4(goal, rootmat, goalinv);
- VECCOPY(goalpos, goal[3]);
+ copy_v3_v3(goalpos, goal[3]);
copy_m3_m4(goalrot, goal);
/* same for pole vector target */
@@ -372,7 +372,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
}
else {
mul_m4_m4m4(goal, rootmat, goalinv);
- VECCOPY(polepos, goal[3]);
+ copy_v3_v3(polepos, goal[3]);
poleconstrain= 1;
/* for pole targets, we blend the result of the ik solver
@@ -398,7 +398,7 @@ static void execute_posetree(struct Scene *scene, Object *ob, PoseTree *tree)
/* end effector in world space */
copy_m4_m4(end_pose, pchan->pose_mat);
- VECCOPY(end_pose[3], pchan->pose_tail);
+ copy_v3_v3(end_pose[3], pchan->pose_tail);
mul_serie_m4(world_pose, goalinv, ob->obmat, end_pose, NULL, NULL, NULL, NULL, NULL);
/* blend position */
diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp
index 400e720f138..2cb3a32ae3e 100644
--- a/source/blender/ikplugin/intern/itasc_plugin.cpp
+++ b/source/blender/ikplugin/intern/itasc_plugin.cpp
@@ -558,7 +558,7 @@ static bool target_callback(const iTaSC::Timestamp& timestamp, const iTaSC::Fram
pchan = pchan->parent;
float chanmat[4][4];
copy_m4_m4(chanmat, pchan->pose_mat);
- VECCOPY(chanmat[3], pchan->pose_tail);
+ copy_v3_v3(chanmat[3], pchan->pose_tail);
mul_serie_m4(restmat, target->owner->obmat, chanmat, target->eeRest, NULL, NULL, NULL, NULL, NULL);
}
else {
@@ -585,7 +585,7 @@ static bool base_callback(const iTaSC::Timestamp& timestamp, const iTaSC::Frame&
pchan = pchan->parent;
float chanmat[4][4];
copy_m4_m4(chanmat, pchan->pose_mat);
- VECCOPY(chanmat[3], pchan->pose_tail);
+ copy_v3_v3(chanmat[3], pchan->pose_tail);
// save the base as a frame too so that we can compute deformation
// after simulation
ikscene->baseFrame.setValue(&chanmat[0][0]);
@@ -1662,12 +1662,12 @@ static void execute_scene(Scene* blscene, IK_Scene* ikscene, bItasc* ikparam, fl
pchan = ikchan->pchan;
// tail mat
ikchan->frame.getValue(&pchan->pose_mat[0][0]);
- VECCOPY(pchan->pose_tail, pchan->pose_mat[3]);
+ copy_v3_v3(pchan->pose_tail, pchan->pose_mat[3]);
// shift to head
- VECCOPY(yaxis, pchan->pose_mat[1]);
+ copy_v3_v3(yaxis, pchan->pose_mat[1]);
mul_v3_fl(yaxis, length);
sub_v3_v3v3(pchan->pose_mat[3], pchan->pose_mat[3], yaxis);
- VECCOPY(pchan->pose_head, pchan->pose_mat[3]);
+ copy_v3_v3(pchan->pose_head, pchan->pose_mat[3]);
// add scale
mul_v3_fl(pchan->pose_mat[0], scale);
mul_v3_fl(pchan->pose_mat[1], scale);
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index e67ab012dc9..1ea1a4e3e7b 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -283,7 +283,7 @@ static void rna_EditBone_connected_check(EditBone *ebone)
if(ebone->parent) {
if(ebone->flag & BONE_CONNECTED) {
/* Attach this bone to its parent */
- VECCOPY(ebone->head, ebone->parent->tail);
+ copy_v3_v3(ebone->head, ebone->parent->tail);
if(ebone->flag & BONE_ROOTSEL)
ebone->parent->flag |= BONE_TIPSEL;
@@ -350,7 +350,7 @@ static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
sub_v3_v3v3(delta, ebone->tail, ebone->head);
vec_roll_to_mat3(delta, ebone->roll, tmat);
copy_m4_m3(mat, tmat);
- VECCOPY(mat[3], ebone->head);
+ copy_v3_v3(mat[3], ebone->head);
memcpy(values, mat, 16 * sizeof(float));
}
@@ -363,12 +363,12 @@ static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, Po
/* update our parent */
if(ebone->parent && ebone->flag & BONE_CONNECTED)
- VECCOPY(ebone->parent->tail, ebone->head)
+ copy_v3_v3(ebone->parent->tail, ebone->head);
/* update our children if necessary */
for(child = arm->edbo->first; child; child=child->next)
if(child->parent == ebone && (child->flag & BONE_CONNECTED))
- VECCOPY(child->head, ebone->tail);
+ copy_v3_v3(child->head, ebone->tail);
if(arm->flag & ARM_MIRROR_EDIT) {
eboflip= ED_armature_bone_get_mirrored(arm->edbo, ebone);
@@ -381,12 +381,12 @@ static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, Po
/* update our parent */
if(eboflip->parent && eboflip->flag & BONE_CONNECTED)
- VECCOPY(eboflip->parent->tail, eboflip->head);
+ copy_v3_v3(eboflip->parent->tail, eboflip->head);
/* update our children if necessary */
for(child = arm->edbo->first; child; child=child->next)
if(child->parent == eboflip && (child->flag & BONE_CONNECTED))
- VECCOPY (child->head, eboflip->tail);
+ copy_v3_v3 (child->head, eboflip->tail);
}
}
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index ed28dda8076..26dc7076101 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -75,7 +75,7 @@ static int dependsOnTime(ModifierData *UNUSED(md))
return 1;
}
-static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
+static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
DerivedMesh *derivedData,
int UNUSED(useRenderParams),
int UNUSED(isFinalCalc))
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index eae7dcef26d..1b9c0061494 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -257,7 +257,7 @@ static DerivedMesh * applyModifier(ModifierData *md, Object *ob,
mul_qt_v3(state.rot,mv->co);
if(pimd->flag & eParticleInstanceFlag_UseSize)
mul_v3_fl(mv->co, size[i/totvert]);
- VECADD(mv->co,mv->co,state.co);
+ add_v3_v3(mv->co, state.co);
}
mface=result->getTessFaceArray(result);
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 6b691ad63aa..4485346bf55 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -198,7 +198,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
for(i=0; i<numVerts; i++)
{
float tmp[3];
- VECCOPY(tmp, vertexCos[i]);
+ copy_v3_v3(tmp, vertexCos[i]);
if(transf) space_transform_apply(transf, tmp);
@@ -236,7 +236,7 @@ static void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object
if(transf) space_transform_apply(transf, vertexCos[i]);
- VECCOPY(co, vertexCos[i]);
+ copy_v3_v3(co, vertexCos[i]);
//Apply axis limits
if(smd->mode != MOD_SIMPLEDEFORM_MODE_BEND) //Bend mode shoulnt have any lock axis
diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c
index 929b87618d8..0356ed394f1 100644
--- a/source/blender/nodes/composite/node_composite_util.c
+++ b/source/blender/nodes/composite/node_composite_util.c
@@ -317,8 +317,8 @@ CompBuf *typecheck_compbuf(CompBuf *inbuf, int type)
if(inbuf->rect_procedural) {
outbuf->rect_procedural= inbuf->rect_procedural;
- VECCOPY(outbuf->procedural_size, inbuf->procedural_size);
- VECCOPY(outbuf->procedural_offset, inbuf->procedural_offset);
+ copy_v3_v3(outbuf->procedural_size, inbuf->procedural_size);
+ copy_v3_v3(outbuf->procedural_offset, inbuf->procedural_offset);
outbuf->procedural_type= inbuf->procedural_type;
outbuf->node= inbuf->node;
return outbuf;
@@ -707,12 +707,12 @@ void do_ycca_to_rgba(bNode *UNUSED(node), float *out, float *in)
void do_copy_rgba(bNode *UNUSED(node), float *out, float *in)
{
- QUATCOPY(out, in);
+ copy_v4_v4(out, in);
}
void do_copy_rgb(bNode *UNUSED(node), float *out, float *in)
{
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
out[3]= 1.0f;
}
@@ -723,7 +723,7 @@ void do_copy_value(bNode *UNUSED(node), float *out, float *in)
void do_copy_a_rgba(bNode *UNUSED(node), float *out, float *in, float *fac)
{
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
out[3]= *fac;
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
index b542954948a..4fd4b750178 100644
--- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
+++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.c
@@ -48,10 +48,10 @@ static void do_alphaover_premul(bNode *UNUSED(node), float *out, float *src, flo
{
if(over[3]<=0.0f) {
- QUATCOPY(out, src);
+ copy_v4_v4(out, src);
}
else if(fac[0]==1.0f && over[3]>=1.0f) {
- QUATCOPY(out, over);
+ copy_v4_v4(out, over);
}
else {
float mul= 1.0f - fac[0]*over[3];
@@ -68,10 +68,10 @@ static void do_alphaover_key(bNode *UNUSED(node), float *out, float *src, float
{
if(over[3]<=0.0f) {
- QUATCOPY(out, src);
+ copy_v4_v4(out, src);
}
else if(fac[0]==1.0f && over[3]>=1.0f) {
- QUATCOPY(out, over);
+ copy_v4_v4(out, over);
}
else {
float premul= fac[0]*over[3];
@@ -89,10 +89,10 @@ static void do_alphaover_mixed(bNode *node, float *out, float *src, float *over,
{
if(over[3]<=0.0f) {
- QUATCOPY(out, src);
+ copy_v4_v4(out, src);
}
else if(fac[0]==1.0f && over[3]>=1.0f) {
- QUATCOPY(out, over);
+ copy_v4_v4(out, over);
}
else {
NodeTwoFloats *ntf= node->storage;
diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.c b/source/blender/nodes/composite/nodes/node_composite_blur.c
index 188ac653506..d0ddfb47f08 100644
--- a/source/blender/nodes/composite/nodes/node_composite_blur.c
+++ b/source/blender/nodes/composite/nodes/node_composite_blur.c
@@ -512,7 +512,7 @@ static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf
if(pix==1)
dest[0]= src[0];
else
- QUATCOPY(dest, src);
+ copy_v4_v4(dest, src);
}
else {
int minxr= x-refradx<0?-x:-refradx;
diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
index 3dfc3a193a8..b226e562799 100644
--- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.c
@@ -52,7 +52,7 @@ static void do_color_key(bNode *node, float *out, float *in)
c=node->storage;
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
if(
/* do hue last because it needs to wrap, and does some more checks */
diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.c b/source/blender/nodes/composite/nodes/node_composite_curves.c
index 675710942fb..6f4d32f6573 100644
--- a/source/blender/nodes/composite/nodes/node_composite_curves.c
+++ b/source/blender/nodes/composite/nodes/node_composite_curves.c
@@ -144,7 +144,7 @@ static void do_curves_fac(bNode *node, float *out, float *in, float *fac)
if(*fac>=1.0)
curvemapping_evaluate_premulRGBF(node->storage, out, in);
else if(*fac<=0.0) {
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
}
else {
float col[4], mfac= 1.0f-*fac;
@@ -175,7 +175,7 @@ static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeS
curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec);
- if(in[0]->vec[0] == 1.0)
+ if(in[0]->data==NULL && in[0]->vec[0] == 1.0)
composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA);
else
composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL);
diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
index c621d524044..17156ab3492 100644
--- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.c
@@ -60,7 +60,7 @@ static void do_diff_matte(bNode *node, float *outColor, float *inColor1, float *
/*average together the distances*/
difference=difference/3.0;
- VECCOPY(outColor, inColor1);
+ copy_v3_v3(outColor, inColor1);
/*make 100% transparent*/
if(difference < tolerence) {
diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
index 401b143aac3..27fe66cbe0d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
+++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.c
@@ -59,7 +59,7 @@ static void do_distance_matte(bNode *node, float *out, float *in)
(c->key[1]-in[1])*(c->key[1]-in[1]) +
(c->key[2]-in[2])*(c->key[2]-in[2]));
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
/*make 100% transparent */
if(distance < tolerence) {
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.c b/source/blender/nodes/composite/nodes/node_composite_filter.c
index 071ee84377c..1a0c51fab53 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.c
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.c
@@ -64,7 +64,7 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
fp= out->rect + pix*y*rowlen;
if(pix==CB_RGBA) {
- QUATCOPY(fp, row2);
+ copy_v4_v4(fp, row2);
fp+= pix;
for(x=2; x<rowlen; x++) {
@@ -78,7 +78,7 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
/* no alpha... will clear it completely */
fp++; row1++; row2++; row3++;
}
- QUATCOPY(fp, row2+4);
+ copy_v4_v4(fp, row2+4);
}
else if(pix==CB_VAL) {
fp+= pix;
@@ -138,7 +138,7 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
fp[1]= row2[3];
}
else if(pixlen==3) {
- VECCOPY(fp, row2);
+ copy_v3_v3(fp, row2);
fp+= 3;
for(x=2; x<rowlen; x++) {
@@ -147,10 +147,10 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
fp++; row1++; row2++; row3++;
}
}
- VECCOPY(fp, row2+3);
+ copy_v3_v3(fp, row2+3);
}
else {
- QUATCOPY(fp, row2);
+ copy_v4_v4(fp, row2);
fp+= 4;
for(x=2; x<rowlen; x++) {
@@ -159,7 +159,7 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
fp++; row1++; row2++; row3++;
}
}
- QUATCOPY(fp, row2+4);
+ copy_v4_v4(fp, row2+4);
}
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
index c2304b37c0d..3c73d07d96c 100644
--- a/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_hueSatVal.c
@@ -64,7 +64,7 @@ static void do_hue_sat_fac(bNode *node, float *out, float *in, float *fac)
out[3]= in[3];
}
else {
- QUATCOPY(out, in);
+ copy_v4_v4(out, in);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.c b/source/blender/nodes/composite/nodes/node_composite_invert.c
index c428e37bd35..daf2ee0cbe7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_invert.c
+++ b/source/blender/nodes/composite/nodes/node_composite_invert.c
@@ -50,7 +50,7 @@ static void do_invert(bNode *node, float *out, float *in)
out[1] = 1.0f - in[1];
out[2] = 1.0f - in[2];
} else
- VECCOPY(out, in);
+ copy_v3_v3(out, in);
if(node->custom1 & CMP_CHAN_A)
out[3] = 1.0f - in[3];
@@ -75,7 +75,7 @@ static void do_invert_fac(bNode *node, float *out, float *in, float *fac)
if(node->custom1 & CMP_CHAN_A)
col[3] = fac[0]*col[3] + (facm*in[3]);
- QUATCOPY(out, col);
+ copy_v4_v4(out, col);
}
static void node_composit_exec_invert(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out)
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
index 0f5a2b61b87..275d949da28 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.c
@@ -47,12 +47,12 @@ static void do_mix_rgb(bNode *node, float *out, float *in1, float *in2, float *f
{
float col[3];
- VECCOPY(col, in1);
+ copy_v3_v3(col, in1);
if(node->custom2)
ramp_blend(node->custom1, col, col+1, col+2, in2[3]*fac[0], in2);
else
ramp_blend(node->custom1, col, col+1, col+2, fac[0], in2);
- VECCOPY(out, col);
+ copy_v3_v3(out, col);
out[3]= in1[3];
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_normal.c b/source/blender/nodes/composite/nodes/node_composite_normal.c
index a19b339e674..4c43871d867 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normal.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normal.c
@@ -64,9 +64,9 @@ static void node_composit_exec_normal(void *UNUSED(data), bNode *node, bNodeStac
/* input no image? then only vector op */
if(in[0]->data==NULL) {
- VECCOPY(out[0]->vec, nor);
+ copy_v3_v3(out[0]->vec, nor);
/* render normals point inside... the widget points outside */
- out[1]->vec[0]= -INPR(out[0]->vec, in[0]->vec);
+ out[1]->vec[0]= -dot_v3v3(out[0]->vec, in[0]->vec);
}
else if(out[1]->hasoutput) {
/* make output size of input image */
diff --git a/source/blender/nodes/composite/nodes/node_composite_normalize.c b/source/blender/nodes/composite/nodes/node_composite_normalize.c
index 36206d82d0b..a6220fbd20d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_normalize.c
+++ b/source/blender/nodes/composite/nodes/node_composite_normalize.c
@@ -69,7 +69,7 @@ static void node_composit_exec_normalize(void *UNUSED(data), bNode *node, bNodeS
/* Input has no image buffer? Then pass the value */
if(in[0]->data==NULL) {
- QUATCOPY(out[0]->vec, in[0]->vec);
+ copy_v4_v4(out[0]->vec, in[0]->vec);
}
else {
float min = 1.0f+BLENDER_ZMAX;
diff --git a/source/blender/nodes/composite/nodes/node_composite_rgb.c b/source/blender/nodes/composite/nodes/node_composite_rgb.c
index a7c820ddce6..12f073a816d 100644
--- a/source/blender/nodes/composite/nodes/node_composite_rgb.c
+++ b/source/blender/nodes/composite/nodes/node_composite_rgb.c
@@ -55,7 +55,7 @@ static void node_composit_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack *
bNodeSocket *sock= node->outputs.first;
float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
- QUATCOPY(out[0]->vec, col);
+ copy_v4_v4(out[0]->vec, col);
}
void register_node_type_cmp_rgb(ListBase *lb)
diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
index 22f3dd3a7b0..b63b42224e2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
+++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.c
@@ -42,10 +42,10 @@ static bNodeSocketTemplate cmp_node_splitviewer_in[]= {
static void do_copy_split_rgba(bNode *UNUSED(node), float *out, float *in1, float *in2, float *fac)
{
if(*fac==0.0f) {
- QUATCOPY(out, in1);
+ copy_v4_v4(out, in1);
}
else {
- QUATCOPY(out, in2);
+ copy_v4_v4(out, in2);
}
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_texture.c b/source/blender/nodes/composite/nodes/node_composite_texture.c
index 24d7b30f11d..2f54f27e481 100644
--- a/source/blender/nodes/composite/nodes/node_composite_texture.c
+++ b/source/blender/nodes/composite/nodes/node_composite_texture.c
@@ -80,7 +80,7 @@ static void texture_procedural(CompBuf *cbuf, float *out, float xco, float yco)
else col[0]= col[1]= col[2]= col[3];
}
else {
- VECCOPY(col, nor);
+ copy_v3_v3(col, nor);
}
typecheck_compbuf_color(out, col, cbuf->type, cbuf->procedural_type);
@@ -101,8 +101,8 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
prevbuf->rect_procedural= texture_procedural;
prevbuf->node= node;
- VECCOPY(prevbuf->procedural_offset, in[0]->vec);
- VECCOPY(prevbuf->procedural_size, in[1]->vec);
+ copy_v3_v3(prevbuf->procedural_offset, in[0]->vec);
+ copy_v3_v3(prevbuf->procedural_size, in[1]->vec);
prevbuf->procedural_type= CB_RGBA;
composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
@@ -118,8 +118,8 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
stackbuf->rect_procedural= texture_procedural;
stackbuf->node= node;
- VECCOPY(stackbuf->procedural_offset, in[0]->vec);
- VECCOPY(stackbuf->procedural_size, in[1]->vec);
+ copy_v3_v3(stackbuf->procedural_offset, in[0]->vec);
+ copy_v3_v3(stackbuf->procedural_size, in[1]->vec);
stackbuf->procedural_type= CB_VAL;
composit1_pixel_processor(node, stackbuf, stackbuf, out[0]->vec, do_copy_value, CB_VAL);
stackbuf->rect_procedural= NULL;
@@ -131,8 +131,8 @@ static void node_composit_exec_texture(void *data, bNode *node, bNodeStack **in,
stackbuf->rect_procedural= texture_procedural;
stackbuf->node= node;
- VECCOPY(stackbuf->procedural_offset, in[0]->vec);
- VECCOPY(stackbuf->procedural_size, in[1]->vec);
+ copy_v3_v3(stackbuf->procedural_offset, in[0]->vec);
+ copy_v3_v3(stackbuf->procedural_size, in[1]->vec);
stackbuf->procedural_type= CB_RGBA;
composit1_pixel_processor(node, stackbuf, stackbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
stackbuf->rect_procedural= NULL;
diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.c b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
index 7aac3539960..868c0d2b5f3 100644
--- a/source/blender/nodes/composite/nodes/node_composite_zcombine.c
+++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.c
@@ -65,7 +65,7 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
}
else {
// do combination based solely on z value
- QUATCOPY(out, src1);
+ copy_v4_v4(out, src1);
}
}
else {
@@ -80,7 +80,7 @@ static void do_zcombine(bNode *node, float *out, float *src1, float *z1, float *
}
else {
// do combination based solely on z value
- QUATCOPY(out, src1);
+ copy_v4_v4(out, src1);
}
if(node->custom2)
diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c
index 1acb04c9b41..0c86d8fd5e4 100644
--- a/source/blender/nodes/shader/node_shader_util.c
+++ b/source/blender/nodes/shader/node_shader_util.c
@@ -55,12 +55,12 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
in[2]= from[0];
}
else {
- VECCOPY(in, from);
+ copy_v3_v3(in, from);
}
}
else { /* type_in==SOCK_RGBA */
if(ns->sockettype==SOCK_RGBA) {
- QUATCOPY(in, from);
+ copy_v4_v4(in, from);
}
else if(ns->sockettype==SOCK_FLOAT) {
in[0]= from[0];
@@ -69,7 +69,7 @@ void nodestack_get_vec(float *in, short type_in, bNodeStack *ns)
in[3]= 1.0f;
}
else {
- VECCOPY(in, from);
+ copy_v3_v3(in, from);
in[3]= 1.0f;
}
}
@@ -140,13 +140,13 @@ void nodeShaderSynchronizeID(bNode *node, int copyto)
if(copyto) {
switch(a) {
case MAT_IN_COLOR:
- VECCOPY(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
+ copy_v3_v3(&ma->r, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
case MAT_IN_SPEC:
- VECCOPY(&ma->specr, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
+ copy_v3_v3(&ma->specr, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
case MAT_IN_REFL:
ma->ref= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
case MAT_IN_MIR:
- VECCOPY(&ma->mirr, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
+ copy_v3_v3(&ma->mirr, ((bNodeSocketValueRGBA*)sock->default_value)->value); break;
case MAT_IN_AMB:
ma->amb= ((bNodeSocketValueFloat*)sock->default_value)->value; break;
case MAT_IN_EMIT:
@@ -164,13 +164,13 @@ void nodeShaderSynchronizeID(bNode *node, int copyto)
else {
switch(a) {
case MAT_IN_COLOR:
- VECCOPY(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->r); break;
+ copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->r); break;
case MAT_IN_SPEC:
- VECCOPY(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->specr); break;
+ copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->specr); break;
case MAT_IN_REFL:
((bNodeSocketValueFloat*)sock->default_value)->value= ma->ref; break;
case MAT_IN_MIR:
- VECCOPY(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->mirr); break;
+ copy_v3_v3(((bNodeSocketValueRGBA*)sock->default_value)->value, &ma->mirr); break;
case MAT_IN_AMB:
((bNodeSocketValueFloat*)sock->default_value)->value= ma->amb; break;
case MAT_IN_EMIT:
@@ -196,7 +196,7 @@ void node_gpu_stack_from_data(struct GPUNodeStack *gs, int type, bNodeStack *ns)
{
memset(gs, 0, sizeof(*gs));
- QUATCOPY(gs->vec, ns->vec);
+ copy_v4_v4(gs->vec, ns->vec);
gs->link= ns->data;
if (type == SOCK_FLOAT)
diff --git a/source/blender/nodes/shader/nodes/node_shader_camera.c b/source/blender/nodes/shader/nodes/node_shader_camera.c
index c7882a6e0e2..02efbd63aba 100644
--- a/source/blender/nodes/shader/nodes/node_shader_camera.c
+++ b/source/blender/nodes/shader/nodes/node_shader_camera.c
@@ -46,7 +46,7 @@ static void node_shader_exec_camera(void *data, bNode *UNUSED(node), bNodeStack
if(data) {
ShadeInput *shi= ((ShaderCallData *)data)->shi; /* Data we need for shading. */
- VECCOPY(out[0]->vec, shi->co); /* get view vector */
+ copy_v3_v3(out[0]->vec, shi->co); /* get view vector */
out[1]->vec[0]= fabs(shi->co[2]); /* get view z-depth */
out[2]->vec[0]= normalize_v3(out[0]->vec); /* get view distance */
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_geom.c b/source/blender/nodes/shader/nodes/node_shader_geom.c
index dedc25092c1..5c4ba75ae67 100644
--- a/source/blender/nodes/shader/nodes/node_shader_geom.c
+++ b/source/blender/nodes/shader/nodes/node_shader_geom.c
@@ -90,7 +90,7 @@ static void node_shader_exec_geom(void *data, bNode *node, bNodeStack **UNUSED(i
}
}
- VECCOPY(out[GEOM_OUT_VCOL]->vec, scol->col);
+ copy_v3_v3(out[GEOM_OUT_VCOL]->vec, scol->col);
out[GEOM_OUT_VCOL]->vec[3]= 1.0f;
}
else
diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
index 7fb31d80ffc..1207196381d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.c
@@ -65,7 +65,7 @@ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float *hue, float *s
out[2]= mfac*in[2] + *fac*col[2];
}
else {
- QUATCOPY(out, in);
+ copy_v4_v4(out, in);
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.c b/source/blender/nodes/shader/nodes/node_shader_invert.c
index 066ff14a870..e3dacefbcf2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_invert.c
+++ b/source/blender/nodes/shader/nodes/node_shader_invert.c
@@ -64,7 +64,7 @@ bNodeStack **out)
col[2] = in[0]->vec[0]*col[2] + (facm*in[1]->vec[2]);
}
- VECCOPY(out[0]->vec, col);
+ copy_v3_v3(out[0]->vec, col);
}
static int gpu_shader_invert(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_material.c b/source/blender/nodes/shader/nodes/node_shader_material.c
index f93928d8884..a74a2567844 100644
--- a/source/blender/nodes/shader/nodes/node_shader_material.c
+++ b/source/blender/nodes/shader/nodes/node_shader_material.c
@@ -148,13 +148,13 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
/* write to outputs */
if(node->custom1 & SH_NODE_MAT_DIFF) {
- VECCOPY(col, shrnode.combined);
+ copy_v3_v3(col, shrnode.combined);
if(!(node->custom1 & SH_NODE_MAT_SPEC)) {
sub_v3_v3(col, shrnode.spec);
}
}
else if(node->custom1 & SH_NODE_MAT_SPEC) {
- VECCOPY(col, shrnode.spec);
+ copy_v3_v3(col, shrnode.spec);
}
else
col[0]= col[1]= col[2]= 0.0f;
@@ -164,7 +164,7 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
if(shi->do_preview)
nodeAddToPreview(node, col, shi->xs, shi->ys, shi->do_manage);
- VECCOPY(out[MAT_OUT_COLOR]->vec, col);
+ copy_v3_v3(out[MAT_OUT_COLOR]->vec, col);
out[MAT_OUT_ALPHA]->vec[0]= shrnode.alpha;
if(node->custom1 & SH_NODE_MAT_NEG) {
@@ -173,15 +173,15 @@ static void node_shader_exec_material(void *data, bNode *node, bNodeStack **in,
shi->vn[2]= -shi->vn[2];
}
- VECCOPY(out[MAT_OUT_NORMAL]->vec, shi->vn);
+ copy_v3_v3(out[MAT_OUT_NORMAL]->vec, shi->vn);
/* Extended material options */
if (node->type == SH_NODE_MATERIAL_EXT) {
/* Shadow, Reflect, Refract, Radiosity, Speed seem to cause problems inside
* a node tree :( */
- VECCOPY(out[MAT_OUT_DIFFUSE]->vec, shrnode.diff);
- VECCOPY(out[MAT_OUT_SPEC]->vec, shrnode.spec);
- VECCOPY(out[MAT_OUT_AO]->vec, shrnode.ao);
+ copy_v3_v3(out[MAT_OUT_DIFFUSE]->vec, shrnode.diff);
+ copy_v3_v3(out[MAT_OUT_SPEC]->vec, shrnode.spec);
+ copy_v3_v3(out[MAT_OUT_AO]->vec, shrnode.ao);
}
/* copy passes, now just active node */
diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
index 7aed6bce4c4..7692956368c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.c
@@ -59,7 +59,7 @@ static void node_shader_exec_mix_rgb(void *UNUSED(data), bNode *node, bNodeStack
nodestack_get_vec(vec, SOCK_VECTOR, in[2]);
ramp_blend(node->custom1, col, col+1, col+2, fac, vec);
- VECCOPY(out[0]->vec, col);
+ copy_v3_v3(out[0]->vec, col);
}
static int gpu_shader_mix_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.c b/source/blender/nodes/shader/nodes/node_shader_normal.c
index c23c6d328cf..40f2f65a193 100644
--- a/source/blender/nodes/shader/nodes/node_shader_normal.c
+++ b/source/blender/nodes/shader/nodes/node_shader_normal.c
@@ -66,7 +66,7 @@ static void node_shader_exec_normal(void *UNUSED(data), bNode *node, bNodeStack
nodestack_get_vec(vec, SOCK_VECTOR, in[0]);
- VECCOPY(out[0]->vec, ((bNodeSocketValueVector*)sock->default_value)->value);
+ copy_v3_v3(out[0]->vec, ((bNodeSocketValueVector*)sock->default_value)->value);
/* render normals point inside... the widget points outside */
out[1]->vec[0]= -INPR(out[0]->vec, vec);
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_output.c b/source/blender/nodes/shader/nodes/node_shader_output.c
index ea7fae8f961..22e3cab532d 100644
--- a/source/blender/nodes/shader/nodes/node_shader_output.c
+++ b/source/blender/nodes/shader/nodes/node_shader_output.c
@@ -57,10 +57,10 @@ static void node_shader_exec_output(void *data, bNode *node, bNodeStack **in, bN
if(node->flag & NODE_DO_OUTPUT) {
ShadeResult *shr= ((ShaderCallData *)data)->shr;
- QUATCOPY(shr->combined, col);
+ copy_v4_v4(shr->combined, col);
shr->alpha= col[3];
- // VECCOPY(shr->nor, in[3]->vec);
+ // copy_v3_v3(shr->nor, in[3]->vec);
}
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb.c b/source/blender/nodes/shader/nodes/node_shader_rgb.c
index 1a0b4ea616b..67c0ec165ca 100644
--- a/source/blender/nodes/shader/nodes/node_shader_rgb.c
+++ b/source/blender/nodes/shader/nodes/node_shader_rgb.c
@@ -54,7 +54,7 @@ static void node_shader_exec_rgb(void *UNUSED(data), bNode *node, bNodeStack **U
bNodeSocket *sock= node->outputs.first;
float *col= ((bNodeSocketValueRGBA*)sock->default_value)->value;
- VECCOPY(out[0]->vec, col);
+ copy_v3_v3(out[0]->vec, col);
}
static int gpu_shader_rgb(GPUMaterial *mat, bNode *node, GPUNodeStack *in, GPUNodeStack *out)
diff --git a/source/blender/nodes/shader/nodes/node_shader_texture.c b/source/blender/nodes/shader/nodes/node_shader_texture.c
index 588cdc1da83..42460e141e2 100644
--- a/source/blender/nodes/shader/nodes/node_shader_texture.c
+++ b/source/blender/nodes/shader/nodes/node_shader_texture.c
@@ -82,7 +82,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
retval= multitex_nodes((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output, NULL, NULL);
}
else {
- VECCOPY(vec, shi->lo);
+ copy_v3_v3(vec, shi->lo);
retval= multitex_nodes((Tex *)node->id, vec, NULL, NULL, 0, &texres, thread, which_output, NULL, NULL);
}
@@ -111,7 +111,7 @@ static void node_shader_exec_texture(void *data, bNode *node, bNodeStack **in, b
out[1]->vec[3]= 1.0f;
}
- VECCOPY(out[2]->vec, nor);
+ copy_v3_v3(out[2]->vec, nor);
if(shi->do_preview)
nodeAddToPreview(node, out[1]->vec, shi->xs, shi->ys, shi->do_manage);
diff --git a/source/blender/nodes/texture/nodes/node_texture_bricks.c b/source/blender/nodes/texture/nodes/node_texture_bricks.c
index 2011426b845..0700085a787 100644
--- a/source/blender/nodes/texture/nodes/node_texture_bricks.c
+++ b/source/blender/nodes/texture/nodes/node_texture_bricks.c
@@ -107,9 +107,9 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
if( ins_x < mortar_thickness || ins_y < mortar_thickness ||
ins_x > (brick_width - mortar_thickness) ||
ins_y > (row_height - mortar_thickness) ) {
- QUATCOPY( out, mortar );
+ copy_v4_v4( out, mortar );
} else {
- QUATCOPY( out, bricks1 );
+ copy_v4_v4( out, bricks1 );
ramp_blend( MA_RAMP_BLEND, out, out+1, out+2, tint, bricks2 );
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
index 111d6e78023..3346592f7d3 100644
--- a/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
+++ b/source/blender/nodes/texture/nodes/node_texture_hueSatVal.c
@@ -66,7 +66,7 @@ static void do_hue_sat_fac(bNode *UNUSED(node), float *out, float hue, float sat
out[2]= mfac*in[2] + fac*col[2];
}
else {
- QUATCOPY(out, in);
+ copy_v4_v4(out, in);
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index 3a81ecb1466..0ead3a3dec2 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -76,7 +76,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **UNUSED(i
while( py >= ibuf->y ) py -= ibuf->y;
result = ibuf->rect_float + py*ibuf->x*4 + px*4;
- QUATCOPY( out, result );
+ copy_v4_v4( out, result );
}
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_invert.c b/source/blender/nodes/texture/nodes/node_texture_invert.c
index 3ad11026f28..5ee60d02e32 100644
--- a/source/blender/nodes/texture/nodes/node_texture_invert.c
+++ b/source/blender/nodes/texture/nodes/node_texture_invert.c
@@ -54,7 +54,7 @@ static void colorfn(float *out, TexParams *p, bNode *UNUSED(node), bNodeStack **
col[1] = 1.0f - col[1];
col[2] = 1.0f - col[2];
- VECCOPY(out, col);
+ copy_v3_v3(out, col);
out[3] = col[3];
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
index c68adf2f4aa..e3b5119c797 100644
--- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
@@ -55,7 +55,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
CLAMP(fac, 0.0f, 1.0f);
- QUATCOPY(out, col1);
+ copy_v4_v4(out, col1);
ramp_blend(node->custom1, out, out+1, out+2, fac, col2);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_proc.c b/source/blender/nodes/texture/nodes/node_texture_proc.c
index d9ac8700be1..3012d313db5 100644
--- a/source/blender/nodes/texture/nodes/node_texture_proc.c
+++ b/source/blender/nodes/texture/nodes/node_texture_proc.c
@@ -75,10 +75,10 @@ static void do_proc(float *result, TexParams *p, float *col1, float *col2, char
return;
if(textype & TEX_RGB) {
- QUATCOPY(result, &texres.tr);
+ copy_v4_v4(result, &texres.tr);
}
else {
- QUATCOPY(result, col1);
+ copy_v4_v4(result, col1);
ramp_blend(MA_RAMP_BLEND, result, result+1, result+2, texres.tin, col2);
}
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_texture.c b/source/blender/nodes/texture/nodes/node_texture_texture.c
index 1b8eb3aabc6..667570582fe 100644
--- a/source/blender/nodes/texture/nodes/node_texture_texture.c
+++ b/source/blender/nodes/texture/nodes/node_texture_texture.c
@@ -65,7 +65,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
if(node->custom2 || node->need_exec==0) {
/* this node refers to its own texture tree! */
- QUATCOPY(out, (fabs(co[0] - co[1]) < .01) ? white : red );
+ copy_v4_v4(out, (fabs(co[0] - co[1]) < .01) ? white : red );
}
else if(nodetex) {
TexResult texres;
@@ -81,10 +81,10 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
&texres, thread, 0, p->shi, p->mtex);
if(textype & TEX_RGB) {
- QUATCOPY(out, &texres.tr);
+ copy_v4_v4(out, &texres.tr);
}
else {
- QUATCOPY(out, col1);
+ copy_v4_v4(out, col1);
ramp_blend(MA_RAMP_BLEND, out, out+1, out+2, texres.tin, col2);
}
}
diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c
index e8721a3a91d..3518c8008c6 100644
--- a/source/blender/python/mathutils/mathutils_geometry.c
+++ b/source/blender/python/mathutils/mathutils_geometry.c
@@ -97,14 +97,14 @@ static PyObject *M_Geometry_intersect_ray_tri(PyObject *UNUSED(self), PyObject*
if (BaseMath_ReadCallback(vec1) == -1 || BaseMath_ReadCallback(vec2) == -1 || BaseMath_ReadCallback(vec3) == -1 || BaseMath_ReadCallback(ray) == -1 || BaseMath_ReadCallback(ray_off) == -1)
return NULL;
- VECCOPY(v1, vec1->vec);
- VECCOPY(v2, vec2->vec);
- VECCOPY(v3, vec3->vec);
+ copy_v3_v3(v1, vec1->vec);
+ copy_v3_v3(v2, vec2->vec);
+ copy_v3_v3(v3, vec3->vec);
- VECCOPY(dir, ray->vec);
+ copy_v3_v3(dir, ray->vec);
normalize_v3(dir);
- VECCOPY(orig, ray_off->vec);
+ copy_v3_v3(orig, ray_off->vec);
/* find vectors for two edges sharing v1 */
sub_v3_v3v3(e1, v2, v1);
@@ -189,10 +189,10 @@ static PyObject *M_Geometry_intersect_line_line(PyObject *UNUSED(self), PyObject
int result;
if (vec1->size == 3) {
- VECCOPY(v1, vec1->vec);
- VECCOPY(v2, vec2->vec);
- VECCOPY(v3, vec3->vec);
- VECCOPY(v4, vec4->vec);
+ copy_v3_v3(v1, vec1->vec);
+ copy_v3_v3(v2, vec2->vec);
+ copy_v3_v3(v3, vec3->vec);
+ copy_v3_v3(v4, vec4->vec);
}
else {
v1[0]= vec1->vec[0];
diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h
index 5a544c46255..08f73ccbe0d 100644
--- a/source/blender/render/intern/include/rendercore.h
+++ b/source/blender/render/intern/include/rendercore.h
@@ -42,7 +42,6 @@
/* vector defines */
#define CROSS(dest, a, b) { dest[0]= a[1] * b[2] - a[2] * b[1]; dest[1]= a[2] * b[0] - a[0] * b[2]; dest[2]= a[0] * b[1] - a[1] * b[0]; }
-#define VECMUL(dest, f) { dest[0]*= f; dest[1]*= f; dest[2]*= f; }
struct HaloRen;
struct ShadeInput;
diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h
index 6567cdacf0e..c467c31b5a6 100644
--- a/source/blender/render/intern/include/zbuf.h
+++ b/source/blender/render/intern/include/zbuf.h
@@ -135,7 +135,7 @@ void zbufclipwire(struct ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, f
/* exported to shadeinput.c */
void zbuf_make_winmat(Render *re, float winmat[][4]);
-void zbuf_render_project(float winmat[][4], float *co, float *ho);
+void zbuf_render_project(float winmat[][4], const float co[3], float ho[4]);
#endif
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 31d92d7f342..4fe34a29e55 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -478,11 +478,11 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
if(do_tangent) {
tav= RE_vertren_get_tangent(obr, v1, 1);
- VECADD(tav, tav, tang);
+ add_v3_v3(tav, tang);
tav= RE_vertren_get_tangent(obr, v2, 1);
- VECADD(tav, tav, tang);
+ add_v3_v3(tav, tang);
tav= RE_vertren_get_tangent(obr, v3, 1);
- VECADD(tav, tav, tang);
+ add_v3_v3(tav, tang);
}
if(do_nmap_tangent) {
@@ -496,11 +496,11 @@ static void calc_tangent_vector(ObjectRen *obr, VertexTangent **vtangents, MemAr
if(do_tangent) {
tav= RE_vertren_get_tangent(obr, v1, 1);
- VECADD(tav, tav, tang);
+ add_v3_v3(tav, tang);
tav= RE_vertren_get_tangent(obr, v3, 1);
- VECADD(tav, tav, tang);
+ add_v3_v3(tav, tang);
tav= RE_vertren_get_tangent(obr, v4, 1);
- VECADD(tav, tav, tang);
+ add_v3_v3(tav, tang);
}
if(do_nmap_tangent) {
@@ -1357,20 +1357,20 @@ static void particle_billboard(Render *re, ObjectRen *obr, Material *ma, Particl
psys_make_billboard(bb, xvec, yvec, zvec, bb_center);
- VECADD(vlr->v1->co, bb_center, xvec);
- VECADD(vlr->v1->co, vlr->v1->co, yvec);
+ add_v3_v3v3(vlr->v1->co, bb_center, xvec);
+ add_v3_v3(vlr->v1->co, yvec);
mul_m4_v3(re->viewmat, vlr->v1->co);
- VECSUB(vlr->v2->co, bb_center, xvec);
- VECADD(vlr->v2->co, vlr->v2->co, yvec);
+ sub_v3_v3v3(vlr->v2->co, bb_center, xvec);
+ add_v3_v3(vlr->v2->co, yvec);
mul_m4_v3(re->viewmat, vlr->v2->co);
- VECSUB(vlr->v3->co, bb_center, xvec);
- VECSUB(vlr->v3->co, vlr->v3->co, yvec);
+ sub_v3_v3v3(vlr->v3->co, bb_center, xvec);
+ sub_v3_v3v3(vlr->v3->co, vlr->v3->co, yvec);
mul_m4_v3(re->viewmat, vlr->v3->co);
- VECADD(vlr->v4->co, bb_center, xvec);
- VECSUB(vlr->v4->co, vlr->v4->co, yvec);
+ add_v3_v3v3(vlr->v4->co, bb_center, xvec);
+ sub_v3_v3(vlr->v4->co, yvec);
mul_m4_v3(re->viewmat, vlr->v4->co);
normal_quad_v3( vlr->n,vlr->v4->co, vlr->v3->co, vlr->v2->co, vlr->v1->co);
@@ -1968,8 +1968,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if(k==1){
sd.first = 1;
sd.time = 0.0f;
- VECSUB(loc0,loc1,loc);
- VECADD(loc0,loc1,loc0);
+ sub_v3_v3v3(loc0,loc1,loc);
+ add_v3_v3v3(loc0,loc1,loc0);
particle_curve(re, obr, psmd->dm, ma, &sd, loc1, loc0, seed, pa_co);
}
@@ -3475,7 +3475,7 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset)
float * ftang = RE_vlakren_get_nmap_tangent(obr, vlr, 1);
for(vindex=0; vindex<nr_verts; vindex++)
{
- QUATCOPY(ftang+vindex*4, tangent+a*16+rev_tab[vindex]*4);
+ copy_v4_v4(ftang+vindex*4, tangent+a*16+rev_tab[vindex]*4);
mul_mat3_m4_v3(mat, ftang+vindex*4);
normalize_v3(ftang+vindex*4);
}
@@ -3579,7 +3579,7 @@ static void initshadowbuf(Render *re, LampRen *lar, float mat[][4])
if(shb==NULL) return;
- VECCOPY(shb->co, lar->co);
+ VECCOPY(shb->co, lar->co); /* int copy */
/* percentage render: keep track of min and max */
shb->size= (lar->bufsize*re->r.size)/100;
@@ -4190,7 +4190,7 @@ static void check_non_flat_quads(ObjectRen *obr)
v2= vlr->v2;
v3= vlr->v3;
v4= vlr->v4;
- VECSUB(nor, v1->co, v2->co);
+ sub_v3_v3v3(nor, v1->co, v2->co);
if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v1= v2;
vlr->v2= v3;
@@ -4198,19 +4198,19 @@ static void check_non_flat_quads(ObjectRen *obr)
vlr->v4= NULL;
}
else {
- VECSUB(nor, v2->co, v3->co);
+ sub_v3_v3v3(nor, v2->co, v3->co);
if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v2= v3;
vlr->v3= v4;
vlr->v4= NULL;
}
else {
- VECSUB(nor, v3->co, v4->co);
+ sub_v3_v3v3(nor, v3->co, v4->co);
if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v4= NULL;
}
else {
- VECSUB(nor, v4->co, v1->co);
+ sub_v3_v3v3(nor, v4->co, v1->co);
if( ABS(nor[0])<FLT_EPSILON10 && ABS(nor[1])<FLT_EPSILON10 && ABS(nor[2])<FLT_EPSILON10 ) {
vlr->v4= NULL;
}
@@ -5397,12 +5397,12 @@ static void calculate_speedvectors(Render *re, ObjectInstanceRen *obi, float *ve
interp_weights_face_v3( w,co1, co2, co3, co4, strand->vert->co);
- speed[0]= speed[1]= speed[2]= speed[3]= 0.0f;
- QUATADDFAC(speed, speed, winspeed[face[0]], w[0]);
- QUATADDFAC(speed, speed, winspeed[face[1]], w[1]);
- QUATADDFAC(speed, speed, winspeed[face[2]], w[2]);
+ zero_v4(speed);
+ madd_v4_v4fl(speed, winspeed[face[0]], w[0]);
+ madd_v4_v4fl(speed, winspeed[face[1]], w[1]);
+ madd_v4_v4fl(speed, winspeed[face[2]], w[2]);
if(face[3])
- QUATADDFAC(speed, speed, winspeed[face[3]], w[3]);
+ madd_v4_v4fl(speed, winspeed[face[3]], w[3]);
}
}
diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c
index 2f20c328405..6ea62828601 100644
--- a/source/blender/render/intern/source/envmap.c
+++ b/source/blender/render/intern/source/envmap.c
@@ -704,7 +704,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
}
/* rotate to envmap space, if object is set */
- VECCOPY(vec, texvec);
+ copy_v3_v3(vec, texvec);
if(env->object) mul_m3_v3(env->obimat, vec);
else mul_mat3_m4_v3(R.viewinv, vec);
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index 719b9674b80..d1f7059416d 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -88,11 +88,11 @@ static void ibuf_get_color(float *col, struct ImBuf *ibuf, int x, int y)
if(ibuf->rect_float) {
if(ibuf->channels==4) {
float *fp= ibuf->rect_float + 4*ofs;
- QUATCOPY(col, fp);
+ copy_v4_v4(col, fp);
}
else if(ibuf->channels==3) {
float *fp= ibuf->rect_float + 3*ofs;
- VECCOPY(col, fp);
+ copy_v3_v3(col, fp);
col[3]= 1.0f;
}
else {
diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c
index a2363472694..7434425d24b 100644
--- a/source/blender/render/intern/source/occlusion.c
+++ b/source/blender/render/intern/source/occlusion.c
@@ -172,7 +172,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
shade_input_set_triangle_i(shi, obi, vlr, 0, 1, 2);
/* set up view vector */
- VECCOPY(shi->view, shi->co);
+ copy_v3_v3(shi->view, shi->co);
normalize_v3(shi->view);
/* cache for shadow */
@@ -205,7 +205,7 @@ static void occ_shade(ShadeSample *ssamp, ObjectInstanceRen *obi, VlakRen *vlr,
shade_input_set_shade_texco(shi);
shade_material_loop(shi, shr); /* todo: nodes */
- VECCOPY(rad, shr->combined);
+ copy_v3_v3(rad, shr->combined);
}
static void occ_build_shade(Render *re, OcclusionTree *tree)
@@ -339,10 +339,10 @@ static void occ_face(const OccFace *face, float co[3], float normal[3], float *a
}
if(area) {
- VECCOPY(v1, vlr->v1->co);
- VECCOPY(v2, vlr->v2->co);
- VECCOPY(v3, vlr->v3->co);
- if(vlr->v4) VECCOPY(v4, vlr->v4->co);
+ copy_v3_v3(v1, vlr->v1->co);
+ copy_v3_v3(v2, vlr->v2->co);
+ copy_v3_v3(v3, vlr->v3->co);
+ if(vlr->v4) copy_v3_v3(v4, vlr->v4->co);
if(obi->flag & R_TRANSFORMED) {
mul_m4_v3(obi->mat, v1);
@@ -439,14 +439,14 @@ static void occ_build_dco(OcclusionTree *tree, OccNode *node, const float co[3],
else if(node->child[b].node) {
OccNode *child= node->child[b].node;
occ_build_dco(tree, child, co, dco);
- VECCOPY(nco, child->co);
+ copy_v3_v3(nco, child->co);
}
else {
continue;
}
- VECSUB(d, nco, co);
- dist= INPR(d, d);
+ sub_v3_v3v3(d, nco, co);
+ dist= dot_v3v3(d, d);
if(dist > *dco)
*dco= dist;
}
@@ -604,7 +604,7 @@ static void occ_build_recursive(OcclusionTree *tree, OccNode *node, int begin, i
if(child) {
node->area += child->area;
sh_add(node->sh, node->sh, child->sh);
- VECADDFAC(node->co, node->co, child->co, child->area);
+ madd_v3_v3fl(node->co, child->co, child->area);
}
}
@@ -745,7 +745,7 @@ static void occ_free_tree(OcclusionTree *tree)
/* ------------------------- Traversal --------------------------- */
-static float occ_solid_angle(OccNode *node, float *v, float d2, float invd2, float *receivenormal)
+static float occ_solid_angle(OccNode *node, const float v[3], float d2, float invd2, const float receivenormal[3])
{
float dotreceive, dotemit;
float ev[3];
@@ -754,7 +754,7 @@ static float occ_solid_angle(OccNode *node, float *v, float d2, float invd2, flo
ev[1]= -v[1]*invd2;
ev[2]= -v[2]*invd2;
dotemit= sh_eval(node->sh, ev);
- dotreceive= INPR(receivenormal, v)*invd2;
+ dotreceive= dot_v3v3(receivenormal, v)*invd2;
CLAMP(dotemit, 0.0f, 1.0f);
CLAMP(dotreceive, 0.0f, 1.0f);
@@ -762,24 +762,24 @@ static float occ_solid_angle(OccNode *node, float *v, float d2, float invd2, flo
return ((node->area*dotemit*dotreceive)/(d2 + node->area*INVPI))*INVPI;
}
-static void VecAddDir(float *result, float *v1, float *v2, float fac)
+static void VecAddDir(float result[3], const float v1[3], const float v2[3], const float fac)
{
result[0]= v1[0] + fac*(v2[0] - v1[0]);
result[1]= v1[1] + fac*(v2[1] - v1[1]);
result[2]= v1[2] + fac*(v2[2] - v1[2]);
}
-static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2, float *q0, float *q1, float *q2, float *q3)
+static int occ_visible_quad(float *p, const float n[3], const float v0[3], const float *v1, const float *v2, float q0[3], float q1[3], float q2[3], float q3[3])
{
static const float epsilon = 1e-6f;
float c, sd[3];
- c= INPR(n, p);
+ c= dot_v3v3(n, p);
/* signed distances from the vertices to the plane. */
- sd[0]= INPR(n, v0) - c;
- sd[1]= INPR(n, v1) - c;
- sd[2]= INPR(n, v2) - c;
+ sd[0]= dot_v3v3(n, v0) - c;
+ sd[1]= dot_v3v3(n, v1) - c;
+ sd[2]= dot_v3v3(n, v2) - c;
if(fabsf(sd[0]) < epsilon) sd[0] = 0.0f;
if(fabsf(sd[1]) < epsilon) sd[1] = 0.0f;
@@ -789,70 +789,70 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2,
if(sd[1] > 0) {
if(sd[2] > 0) {
// +++
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
else if(sd[2] < 0) {
// ++-
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
VecAddDir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
}
else {
// ++0
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
}
else if(sd[1] < 0) {
if(sd[2] > 0) {
// +-+
- VECCOPY(q0, v0);
+ copy_v3_v3(q0, v0);
VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
- VECCOPY(q3, v2);
+ copy_v3_v3(q3, v2);
}
else if(sd[2] < 0) {
// +--
- VECCOPY(q0, v0);
+ copy_v3_v3(q0, v0);
VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
VecAddDir(q2, v0, v2, (sd[0]/(sd[0]-sd[2])));
- VECCOPY(q3, q2);
+ copy_v3_v3(q3, q2);
}
else {
// +-0
- VECCOPY(q0, v0);
+ copy_v3_v3(q0, v0);
VecAddDir(q1, v0, v1, (sd[0]/(sd[0]-sd[1])));
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
}
else {
if(sd[2] > 0) {
// +0+
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
else if(sd[2] < 0) {
// +0-
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
VecAddDir(q2, v0, v2, (sd[0]/(sd[0]-sd[2])));
- VECCOPY(q3, q2);
+ copy_v3_v3(q3, q2);
}
else {
// +00
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
}
}
@@ -861,23 +861,23 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2,
if(sd[2] > 0) {
// -++
VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
VecAddDir(q3, v0, v2, (sd[0]/(sd[0]-sd[2])));
}
else if(sd[2] < 0) {
// -+-
VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
- VECCOPY(q1, v1);
+ copy_v3_v3(q1, v1);
VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
- VECCOPY(q3, q2);
+ copy_v3_v3(q3, q2);
}
else {
// -+0
VecAddDir(q0, v0, v1, (sd[0]/(sd[0]-sd[1])));
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
}
else if(sd[1] < 0) {
@@ -885,8 +885,8 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2,
// --+
VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
else if(sd[2] < 0) {
// ---
@@ -901,9 +901,9 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2,
if(sd[2] > 0) {
// -0+
VecAddDir(q0, v0, v2, (sd[0]/(sd[0]-sd[2])));
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
else if(sd[2] < 0) {
// -0-
@@ -919,33 +919,33 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2,
if(sd[1] > 0) {
if(sd[2] > 0) {
// 0++
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
else if(sd[2] < 0) {
// 0+-
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
VecAddDir(q2, v1, v2, (sd[1]/(sd[1]-sd[2])));
- VECCOPY(q3, q2);
+ copy_v3_v3(q3, q2);
}
else {
// 0+0
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
}
else if(sd[1] < 0) {
if(sd[2] > 0) {
// 0-+
- VECCOPY(q0, v0);
+ copy_v3_v3(q0, v0);
VecAddDir(q1, v1, v2, (sd[1]/(sd[1]-sd[2])));
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
else if(sd[2] < 0) {
// 0--
@@ -959,10 +959,10 @@ static int occ_visible_quad(float *p, float *n, float *v0, float *v1, float *v2,
else {
if(sd[2] > 0) {
// 00+
- VECCOPY(q0, v0);
- VECCOPY(q1, v1);
- VECCOPY(q2, v2);
- VECCOPY(q3, q2);
+ copy_v3_v3(q0, v0);
+ copy_v3_v3(q1, v1);
+ copy_v3_v3(q2, v2);
+ copy_v3_v3(q3, q2);
}
else if(sd[2] < 0) {
// 00-
@@ -1117,7 +1117,7 @@ static void normalizef(float *n)
{
float d;
- d= INPR(n, n);
+ d= dot_v3v3(n, n);
if(d > 1.0e-35F) {
d= 1.0f/sqrtf(d);
@@ -1128,15 +1128,15 @@ static void normalizef(float *n)
}
}
-static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, float *q2, float *q3)
+static float occ_quad_form_factor(const float p[3], const float n[3], const float q0[3], const float q1[3], const float q2[3], const float q3[3])
{
float r0[3], r1[3], r2[3], r3[3], g0[3], g1[3], g2[3], g3[3];
float a1, a2, a3, a4, dot1, dot2, dot3, dot4, result;
- VECSUB(r0, q0, p);
- VECSUB(r1, q1, p);
- VECSUB(r2, q2, p);
- VECSUB(r3, q3, p);
+ sub_v3_v3v3(r0, q0, p);
+ sub_v3_v3v3(r1, q1, p);
+ sub_v3_v3v3(r2, q2, p);
+ sub_v3_v3v3(r3, q3, p);
normalizef(r0);
normalizef(r1);
@@ -1148,15 +1148,15 @@ static float occ_quad_form_factor(float *p, float *n, float *q0, float *q1, floa
cross_v3_v3v3(g2, r3, r2); normalizef(g2);
cross_v3_v3v3(g3, r0, r3); normalizef(g3);
- a1= saacosf(INPR(r0, r1));
- a2= saacosf(INPR(r1, r2));
- a3= saacosf(INPR(r2, r3));
- a4= saacosf(INPR(r3, r0));
+ a1= saacosf(dot_v3v3(r0, r1));
+ a2= saacosf(dot_v3v3(r1, r2));
+ a3= saacosf(dot_v3v3(r2, r3));
+ a4= saacosf(dot_v3v3(r3, r0));
- dot1= INPR(n, g0);
- dot2= INPR(n, g1);
- dot3= INPR(n, g2);
- dot4= INPR(n, g3);
+ dot1= dot_v3v3(n, g0);
+ dot2= dot_v3v3(n, g1);
+ dot3= dot_v3v3(n, g2);
+ dot4= dot_v3v3(n, g3);
result= (a1*dot1 + a2*dot2 + a3*dot3 + a4*dot4)*0.5f/(float)M_PI;
result= MAX2(result, 0.0f);
@@ -1173,9 +1173,9 @@ static float occ_form_factor(OccFace *face, float *p, float *n)
obi= &R.objectinstance[face->obi];
vlr= RE_findOrAddVlak(obi->obr, face->facenr);
- VECCOPY(v1, vlr->v1->co);
- VECCOPY(v2, vlr->v2->co);
- VECCOPY(v3, vlr->v3->co);
+ copy_v3_v3(v1, vlr->v1->co);
+ copy_v3_v3(v2, vlr->v2->co);
+ copy_v3_v3(v3, vlr->v3->co);
if(obi->flag & R_TRANSFORMED) {
mul_m4_v3(obi->mat, v1);
@@ -1187,7 +1187,7 @@ static float occ_form_factor(OccFace *face, float *p, float *n)
contrib += occ_quad_form_factor(p, n, q0, q1, q2, q3);
if(vlr->v4) {
- VECCOPY(v4, vlr->v4->co);
+ copy_v3_v3(v4, vlr->v4->co);
if(obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, v4);
@@ -1207,9 +1207,9 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
int b, f, totstack;
/* init variables */
- VECCOPY(p, pp);
- VECCOPY(n, pn);
- VECADDFAC(p, p, n, 1e-4f);
+ copy_v3_v3(p, pp);
+ copy_v3_v3(n, pn);
+ madd_v3_v3fl(p, n, 1e-4f);
if(bentn)
copy_v3_v3(bentn, n);
@@ -1229,8 +1229,8 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
/* pop point off the stack */
node= stack[--totstack];
- VECSUB(v, node->co, p);
- d2= INPR(v, v) + 1e-16f;
+ sub_v3_v3v3(v, node->co, p);
+ d2= dot_v3v3(v, v) + 1e-16f;
emitarea= MAX2(node->area, node->dco);
if(d2*error > emitarea) {
@@ -1270,8 +1270,8 @@ static void occ_lookup(OcclusionTree *tree, int thread, OccFace *exclude, float
if(!exclude || !(face->obi == exclude->obi && face->facenr == exclude->facenr)) {
if(bentn || distfac != 0.0f) {
occ_face(face, co, NULL, NULL);
- VECSUB(v, co, p);
- d2= INPR(v, v) + 1e-16f;
+ sub_v3_v3v3(v, co, p);
+ d2= dot_v3v3(v, v) + 1e-16f;
fac= (distfac == 0.0f)? 1.0f: 1.0f/(1.0f + distfac*d2);
if(fac < 0.01f)
@@ -1368,7 +1368,7 @@ static void occ_compute_passes(Render *re, OcclusionTree *tree, int totpass)
for(i=0; i<tree->totface; i++) {
occ_face(&tree->face[i], co, n, NULL);
negate_v3(n);
- VECADDFAC(co, co, n, 1e-8f);
+ madd_v3_v3fl(co, n, 1e-8f);
occ_lookup(tree, 0, &tree->face[i], co, n, &occ[i], NULL, NULL);
if(re->test_break(re->tbh))
@@ -1484,12 +1484,12 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
if(cache->sample && cache->step) {
sample= &cache->sample[(y-cache->y)*cache->w + (x-cache->x)];
if(sample->filled) {
- VECSUB(d, sample->co, co);
- dist2= INPR(d, d);
- if(dist2 < 0.5f*sample->dist2 && INPR(sample->n, n) > 0.98f) {
- VECCOPY(ao, sample->ao);
- VECCOPY(env, sample->env);
- VECCOPY(indirect, sample->indirect);
+ sub_v3_v3v3(d, sample->co, co);
+ dist2= dot_v3v3(d, d);
+ if(dist2 < 0.5f*sample->dist2 && dot_v3v3(sample->n, n) > 0.98f) {
+ copy_v3_v3(ao, sample->ao);
+ copy_v3_v3(env, sample->env);
+ copy_v3_v3(indirect, sample->indirect);
return 1;
}
}
@@ -1534,11 +1534,11 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int
wb[0]= tx*ty;
for(i=0; i<4; i++) {
- VECSUB(d, samples[i]->co, co);
- //dist2= INPR(d, d);
+ sub_v3_v3v3(d, samples[i]->co, co);
+ //dist2= dot_v3v3(d, d);
wz[i]= 1.0f; //(samples[i]->dist2/(1e-4f + dist2));
- wn[i]= pow(INPR(samples[i]->n, n), 32.0f);
+ wn[i]= pow(dot_v3v3(samples[i]->n, n), 32.0f);
w= wb[i]*wn[i]*wz[i];
@@ -1633,9 +1633,9 @@ static void *exec_strandsurface_sample(void *data)
negate_v3(n);
sample_occ_tree(re, re->occlusiontree, NULL, co, n, othread->thread, 0, ao, env, indirect);
- VECCOPY(othread->faceao[a], ao);
- VECCOPY(othread->faceenv[a], env);
- VECCOPY(othread->faceindirect[a], indirect);
+ copy_v3_v3(othread->faceao[a], ao);
+ copy_v3_v3(othread->faceenv[a], env);
+ copy_v3_v3(othread->faceindirect[a], indirect);
}
return 0;
@@ -1701,27 +1701,27 @@ void make_occ_tree(Render *re)
for(a=0; a<mesh->totface; a++) {
face= mesh->face[a];
- VECCOPY(ao, faceao[a]);
- VECCOPY(env, faceenv[a]);
- VECCOPY(indirect, faceindirect[a]);
+ copy_v3_v3(ao, faceao[a]);
+ copy_v3_v3(env, faceenv[a]);
+ copy_v3_v3(indirect, faceindirect[a]);
- VECADD(mesh->ao[face[0]], mesh->ao[face[0]], ao);
- VECADD(mesh->env[face[0]], mesh->env[face[0]], env);
- VECADD(mesh->indirect[face[0]], mesh->indirect[face[0]], indirect);
+ add_v3_v3(mesh->ao[face[0]], ao);
+ add_v3_v3(mesh->env[face[0]], env);
+ add_v3_v3(mesh->indirect[face[0]], indirect);
count[face[0]]++;
- VECADD(mesh->ao[face[1]], mesh->ao[face[1]], ao);
- VECADD(mesh->env[face[1]], mesh->env[face[1]], env);
- VECADD(mesh->indirect[face[1]], mesh->indirect[face[1]], indirect);
+ add_v3_v3(mesh->ao[face[1]], ao);
+ add_v3_v3(mesh->env[face[1]], env);
+ add_v3_v3(mesh->indirect[face[1]], indirect);
count[face[1]]++;
- VECADD(mesh->ao[face[2]], mesh->ao[face[2]], ao);
- VECADD(mesh->env[face[2]], mesh->env[face[2]], env);
- VECADD(mesh->indirect[face[2]], mesh->indirect[face[2]], indirect);
+ add_v3_v3(mesh->ao[face[2]], ao);
+ add_v3_v3(mesh->env[face[2]], env);
+ add_v3_v3(mesh->indirect[face[2]], indirect);
count[face[2]]++;
if(face[3]) {
- VECADD(mesh->ao[face[3]], mesh->ao[face[3]], ao);
- VECADD(mesh->env[face[3]], mesh->env[face[3]], env);
- VECADD(mesh->indirect[face[3]], mesh->indirect[face[3]], indirect);
+ add_v3_v3(mesh->ao[face[3]], ao);
+ add_v3_v3(mesh->env[face[3]], env);
+ add_v3_v3(mesh->indirect[face[3]], indirect);
count[face[3]]++;
}
}
@@ -1784,7 +1784,7 @@ void sample_occ(Render *re, ShadeInput *shi)
sample->intensity= MAX3(sample->ao[0], sample->ao[1], sample->ao[2]);
sample->intensity= MAX2(sample->intensity, MAX3(sample->env[0], sample->env[1], sample->env[2]));
sample->intensity= MAX2(sample->intensity, MAX3(sample->indirect[0], sample->indirect[1], sample->indirect[2]));
- sample->dist2= INPR(shi->dxco, shi->dxco) + INPR(shi->dyco, shi->dyco);
+ sample->dist2= dot_v3v3(shi->dxco, shi->dxco) + dot_v3v3(shi->dyco, shi->dyco);
sample->filled= 1;
}
}
@@ -1879,7 +1879,7 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp)
sample->intensity= MAX3(sample->ao[0], sample->ao[1], sample->ao[2]);
sample->intensity= MAX2(sample->intensity, MAX3(sample->env[0], sample->env[1], sample->env[2]));
sample->intensity= MAX2(sample->intensity, MAX3(sample->indirect[0], sample->indirect[1], sample->indirect[2]));
- sample->dist2= INPR(shi->dxco, shi->dxco) + INPR(shi->dyco, shi->dyco);
+ sample->dist2= dot_v3v3(shi->dxco, shi->dxco) + dot_v3v3(shi->dyco, shi->dyco);
sample->x= shi->xs;
sample->y= shi->ys;
sample->filled= 1;
diff --git a/source/blender/render/intern/source/pixelshading.c b/source/blender/render/intern/source/pixelshading.c
index dfd10687a33..36709408496 100644
--- a/source/blender/render/intern/source/pixelshading.c
+++ b/source/blender/render/intern/source/pixelshading.c
@@ -84,7 +84,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
ir= ig= ib= 0.0;
- VECCOPY(rco, har->co);
+ copy_v3_v3(rco, har->co);
dco[0]=dco[1]=dco[2]= 1.0f/har->rad;
vn= har->no;
@@ -97,7 +97,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
/* lampdist cacluation */
if(lar->type==LA_SUN || lar->type==LA_HEMI) {
- VECCOPY(lv, lar->vec);
+ copy_v3_v3(lv, lar->vec);
lampdist= 1.0;
}
else {
@@ -146,7 +146,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
memset(&shi, 0, sizeof(ShadeInput));
/* end warning! - Campbell */
- VECCOPY(shi.co, rco);
+ copy_v3_v3(shi.co, rco);
shi.osatex= 0;
do_lamp_tex(lar, lv, &shi, lacol, LA_TEXTURE);
}
@@ -158,7 +158,7 @@ static void render_lighting_halo(HaloRen *har, float col_r[3])
float x, lvrot[3];
/* rotate view to lampspace */
- VECCOPY(lvrot, lv);
+ copy_v3_v3(lvrot, lv);
mul_m3_v3(lar->imat, lvrot);
x= MAX2(fabs(lvrot[0]/lvrot[2]) , fabs(lvrot[1]/lvrot[2]));
@@ -610,7 +610,7 @@ void shadeSkyPixel(float collector[4], float fx, float fy, short thread)
if((R.wrld.skytype & (WO_SKYBLEND+WO_SKYTEX))==0) {
/* 1. solid color */
- VECCOPY(collector, &R.wrld.horr);
+ copy_v3_v3(collector, &R.wrld.horr);
collector[3] = 0.0f;
}
diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c
index 36ded5c10d2..c3a4ca9bf7d 100644
--- a/source/blender/render/intern/source/pointdensity.c
+++ b/source/blender/render/intern/source/pointdensity.c
@@ -153,7 +153,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa
state.time = cfra;
if(psys_get_particle_state(&sim, i, &state, 0)) {
- VECCOPY(partco, state.co);
+ copy_v3_v3(partco, state.co);
if (pd->psys_cache_space == TEX_PD_OBJECTSPACE)
mul_m4_v3(ob->imat, partco);
@@ -217,7 +217,7 @@ static void pointdensity_cache_object(Render *re, PointDensity *pd, Object *ob)
for(i=0; i < pd->totpoints; i++, mvert++) {
float co[3];
- VECCOPY(co, mvert->co);
+ copy_v3_v3(co, mvert->co);
switch(pd->ob_cache_space) {
case TEX_PD_OBJECTSPACE:
@@ -423,7 +423,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
(pd->flag&TEX_PD_FALLOFF_CURVE ? pd->falloff_curve : NULL), pd->falloff_speed_scale*0.001f);
noise_fac = pd->noise_fac * 0.5f; /* better default */
- VECCOPY(co, texvec);
+ copy_v3_v3(co, texvec);
if (point_data_used(pd)) {
/* does a BVH lookup to find accumulated density and additional point data *
@@ -480,7 +480,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
if (pd->coba) {
if (do_colorband(pd->coba, age, col)) {
texres->talpha= 1;
- VECCOPY(&texres->tr, col);
+ copy_v3_v3(&texres->tr, col);
texres->tin *= col[3];
texres->ta = texres->tin;
}
@@ -493,7 +493,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
if (pd->coba) {
if (do_colorband(pd->coba, speed, col)) {
texres->talpha= 1;
- VECCOPY(&texres->tr, col);
+ copy_v3_v3(&texres->tr, col);
texres->tin *= col[3];
texres->ta = texres->tin;
}
@@ -503,7 +503,7 @@ int pointdensitytex(Tex *tex, float *texvec, TexResult *texres)
case TEX_PD_COLOR_PARTVEL:
texres->talpha= 1;
mul_v3_fl(vec, pd->speed_scale);
- VECCOPY(&texres->tr, vec);
+ copy_v3_v3(&texres->tr, vec);
texres->ta = texres->tin;
break;
case TEX_PD_COLOR_CONSTANT:
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index a02c5681e5e..1a58a665e0a 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -1593,7 +1593,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
}
/* put back together */
if(shi->combinedflag & SCE_PASS_SPEC)
- VECADD(shr->combined, diff, shr->spec) /* no ; */
+ add_v3_v3v3(shr->combined, diff, shr->spec);
else
copy_v3_v3(shr->combined, diff);
}
diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c
index 14b02920439..b5386dde623 100644
--- a/source/blender/render/intern/source/render_texture.c
+++ b/source/blender/render/intern/source/render_texture.c
@@ -2297,7 +2297,7 @@ void do_material_tex(ShadeInput *shi)
else texres.nor= NULL;
if(warpdone) {
- VECADD(tempvec, co, warpvec);
+ add_v3_v3v3(tempvec, co, warpvec);
co= tempvec;
}
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index d2683f26c3a..456702e0827 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -562,7 +562,7 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
float *fp;
fp= rl->rectf + 4*offset;
- QUATCOPY(fp, shr->combined);
+ copy_v4_v4(fp, shr->combined);
for(rpass= rl->passes.first; rpass; rpass= rpass->next) {
float *col= NULL, uvcol[3];
@@ -695,7 +695,7 @@ static void sky_tile(RenderPart *pa, RenderLayer *rl)
}
if(pass[3]==0.0f) {
- QUATCOPY(pass, col);
+ copy_v4_v4(pass, col);
}
else {
addAlphaUnderFloat(pass, col);
@@ -768,18 +768,17 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
continue;
}
- VECCOPY(tmp_rgb, rgbrect);
+ copy_v3_v3(tmp_rgb, rgbrect);
if(rgbrect[3]!=1.0f) { /* de-premul */
- float div= 1.0f/rgbrect[3];
- VECMUL(tmp_rgb, div);
+ mul_v3_fl(tmp_rgb, 1.0f/rgbrect[3]);
}
shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect);
if(rgbrect[3]!=1.0f) { /* premul */
- VECMUL(tmp_rgb, rgbrect[3]);
+ mul_v3_fl(tmp_rgb, rgbrect[3]);
}
if(done==0) {
- VECCOPY(rgb, tmp_rgb);
+ copy_v3_v3(rgb, tmp_rgb);
done = 1;
}
else{
@@ -793,7 +792,7 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
/* if at least for one sun lamp aerial perspective was applied*/
if(done) {
- VECCOPY(rgbrect, rgb);
+ copy_v3_v3(rgbrect, rgb);
}
}
}
@@ -1533,13 +1532,13 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
then clamp to avoid a too large contribution from a single pixel */
shi->osatex= 1;
- VECCOPY(nor, shi->facenor);
+ copy_v3_v3(nor, shi->facenor);
calc_view_vector(shi->facenor, sx, sy);
normalize_v3(shi->facenor);
shade_input_set_viewco(shi, x, y, sx, sy, z);
orthoarea= len_v3(shi->dxco)*len_v3(shi->dyco);
- VECCOPY(shi->facenor, nor);
+ copy_v3_v3(shi->facenor, nor);
shade_input_set_viewco(shi, x, y, sx, sy, z);
*area= len_v3(shi->dxco)*len_v3(shi->dyco);
*area= MIN2(*area, 2.0f*orthoarea);
@@ -1572,8 +1571,8 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
shade_samples_do_AO(ssamp);
shade_material_loop(shi, &shr);
- VECCOPY(co, shi->co);
- VECCOPY(color, shr.combined);
+ copy_v3_v3(co, shi->co);
+ copy_v3_v3(color, shr.combined);
/* texture blending */
/* texfac= shi->mat->sss_texfac; */ /* UNUSED */
@@ -1711,7 +1710,7 @@ void zbufshade_sss_tile(RenderPart *pa)
totpoint++;
- VECADD(fcol, fcol, color);
+ add_v3_v3(fcol, color);
fcol[3]= 1.0f;
}
@@ -1730,7 +1729,7 @@ void zbufshade_sss_tile(RenderPart *pa)
shade_sample_sss(&ssamp, mat, obi, vlr, quad, x, y, *rz,
co[totpoint], color[totpoint], &area[totpoint]);
- VECADD(fcol, fcol, color[totpoint]);
+ add_v3_v3(fcol, color[totpoint]);
fcol[3]= 1.0f;
totpoint++;
}
@@ -1753,7 +1752,7 @@ void zbufshade_sss_tile(RenderPart *pa)
/* to indicate this is a back sample */
area[totpoint]= -area[totpoint];
- VECADD(fcol, fcol, color[totpoint]);
+ add_v3_v3(fcol, color[totpoint]);
fcol[3]= 1.0f;
totpoint++;
}
@@ -2068,7 +2067,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
if(bs->type==RE_BAKE_NORMALS) {
float nor[3];
- VECCOPY(nor, shi->vn);
+ copy_v3_v3(nor, shi->vn);
if(R.r.bake_normal_space == R_BAKE_SPACE_CAMERA);
else if(R.r.bake_normal_space == R_BAKE_SPACE_TANGENT) {
@@ -2076,16 +2075,16 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
/* bitangent */
if(tvn && ttang) {
- VECCOPY(mat[0], ttang);
+ copy_v3_v3(mat[0], ttang);
cross_v3_v3v3(mat[1], tvn, ttang);
mul_v3_fl(mat[1], ttang[3]);
- VECCOPY(mat[2], tvn);
+ copy_v3_v3(mat[2], tvn);
}
else {
- VECCOPY(mat[0], shi->nmaptang);
+ copy_v3_v3(mat[0], shi->nmaptang);
cross_v3_v3v3(mat[1], shi->nmapnorm, shi->nmaptang);
mul_v3_fl(mat[1], shi->nmaptang[3]);
- VECCOPY(mat[2], shi->nmapnorm);
+ copy_v3_v3(mat[2], shi->nmapnorm);
}
invert_m3_m3(imat, mat);
@@ -2115,7 +2114,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
shr.alpha = shi->alpha;
}
else if(bs->type==RE_BAKE_SHADOW) {
- VECCOPY(shr.combined, shr.shad);
+ copy_v3_v3(shr.combined, shr.shad);
shr.alpha = shi->alpha;
}
else if(bs->type==RE_BAKE_SPEC_COLOR) {
@@ -2158,7 +2157,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int UNUSED(qua
if(bs->rect_float) {
float *col= bs->rect_float + 4*(bs->rectx*y + x);
- VECCOPY(col, shr.combined);
+ copy_v3_v3(col, shr.combined);
if (bs->type==RE_BAKE_ALL || bs->type==RE_BAKE_TEXTURE) {
col[3]= shr.alpha;
} else {
@@ -2336,16 +2335,16 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
if(obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, shi->co);
- VECCOPY(shi->dxco, bs->dxco);
- VECCOPY(shi->dyco, bs->dyco);
+ copy_v3_v3(shi->dxco, bs->dxco);
+ copy_v3_v3(shi->dyco, bs->dyco);
quad= bs->quad;
bake_set_shade_input(obi, vlr, shi, quad, 0, x, y, u, v);
if(bs->type==RE_BAKE_NORMALS && R.r.bake_normal_space==R_BAKE_SPACE_TANGENT) {
shade_input_set_shade_texco(shi);
- VECCOPY(tvn, shi->nmapnorm);
- QUATCOPY(ttang, shi->nmaptang);
+ copy_v3_v3(tvn, shi->nmapnorm);
+ copy_v4_v4(ttang, shi->nmaptang);
}
/* if we are doing selected to active baking, find point on other face */
@@ -2359,7 +2358,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
memset(&minisec, 0, sizeof(minisec));
minco[0]= minco[1]= minco[2]= 0.0f;
- VECCOPY(bs->dir, shi->vn);
+ copy_v3_v3(bs->dir, shi->vn);
for(sign=-1; sign<=1; sign+=2) {
memset(&isec, 0, sizeof(isec));
@@ -2375,7 +2374,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
if(!hit || len_v3v3(shi->co, co) < len_v3v3(shi->co, minco)) {
minisec= isec;
mindist= dist;
- VECCOPY(minco, co);
+ copy_v3_v3(minco, co);
hit= 1;
dir = sign;
}
@@ -2395,7 +2394,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
obi= (ObjectInstanceRen*)minisec.hit.ob;
vlr= (VlakRen*)minisec.hit.face;
quad= (minisec.isect == 2);
- VECCOPY(shi->co, minco);
+ copy_v3_v3(shi->co, minco);
u= -minisec.u;
v= -minisec.v;
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 274fa4469e0..f3eb2234778 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -672,7 +672,7 @@ static void shadowbuf_autoclip(Render *re, LampRen *lar)
else ver++;
if(clipflag[a]) {
- VECCOPY(vec, ver->co);
+ copy_v3_v3(vec, ver->co);
mul_m4_v3(obviewmat, vec);
/* Z on visible side of lamp space */
if(vec[2] < 0.0f) {
@@ -2063,7 +2063,7 @@ static int viewpixel_to_lampbuf(ShadBuf *shb, ObjectInstanceRen *obi, VlakRen *v
float dface, fac, siz;
RE_vlakren_get_normal(&R, obi, vlr, nor);
- VECCOPY(v1, vlr->v1->co);
+ copy_v3_v3(v1, vlr->v1->co);
if(obi->flag & R_TRANSFORMED)
mul_m4_v3(obi->mat, v1);
@@ -2463,7 +2463,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
samp->facenr= apn->p[a] & ~RE_QUAD_OFFS;
samp->shadfac= &apn->shadfac[a];
- VECCOPY(samp->zco, zco);
+ copy_v3_v3(samp->zco, zco);
bound_rectf((rctf *)&root.box, samp->zco);
}
}
@@ -2479,7 +2479,7 @@ static void isb_make_buffer_transp(RenderPart *pa, APixstr *apixbuf, LampRen *la
samp->facenr= apn->p[a] & ~RE_QUAD_OFFS;
samp->shadfac= &apn->shadfac[a];
- VECCOPY(samp->zco, zco);
+ copy_v3_v3(samp->zco, zco);
bound_rectf((rctf *)&root.box, samp->zco);
}
}
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c
index 55d3703d351..1852dfaebab 100644
--- a/source/blender/render/intern/source/shadeinput.c
+++ b/source/blender/render/intern/source/shadeinput.c
@@ -127,8 +127,8 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr)
if(shi->passflag & SCE_PASS_SHADOW)
VECADDISFAC(shr->shad, shr_t.shad, fac);
- VECMUL(shi->vn, -1.0f);
- VECMUL(shi->facenor, -1.0f);
+ negate_v3(shi->vn);
+ negate_v3(shi->facenor);
}
/* depth >= 1 when ray-shading */
diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c
index ddfe3199d30..0ed3a094cf8 100644
--- a/source/blender/render/intern/source/shadeoutput.c
+++ b/source/blender/render/intern/source/shadeoutput.c
@@ -495,10 +495,10 @@ static float area_lamp_energy_multisample(LampRen *lar, float *co, float *vn)
vec[2]= 0.0f;
mul_m3_v3(lar->mat, vec);
- VECADD(area[0], lar->area[0], vec);
- VECADD(area[1], lar->area[1], vec);
- VECADD(area[2], lar->area[2], vec);
- VECADD(area[3], lar->area[3], vec);
+ add_v3_v3v3(area[0], lar->area[0], vec);
+ add_v3_v3v3(area[1], lar->area[1], vec);
+ add_v3_v3v3(area[2], lar->area[2], vec);
+ add_v3_v3v3(area[3], lar->area[3], vec);
intens+= area_lamp_energy(area, co, vn);
@@ -1111,12 +1111,12 @@ void lamp_get_shadow(LampRen *lar, ShadeInput *shi, float inp, float shadfac[4],
}
if(shi->depth==0) {
- QUATCOPY(lss->shadfac, shadfac);
+ copy_v4_v4(lss->shadfac, shadfac);
lss->samplenr= shi->samplenr;
}
}
else {
- QUATCOPY(shadfac, lss->shadfac);
+ copy_v4_v4(shadfac, lss->shadfac);
}
}
@@ -1879,16 +1879,16 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr)
/* and add emit and spec */
if(shi->combinedflag & SCE_PASS_EMIT)
- VECADD(shr->combined, shr->combined, shr->emit);
+ add_v3_v3(shr->combined, shr->emit);
if(shi->combinedflag & SCE_PASS_SPEC)
- VECADD(shr->combined, shr->combined, shr->spec);
+ add_v3_v3(shr->combined, shr->spec);
/* modulate by the object color */
if((ma->shade_flag & MA_OBCOLOR) && shi->obr->ob) {
if(!(ma->sss_flag & MA_DIFF_SSS) || !sss_pass_done(&R, ma)) {
float obcol[4];
- QUATCOPY(obcol, shi->obr->ob->col);
+ copy_v4_v4(obcol, shi->obr->ob->col);
CLAMP(obcol[3], 0.0f, 1.0f);
shr->combined[0] *= obcol[0];
diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c
index cf97a63d8a0..4192aaf42aa 100644
--- a/source/blender/render/intern/source/sss.c
+++ b/source/blender/render/intern/source/sss.c
@@ -1,4 +1,4 @@
-/*
+/*
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -452,11 +452,11 @@ static void compute_radiance(ScatterTree *tree, float *co, float *rad)
mul_v3_fl(result.rad, tree->ss[0]->frontweight);
mul_v3_fl(result.backrad, tree->ss[0]->backweight);
- VECCOPY(rad, result.rad);
- VECADD(backrad, result.rad, result.backrad);
+ copy_v3_v3(rad, result.rad);
+ add_v3_v3v3(backrad, result.rad, result.backrad);
- VECCOPY(rdsum, result.rdsum);
- VECADD(backrdsum, result.rdsum, result.backrdsum);
+ copy_v3_v3(rdsum, result.rdsum);
+ add_v3_v3v3(backrdsum, result.rdsum, result.backrdsum);
if(rdsum[0] > 1e-16f) rad[0]= tree->ss[0]->color*rad[0]/rdsum[0];
if(rdsum[1] > 1e-16f) rad[1]= tree->ss[1]->color*rad[1]/rdsum[1];
@@ -761,8 +761,8 @@ ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error,
INIT_MINMAX(tree->min, tree->max);
for(i=0; i<totpoint; i++) {
- VECCOPY(points[i].co, co[i]);
- VECCOPY(points[i].rad, color[i]);
+ copy_v3_v3(points[i].co, co[i]);
+ copy_v3_v3(points[i].rad, color[i]);
points[i].area= fabsf(area[i])/(tree->scale*tree->scale);
points[i].back= (area[i] < 0.0f);
@@ -818,7 +818,7 @@ void scatter_tree_sample(ScatterTree *tree, float *co, float *color)
{
float sco[3];
- VECCOPY(sco, co);
+ copy_v3_v3(sco, co);
mul_v3_fl(sco, 1.0f/tree->scale);
compute_radiance(tree, sco, color);
diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c
index 644cb821e8c..913b4f45bcf 100644
--- a/source/blender/render/intern/source/strand.c
+++ b/source/blender/render/intern/source/strand.c
@@ -98,10 +98,10 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
t= spoint->t;
type= (strandbuf->flag & R_STRAND_BSPLINE)? KEY_BSPLINE: KEY_CARDINAL;
- VECCOPY(p[0], sseg->v[0]->co);
- VECCOPY(p[1], sseg->v[1]->co);
- VECCOPY(p[2], sseg->v[2]->co);
- VECCOPY(p[3], sseg->v[3]->co);
+ copy_v3_v3(p[0], sseg->v[0]->co);
+ copy_v3_v3(p[1], sseg->v[1]->co);
+ copy_v3_v3(p[2], sseg->v[2]->co);
+ copy_v3_v3(p[3], sseg->v[3]->co);
if(sseg->obi->flag & R_TRANSFORMED) {
mul_m4_v3(sseg->obi->mat, p[0]);
@@ -111,7 +111,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
}
if(t == 0.0f) {
- VECCOPY(spoint->co, p[1]);
+ copy_v3_v3(spoint->co, p[1]);
spoint->strandco= sseg->v[1]->strandco;
spoint->dtstrandco= (sseg->v[2]->strandco - sseg->v[0]->strandco);
@@ -119,7 +119,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
spoint->dtstrandco *= 0.5f;
}
else if(t == 1.0f) {
- VECCOPY(spoint->co, p[2]);
+ copy_v3_v3(spoint->co, p[2]);
spoint->strandco= sseg->v[2]->strandco;
spoint->dtstrandco= (sseg->v[3]->strandco - sseg->v[1]->strandco);
@@ -139,12 +139,9 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
spoint->dtco[1]= data[0]*p[0][1] + data[1]*p[1][1] + data[2]*p[2][1] + data[3]*p[3][1];
spoint->dtco[2]= data[0]*p[0][2] + data[1]*p[1][2] + data[2]*p[2][2] + data[3]*p[3][2];
- VECCOPY(spoint->tan, spoint->dtco);
- normalize_v3(spoint->tan);
-
- VECCOPY(spoint->nor, spoint->co);
- VECMUL(spoint->nor, -1.0f);
- normalize_v3(spoint->nor);
+ normalize_v3_v3(spoint->tan, spoint->dtco);
+ normalize_v3_v3(spoint->nor, spoint->co);
+ negate_v3(spoint->nor);
spoint->width= strand_eval_width(ma, spoint->strandco);
@@ -183,7 +180,7 @@ void strand_eval_point(StrandSegment *sseg, StrandPoint *spoint)
sub_v3_v3v3(spoint->co1, spoint->co, cross);
add_v3_v3v3(spoint->co2, spoint->co, cross);
- VECCOPY(spoint->dsco, cross);
+ copy_v3_v3(spoint->dsco, cross);
}
/* *************** */
@@ -617,10 +614,10 @@ static void do_scanconvert_strand(Render *UNUSED(re), StrandPart *spart, ZSpan *
{
float jco1[3], jco2[3], jco3[3], jco4[3], jx, jy;
- VECCOPY(jco1, co1);
- VECCOPY(jco2, co2);
- VECCOPY(jco3, co3);
- VECCOPY(jco4, co4);
+ copy_v3_v3(jco1, co1);
+ copy_v3_v3(jco2, co2);
+ copy_v3_v3(jco3, co3);
+ copy_v3_v3(jco4, co4);
if(spart->jit) {
jx= -spart->jit[sample][0];
@@ -1008,7 +1005,7 @@ StrandSurface *cache_strand_surface(Render *re, ObjectRen *obr, DerivedMesh *dm,
mvert= dm->getVertArray(dm);
for(a=0; a<mesh->totvert; a++, mvert++) {
- VECCOPY(co[a], mvert->co);
+ copy_v3_v3(co[a], mvert->co);
mul_m4_v3(mat, co[a]);
}
@@ -1047,7 +1044,7 @@ void strand_minmax(StrandRen *strand, float *min, float *max, float width)
int a;
for(a=0, svert=strand->vert; a<strand->totvert; a++, svert++) {
- VECCOPY(vec, svert->co);
+ copy_v3_v3(vec, svert->co);
DO_MINMAX(vec, min, max);
if(width!=0.0f) {
diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c
index 850db5a55d4..29eea081672 100644
--- a/source/blender/render/intern/source/volume_precache.c
+++ b/source/blender/render/intern/source/volume_precache.c
@@ -102,8 +102,8 @@ static int point_inside_obi(RayObject *tree, ObjectInstanceRen *UNUSED(obi), flo
int final_depth=0, depth=0, limit=20;
/* set up the isect */
- VECCOPY(isect.start, co);
- VECCOPY(isect.dir, dir);
+ copy_v3_v3(isect.start, co);
+ copy_v3_v3(isect.dir, dir);
isect.mode= RE_RAY_MIRROR;
isect.last_hit= NULL;
isect.lay= -1;
@@ -623,7 +623,7 @@ static void precache_init_parts(Render *re, RayObject *tree, ShadeInput *shi, Ob
copy_v3_v3(pa->bbmin, bbmin);
copy_v3_v3(pa->voxel, voxel);
- VECCOPY(pa->res, res);
+ copy_v3_v3_int(pa->res, res);
pa->minx = minx; pa->maxx = maxx;
pa->miny = miny; pa->maxy = maxy;
diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c
index d624751f613..57ff5f4237a 100644
--- a/source/blender/render/intern/source/voxeldata.c
+++ b/source/blender/render/intern/source/voxeldata.c
@@ -241,7 +241,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
size_t i;
float *heat;
- VECCOPY(vd->resol, smd->domain->res);
+ copy_v3_v3_int(vd->resol, smd->domain->res);
totRes= vd_resol_size(vd);
// scaling heat values from -2.0-2.0 to 0.0-1.0
@@ -262,7 +262,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
size_t i;
float *xvel, *yvel, *zvel;
- VECCOPY(vd->resol, smd->domain->res);
+ copy_v3_v3_int(vd->resol, smd->domain->res);
totRes= vd_resol_size(vd);
// scaling heat values from -2.0-2.0 to 0.0-1.0
@@ -286,7 +286,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra)
smoke_turbulence_get_res(smd->domain->wt, vd->resol);
density = smoke_turbulence_get_density(smd->domain->wt);
} else {
- VECCOPY(vd->resol, smd->domain->res);
+ copy_v3_v3_int(vd->resol, smd->domain->res);
density = smoke_get_density(smd->domain->fluid);
}
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 7a8779ee969..8b383992e65 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -444,12 +444,12 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
/* all lines from left to right */
if(vec1[0]<vec2[0]) {
- VECCOPY(v1, vec1);
- VECCOPY(v2, vec2);
+ copy_v3_v3(v1, vec1);
+ copy_v3_v3(v2, vec2);
}
else {
- VECCOPY(v2, vec1);
- VECCOPY(v1, vec2);
+ copy_v3_v3(v2, vec1);
+ copy_v3_v3(v1, vec2);
dx= -dx; dy= -dy;
}
@@ -512,12 +512,12 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec
/* all lines from top to bottom */
if(vec1[1]<vec2[1]) {
- VECCOPY(v1, vec1);
- VECCOPY(v2, vec2);
+ copy_v3_v3(v1, vec1);
+ copy_v3_v3(v2, vec2);
}
else {
- VECCOPY(v2, vec1);
- VECCOPY(v1, vec2);
+ copy_v3_v3(v2, vec1);
+ copy_v3_v3(v1, vec2);
dx= -dx; dy= -dy;
}
@@ -598,12 +598,12 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
/* all lines from left to right */
if(vec1[0]<vec2[0]) {
- VECCOPY(v1, vec1);
- VECCOPY(v2, vec2);
+ copy_v3_v3(v1, vec1);
+ copy_v3_v3(v2, vec2);
}
else {
- VECCOPY(v2, vec1);
- VECCOPY(v1, vec2);
+ copy_v3_v3(v2, vec1);
+ copy_v3_v3(v1, vec2);
dx= -dx; dy= -dy;
}
@@ -656,12 +656,12 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, float *vec1, float *vec2)
else {
/* all lines from top to bottom */
if(vec1[1]<vec2[1]) {
- VECCOPY(v1, vec1);
- VECCOPY(v2, vec2);
+ copy_v3_v3(v1, vec1);
+ copy_v3_v3(v2, vec2);
}
else {
- VECCOPY(v2, vec1);
- VECCOPY(v1, vec2);
+ copy_v3_v3(v2, vec1);
+ copy_v3_v3(v1, vec2);
dx= -dx; dy= -dy;
}
@@ -728,12 +728,12 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
/* all lines from left to right */
if(vec1[0]<vec2[0]) {
- VECCOPY(v1, vec1);
- VECCOPY(v2, vec2);
+ copy_v3_v3(v1, vec1);
+ copy_v3_v3(v2, vec2);
}
else {
- VECCOPY(v2, vec1);
- VECCOPY(v1, vec2);
+ copy_v3_v3(v2, vec1);
+ copy_v3_v3(v1, vec2);
dx= -dx; dy= -dy;
}
@@ -784,12 +784,12 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), flo
else {
/* all lines from top to bottom */
if(vec1[1]<vec2[1]) {
- VECCOPY(v1, vec1);
- VECCOPY(v2, vec2);
+ copy_v3_v3(v1, vec1);
+ copy_v3_v3(v2, vec2);
}
else {
- VECCOPY(v2, vec1);
- VECCOPY(v1, vec2);
+ copy_v3_v3(v2, vec1);
+ copy_v3_v3(v1, vec2);
dx= -dx; dy= -dy;
}
@@ -925,8 +925,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
else { /* clipping */
if(ec & ME_V1V2) {
- QUATCOPY(vez, ho1);
- QUATCOPY(vez+4, ho2);
+ copy_v4_v4(vez, ho1);
+ copy_v4_v4(vez+4, ho2);
if( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
@@ -934,8 +934,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
}
}
if(ec & ME_V2V3) {
- QUATCOPY(vez, ho2);
- QUATCOPY(vez+4, ho3);
+ copy_v4_v4(vez, ho2);
+ copy_v4_v4(vez+4, ho3);
if( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
@@ -944,8 +944,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
}
if(ho4) {
if(ec & ME_V3V4) {
- QUATCOPY(vez, ho3);
- QUATCOPY(vez+4, ho4);
+ copy_v4_v4(vez, ho3);
+ copy_v4_v4(vez+4, ho4);
if( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
@@ -953,8 +953,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
}
}
if(ec & ME_V4V1) {
- QUATCOPY(vez, ho4);
- QUATCOPY(vez+4, ho1);
+ copy_v4_v4(vez, ho4);
+ copy_v4_v4(vez+4, ho1);
if( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
@@ -964,8 +964,8 @@ void zbufclipwire(ZSpan *zspan, int obi, int zvlnr, int ec, float *ho1, float *h
}
else {
if(ec & ME_V3V1) {
- QUATCOPY(vez, ho3);
- QUATCOPY(vez+4, ho1);
+ copy_v4_v4(vez, ho3);
+ copy_v4_v4(vez+4, ho1);
if( clipline(vez, vez+4)) {
hoco_to_zco(zspan, vez, vez);
hoco_to_zco(zspan, vez+4, vez+4);
@@ -1748,7 +1748,7 @@ static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[
int cindex= index & 255;
if(cache[cindex].index == index) {
- QUATCOPY(ho, cache[cindex].ho);
+ copy_v4_v4(ho, cache[cindex].ho);
return cache[cindex].clip;
}
else {
@@ -1756,7 +1756,7 @@ static int zbuf_shadow_project(ZbufProjectCache *cache, int index, float winmat[
projectvert(co, winmat, ho);
clipflag= testclip(ho);
- QUATCOPY(cache[cindex].ho, ho);
+ copy_v4_v4(cache[cindex].ho, ho);
cache[cindex].clip= clipflag;
cache[cindex].index= index;
@@ -1778,13 +1778,13 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][
int cindex= index & 255;
if(cache[cindex].index == index) {
- QUATCOPY(ho, cache[cindex].ho);
+ copy_v4_v4(ho, cache[cindex].ho);
return cache[cindex].clip;
}
else {
float wco;
int clipflag= 0;
- VECCOPY(vec, co)
+ copy_v3_v3(vec, co);
projectvert(co, winmat, ho);
wco= ho[3];
@@ -1793,7 +1793,7 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][
if(ho[1] > bounds[3]*wco) clipflag |= 4;
else if(ho[1] < bounds[2]*wco) clipflag |= 8;
- QUATCOPY(cache[cindex].ho, ho);
+ copy_v4_v4(cache[cindex].ho, ho);
cache[cindex].clip= clipflag;
cache[cindex].index= index;
@@ -1801,11 +1801,11 @@ static int zbuf_part_project(ZbufProjectCache *cache, int index, float winmat[][
}
}
-void zbuf_render_project(float winmat[][4], float *co, float *ho)
+void zbuf_render_project(float winmat[][4], const float co[3], float ho[4])
{
float vec[3];
- VECCOPY(vec, co)
+ copy_v3_v3(vec, co);
projectvert(vec, winmat, ho);
}
@@ -3348,7 +3348,7 @@ static int zbuffer_abuf(Render *re, RenderPart *pa, APixstr *APixbuf, ListBase *
mul= 0x7FFFFFFF;
zval= mul*(1.0f+ho1[2]/ho1[3]);
- VECCOPY(vec, v1->co);
+ copy_v3_v3(vec, v1->co);
/* z is negative, otherwise its being clipped */
vec[2]-= ma->zoffs;
projectverto(vec, obwinmat, hoco);
@@ -3474,7 +3474,7 @@ void add_transp_speed(RenderLayer *rl, int offset, float *speed, float alpha, in
if(fp[3]==PASS_VECTOR_MAX) fp[3]= 0.0f;
}
else if(rdrect==NULL || rdrect[offset]==0 || alpha>0.95f) {
- QUATCOPY(fp, speed);
+ copy_v4_v4(fp, speed);
}
else {
/* add minimum speed in pixel */
@@ -3866,7 +3866,7 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
samp_shr->z= MIN2(samp_shr->z, shr->z);
if(addpassflag & SCE_PASS_VECTOR) {
- QUATCOPY(samp_shr->winspeed, shr->winspeed);
+ copy_v4_v4(samp_shr->winspeed, shr->winspeed);
}
/* optim... */
if(addpassflag & ~(SCE_PASS_VECTOR)) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 933066513e2..19e9a6bd483 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -270,7 +270,7 @@ static int wm_macro_modal(bContext *C, wmOperator *op, wmEvent *event)
int retval= OPERATOR_FINISHED;
if(opm==NULL)
- printf("macro error, calling NULL modal()\n");
+ printf("%s: macro error, calling NULL modal()\n", __func__);
else {
retval = opm->type->modal(C, opm, event);
OPERATOR_RETVAL_CHECK(retval);
@@ -341,7 +341,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam
wmOperatorType *ot;
if(WM_operatortype_find(idname, TRUE)) {
- printf("Macro error: operator %s exists\n", idname);
+ printf("%s: macro error: operator %s exists\n", __func__, idname);
return NULL;
}
@@ -658,10 +658,11 @@ int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
uiLayout *layout;
if(prop==NULL) {
- printf("WM_menu_invoke: %s has no enum property set\n", op->type->idname);
+ printf("%s: %s has no enum property set\n", __func__, op->type->idname);
}
else if (RNA_property_type(prop) != PROP_ENUM) {
- printf("WM_menu_invoke: %s \"%s\" is not an enum property\n", op->type->idname, RNA_property_identifier(prop));
+ printf("%s: %s \"%s\" is not an enum property\n",
+ __func__, op->type->idname, RNA_property_identifier(prop));
}
else if (RNA_property_is_set(op->ptr, RNA_property_identifier(prop))) {
const int retval= op->type->exec(C, op);
@@ -686,10 +687,12 @@ static void operator_enum_search_cb(const struct bContext *C, void *arg_ot, cons
PropertyRNA *prop= ot->prop;
if(prop==NULL) {
- printf("WM_enum_search_invoke: %s has no enum property set\n", ot->idname);
+ printf("%s: %s has no enum property set\n",
+ __func__, ot->idname);
}
else if (RNA_property_type(prop) != PROP_ENUM) {
- printf("WM_enum_search_invoke: %s \"%s\" is not an enum property\n", ot->idname, RNA_property_identifier(prop));
+ printf("%s: %s \"%s\" is not an enum property\n",
+ __func__, ot->idname, RNA_property_identifier(prop));
}
else {
PointerRNA ptr;
@@ -725,7 +728,7 @@ static void operator_enum_call_cb(struct bContext *C, void *arg1, void *arg2)
WM_operator_properties_free(&props_ptr);
}
else {
- printf("operator_enum_call_cb: op->prop for '%s' is NULL\n", ot->idname);
+ printf("%s: op->prop for '%s' is NULL\n", __func__, ot->idname);
}
}
}
@@ -2619,7 +2622,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event)
memcpy(gesture->customdata, old_lasso, 2*sizeof(short)*gesture->size);
gesture->size = gesture->size + WM_LASSO_MIN_POINTS;
MEM_freeN(old_lasso);
- printf("realloc\n");
+ // printf("realloc\n");
}
{
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp
index a6d02db8cea..abc45293542 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -445,9 +445,9 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel,
pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there.
if(pchan) {
- VECCOPY (pchan->loc, matrix[3]);
- mat4_to_size( pchan->size,matrix);
- mat4_to_quat( pchan->quat,matrix);
+ copy_v3_v3(pchan->loc, matrix[3]);
+ mat4_to_size(pchan->size, matrix);
+ mat4_to_quat(pchan->quat, matrix);
}
}
else {
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 836cfab6b49..5a44e1022ff 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -162,8 +162,8 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/)
if (schan->rotmode == ROT_MODE_QUAT) {
float dquat[4], squat[4];
- QUATCOPY(dquat, dchan->quat);
- QUATCOPY(squat, schan->quat);
+ copy_qt_qt(dquat, dchan->quat);
+ copy_qt_qt(squat, schan->quat);
if (mode==ACTSTRIPMODE_BLEND)
interp_qt_qtqt(dchan->quat, dquat, squat, srcweight);
else {