![]() |
VR-Forces Developer's Guide
|
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).
Classes | |
| struct | BlendData |
| struct | DrawData |
| struct | MeshGroup |
| struct | Particle |
| struct | SimulationUpdateJobData |
| struct | SortJobData |
Public Types | |
| enum | SurfaceHitType { SurfaceHitTypeNone = 0, SurfaceHitTypeHail, SurfaceHitTypeWindBlown } |
Public Member Functions | |
| DtWeatherEffect (makVrv::DtDe &de, const int &particleCount, const float &particleSize, const float &radius, const DtWeatherEffectType &type, const unsigned int &randomSeed) | |
| virtual | ~DtWeatherEffect () |
| virtual void | init (int particleCount, float particleSize, float radius, DtWeatherEffectType type, unsigned int randomSeed) |
| virtual void | releaseGLObjects (osg::State *state) const |
| virtual void | simulationUpdate (float timeStep, double currentTime, DtJobSplitter *jobSplitter) |
| virtual void | postSimulationUpdate (float timeStep, double currentTime) |
| virtual void | draw (DtWeatherEffect::DrawData &drawData, float cullFade=1.0f) const |
| virtual void | cullUpdate (const osg::Vec3d &camPos, const osg::Matrixd &basis, DtJobSplitter *jobSplitter) |
| virtual void | setSurfaceHitType (SurfaceHitType type) |
| virtual void | setSurfaceHitOffset (float offset) |
| virtual void | setSurfaceHitMaxSlope (float degrees) |
| virtual void | setWindBlownParameters (int spawnCount, float minSpeed, float maxSpeed, float minTime, float maxTime) |
| virtual void | setWind (float windDirectionRad, float windSpeedMps) |
| virtual void | setWindSpeedMultiplier (float multiplier) |
| virtual void | setWindLiftMultiplier (float multiplier) |
| virtual void | setWindTurbulence (float multiplier) |
| virtual void | setWindVariation (float minWind, float maxWind) |
| virtual void | setScaleAnimation (float minX, float maxX, float minY, float maxY, float time) |
| virtual void | setStreak (float multiplier) |
| virtual void | setCameraStreakEnable (bool enable) |
| virtual void | setStreakAdjustmentEnable (bool enable) |
| virtual void | setOrientFlat (bool enable) |
| virtual void | setIntensity (float intensity) |
| virtual void | setFadePerIntensity (float fadeMin, float fadeMax, float intensityMin, float intensityMax) |
| virtual void | setFadePerWind (float fadeMin, float fadeMax, float windMin, float windMax) |
| virtual void | setTextureCoordAnimationPerWind (float multMin, float multMax, float windMin, float windMax) |
| virtual void | setParticlesPerIntensity (float percentMin, float percentMax, float intensityMin, float intensityMax) |
| virtual void | setBaseColor (const osg::Vec3 &color) |
| virtual void | setAdditiveBlend (bool enable) |
| virtual bool | additiveBlend () const |
| virtual void | setVelocity (float x, float y, float z) |
| virtual void | setInitRotationVariation (float rotationDeg) |
| virtual void | setRotationVelocity (float velDeg) |
| virtual float | radius () const |
| virtual void | setTextureAtlasCell (unsigned char numColumns, unsigned char numRows, unsigned char col, unsigned char row) |
| virtual void | setTextureCoordinateAnimation (float dirSpeedU, float dirSpeedV, float scale0, float scale1) |
| virtual void | setTexturePatternChannelMix (float mix0, float mix1) |
| virtual void | setDepthSoftness (float softness) |
| virtual float | depthSoftness () const |
| virtual void | setDepthProximity (float startFade, float fadeEnd, float mix) |
| virtual void | setDragCoefficient (float coefficient) |
| virtual float | dragCoefficient () const |
| virtual void | setSortEnable (bool enable) |
| virtual bool | sortEnable () const |
| virtual void | runSort (const osg::Vec3 &localCamPos) |
| virtual void | setClampToSurface (bool enable) |
| virtual bool | clampToSurface () const |
| virtual void | setGravity (const osg::Vec3 &gravity) |
| virtual void | setRadiusFading (float fadeInStart, float fadeInEnd, float fadeOutStart, float fadeOutEnd) |
Protected Member Functions | |
| virtual void | runSimulationUpdateJob (float timeStep, double currentTime) |
| virtual void | updateHailSurfaceHit (float timeStep) |
| virtual void | updateWindBlownSurfaceHit (float timeStep) |
| virtual void | computeSortDepth (const osg::Vec3 &reference) |
| virtual void | fillSortedParticles () |
| virtual bool | bindMeshGroupData (MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| virtual bool | bindDynamicMeshGroupData (MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| virtual bool | bindVaoToMeshGroup (GLuint vao, MeshGroup *meshGroup, osg::RenderInfo &renderInfo) const |
| virtual void | simulatePrecipitationParticles (float timeStep, double currentTime) |
| virtual void | simulateParticles (float timeStep, double currentTime, osg::Vec3d &basisPosChange) |
| void | wrapPosition (float &posX, float &posY, float &posZ) |
| Particle * | getFreeParticle (void) |
| void | freeParticle (Particle *particle) |
| void | spawnHailParticle (const osg::Vec3d &position, const osg::Vec3 &normal, const unsigned char usePhysics) |
| void | spawnWindBlownParticle (const osg::Vec3d &position, const osg::Vec3 &normal, float windRandom, float cosAng) |
| const osg::Vec3 | crossProduct (const osg::Vec3 &v0, const osg::Vec3 &v1) |
| float | computeRandomMinMax (float fMin, float fMax) |
| void | computeRandomPointInRadius (osg::Vec2 &point, float radius) |
| bool | clampPosition (osg::Vec3d &position, osg::Vec3 &normal, const osg::Vec3 &up) |
| virtual float | computeBlendControl (const BlendData &data, float blendPos) const |
Static Protected Member Functions | |
| static void | theSimulationUpdateJob (void *data) |
| static int | theSortBackToFront (const void *arg0, const void *arg1) |
| static void | theSortJob (void *data) |
Private Member Functions | |
| DtWeatherEffect ()=delete | |
| DtWeatherEffect (const DtWeatherEffect &other)=delete | |
| DtWeatherEffect & | operator= (const DtWeatherEffect &other)=delete |
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 location. The WindBlown type spawns wind blown particles at a surface location.
| Enumerator | |
|---|---|
| SurfaceHitTypeNone | |
| SurfaceHitTypeHail | |
| SurfaceHitTypeWindBlown | |
| makVrv::DtWeatherEffect::DtWeatherEffect | ( | makVrv::DtDe & | de, |
| const int & | particleCount, | ||
| const float & | particleSize, | ||
| const float & | radius, | ||
| const DtWeatherEffectType & | type, | ||
| const unsigned int & | randomSeed | ||
| ) |
CTOR.
|
virtual |
DTOR.
|
privatedelete |
Default Constructor not implemented.
|
privatedelete |
Copy Constructor not implemented - Copy not allowed.
|
privatedelete |
Assignment Operator not implemented - Assignment not allowed.
|
virtual |
Initialize the effect.
| particleCount | The maximum number of particles to simulate. |
| particleSize | The base particle size. |
| radius | The effect radius. |
| type | the type of effect. |
| randomSeed | Sets a random seed used during initialization. The random seed value is set by the current time, but this seed is an offset that is added to that to allow multiple effects created at the same time, to look different. |
|
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.
| drawData | The drawing data structure containing draw parameters. |
| cullFade | An addition fade value used for culling falloff. |
|
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 a position offset used for particles that hit a surface.
| offset | The amount to offset the hit position by the suface normal direction. |
|
virtual |
Sets the max surface slope angle allowed for a particle to spawn for a surface hit.
| angleDeg | The maximum slope angle in degrees (0 - 90). |
|
virtual |
Sets the parameters used for the SurfaceHitTypeWindBlown surface hit type.
| spawnCount | The number of particles to spawn. |
| minSpeed | The minimum wind speed multiplier. |
| maxSpeed | The maximum wind speed multiplier. |
| minTime | The minimum alive time. |
| maxTime | The maximum alive time. |
|
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 the particle wind response variation when physics are enabled.
| minWind | The minimum (scalar) a particle is affected by wind. |
| maxWind | The maximum (scalar) a particle is affected by wind. |
|
virtual |
Sets parameters for animated shrink/grow on the particle axis. Scale is cycled back and forth over time from normal to scaled value.
| minX | The minimum x axis size multiplier. |
| maxX | The maximum x axis size multiplier. |
| minY | The minimum y axis size multiplier. |
| maxX | The maximum y axis size multiplier. |
| speed | The time of 1 animation cycle in seconds. |
|
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 is not enabled). |
|
virtual |
Sets the flag to enable streak effect framerate adjustment. If enabled, the streak length will be adjusted when frame rate dips below 60hz. This keeps particles from stretching too much at low frame rates. This should only be enabled for fast moving particles.
| enable | Set to true to enable adjustment. (default is enabled). |
|
virtual |
Sets the particles to be rendered in a flat orientation.
|
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 fadeMin 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 fadeMin 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 an effect texture coordinate animation speed ramp based on the current wind in mps. Computed output will be multMin if wind < windMin. Computed output will be multMax if windMin = windMax.
| multMin | The texture animation speed multiplier value (0.0 to 1.0) when wind = windMin. |
| multMax | The texture animation speed 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 percentMin 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 for the effect.
| color | The r,g,b color 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 |
Sets particle maximum rotation velocity.
| velDeg | The rotation velocity in degrees per second. |
|
virtual |
Returns the radius of the effect.
|
virtual |
Sets the texture cell to use for a texture atlas transparency mask channel.
| 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 texture uv coordinate animation settings applied to the transpancey pattern channels.
| dirSpeedU | The U scrolling speed (u space per second). |
| dirSpeedV | The V scrolling speed (v space per second). |
| scale | The uv scale for pattern 0. (1.0 = one full texture) |
| scale | The uv scale for pattern 1. (1.0 = one full texture) |
|
virtual |
Sets the texture channel mix values for the transparancy patterns. This is used to mix between the r and g channels of the transparency patterns.
| mix | A rg mixing value in the range of (0.0 to 1.0) for pattern 0. |
| mix | A rg mixing value in the range of (0.0 to 1.0) for pattern 1. |
|
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 depth proximity values, to fade particle at it moves away from a surface.
| startFade | The depth distance to start fading out. |
| fadeRange | The depth distance to end fading out. |
| mix | The amount of the fading value to use. (0 = full off, 1 = full on) |
|
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. |
|
virtual |
Sets the flag to enable particles to clamp to a surface in the shader.
| enable | Set to true to enable clamping. |
|
virtual |
Returns the flag to enable particles to clamp to a surface in the shader.
|
virtual |
Sets the gravity (mps^2) used when particle physics are enabled.
| gravity | The acceleration value. |
|
virtual |
Sets radius linear fading values for fading in/out particles based on distance.
| fadeInStart | The distance to begin fading in. |
| fadeInEnd | The distance to be fully faded in. |
| fadeOutStart | The distance to begin fading out. |
| fadeOutEnd | The distance to be fully faded out. |
|
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.
| timeStep | The simulation time step. |
|
protectedvirtual |
Does an update for the WindBlown surface hit type.
| timeStep | The simulation time step. |
|
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 | Set to 1 if the particle should use physics otherwise 0. |
|
protected |
Spawns a wind blown particle at the given location.
| position | The world surface location. |
| normal | The world surface normal. |
| windRandom | A +- wind random direction offset in radians. |
| cosAngle | The cosine of the surface normal vs world up. |
|
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. |
|
staticprotected |
simulation update job function used as a callback for job splitting
|
staticprotected |
sort function used for qsorting particles
|
staticprotected |
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 |
|
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 |