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:
authorDaniel Genrich <daniel.genrich@gmx.net>2009-08-02 22:32:56 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2009-08-02 22:32:56 +0400
commit7b123ff13c21984c36a44962b5e48d8ae8b69c6e (patch)
treeb63a28928ea3d42f5a06114ce74e29e52c4f92db
parent08d4b963174d0f3faa313d867fd489238f5e7bd6 (diff)
Smoke: (hopefully) fix collision high-res smoke disappearance
-rw-r--r--source/blender/blenkernel/intern/smoke.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index fbf6beb835f..3eec7ec2423 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -769,7 +769,6 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
for(p=0, pa=psys->particles; p<psys->totpart; p++, pa++)
{
int cell[3];
- int valid = 1;
size_t i = 0;
size_t index = 0;
@@ -786,11 +785,10 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// check if cell is valid (in the domain boundary)
for(i = 0; i < 3; i++)
+ {
if((cell[i] > sds->res[i] - 1) || (cell[i] < 0))
- valid = 0;
-
- if(!valid)
- continue;
+ continue;
+ }
// 2. set cell values (heat, density and velocity)
index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
@@ -1218,15 +1216,15 @@ static void get_cell(struct SmokeModifierData *smd, float *pos, int *cell, int c
if(correct)
{
- cell[0] = MIN2(smd->domain->res[0] - 1, MAX2(0, (int)(tmp[0] + 0.5)));
- cell[1] = MIN2(smd->domain->res[1] - 1, MAX2(0, (int)(tmp[1] + 0.5)));
- cell[2] = MIN2(smd->domain->res[2] - 1, MAX2(0, (int)(tmp[2] + 0.5)));
+ cell[0] = MIN2(smd->domain->res[0] - 1, MAX2(0, (int)floor(tmp[0])));
+ cell[1] = MIN2(smd->domain->res[1] - 1, MAX2(0, (int)floor(tmp[1])));
+ cell[2] = MIN2(smd->domain->res[2] - 1, MAX2(0, (int)floor(tmp[2])));
}
else
{
- cell[0] = (int)(tmp[0] + 0.5);
- cell[1] = (int)(tmp[1] + 0.5);
- cell[2] = (int)(tmp[2] + 0.5);
+ cell[0] = (int)floor(tmp[0]);
+ cell[1] = (int)floor(tmp[1]);
+ cell[2] = (int)floor(tmp[2]);
}
}
static void get_bigcell(struct SmokeModifierData *smd, float *pos, int *cell, int correct)
@@ -1241,15 +1239,15 @@ static void get_bigcell(struct SmokeModifierData *smd, float *pos, int *cell, in
if(correct)
{
- cell[0] = MIN2(res[0] - 1, MAX2(0, (int)(tmp[0] + 0.5)));
- cell[1] = MIN2(res[1] - 1, MAX2(0, (int)(tmp[1] + 0.5)));
- cell[2] = MIN2(res[2] - 1, MAX2(0, (int)(tmp[2] + 0.5)));
+ cell[0] = MIN2(res[0] - 1, MAX2(0, (int)floor(tmp[0])));
+ cell[1] = MIN2(res[1] - 1, MAX2(0, (int)floor(tmp[1])));
+ cell[2] = MIN2(res[2] - 1, MAX2(0, (int)floor(tmp[2])));
}
else
{
- cell[0] = (int)(tmp[0] + 0.5);
- cell[1] = (int)(tmp[1] + 0.5);
- cell[2] = (int)(tmp[2] + 0.5);
+ cell[0] = (int)floor(tmp[0]);
+ cell[1] = (int)floor(tmp[1]);
+ cell[2] = (int)floor(tmp[2]);
}
}