Commit: a8fe38ea50fd98bed2726d0b1287638c44dbd849
Author: Campbell Barton
Date:   Tue Feb 3 04:35:02 2015 +1100
Branches: temp_custom_loop_normals
https://developer.blender.org/rBa8fe38ea50fd98bed2726d0b1287638c44dbd849

Warp modifier: avoid sqrt checking radius

===================================================================

M       source/blender/modifiers/intern/MOD_warp.c

===================================================================

diff --git a/source/blender/modifiers/intern/MOD_warp.c 
b/source/blender/modifiers/intern/MOD_warp.c
index 60ed4be..9abec80 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -167,6 +167,7 @@ static void warpModifier_do(WarpModifierData *wmd, Object 
*ob,
 
        float tmat[4][4];
 
+       const float falloff_radius_sq = SQUARE(wmd->falloff_radius);
        float strength = wmd->strength;
        float fac = 1.0f, weight;
        int i;
@@ -222,8 +223,8 @@ static void warpModifier_do(WarpModifierData *wmd, Object 
*ob,
                float *co = vertexCos[i];
 
                if (wmd->falloff_type == eWarp_Falloff_None ||
-                   ((fac = len_v3v3(co, mat_from[3])) < wmd->falloff_radius &&
-                    (fac = (wmd->falloff_radius - fac) / wmd->falloff_radius)))
+                   ((fac = len_squared_v3v3(co, mat_from[3])) < 
falloff_radius_sq &&
+                    (fac = (wmd->falloff_radius - sqrtf(fac)) / 
wmd->falloff_radius)))
                {
                        /* skip if no vert group found */
                        if (dvert && defgrp_index != -1) {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to