[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42069] trunk/blender/source/blender/ modifiers/intern/MOD_ocean.c: remove unnecessary switch() statement from ocean sim loop.
Campbell Barton
ideasman42 at gmail.com
Tue Nov 22 16:10:08 CET 2011
Revision: 42069
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42069
Author: campbellbarton
Date: 2011-11-22 15:10:08 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
remove unnecessary switch() statement from ocean sim loop.
Modified Paths:
--------------
trunk/blender/source/blender/modifiers/intern/MOD_ocean.c
Modified: trunk/blender/source/blender/modifiers/intern/MOD_ocean.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_ocean.c 2011-11-22 14:55:53 UTC (rev 42068)
+++ trunk/blender/source/blender/modifiers/intern/MOD_ocean.c 2011-11-22 15:10:08 UTC (rev 42069)
@@ -404,7 +404,8 @@
if (omd->cached == TRUE) {
if (!omd->oceancache) init_cache_data(ob, omd);
BKE_simulate_ocean_cache(omd->oceancache, md->scene->r.cfra);
- } else {
+ }
+ else {
simulate_ocean_modifier(omd);
}
@@ -441,43 +442,26 @@
mf = dm->getFaceArray(dm);
for (i = 0; i < num_faces; i++, mf++) {
- for (j=0; j<4; j++) {
+ j= mf->v4 ? 3 : 2;
+ do {
+ const float *co= mv[*(&mf->v1 + j)].co;
+ u = ocean_co(omd, co[0]);
+ v = ocean_co(omd, co[1]);
- if (j == 3 && !mf->v4) continue;
-
- switch(j) {
- case 0:
- u = ocean_co(omd, mv[mf->v1].co[0]);
- v = ocean_co(omd, mv[mf->v1].co[1]);
- break;
- case 1:
- u = ocean_co(omd, mv[mf->v2].co[0]);
- v = ocean_co(omd, mv[mf->v2].co[1]);
- break;
- case 2:
- u = ocean_co(omd, mv[mf->v3].co[0]);
- v = ocean_co(omd, mv[mf->v3].co[1]);
- break;
- case 3:
- u = ocean_co(omd, mv[mf->v4].co[0]);
- v = ocean_co(omd, mv[mf->v4].co[1]);
-
- break;
- }
-
if (omd->oceancache && omd->cached==TRUE) {
BKE_ocean_cache_eval_uv(omd->oceancache, &ocr, cfra, u, v);
foam = ocr.foam;
CLAMP(foam, 0.0f, 1.0f);
- } else {
+ }
+ else {
BKE_ocean_eval_uv(omd->ocean, &ocr, u, v);
foam = BKE_ocean_jminus_to_foam(ocr.Jminus, omd->foam_coverage);
}
- cf = (char)(foam*255);
+ cf = (char)(foam * 255);
mc[i*4 + j].r = mc[i*4 + j].g = mc[i*4 + j].b = cf;
mc[i*4 + j].a = 255;
- }
+ } while (j--);
}
}
More information about the Bf-blender-cvs
mailing list