Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-22 19:33:44 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-22 19:33:44 +0400
commitc6391e8d2394b8d022b03f48941b235b96d677d0 (patch)
treecdc9bff57e2b0a7cdc33f22677f2f6d505a21bc1 /source/blender/modifiers/intern/MOD_ocean.c
parentb2c7dd2d5cb2cda7c1a43018f5f61602b0908c78 (diff)
parent36fa74b50e2d24ef9f99fbff4cc2d393da37361e (diff)
svn merge ^/trunk/blender -r42053:42069
Diffstat (limited to 'source/blender/modifiers/intern/MOD_ocean.c')
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 9377fdc115d..991b4afe073 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -404,7 +404,8 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
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 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
mf = dm->getFaceArray(dm);
for (i = 0; i < num_faces; i++, mf++) {
- for (j=0; j<4; j++) {
-
- 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;
- }
+ 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 (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--);
}
}