![]() |
VR-Forces 4.8 Class Documentation
|
this class is used to create weather effects around the eye to represent effects such as mist, rain and hail. More...
Classes | |
| struct | BlendData |
| A structure to hold blending control data for things like particle amount per intensity. More... | |
| struct | DrawData |
| A structure used to hold data for drawing. More... | |
| struct | MeshGroup |
| A structure used to define a mesh group (voa, positions, coords). More... | |
| struct | Particle |
| A structure used to define a simulation particle. More... | |
| struct | SimulationUpdateJobData |
| A structure to hold data for a simluation update job. More... | |
| struct | SortJobData |
| A structure to hold data for a sorting job. More... | |
Public Types | |
| enum | EffectType { EffectTypePrecipitation = 0, EffectTypeParticle } |
| An enumeration to define the effect type. More... | |
| enum | SurfaceHitType { SurfaceHitTypeNone = 0, SurfaceHitTypeHail } |
| An enumeration to define a surface hit effect. More... | |
Public Member Functions | |
| DtWeatherEffect (makVrv::DtDe &de) | |
| CTOR. More... | |
| virtual | ~DtWeatherEffect () |
| DTOR. More... | |
| virtual void | init (int particleCount, float particleSize, float radius, EffectType type) |
| Initialize the effect. More... | |
| virtual void | releaseGLObjects (osg::State *state) const |
| Release all gl objects used by this object. More... | |
| virtual void | simulationUpdate (float timeStep, double currentTime, DtJobSplitter *jobSplitter) |
| Run a simulation update to simulate particle movement. More... | |
| virtual void | postSimulationUpdate (float timeStep, double currentTime) |
| Run a post simulation update. More... | |
| virtual void | draw (DtWeatherEffect::DrawData &drawData, const osg::Vec3 &baseColor) const |
| Issues the drawing command for the effect. More... | |
| virtual void | cullUpdate (const osg::Vec3d &camPos, const osg::Matrixd &basis, DtJobSplitter *jobSplitter) |
| Prepares the effect for drawing based on the camera position. More... | |
| virtual void | setSurfaceHitType (SurfaceHitType type) |
| Sets a type used to generate hit particles on the ground surface. More... | |
| virtual void | setWind (float windDirectionRad, float windSpeedMps) |
| Sets the current wind. More... | |
| virtual void | setWindSpeedMultiplier (float multiplier) |
| Sets a wind speed multiplier used for particle physics. More... | |
| virtual void | setWindLiftMultiplier (float multiplier) |
| Sets a wind lift multiplier used for particle physics. More... | |
| virtual void | setWindTurbulence (float multiplier) |
| Sets a wind turbulence multiplier for particle physics. More... | |
| virtual void | setStreak (float multiplier) |
| Sets a streak value to control particle streaking based on movement. More... | |
| virtual void | setCameraStreakEnable (bool enable) |
| Sets the flag to enable particle camera movement streak effect. More... | |
| virtual void | setEffectFade (float fade) |
| Sets a (0.0 - 1.0) value to control the effect fade. More... | |
| virtual void | setIntensity (float intensity) |
| Sets a (0.0 - 1.0) value to control the effect intensity. More... | |
| virtual void | setFadePerIntensity (float fadeMin, float fadeMax, float intensityMin, float intensityMax) |
| Sets an effect fade ramp based on the current intensity. More... | |
| virtual void | setFadePerWind (float fadeMin, float fadeMax, float windMin, float windMax) |
| Sets an effect fade ramp based on the current wind in mps. More... | |
| virtual void | setParticlesPerIntensity (float percentMin, float percentMax, float intensityMin, float intensityMax) |
| Sets a particles percentage ramp based on the current intensity. More... | |
| virtual void | setColorMult (float r, float g, float b) |
| Sets a base color color multiplier. More... | |
| virtual void | setAdditiveBlend (bool enable) |
| Enables additive blending mode for rendering. More... | |
| virtual bool | additiveBlend () const |
| Returns the additive blend mode flag. More... | |
| virtual void | setVelocity (float x, float y, float z) |
| Sets a velocity for all effect particles. More... | |
| virtual void | setInitRotationVariation (float rotationDeg) |
| Sets particle +- initial random rotation. More... | |
| virtual float | radius () const |
| Returns the radius of the effect. More... | |
| virtual void | setTextureAtlasCell (unsigned char numColumns, unsigned char numRows, unsigned char col, unsigned char row) |
| Sets the texture cell to use for a texture atlas. More... | |
| virtual void | setDepthSoftness (float softness) |
| Sets the softness for transparency fade when close to a surface. More... | |
| virtual float | depthSoftness () const |
| Returns the softness for transparency fade when close to a surface. More... | |
| virtual void | setDragCoefficient (float coefficient) |
| Sets the drag coefficient for particles. More... | |
| virtual float | dragCoefficient () const |
| Returns the drag coefficient for particles. More... | |
| virtual void | setSortEnable (bool enable) |
| Sets the flag to enable sorting particles within the effect. More... | |
| virtual bool | sortEnable () const |
| Returns the flag to enable sorting particles within the effect. More... | |
| virtual void | runSort (const osg::Vec3 &localCamPos) |
| Sorts particles for the current view. More... | |
Protected Member Functions | |
| virtual void | runSimulationUpdateJob (float timeStep, double currentTime) |
| Called during a muti-thread update job to run a simulation update. More... | |
| virtual void | updateHailSurfaceHit (float timeStep) |
| Does an update for the Hail surface hit type. More... | |
| virtual void | computeSortDepth (const osg::Vec3 &reference) |
| Computes the sort depth for all cells. More... | |
| virtual void | fillSortedParticles () |
| Fills the gpu buffer with sorted particle data. More... | |
| virtual bool | bindMeshGroupData (MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| Binds the mesh group data to the vbo's. More... | |
| virtual bool | bindDynamicMeshGroupData (MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| Binds the dynamic mesh group data to the vbo's. More... | |
| virtual bool | bindVaoToMeshGroup (GLuint vao, MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| Binds the given voa to vbo's for a mesh group. More... | |
| virtual void | simulatePrecipitationParticles (float timeStep, double currentTime) |
| Simulates particles (movements, etc...) for precipitation. More... | |
| virtual void | simulateParticles (float timeStep, double currentTime, osg::Vec3d &basisPosChange) |
| Simulates particles (life, movements, etc...). More... | |
| void | wrapPosition (float &posX, float &posY, float &posZ) |
| Keeps the given position in the effect radius. More... | |
| Particle * | getFreeParticle (void) |
| Returns a particle from the free list. More... | |
| void | freeParticle (Particle *particle) |
| Adds the given particle to the free list. More... | |
| void | spawnHailParticle (const osg::Vec3d &position, const osg::Vec3 &normal, bool usePhysics) |
| Spawns a hail particle at the given location. More... | |
| const osg::Vec3 | crossProduct (const osg::Vec3 &v0, const osg::Vec3 &v1) |
| Returns the cross product of the given 2 vectors. More... | |
| float | computeRandomMinMax (float fMin, float fMax) |
| Computes a random floating point value in the min max range. More... | |
| void | computeRandomPointInRadius (osg::Vec2 &point, float radius) |
| Computes a random point in a radius with even distribution. More... | |
| bool | clampPosition (osg::Vec3d &position, osg::Vec3 &normal, const osg::Vec3 &up) |
| Clamps the given position to a ground surface. More... | |
| virtual float | computeBlendControl (const BlendData &data, float blendPos) const |
| Computes an ouput value based on the given blending data and blend position. More... | |
Private Member Functions | |
| DtWeatherEffect () | |
| Default Constructor not implemented. More... | |
| DtWeatherEffect (const DtWeatherEffect &other) | |
| Copy Constructor not implemented - Copy not allowed. More... | |
| DtWeatherEffect & | operator= (const DtWeatherEffect &other) |
| Assignment Operator not implemented - Assignment not allowed. More... | |
Static Private Member Functions | |
| static void | theSimulationUpdateJob (void *data) |
| simulation update job function used as a callback for job splitting More... | |
| static int | theSortBackToFront (const void *arg0, const void *arg1) |
| sort function used for qsorting particles More... | |
| static void | theSortJob (void *data) |
| sort job function used as a callback for job splitting More... | |
this class is used to create weather effects around the eye to represent effects such as mist, rain and hail.
The effect is made from a particle system with simple physics applied. There are 2 initialiation types for this class: precipitation and particles. The precipitation type is an infinite scolling box of particles around the eye used for items such as mist or falling rain. The particle type is for dynamic particles such as surface hits. This class is not a stand-alone class as it relies on a larger system to initiate drawing and update methods (see DtWeatherLayerGroup and DtWeatherEffectDrawable).
An enumeration to define the effect type.
Precipitation is an ageless effect that's infinite in a scrolling box. Precipitation would be used for something like falling rain. Particle is a particle simulation that has a life span. Particle would be used for something like splashes at a specific location.
| Enumerator | |
|---|---|
| EffectTypePrecipitation | |
| EffectTypeParticle | |
An enumeration to define a surface hit effect.
A surface hit effect creates particles based on surface heights around the weather effect's current location. Note that the weather effect must be of type EffectTypeParticle to use surface hits. The Hail type spawns a few hail particles at a surface loaction.
| Enumerator | |
|---|---|
| SurfaceHitTypeNone | |
| SurfaceHitTypeHail | |
| makVrv::DtWeatherEffect::DtWeatherEffect | ( | makVrv::DtDe & | de | ) |
CTOR.
|
virtual |
DTOR.
|
private |
Default Constructor not implemented.
|
private |
Copy Constructor not implemented - Copy not allowed.
|
private |
Assignment Operator not implemented - Assignment not allowed.
|
virtual |
Initialize the effect.
|
virtual |
Release all gl objects used by this object.
|
virtual |
Run a simulation update to simulate particle movement.
| timeStep | The time step to simulate. |
| currentTime | The current simulation time. |
| jobSplitter | A job splitter to add simulation jobs to. |
|
virtual |
Run a post simulation update.
This is specifically here to update things that might not be job thread safe.
| timeStep | The time step to simulate. |
|
virtual |
Issues the drawing command for the effect.
|
virtual |
Prepares the effect for drawing based on the camera position.
| camPos | The camera position. |
| basisRot | The basis rotation at the camera location. |
| jobSplitter | A job splitter to add predraw jobs to. |
|
virtual |
Sets a type used to generate hit particles on the ground surface.
A surface hit effect creates particles based on surface heights around the weather effect's current location. The weather effect must be of type EffectTypeParticle to use surface hits.
| type | The type of surface hit to enable. |
|
virtual |
Sets the current wind.
| windDirectionRad | The wind direction in radians. |
| windSpeedMps | The wind speed in meters per second. |
|
virtual |
Sets a wind speed multiplier used for particle physics.
| multiplier | The multiplier value. |
|
virtual |
Sets a wind lift multiplier used for particle physics.
| multiplier | The lift multiplier value can be positive (up) or negative (down). |
|
virtual |
Sets a wind turbulence multiplier for particle physics.
| multiplier | The multiplier value (basically height deviation in meters). |
|
virtual |
Sets a streak value to control particle streaking based on movement.
A streak value of 0 disables streaking. A value greater than 0 lengthens the particle based on how fast it is moving.
| multiplier | The streak multiplier value. |
|
virtual |
Sets the flag to enable particle camera movement streak effect.
If streak is enabled (see setStreak()), then this method enables or disables the camera movement streak effect.
| enable | Set to true to enable camera streak (default if not enabled). |
|
virtual |
Sets a (0.0 - 1.0) value to control the effect fade.
| fade | The transparency multiplier. |
|
virtual |
Sets a (0.0 - 1.0) value to control the effect intensity.
| intensity | The intensity scalar (0.0 - 1.0). |
|
virtual |
Sets an effect fade ramp based on the current intensity.
Fade will be 0 if intensity < intensityMin. Fade will be fadeMax if intensityMin = intensityMax.
| fadeMin | The fade value (0.0 to 1.0) when intensity = intensityMin. |
| fadeMax | The fade value (0.0 to 1.0) when intensity = intensityMax. |
| intensityMin | The intensity (0.0 to 1.0) at which the ramp begins. |
| intensityMax | The intensity (0.0 to 1.0) at which the ramp ends. |
|
virtual |
Sets an effect fade ramp based on the current wind in mps.
Fade will be 0 if wind < windMin. Fade will be fadeMax if windMin = windMax.
| fadeMin | The fade value (0.0 to 1.0) when wind = windMin. |
| fadeMax | The fade value (0.0 to 1.0) when wind = windMax. |
| windMin | The wind speed at which the ramp begins. |
| windMax | The wind speed at which the ramp ends. |
|
virtual |
Sets a particles percentage ramp based on the current intensity.
Percent will be 0 if intensity < intensityMin. Percent will be percentMax if intensityMin = intensityMax.
| percentMin | The percent value (0.0 to 1.0) when intensity = intensityMin. |
| percentMax | The percent value (0.0 to 1.0) when intensity = intensityMax. |
| intensityMin | The intensity (0.0 to 1.0) at which the ramp begins. |
| intensityMax | The intensity (0.0 to 1.0) at which the ramp ends. |
|
virtual |
Sets a base color color multiplier.
| (r,g,b) | The r,g,b multiplier values. |
|
virtual |
Enables additive blending mode for rendering.
| enable | Set to true for additive or false for alphablend. |
|
virtual |
Returns the additive blend mode flag.
|
virtual |
Sets a velocity for all effect particles.
| (x,y,z) | The x,y,z local space velocity values. |
|
virtual |
Sets particle +- initial random rotation.
| rotationDeg | The initial rotation variation in degrees. |
|
virtual |
Returns the radius of the effect.
|
virtual |
Sets the texture cell to use for a texture atlas.
| numColumns | The number of columns in the texture. |
| numRows | The number of rows in the texture. |
| col | The cell column to use. |
| row | The cell row to use. |
|
virtual |
Sets the softness for transparency fade when close to a surface.
| softness | The distance in meters to start the softness fade. |
|
virtual |
Returns the softness for transparency fade when close to a surface.
|
virtual |
Sets the drag coefficient for particles.
| coefficient | The coefficient value. |
|
virtual |
Returns the drag coefficient for particles.
|
virtual |
Sets the flag to enable sorting particles within the effect.
| enable | Set to true to enable sorting. |
|
virtual |
Returns the flag to enable sorting particles within the effect.
|
virtual |
Sorts particles for the current view.
Fills indice buffer.
| localCamPos | The local camera position. |
|
protectedvirtual |
Called during a muti-thread update job to run a simulation update.
| timeStep | The change in time. |
| currentTime | The current simulation time. |
|
protectedvirtual |
Does an update for the Hail surface hit type.
|
protectedvirtual |
Computes the sort depth for all cells.
| reference | The reference position to compute sort depth from. |
|
protectedvirtual |
Fills the gpu buffer with sorted particle data.
|
protectedvirtual |
Binds the mesh group data to the vbo's.
| meshGroup | The mesh group object to bind. |
| renderInfo | The current rendering info. |
|
protectedvirtual |
Binds the dynamic mesh group data to the vbo's.
| meshGroup | The mesh group object to bind. |
| renderInfo | The current rendering info. |
|
protectedvirtual |
Binds the given voa to vbo's for a mesh group.
| vao | The GL VAO handle. |
| meshGroup | The mesh group to bind. |
| renderInfo | The current rendering info. |
|
protectedvirtual |
Simulates particles (movements, etc...) for precipitation.
| timeStep | The change in time. |
| currentTime | The current simulation time. |
|
protectedvirtual |
Simulates particles (life, movements, etc...).
| timeStep | The change in time. |
| currentTime | The current simulation time. |
| basisPosChange | The change in basis position. |
|
protected |
Keeps the given position in the effect radius.
| posX | The X position to constrain. |
| posY | The Y position to constrain. |
| posZ | The Z position to constrain. |
|
protected |
Returns a particle from the free list.
Makes the particle the head of the active list. NULL(0) if no particles are available.
|
protected |
Adds the given particle to the free list.
Handles unlinking from the active list.
|
protected |
Spawns a hail particle at the given location.
| position | The world location. |
| normal | The spawn direction. |
| usePhysics | True if the particle should use physics. |
|
protected |
Returns the cross product of the given 2 vectors.
| v0 | The first vector. |
| v1 | The second vector. |
|
protected |
Computes a random floating point value in the min max range.
| min | The minimum value. |
| max | The maximum value. |
|
protected |
Computes a random point in a radius with even distribution.
| point | The computed point (output). |
| radius | The radius. |
|
protected |
Clamps the given position to a ground surface.
Returns true if successful.
| position | The input/output position to clamp. |
| normal | The output surface normal. |
| up | The up vector to use for detecting surfaces below the position. |
|
protectedvirtual |
Computes an ouput value based on the given blending data and blend position.
| data | The blending data (see BlendData struct for details). |
| blendPos | The blend position. |
|
staticprivate |
simulation update job function used as a callback for job splitting
|
staticprivate |
sort function used for qsorting particles
|
staticprivate |
sort job function used as a callback for job splitting
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |