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-03 03:30:44 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2009-08-03 03:30:44 +0400
commit262a76812e132f57b8aa5eece17b1bad5889ec73 (patch)
tree2a85d1c5aae4a6b26d1e2d65272c4de08123cf80 /source/blender/blenkernel
parenteff8e107fed85aa1b6ca1da812a7f60af1b85f45 (diff)
Smoke:
a) fixing domain boundaries b) fixing flow gui (no more velocity there - taken from particles) c) Outflow available (deletes smoke from scene) d) deactivating other noise options for now e) base for render/preview settings f) fixing collisions to be working again
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/smoke.c79
1 files changed, 53 insertions, 26 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 3eec7ec2423..c619c3e25ab 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -199,7 +199,9 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
}
}
- printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
+ // TODO: put in failsafe if res<=0 - dg
+
+ // printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
// dt max is 0.1
smd->domain->fluid = smoke_init(smd->domain->res, smd->domain->amplify, smd->domain->p0, smd->domain->p1, 2.5 / FPS);
@@ -222,10 +224,14 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
return 1;
}
- else if((smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll)
+ else if((smd->type & MOD_SMOKE_TYPE_COLL))
{
smd->time = scene->r.cfra;
+ // todo: delete this when loading colls work -dg
+ if(!smd->coll)
+ smokeModifier_createType(smd);
+
if(!smd->coll->points)
{
// init collision points
@@ -600,7 +606,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->eff_group = NULL;
smd->domain->fluid_group = NULL;
smd->domain->coll_group = NULL;
- smd->domain->maxres = 48;
+ smd->domain->maxres = 32;
smd->domain->amplify = 2;
smd->domain->omega = 0.5;
smd->domain->alpha = -0.001;
@@ -652,7 +658,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
void smoke_calc_transparency(struct SmokeModifierData *smd, float *light, int big);
void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedMesh *dm)
-{
+{
if(scene->r.cfra >= smd->time)
smokeModifier_init(smd, ob, scene, dm);
@@ -793,24 +799,49 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// 2. set cell values (heat, density and velocity)
index = smoke_get_index(cell[0], sds->res[0], cell[1], sds->res[1], cell[2]);
- heat[index] = sfs->temp;
- density[index] = sfs->density;
- velocity_x[index] = pa->state.vel[0];
- velocity_y[index] = pa->state.vel[1];
- velocity_z[index] = pa->state.vel[2];
-
- // we need different handling for the high-res feature
- if(bigdensity)
+ if(!(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW)) // this is inflow
{
- // init all surrounding cells according to amplification, too
- int i, j, k;
- for(i = 0; i < smd->domain->amplify; i++)
- for(j = 0; j < smd->domain->amplify; j++)
- for(k = 0; k < smd->domain->amplify; 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);
- bigdensity[index] = sfs->density;
- }
+ heat[index] = sfs->temp;
+ density[index] = sfs->density;
+ velocity_x[index] = pa->state.vel[0];
+ velocity_y[index] = pa->state.vel[1];
+ velocity_z[index] = pa->state.vel[2];
+
+ // we need different handling for the high-res feature
+ if(bigdensity)
+ {
+ // init all surrounding cells according to amplification, too
+ int i, j, k;
+ for(i = 0; i < smd->domain->amplify; i++)
+ for(j = 0; j < smd->domain->amplify; j++)
+ for(k = 0; k < smd->domain->amplify; 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);
+ bigdensity[index] = sfs->density;
+ }
+ }
+ }
+ else // outflow
+ {
+ heat[index] = 0.f;
+ density[index] = 0.f;
+ velocity_x[index] = 0.f;
+ velocity_y[index] = 0.f;
+ velocity_z[index] = 0.f;
+
+ // we need different handling for the high-res feature
+ if(bigdensity)
+ {
+ // init all surrounding cells according to amplification, too
+ int i, j, k;
+ for(i = 0; i < smd->domain->amplify; i++)
+ for(j = 0; j < smd->domain->amplify; j++)
+ for(k = 0; k < smd->domain->amplify; 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);
+ bigdensity[index] = 0.f;
+ }
+ }
}
}
}
@@ -886,7 +917,6 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// we got nice collision object
SmokeCollSettings *scs = smd2->coll;
int cell[3];
- int valid = 1;
size_t index = 0;
size_t i, j;
unsigned char *obstacles = smoke_get_obstacle(smd->domain->fluid);
@@ -899,10 +929,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// check if cell is valid (in the domain boundary)
for(j = 0; j < 3; j++)
if((cell[j] > sds->res[j] - 1) || (cell[j] < 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]);