diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2009-08-09 00:41:44 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2009-08-09 00:41:44 +0400 |
commit | 18121524dd626cc9fec510220ff5f808fe3bd5b9 (patch) | |
tree | fb3f8b3d709955a063a48ca66cad1ac15ae46150 /source/blender | |
parent | c4c0753dcc066296328344b7991b21dbb7089e74 (diff) |
Smoke: fixing collision objects again (bug introduced in decoupling commit) - thanks to nudelZ for reporting
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 34 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 2 |
3 files changed, 23 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 0d46e4baa88..bd93126d365 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -566,13 +566,9 @@ void smokeModifier_reset(struct SmokeModifierData *smd) } smd->domain->max_textures = 0; if(smd->domain->viewsettings < MOD_SMOKE_VIEW_USEBIG) - { smd->domain->viewsettings = 0; - } else - { smd->domain->viewsettings = MOD_SMOKE_VIEW_USEBIG; - } if(smd->domain->tray) MEM_freeN(smd->domain->tray); @@ -753,9 +749,13 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM tstart(); - sds->viewsettings = 0; // reset view for new frame + /* reset view for new frame */ + if(sds->viewsettings < MOD_SMOKE_VIEW_USEBIG) + sds->viewsettings = 0; + else + sds->viewsettings = MOD_SMOKE_VIEW_USEBIG; - // check for 2nd domain, if not there -> no groups are necessary + /* check for 2nd domain, if not there -> no groups are necessary */ for(base = scene->base.first; base; base= base->next) { Object *ob1= base->object; @@ -889,11 +889,11 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_get_bigres(smd->domain->fluid, bigres); - for(i = 0; i < smd->domain->amplify; i++) - for(j = 0; j < smd->domain->amplify; j++) - for(k = 0; k < smd->domain->amplify; k++) + for(i = 0; i < smd->domain->amplify + 1; i++) + for(j = 0; j < smd->domain->amplify + 1; j++) + for(k = 0; k < smd->domain->amplify + 1; k++) { - index = smoke_get_index(smd->domain->amplify * cell[0] + i, bigres[0], smd->domain->amplify * cell[1] + j, bigres[1], smd->domain->amplify * cell[2] + k); + index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k); bigdensity[index] = sfs->density; } } @@ -914,11 +914,11 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_get_bigres(smd->domain->fluid, bigres); - for(i = 0; i < smd->domain->amplify; i++) - for(j = 0; j < smd->domain->amplify; j++) - for(k = 0; k < smd->domain->amplify; k++) + for(i = 0; i < smd->domain->amplify + 1; i++) + for(j = 0; j < smd->domain->amplify + 1; j++) + for(k = 0; k < smd->domain->amplify + 1; k++) { - index = smoke_get_index(smd->domain->amplify * cell[0] + i, bigres[0], smd->domain->amplify * cell[1] + j, bigres[1], smd->domain->amplify * cell[2] + k); + index = smoke_get_index((smd->domain->amplify + 1)* cell[0] + i, bigres[0], (smd->domain->amplify + 1)* cell[1] + j, bigres[1], (smd->domain->amplify + 1)* cell[2] + k); bigdensity[index] = 0.f; } } @@ -1138,7 +1138,7 @@ void smoke_prepare_bigView(SmokeModifierData *smd, float *light) // formula taken from "Visual Simulation of Smoke" / Fedkiw et al. pg. 4 // T_vox = exp(-C_ext * h) // C_ext/sigma_t = density * C_ext - smoke_set_bigtvox(smd, i, exp(-density[i] * 7.0 * smd->domain->dx / smd->domain->amplify) ); + smoke_set_bigtvox(smd, i, exp(-density[i] * 7.0 * smd->domain->dx / (smd->domain->amplify + 1)) ); } smoke_calc_transparency(smd, light, 1); } @@ -1353,7 +1353,7 @@ static void get_bigcell(struct SmokeModifierData *smd, float *pos, int *cell, in VECSUB(tmp, pos, smd->domain->p0); - VecMulf(tmp, smd->domain->amplify / smd->domain->dx ); + VecMulf(tmp, (smd->domain->amplify + 1)/ smd->domain->dx ); if(correct) { @@ -1402,7 +1402,7 @@ void smoke_calc_transparency(struct SmokeModifierData *smd, float *light, int bi else { smoke_get_bigres(smd->domain->fluid, res); - bigfactor = 1.0 / smd->domain->amplify; + bigfactor = 1.0 / (smd->domain->amplify + 1); } #pragma omp parallel for schedule(static) private(y, z) shared(big, smd, light, res, bigfactor) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6bcb1109480..019392ebcb2 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -3665,7 +3665,11 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb) smd->domain->traybig = NULL; smd->domain->bind = NULL; smd->domain->max_textures = 0; - smd->domain->viewsettings = 0; // reset view for new frame + // reset 3dview + if(smd->domain->viewsettings < MOD_SMOKE_VIEW_USEBIG) + smd->domain->viewsettings = 0; + else + smd->domain->viewsettings = MOD_SMOKE_VIEW_USEBIG; } else if(smd->type==MOD_SMOKE_TYPE_FLOW) { diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 996c7316570..dd1f44c55cb 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -5368,7 +5368,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) else { smoke_get_bigres(smd->domain->fluid, res); - bigfactor = 1.0 / smd->domain->amplify; + bigfactor = 1.0 / (smd->domain->amplify + 1); } wmLoadMatrix(rv3d->viewmat); |