clamp delta to prevent cases where strength is a huge number. Very high values would...
authorNathan Letwory <nathan@letworyinteractive.com>
Tue, 24 May 2011 11:20:33 +0000 (11:20 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Tue, 24 May 2011 11:20:33 +0000 (11:20 +0000)
source/blender/modifiers/intern/MOD_displace.c

index 3288c1b5da1f4e8213eee6078c5d1c9a7e10fbc7..02845ecaab7e967e79a4e2786fff3388254be412 100644 (file)
@@ -210,6 +210,7 @@ static void displaceModifier_do(
                if(def_weight) strength *= def_weight->weight;
 
                delta *= strength;
+               CLAMP(delta, -10000, 10000);
 
                switch(dmd->direction) {
                        case MOD_DISP_DIR_X:
@@ -227,9 +228,9 @@ static void displaceModifier_do(
                                vertexCos[i][2] += (texres.tb - dmd->midlevel) * strength;
                                break;
                        case MOD_DISP_DIR_NOR:
-                               vertexCos[i][0] += delta * mvert[i].no[0] / 32767.0f;
-                               vertexCos[i][1] += delta * mvert[i].no[1] / 32767.0f;
-                               vertexCos[i][2] += delta * mvert[i].no[2] / 32767.0f;
+                               vertexCos[i][0] += delta * (mvert[i].no[0] / 32767.0f);
+                               vertexCos[i][1] += delta * (mvert[i].no[1] / 32767.0f);
+                               vertexCos[i][2] += delta * (mvert[i].no[2] / 32767.0f);
                                break;
                }
        }