From 81829f5221f24e72658fe89f52cbee73c37fe6f3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Jul 2012 12:42:02 +0000 Subject: [PATCH] code cleanup: use const for passing vectors --- source/blender/blenlib/BLI_kdopbvh.h | 2 +- source/blender/blenlib/intern/BLI_kdopbvh.c | 4 ++-- source/blender/editors/sculpt_paint/paint_image.c | 10 +++++++--- source/blender/ikplugin/intern/itasc_plugin.cpp | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 5ec8247c03a..a2957b32824 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -104,7 +104,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n 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, const float light_start[3], const float light_end[3], float pos[3]); +float BLI_bvhtree_bb_raycast(const 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[3], float radius, BVHTree_RangeQuery callback, void *userdata); diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index d07f19e78e0..a5b5065e023 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -1343,7 +1343,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, const float co[3], BVHTreeNearest *n /* Determines the distance that the ray must travel to hit the bounding volume of the given node */ -static float ray_nearest_hit(BVHRayCastData *data, float *bv) +static float ray_nearest_hit(BVHRayCastData *data, const float *bv) { int i; @@ -1521,7 +1521,7 @@ int BLI_bvhtree_ray_cast(BVHTree *tree, const float co[3], const float dir[3], f return data.hit.index; } -float BLI_bvhtree_bb_raycast(float *bv, const float light_start[3], const float light_end[3], float pos[3]) +float BLI_bvhtree_bb_raycast(const float *bv, const float light_start[3], const float light_end[3], float pos[3]) { BVHRayCastData data; float dist = 0.0; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index f6c17c97758..70a2ff9e0bc 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -583,7 +583,7 @@ static int project_bucket_offset_safe(const ProjPaintState *ps, const float proj } /* still use 2D X,Y space but this works for verts transformed by a perspective matrix, using their 4th component as a weight */ -static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], float co[2], float w[3]) +static void barycentric_weights_v2_persp(const float v1[4], const float v2[4], const float v3[4], const float co[2], float w[3]) { float wtot_inv, wtot; @@ -603,13 +603,17 @@ static void barycentric_weights_v2_persp(float v1[4], float v2[4], float v3[4], w[0] = w[1] = w[2] = 1.0f / 3.0f; } -static float VecZDepthOrtho(float pt[2], float v1[3], float v2[3], float v3[3], float w[3]) +static float VecZDepthOrtho(const float pt[2], + const float v1[3], const float v2[3], const float v3[3], + float w[3]) { barycentric_weights_v2(v1, v2, v3, pt, w); return (v1[2] * w[0]) + (v2[2] * w[1]) + (v3[2] * w[2]); } -static float VecZDepthPersp(float pt[2], float v1[4], float v2[4], float v3[4], float w[3]) +static float VecZDepthPersp(const float pt[2], + const float v1[4], const float v2[4], const float v3[4], + float w[3]) { float wtot_inv, wtot; float w_tmp[3]; diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index a0d7bfbaaf6..652b16a7c65 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -1618,7 +1618,7 @@ static void execute_scene(Scene *blscene, IK_Scene *ikscene, bItasc *ikparam, fl timestep = sts / 1000.0; } } - // don't cache if we are reiterating because we don't want to distroy the cache unnecessarily + // don't cache if we are reiterating because we don't want to destroy the cache unnecessarily ikscene->scene->update(timestamp, timestep, numstep, false, !reiterate, simulation); if (reiterate) { // how many times do we reiterate?