[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29194] trunk/blender/source/blender/ modifiers/intern/MOD_wave.c: wave modifier was dividing by zero for each vertex with default settings of falloff == 0.0f.
Campbell Barton
ideasman42 at gmail.com
Thu Jun 3 21:56:14 CEST 2010
Revision: 29194
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29194
Author: campbellbarton
Date: 2010-06-03 21:56:13 +0200 (Thu, 03 Jun 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/modifiers/intern/MOD_wave.c
Modified: trunk/blender/source/blender/modifiers/intern/MOD_wave.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_wave.c 2010-06-03 18:25:03 UTC (rev 29193)
+++ trunk/blender/source/blender/modifiers/intern/MOD_wave.c 2010-06-03 19:56:13 UTC (rev 29194)
@@ -293,7 +293,9 @@
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 @@
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);
More information about the Bf-blender-cvs
mailing list