[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40108] trunk/blender/source/blender: minor edits / cleanup - no functional changes.
Campbell Barton
ideasman42 at gmail.com
Sun Sep 11 04:50:04 CEST 2011
Revision: 40108
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40108
Author: campbellbarton
Date: 2011-09-11 02:50:01 +0000 (Sun, 11 Sep 2011)
Log Message:
-----------
minor edits / cleanup - no functional changes.
- use 'const float *' and array size in some function declarations.
- replace macros for BLI_math functions INPF, VECCOPY, VECADD etc.
- remove unused VertRen.clip struct member.
- remove static squared_dist() from 2 files, replace with BLI_math function len_squared_v3v3().
- use vertex arrays for drawing clipping background in the 3D viewport.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_colortools.h
trunk/blender/source/blender/blenkernel/intern/brush.c
trunk/blender/source/blender/blenkernel/intern/colortools.c
trunk/blender/source/blender/blenkernel/intern/curve.c
trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c
trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c
trunk/blender/source/blender/editors/armature/meshlaplacian.c
trunk/blender/source/blender/editors/mesh/editmesh_add.c
trunk/blender/source/blender/editors/mesh/editmesh_lib.c
trunk/blender/source/blender/editors/space_node/drawnode.c
trunk/blender/source/blender/editors/space_view3d/drawarmature.c
trunk/blender/source/blender/editors/space_view3d/drawobject.c
trunk/blender/source/blender/editors/space_view3d/drawvolume.c
trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
trunk/blender/source/blender/modifiers/intern/MOD_weightvgproximity.c
trunk/blender/source/blender/render/intern/include/render_types.h
trunk/blender/source/blender/render/intern/include/rendercore.h
trunk/blender/source/blender/render/intern/include/renderdatabase.h
trunk/blender/source/blender/render/intern/include/shading.h
trunk/blender/source/blender/render/intern/include/zbuf.h
trunk/blender/source/blender/render/intern/source/convertblender.c
trunk/blender/source/blender/render/intern/source/render_texture.c
trunk/blender/source/blender/render/intern/source/rendercore.c
trunk/blender/source/blender/render/intern/source/renderdatabase.c
trunk/blender/source/blender/render/intern/source/shadeinput.c
trunk/blender/source/blender/render/intern/source/shadeoutput.c
trunk/blender/source/blender/render/intern/source/sss.c
trunk/blender/source/blender/render/intern/source/volumetric.c
trunk/blender/source/blender/render/intern/source/zbuf.c
Modified: trunk/blender/source/blender/blenkernel/BKE_colortools.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_colortools.h 2011-09-11 00:08:07 UTC (rev 40107)
+++ trunk/blender/source/blender/blenkernel/BKE_colortools.h 2011-09-11 02:50:01 UTC (rev 40108)
@@ -55,7 +55,7 @@
struct CurveMapping *curvemapping_add(int tot, float minx, float miny, float maxx, float maxy);
void curvemapping_free(struct CurveMapping *cumap);
struct CurveMapping *curvemapping_copy(struct CurveMapping *cumap);
-void curvemapping_set_black_white(struct CurveMapping *cumap, float *black, float *white);
+void curvemapping_set_black_white(struct CurveMapping *cumap, const float black[3], const float white[3]);
#define CURVEMAP_SLOPE_NEGATIVE 0
#define CURVEMAP_SLOPE_POSITIVE 1
@@ -70,9 +70,9 @@
float curvemap_evaluateF(struct CurveMap *cuma, float value);
/* single curve, with table check */
float curvemapping_evaluateF(struct CurveMapping *cumap, int cur, float value);
-void curvemapping_evaluate3F(struct CurveMapping *cumap, float *vecout, const float *vecin);
-void curvemapping_evaluateRGBF(struct CurveMapping *cumap, float *vecout, const float *vecin);
-void curvemapping_evaluate_premulRGBF(struct CurveMapping *cumap, float *vecout, const float *vecin);
+void curvemapping_evaluate3F(struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
+void curvemapping_evaluateRGBF(struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
+void curvemapping_evaluate_premulRGBF(struct CurveMapping *cumap, float vecout[3], const float vecin[3]);
void curvemapping_do_ibuf(struct CurveMapping *cumap, struct ImBuf *ibuf);
void curvemapping_premultiply(struct CurveMapping *cumap, int restore);
int curvemapping_RGBA_does_something(struct CurveMapping *cumap);
Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c 2011-09-11 00:08:07 UTC (rev 40107)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c 2011-09-11 02:50:01 UTC (rev 40108)
@@ -555,7 +555,7 @@
if (texfall == 0) {
dist = sqrt(xy[0]*xy[0] + xy[1]*xy[1]);
- VECCOPY(dstf, brush_rgb);
+ copy_v3_v3(dstf, brush_rgb);
dstf[3]= alpha*brush_curve_strength_clamp(brush, dist, radius);
}
else if (texfall == 1) {
@@ -754,7 +754,7 @@
for (x=origx; x < w; x++, bf+=4, mf+=4, tf+=4) {
if (dotexold) {
- VECCOPY(tf, otf);
+ copy_v3_v3(tf, otf);
tf[3] = otf[3];
otf += 4;
}
@@ -926,7 +926,7 @@
brush->spacing = MAX2(1.0f, painter->startspacing*(1.5f-pressure));
}
-void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos)
+void brush_jitter_pos(Brush *brush, float pos[2], float jitterpos[2])
{
int use_jitter= brush->jitter != 0;
@@ -949,7 +949,7 @@
jitterpos[1] = pos[1] + 2*rand_pos[1]*diameter*brush->jitter;
}
else {
- VECCOPY2D(jitterpos, pos);
+ copy_v2_v2(jitterpos, pos);
}
}
Modified: trunk/blender/source/blender/blenkernel/intern/colortools.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/colortools.c 2011-09-11 00:08:07 UTC (rev 40107)
+++ trunk/blender/source/blender/blenkernel/intern/colortools.c 2011-09-11 02:50:01 UTC (rev 40108)
@@ -167,14 +167,14 @@
return NULL;
}
-void curvemapping_set_black_white(CurveMapping *cumap, float *black, float *white)
+void curvemapping_set_black_white(CurveMapping *cumap, const float black[3], const float white[3])
{
int a;
if(white)
- VECCOPY(cumap->white, white);
+ copy_v3_v3(cumap->white, white);
if(black)
- VECCOPY(cumap->black, black);
+ copy_v3_v3(cumap->black, black);
for(a=0; a<3; a++) {
if(cumap->white[a]==cumap->black[a])
@@ -432,7 +432,7 @@
/* in X, out Y.
X is presumed to be outside first or last */
-static float curvemap_calc_extend(CurveMap *cuma, float x, float *first, float *last)
+static float curvemap_calc_extend(CurveMap *cuma, float x, const float first[2], const float last[2])
{
if(x <= first[0]) {
if((cuma->flag & CUMA_EXTEND_EXTRAPOLATE)==0) {
@@ -753,7 +753,7 @@
}
/* vector case */
-void curvemapping_evaluate3F(CurveMapping *cumap, float *vecout, const float *vecin)
+void curvemapping_evaluate3F(CurveMapping *cumap, float vecout[3], const float vecin[3])
{
vecout[0]= curvemapping_evaluateF(cumap, 0, vecin[0]);
vecout[1]= curvemapping_evaluateF(cumap, 1, vecin[1]);
@@ -761,7 +761,7 @@
}
/* RGB case, no black/white points, no premult */
-void curvemapping_evaluateRGBF(CurveMapping *cumap, float *vecout, const float *vecin)
+void curvemapping_evaluateRGBF(CurveMapping *cumap, float vecout[3], const float vecin[3])
{
vecout[0]= curvemapping_evaluateF(cumap, 0, curvemapping_evaluateF(cumap, 3, vecin[0]));
vecout[1]= curvemapping_evaluateF(cumap, 1, curvemapping_evaluateF(cumap, 3, vecin[1]));
@@ -770,7 +770,7 @@
/* RGB with black/white points and premult. tables are checked */
-void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float *vecout, const float *vecin)
+void curvemapping_evaluate_premulRGBF(CurveMapping *cumap, float vecout[3], const float vecin[3])
{
float fac;
Modified: trunk/blender/source/blender/blenkernel/intern/curve.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/curve.c 2011-09-11 00:08:07 UTC (rev 40107)
+++ trunk/blender/source/blender/blenkernel/intern/curve.c 2011-09-11 02:50:01 UTC (rev 40108)
@@ -2547,9 +2547,9 @@
sub_v3_v3v3(h2, p2, p2+3);
len1= normalize_v3(h1);
len2= normalize_v3(h2);
-
- vz= INPR(h1, h2);
-
+
+ vz= dot_v3v3(h1, h2);
+
if(leftviolate) {
*(p2+3)= *(p2) - vz*len2*h1[0];
*(p2+4)= *(p2+1) - vz*len2*h1[1];
Modified: trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c 2011-09-11 00:08:07 UTC (rev 40107)
+++ trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c 2011-09-11 02:50:01 UTC (rev 40108)
@@ -134,16 +134,6 @@
}
/*
- * Returns the squared distance between two given points
- */
-static float squared_dist(const float *a, const float *b)
-{
- float tmp[3];
- VECSUB(tmp, a, b);
- return INPR(tmp, tmp);
-}
-
-/*
* Shrinkwrap to the nearest vertex
*
* it builds a kdtree of vertexs we can attach to and then
@@ -195,7 +185,7 @@
//so we can initiate the "nearest.dist" with the expected value to that last hit.
//This will lead in prunning of the search tree.
if(nearest.index != -1)
- nearest.dist = squared_dist(tmp_co, nearest.co);
+ nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
else
nearest.dist = FLT_MAX;
@@ -328,7 +318,7 @@
normalize_v3(proj_axis);
//Invalid projection direction
- if(INPR(proj_axis, proj_axis) < FLT_EPSILON)
+ if(dot_v3v3(proj_axis, proj_axis) < FLT_EPSILON)
return;
}
@@ -469,7 +459,7 @@
//so we can initiate the "nearest.dist" with the expected value to that last hit.
//This will lead in prunning of the search tree.
if(nearest.index != -1)
- nearest.dist = squared_dist(tmp_co, nearest.co);
+ nearest.dist = len_squared_v3v3(tmp_co, nearest.co);
else
nearest.dist = FLT_MAX;
Modified: trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c 2011-09-11 00:08:07 UTC (rev 40107)
+++ trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c 2011-09-11 02:50:01 UTC (rev 40108)
@@ -408,7 +408,7 @@
// for all Axes.
for (i = tree->start_axis; i < tree->stop_axis; i++)
{
- newminmax = INPR(&co[k * 3], KDOP_AXES[i]);
+ newminmax = dot_v3v3(&co[k * 3], KDOP_AXES[i]);
if (newminmax < bv[2 * i])
bv[2 * i] = newminmax;
if (newminmax > bv[(2 * i) + 1])
@@ -1193,17 +1193,6 @@
return overlap;
}
-
-/*
- * Nearest neighbour - BLI_bvhtree_find_nearest
- */
-static float squared_dist(const float *a, const float *b)
-{
- float tmp[3];
- VECSUB(tmp, a, b);
- return INPR(tmp, tmp);
-}
-
//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)
{
@@ -1226,7 +1215,7 @@
VECCOPY(nearest, data->co);
for(i = data->tree->start_axis; i != data->tree->stop_axis; i++, bv+=2)
{
- float proj = INPR( nearest, KDOP_AXES[i]);
+ float proj = dot_v3v3( nearest, KDOP_AXES[i]);
float dl = bv[0] - proj;
float du = bv[1] - proj;
@@ -1240,7 +1229,7 @@
}
}
*/
- return squared_dist(proj, nearest);
+ return len_squared_v3v3(proj, nearest);
}
@@ -1404,7 +1393,7 @@
for(i = data.tree->start_axis; i != data.tree->stop_axis; i++)
{
- data.proj[i] = INPR(data.co, KDOP_AXES[i]);
+ data.proj[i] = dot_v3v3(data.co, KDOP_AXES[i]);
}
if(nearest)
@@ -1596,7 +1585,7 @@
for(i=0; i<3; i++)
{
- data.ray_dot_axis[i] = INPR( data.ray.direction, KDOP_AXES[i]);
+ data.ray_dot_axis[i] = dot_v3v3(data.ray.direction, KDOP_AXES[i]);
data.idot_axis[i] = 1.0f / data.ray_dot_axis[i];
if(fabsf(data.ray_dot_axis[i]) < FLT_EPSILON)
Modified: trunk/blender/source/blender/editors/armature/meshlaplacian.c
===================================================================
--- trunk/blender/source/blender/editors/armature/meshlaplacian.c 2011-09-11 00:08:07 UTC (rev 40107)
+++ trunk/blender/source/blender/editors/armature/meshlaplacian.c 2011-09-11 02:50:01 UTC (rev 40108)
@@ -518,7 +518,7 @@
dist= normalize_v3(d);
/* if the vertex normal does not point along the bone, increase distance */
- cosine= INPR(d, sys->heat.vnors[vertex]);
+ cosine= dot_v3v3(d, sys->heat.vnors[vertex]);
return dist/(0.5f*(cosine + 1.001f));
}
@@ -1120,7 +1120,7 @@
cross_v3_v3v3(pvec, dir, edge2);
/* if determinant is near zero, ray lies in plane of triangle */
- det = INPR(edge1, pvec);
+ det = dot_v3v3(edge1, pvec);
if (det == 0.0f)
return 0;
@@ -1130,7 +1130,7 @@
sub_v3_v3v3(tvec, orig, vert0);
/* calculate U parameter and test bounds */
- u = INPR(tvec, pvec) * inv_det;
+ u = dot_v3v3(tvec, pvec) * inv_det;
if (u < -EPSILON || u > 1.0f+EPSILON)
return 0;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list