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:
authorCampbell Barton <ideasman42@gmail.com>2015-08-21 10:05:48 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-08-21 10:09:18 +0300
commitc727fc59abe2b7e525bdc6594bbd7ec3285936e0 (patch)
treedfcadf23e28c2464655f4c06a5f94621721fe0c2 /source/blender/blenkernel/intern/dynamicpaint.c
parenta98b02ff941edb1d92892f520641433582754f0d (diff)
BVH-raycast: ensure input direction is unit-length
This was already the case for most users of ray-cast. Doing this avoids 2x normalize calls per ray-cast in many places.
Diffstat (limited to 'source/blender/blenkernel/intern/dynamicpaint.c')
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index d97233aad90..7f1d2e877ed 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -3290,10 +3290,9 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
if (brush->flags & MOD_DPAINT_PROX_PROJECT && brush->collision != MOD_DPAINT_COL_VOLUME) {
mul_v3_fl(avg_brushNor, 1.0f / (float)numOfVerts);
/* instead of null vector use positive z */
- if (!(MIN3(avg_brushNor[0], avg_brushNor[1], avg_brushNor[2])))
+ if (UNLIKELY(normalize_v3(avg_brushNor) == 0.0f)) {
avg_brushNor[2] = 1.0f;
- else
- normalize_v3(avg_brushNor);
+ }
}
/* check bounding box collision */