* Enable external forces like e.g. wind
This commit is contained in:
Daniel Genrich
2009-10-08 10:18:14 +00:00
parent 8f154364f2
commit 14f62c1321
9 changed files with 105 additions and 19 deletions

View File

@@ -50,6 +50,10 @@ float *smoke_get_velocity_x(struct FLUID_3D *fluid);
float *smoke_get_velocity_y(struct FLUID_3D *fluid);
float *smoke_get_velocity_z(struct FLUID_3D *fluid);
float *smoke_get_force_x(struct FLUID_3D *fluid);
float *smoke_get_force_y(struct FLUID_3D *fluid);
float *smoke_get_force_z(struct FLUID_3D *fluid);
unsigned char *smoke_get_obstacle(struct FLUID_3D *fluid);
size_t smoke_get_index(int x, int max_x, int y, int max_y, int z);

View File

@@ -184,13 +184,6 @@ void FLUID_3D::step()
{
// addSmokeTestCase(_density, _res);
// addSmokeTestCase(_heat, _res);
// wipe forces
for (int i = 0; i < _totalCells; i++)
{
_xForce[i] = _yForce[i] = _zForce[i] = 0.0f;
// _obstacles[i] &= ~2;
}
wipeBoundaries();
@@ -232,6 +225,13 @@ void FLUID_3D::step()
// todo xxx dg: only clear obstacles, not boundaries
// memset(_obstacles, 0, sizeof(unsigned char)*_xRes*_yRes*_zRes);
// wipe forces
// for external forces we can't do it at the beginning of this function but at the end
for (int i = 0; i < _totalCells; i++)
{
_xForce[i] = _yForce[i] = _zForce[i] = 0.0f;
}
}
//////////////////////////////////////////////////////////////////////

View File

@@ -235,6 +235,21 @@ extern "C" float *smoke_get_velocity_z(FLUID_3D *fluid)
return fluid->_zVelocity;
}
extern "C" float *smoke_get_force_x(FLUID_3D *fluid)
{
return fluid->_xForce;
}
extern "C" float *smoke_get_force_y(FLUID_3D *fluid)
{
return fluid->_yForce;
}
extern "C" float *smoke_get_force_z(FLUID_3D *fluid)
{
return fluid->_zForce;
}
extern "C" float *smoke_turbulence_get_density(WTURBULENCE *wt)
{
return wt ? wt->getDensityBig() : NULL;