diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-11 06:50:01 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-11 06:50:01 +0400 |
commit | 599cd56f535946726bc30e66e7ac483ec91ab6fd (patch) | |
tree | c0c09962558535a0a3435f1eed2669deb3b91094 /source/blender/blenkernel/intern | |
parent | 3a5f2272adc4ec821db16de95781b9ce653dda73 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/colortools.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/shrinkwrap.c | 16 |
4 files changed, 17 insertions, 27 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index c497cd2813a..c84a3cfc730 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -555,7 +555,7 @@ void brush_imbuf_new(Brush *brush, short flt, short texfall, int bufsize, ImBuf 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 @@ static void brush_painter_do_partial(BrushPainter *painter, ImBuf *oldtexibuf, i 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 @@ static void brush_apply_pressure(BrushPainter *painter, Brush *brush, float pres 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 @@ void brush_jitter_pos(Brush *brush, float *pos, float *jitterpos) jitterpos[1] = pos[1] + 2*rand_pos[1]*diameter*brush->jitter; } else { - VECCOPY2D(jitterpos, pos); + copy_v2_v2(jitterpos, pos); } } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 9a6c2cc7e31..61e9daf4138 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -167,14 +167,14 @@ CurveMapping *curvemapping_copy(CurveMapping *cumap) 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 @@ static void calchandle_curvemap(BezTriple *bezt, BezTriple *prev, BezTriple *nex /* 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 @@ float curvemapping_evaluateF(CurveMapping *cumap, int cur, float value) } /* 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 @@ void curvemapping_evaluate3F(CurveMapping *cumap, float *vecout, const float *ve } /* 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 @@ void curvemapping_evaluateRGBF(CurveMapping *cumap, float *vecout, const float * /* 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; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index b1beb6c449a..254629befd5 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -2547,9 +2547,9 @@ void calchandleNurb(BezTriple *bezt, BezTriple *prev, BezTriple *next, int mode) 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]; diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index 7b04a72666d..d2d22aa213a 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -134,16 +134,6 @@ static void space_transform_invert_normal(const SpaceTransform *data, float *no) } /* - * 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 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc) //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 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc) 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 @@ static void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc) //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; |