diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-04 02:32:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-04 02:32:03 +0400 |
commit | 9467d9940583d6c3a2e1b83f854453da9e64fdd7 (patch) | |
tree | b69c66e465ee618bfc4888648be557b74f26e822 /source/blender/editors/sculpt_paint | |
parent | 4ee18eaf12e0430c267054ff04952586fa461153 (diff) |
replace sqrt(dot()) with length functions.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_vertex.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index d4f8e608f0b..538e8394b1f 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -919,15 +919,13 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const float co co, co_ss, V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK) { - float delta[2]; - float dist_squared; - float factor = 1.0; + const float dist_squared = len_squared_v2v2(mval, co_ss); - sub_v2_v2v2(delta, mval, co_ss); - dist_squared = dot_v2v2(delta, delta); /* len squared */ if (dist_squared <= brush_size_pressure * brush_size_pressure) { Brush *brush = BKE_paint_brush(&vp->paint); const float dist = sqrtf(dist_squared); + float factor; + if (brush->mtex.tex && rgba) { if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) { BKE_brush_sample_tex_3D(vc->scene, brush, co, rgba, 0, NULL); @@ -938,6 +936,9 @@ static float calc_vp_strength_col_dl(VPaint *vp, ViewContext *vc, const float co } factor = rgba[3]; } + else { + factor = 1.0f; + } return factor * BKE_brush_curve_strength_clamp(brush, dist, brush_size_pressure); } } |