svn merge -r36840:36890 https://svn.blender.org/svnroot/bf-blender/trunk/blender
[blender.git] / source / blender / modifiers / intern / MOD_displace.c
index 17e7940c1eea06c7206ac191553ab4b7a0b5f8d3..0b350e804164696213e1383662465a2c2ec64f7b 100644 (file)
@@ -211,6 +211,7 @@ static void displaceModifier_do(
                if(def_weight) strength *= def_weight->weight;
 
                delta *= strength;
                if(def_weight) strength *= def_weight->weight;
 
                delta *= strength;
+               CLAMP(delta, -10000, 10000);
 
                switch(dmd->direction) {
                        case MOD_DISP_DIR_X:
 
                switch(dmd->direction) {
                        case MOD_DISP_DIR_X:
@@ -228,9 +229,9 @@ static void displaceModifier_do(
                                vertexCos[i][2] += (texres.tb - dmd->midlevel) * strength;
                                break;
                        case MOD_DISP_DIR_NOR:
                                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;
                }
        }
                                break;
                }
        }