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 /intern/smoke
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 'intern/smoke')
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp38
-rw-r--r--intern/smoke/intern/FLUID_3D_STATIC.cpp32
2 files changed, 35 insertions, 35 deletions
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index 2822fca3607..344883866a8 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -120,29 +120,29 @@ FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float dt) :
// set side obstacles
int index;
- for (int y = 0; y < _yRes; y++)
+ for (int y = 0; y < _yRes; y++) // z
for (int x = 0; x < _xRes; x++)
{
// front slab
index = x + y * _xRes;
- if(DOMAIN_BC_FRONT==1) _obstacles[index] = 1;
+ if(DOMAIN_BC_BOTTOM==1) _obstacles[index] = 1;
// back slab
index += _totalCells - _slabSize;
- if(DOMAIN_BC_BACK==1) _obstacles[index] = 1;
+ if(DOMAIN_BC_TOP==1) _obstacles[index] = 1;
}
- for (int z = 0; z < _zRes; z++)
+ for (int z = 0; z < _zRes; z++) // y
for (int x = 0; x < _xRes; x++)
{
// bottom slab
index = x + z * _slabSize;
- if(DOMAIN_BC_BOTTOM==1) _obstacles[index] = 1;
+ if(DOMAIN_BC_FRONT==1) _obstacles[index] = 1;
// top slab
index += _slabSize - _xRes;
- if(DOMAIN_BC_TOP==1) _obstacles[index] = 1;
+ if(DOMAIN_BC_BACK==1) _obstacles[index] = 1;
}
- for (int z = 0; z < _zRes; z++)
+ for (int z = 0; z < _zRes; z++) // x
for (int y = 0; y < _yRes; y++)
{
// left slab
@@ -360,12 +360,12 @@ void FLUID_3D::project()
if(DOMAIN_BC_LEFT == 0) setNeumannX(_xVelocity, _res);
else setZeroX(_xVelocity, _res);
- if(DOMAIN_BC_TOP == 0) setNeumannY(_yVelocity, _res);
- else setZeroY(_yVelocity, _res);
-
- if(DOMAIN_BC_FRONT == 0) setNeumannZ(_zVelocity, _res);
+ if(DOMAIN_BC_TOP == 0) setNeumannZ(_zVelocity, _res);
else setZeroZ(_zVelocity, _res);
+ if(DOMAIN_BC_FRONT == 0) setNeumannY(_yVelocity, _res);
+ else setZeroY(_yVelocity, _res);
+
// calculate divergence
index = _slabSize + _xRes + 1;
for (z = 1; z < _zRes - 1; z++, index += 2 * _xRes)
@@ -630,12 +630,12 @@ void FLUID_3D::advectMacCormack()
if(DOMAIN_BC_LEFT == 0) copyBorderX(_xVelocity, res);
else setZeroX(_xVelocity, res);
- if(DOMAIN_BC_TOP == 0) copyBorderY(_yVelocity, res);
- else setZeroY(_yVelocity, res);
-
- if(DOMAIN_BC_FRONT == 0) copyBorderZ(_zVelocity, res);
+ if(DOMAIN_BC_TOP == 0) copyBorderZ(_zVelocity, res);
else setZeroZ(_zVelocity, res);
+ if(DOMAIN_BC_FRONT == 0) copyBorderY(_yVelocity, res);
+ else setZeroY(_yVelocity, res);
+
SWAP_POINTERS(_xVelocity, _xVelocityOld);
SWAP_POINTERS(_yVelocity, _yVelocityOld);
SWAP_POINTERS(_zVelocity, _zVelocityOld);
@@ -658,12 +658,12 @@ void FLUID_3D::advectMacCormack()
if(DOMAIN_BC_LEFT == 0) copyBorderX(_xVelocity, res);
else setZeroX(_xVelocity, res);
- if(DOMAIN_BC_TOP == 0) copyBorderY(_yVelocity, res);
- else setZeroY(_yVelocity, res);
-
- if(DOMAIN_BC_FRONT == 0) copyBorderZ(_zVelocity, res);
+ if(DOMAIN_BC_TOP == 0) copyBorderZ(_zVelocity, res);
else setZeroZ(_zVelocity, res);
+ if(DOMAIN_BC_FRONT == 0) copyBorderY(_yVelocity, res);
+ else setZeroY(_yVelocity, res);
+
setZeroBorder(_density, res);
setZeroBorder(_heat, res);
diff --git a/intern/smoke/intern/FLUID_3D_STATIC.cpp b/intern/smoke/intern/FLUID_3D_STATIC.cpp
index a72009b9abf..f2bbcf33075 100644
--- a/intern/smoke/intern/FLUID_3D_STATIC.cpp
+++ b/intern/smoke/intern/FLUID_3D_STATIC.cpp
@@ -104,26 +104,14 @@ void FLUID_3D::setNeumannY(float* field, Vec3Int res)
for (int z = 0; z < res[2]; z++)
for (int x = 0; x < res[0]; x++)
{
- // bottom slab
+ // front slab
index = x + z * slabSize;
field[index] = field[index + 2 * res[0]];
- // top slab
+ // back slab
index += slabSize - res[0];
field[index] = field[index - 2 * res[0]];
}
-
- // fix, force top slab to only allow outwards flux
- for (int z = 0; z < res[2]; z++)
- for (int x = 0; x < res[0]; x++)
- {
- // top slab
- index = x + z * slabSize;
- index += slabSize - res[0];
- if(field[index]<0.) field[index] = 0.;
- index -= res[0];
- if(field[index]<0.) field[index] = 0.;
- }
}
//////////////////////////////////////////////////////////////////////
@@ -137,14 +125,26 @@ void FLUID_3D::setNeumannZ(float* field, Vec3Int res)
for (int y = 0; y < res[1]; y++)
for (int x = 0; x < res[0]; x++)
{
- // front slab
+ // bottom slab
index = x + y * res[0];
field[index] = field[index + 2 * slabSize];
- // back slab
+ // top slab
index += totalCells - slabSize;
field[index] = field[index - 2 * slabSize];
}
+
+ // fix, force top slab to only allow outwards flux
+ for (int y = 0; y < res[1]; y++)
+ for (int x = 0; x < res[0]; x++)
+ {
+ // top slab
+ index = x + y * res[0];
+ index += totalCells - slabSize;
+ if(field[index]<0.) field[index] = 0.;
+ index -= slabSize;
+ if(field[index]<0.) field[index] = 0.;
+ }
}
//////////////////////////////////////////////////////////////////////