diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-03 23:56:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-03 23:56:13 +0400 |
commit | 6d72150312f7644126b5454e939b86dbcae9b370 (patch) | |
tree | dffdce87bc9c53257232ea697c3348515c49bac0 /source | |
parent | 54d764095f904a85d78ff6f7687f5a9ce5c7a117 (diff) |
wave modifier was dividing by zero for each vertex with default settings of falloff == 0.0f.
annoying with --debug-fpe and better to use multiply in the loop.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/modifiers/intern/MOD_wave.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index 8a328021a0e..23e13266d80 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -293,7 +293,9 @@ static void waveModifier_do(WaveModifierData *md, wavemod_get_texture_coords(wmd, ob, dm, vertexCos, tex_co, numVerts); } - if(lifefac != 0.0) { + if(lifefac != 0.0) { + /* avoid divide by zero checks within the loop */ + float falloff_inv= wmd->falloff ? 1.0f / wmd->falloff : 1.0; int i; for(i = 0; i < numVerts; i++) { @@ -338,8 +340,7 @@ static void waveModifier_do(WaveModifierData *md, dist = fabs(y); } - falloff_fac = (1.0-(dist / wmd->falloff)); - CLAMP(falloff_fac,0,1); + falloff_fac = (1.0f - (dist * falloff_inv)); if(wmd->flag & MOD_WAVE_X) { if(wmd->flag & MOD_WAVE_Y) amplit = (float)sqrt(x*x + y*y); |