Eulerian Smoke Simulation on the GPU
|
A container class that simulates smoke and renders it as a mesh or as a 2D plane. More...
#include <FluidEngine.h>
Public Types | |
enum | RenderField { VELOCITY, PRESSURE, TEMPERATURE, DENSITY } |
Public Member Functions | |
FluidEngine (int _simResX, int _simResY, int _simResZ) | |
Constructor. | |
~FluidEngine () | |
Destructor. | |
void | init () |
Initialization function. | |
void | updateOutputs () |
Updates the simulaton outputs. | |
void | drawMesh (RenderField _field, ngl::TransformStack &_transformStack) |
Draws a field as a mesh. | |
void | setIsoLevel (float _isoLevel) |
Set the iso level value for the meshing operation. | |
void | setSamplingChannel (int _channelIndex) |
Sets the 3D texture channel to sample from. | |
void | setMeshingMethod (int _meshingMethod) |
Changes the active meshing method. | |
void | setMeshColour (float _r, float _g, float _b) |
Sets the mesh's colour. | |
void | drawSlice (RenderField _field, ngl::TransformStack &_transformStack) |
Draws a field as a 2D slice. | |
void | setSliceOpacity (float _opacity) |
Sets the slice's opacity. | |
void | setSlicePos (int _slicePos) |
Sets the slice's position in the Z axis. | |
void | drawObstacles (ngl::TransformStack &_transformStack) |
Draws the simulation obstacles. | |
void | drawContainer (ngl::TransformStack &_transformStack) |
Draws the simulation's container. | |
void | passViewProjectionMatrix (ngl::Matrix _modelView, ngl::Matrix _projection) |
Passes the view and projection matrices to the engine. | |
int | getSimResX () const |
Accessor for the simulation's resolution in X. | |
int | getSimResY () const |
Accessor for the simulation's resolution in Y. | |
int | getSimResZ () const |
Accessor for the simulation's resolution in Z. | |
void | resetResolution () |
Resets the simulation's resolution. | |
GasSolver * | getGasSolver () const |
Accessor for the engine's gas solver. | |
void | setObstacleGeometry (int _geoIndex) |
Sets the obstacle's geometry type. | |
void | setCellSize (float _cellSize) |
Sets the simulation's cell size. | |
void | setSplatRadius (float _splatRadius) |
Sets the splat radius. | |
void | setAmbientTemperature (float _ambientTemperature) |
Set the ambient temperature. | |
void | setImpulseTemperature (float _impulseTemperature) |
Sets the impulse temperature. | |
void | setImpulseDensity (float _impulseDensity) |
Sets the impulse density amount. | |
void | setImpulsePosition (float _posX, float _posY, float _posZ) |
Sets the impulse's position. | |
void | setPoissonIterations (int _numPoissonIterations) |
Sets the number of iterations of the Poisson solver. | |
void | setTimestep (float _timestep) |
Sets the time-step. | |
void | setBuoyancyLift (float _buoyancyLift) |
Sets the buoyancy lift factor. | |
void | setGasWeight (float _gasWeight) |
Sets the gas weight. | |
void | setBuoyancyDirection (float _dirX, float _dirY, float _dirZ) |
Sets the buoyancy force direction. | |
void | togglePeriodicNoise (bool _enablePeriodicNoise) |
Toggles the periodic noise function. | |
void | setNoiseVariance (float _noiseVarianceX, float _noiseVarianceY, float _noiseVarianceZ) |
Sets the periodic noise variance. | |
void | setNoiseDrivingFunc (int _funcIndexX, int _funcIndexY, int _funcIndexZ) |
Sets the periodic noise driving function. | |
void | setTemperatureDissipation (float _temperatureDissipation) |
Set the temperature's dissipation factor. | |
void | setDensityDissipation (float _densityDissipation) |
Sets the density dissipation factor. | |
void | setVelocityDissipation (float _velocityDissipation) |
Sets the velocity dissipation factor. |
A container class that simulates smoke and renders it as a mesh or as a 2D plane.
FluidEngine::FluidEngine | ( | int | _simResX, |
int | _simResY, | ||
int | _simResZ | ||
) |
Constructor.
[in] | _simResX | the simulation's resolution in X |
[in] | _simResY | the simulation's resolution in Y |
[in] | _simResZ | the simulation's resolution in Z |
void FluidEngine::drawContainer | ( | ngl::TransformStack & | _transformStack | ) |
Draws the simulation's container.
[in] | _transformStack | the active transform stack |
void FluidEngine::drawMesh | ( | RenderField | _field, |
ngl::TransformStack & | _transformStack | ||
) |
Draws a field as a mesh.
[in] | _field | the field to render |
void FluidEngine::drawObstacles | ( | ngl::TransformStack & | _transformStack | ) |
Draws the simulation obstacles.
[in] | _transformStack | the active transform stack |
void FluidEngine::drawSlice | ( | RenderField | _field, |
ngl::TransformStack & | _transformStack | ||
) |
Draws a field as a 2D slice.
[in] | _field | the field to render |
void FluidEngine::passViewProjectionMatrix | ( | ngl::Matrix | _modelView, |
ngl::Matrix | _projection | ||
) |
Passes the view and projection matrices to the engine.
[in] | _modelView | the model view matrix |
[in] | _projection | the projection matrix |
void FluidEngine::setAmbientTemperature | ( | float | _ambientTemperature | ) | [inline] |
Set the ambient temperature.
[in] | _ambientTemperature | the new ambient temperature |
void FluidEngine::setBuoyancyDirection | ( | float | _dirX, |
float | _dirY, | ||
float | _dirZ | ||
) | [inline] |
Sets the buoyancy force direction.
[in] | _dirX | the direction in X |
[in] | _dirY | the direction in Y |
[in] | _dirZ | the direction in Z |
void FluidEngine::setBuoyancyLift | ( | float | _buoyancyLift | ) | [inline] |
Sets the buoyancy lift factor.
[in] | _buoyancyLift | the new buoyancy lift factor |
void FluidEngine::setCellSize | ( | float | _cellSize | ) | [inline] |
Sets the simulation's cell size.
[in] | _cellSize | the new cell size |
void FluidEngine::setDensityDissipation | ( | float | _densityDissipation | ) | [inline] |
Sets the density dissipation factor.
[in] | _densityDissipation | the new density dissipation |
void FluidEngine::setGasWeight | ( | float | _gasWeight | ) | [inline] |
Sets the gas weight.
[in] | _gasWeight | the new gas weight |
void FluidEngine::setImpulseDensity | ( | float | _impulseDensity | ) | [inline] |
Sets the impulse density amount.
[in] | _impulseDensity | the new impulse density |
void FluidEngine::setImpulsePosition | ( | float | _posX, |
float | _posY, | ||
float | _posZ | ||
) | [inline] |
Sets the impulse's position.
[in] | _posX | the X coordinate of the splat |
[in] | _posY | the Y coordinate of the splat |
[in] | _posZ | the Z coordinate of the splat |
void FluidEngine::setImpulseTemperature | ( | float | _impulseTemperature | ) | [inline] |
Sets the impulse temperature.
[in] | _impulseTemperature | the new impulse temperature |
void FluidEngine::setIsoLevel | ( | float | _isoLevel | ) |
Set the iso level value for the meshing operation.
[in] | _isoLevel | the new iso level |
void FluidEngine::setMeshColour | ( | float | _r, |
float | _g, | ||
float | _b | ||
) |
Sets the mesh's colour.
[in] | _r | the colour's red channel |
[in] | _g | the colour's green channel |
[in] | _b | the colour's blue channel |
void FluidEngine::setMeshingMethod | ( | int | _meshingMethod | ) |
Changes the active meshing method.
[in] | _meshingMethod | the meshing method |
void FluidEngine::setNoiseDrivingFunc | ( | int | _funcIndexX, |
int | _funcIndexY, | ||
int | _funcIndexZ | ||
) | [inline] |
Sets the periodic noise driving function.
[in] | _funcIndexX | the index of the driving function in X |
[in] | _funcIndexY | the index of the driving function in Y |
[in] | _funcIndexZ | the index of the driving function in Z |
void FluidEngine::setNoiseVariance | ( | float | _noiseVarianceX, |
float | _noiseVarianceY, | ||
float | _noiseVarianceZ | ||
) | [inline] |
Sets the periodic noise variance.
[in] | _noiseVarianceX | the turbulance variance in X |
[in] | _noiseVarianceY | the turbulance variance in Y |
[in] | _noiseVarianceZ | the turbulance variance in Z |
void FluidEngine::setObstacleGeometry | ( | int | _geoIndex | ) |
Sets the obstacle's geometry type.
[in] | _geoIndex | the geometry index |
void FluidEngine::setPoissonIterations | ( | int | _numPoissonIterations | ) | [inline] |
Sets the number of iterations of the Poisson solver.
[in] | _numPoissonIterations | the number of iterations |
void FluidEngine::setSamplingChannel | ( | int | _channelIndex | ) |
Sets the 3D texture channel to sample from.
[in] | _channelIndex | the index of the channel to sample |
void FluidEngine::setSliceOpacity | ( | float | _opacity | ) |
Sets the slice's opacity.
[in] | _opacity | the new opacity |
void FluidEngine::setSlicePos | ( | int | _slicePos | ) |
Sets the slice's position in the Z axis.
[in] | _sliceNum | the slice's position |
void FluidEngine::setSplatRadius | ( | float | _splatRadius | ) | [inline] |
Sets the splat radius.
[in] | _splatRadius | the new splat radius |
void FluidEngine::setTemperatureDissipation | ( | float | _temperatureDissipation | ) | [inline] |
Set the temperature's dissipation factor.
[in] | _temperatureDissipation | the new temperature dissipation |
void FluidEngine::setTimestep | ( | float | _timestep | ) | [inline] |
Sets the time-step.
[in] | _timestep | the new time-step |
void FluidEngine::setVelocityDissipation | ( | float | _velocityDissipation | ) | [inline] |
Sets the velocity dissipation factor.
[in] | _velocityDissipation | the new velocity dissipation |
void FluidEngine::togglePeriodicNoise | ( | bool | _enablePeriodicNoise | ) | [inline] |
Toggles the periodic noise function.
[in] | _enablePeriodicNoise | the periodic noise toggling flag |