20 #include <osg/BlendFunc>
21 #include <osg/RenderInfo>
29 class DtWeatherEffectDrawable;
30 class DtWeatherEffectsObject;
52 , myWeatherEffectsObject(0)
55 , myIsGeoCentric(false)
57 , myParametersUnfmLoc(0)
58 , mySoftnessUnfmLoc(0)
59 , myDepthProxyUnfmLoc(0)
61 , mySurfaceProjUnfmLoc(0)
62 , myAdditiveBlend(false)
64 , myAppliedHeightMap(false)
67 , mySurfaceHeightCount(0)
70 , mySurfaceCornerRadius(1)
71 , mySurfaceAltitude(0)
73 , myElevationRange(100000.0f)
111 EffectTypePrecipitation = 0,
124 SurfaceHitTypeNone = 0,
157 virtual void init(
int particleCount,
float particleSize,
float radius, EffectType type,
unsigned int randomSeed);
160 virtual void releaseGLObjects(osg::State* state)
const;
166 virtual void simulationUpdate(
float timeStep,
double currentTime,
DtJobSplitter* jobSplitter);
171 virtual void postSimulationUpdate(
float timeStep,
double currentTime);
182 virtual void cullUpdate(
const osg::Vec3d& camPos,
const osg::Matrixd& basis,
DtJobSplitter* jobSplitter);
189 virtual void setSurfaceHitType(SurfaceHitType type);
193 virtual void setSurfaceHitOffset(
float offset);
197 virtual void setSurfaceHitMaxSlope(
float degrees);
205 virtual void setWindBlownParameters(
int spawnCount,
float minSpeed,
float maxSpeed,
float minTime,
float maxTime);
210 virtual void setWind(
float windDirectionRad,
float windSpeedMps);
214 virtual void setWindSpeedMultiplier(
float multiplier);
218 virtual void setWindLiftMultiplier(
float multiplier);
222 virtual void setWindTurbulence(
float multiplier);
227 virtual void setWindVariation(
float minWind,
float maxWind);
236 virtual void setScaleAnimation(
float minX,
float maxX,
float minY,
float maxY,
float time);
242 virtual void setStreak(
float multiplier);
248 virtual void setCameraStreakEnable(
bool enable);
255 virtual void setStreakAdjustmentEnable(
bool enable);
258 virtual void setOrientFlat(
bool enable);
262 virtual void setIntensity(
float intensity);
271 virtual void setFadePerIntensity(
float fadeMin,
float fadeMax,
float intensityMin,
float intensityMax);
280 virtual void setFadePerWind(
float fadeMin,
float fadeMax,
float windMin,
float windMax);
289 virtual void setTextureCoordAnimationPerWind(
float multMin,
float multMax,
float windMin,
float windMax);
298 virtual void setParticlesPerIntensity(
float percentMin,
float percentMax,
float intensityMin,
float intensityMax);
302 virtual void setBaseColor(
const osg::Vec3& color);
306 virtual void setAdditiveBlend(
bool enable);
309 virtual bool additiveBlend()
const;
313 virtual void setVelocity(
float x,
float y,
float z);
317 virtual void setInitRotationVariation(
float rotationDeg);
321 virtual void setRotationVelocity(
float velDeg);
324 virtual float radius()
const;
331 virtual void setTextureAtlasCell(
unsigned char numColumns,
unsigned char numRows,
unsigned char col,
unsigned char row);
338 virtual void setTextureCoordinateAnimation(
float dirSpeedU,
float dirSpeedV,
float scale0,
float scale1);
344 virtual void setTexturePatternChannelMix(
float mix0,
float mix1);
348 virtual void setDepthSoftness(
float softness);
351 virtual float depthSoftness()
const;
357 virtual void setDepthProximity(
float startFade,
float fadeEnd,
float mix);
361 virtual void setDragCoefficient(
float coefficient);
364 virtual float dragCoefficient()
const;
368 virtual void setSortEnable(
bool enable);
371 virtual bool sortEnable()
const;
375 virtual void runSort(
const osg::Vec3& localCamPos);
379 virtual void setClampToSurface(
bool enable);
382 virtual bool clampToSurface()
const;
386 virtual void setGravity(
const osg::Vec3& gravity);
393 virtual void setRadiusFading(
float fadeInStart,
float fadeInEnd,
float fadeOutStart,
float fadeOutEnd);
401 : myVboPositionArray(0)
403 , myVboTexCoords0Array(0)
405 myPoints =
new osg::Vec4Array;
406 myMove =
new osg::Vec4Array;
407 myTexCoords0 =
new osg::Vec2Array;
426 , myPosition(0, 0, 0, 0)
428 , myVelocity(0, 0, 0)
430 , myLifeTimeInit(1.0f)
473 virtual void runSimulationUpdateJob(
float timeStep,
double currentTime);
477 virtual void updateHailSurfaceHit(
float timeStep);
481 virtual void updateWindBlownSurfaceHit(
float timeStep);
485 virtual void computeSortDepth(
const osg::Vec3& reference);
488 virtual void fillSortedParticles();
493 virtual bool bindMeshGroupData(
MeshGroup* meshGroup, osg::RenderInfo& renderInfo)
const;
498 virtual bool bindDynamicMeshGroupData(
MeshGroup* meshGroup, osg::RenderInfo& renderInfo)
const;
504 virtual bool bindVaoToMeshGroup(
GLuint vao,
MeshGroup* meshGroup, osg::RenderInfo& renderInfo)
const;
509 virtual void simulatePrecipitationParticles(
float timeStep,
double currentTime);
515 virtual void simulateParticles(
float timeStep,
double currentTime, osg::Vec3d& basisPosChange);
523 void wrapPosition(
float& posX,
float& posY,
float& posZ);
532 void freeParticle(
Particle* particle);
538 void spawnHailParticle(
const osg::Vec3d& position,
const osg::Vec3& normal,
539 const unsigned char usePhysics);
546 void spawnWindBlownParticle(
const osg::Vec3d& position,
547 const osg::Vec3& normal,
float windRandom,
float cosAng);
552 const osg::Vec3 crossProduct(
const osg::Vec3& v0,
const osg::Vec3& v1);
557 float computeRandomMinMax(
float fMin,
float fMax);
562 void computeRandomPointInRadius(osg::Vec2& point,
float radius);
569 bool clampPosition(osg::Vec3d& position, osg::Vec3& normal,
const osg::Vec3& up);
574 virtual float computeBlendControl(
const BlendData& data,
float blendPos)
const;
579 static void theSimulationUpdateJob(
void* data);
582 static int theSortBackToFront(
const void* arg0,
const void* arg1);
585 static void theSortJob(
void* data);
610 , myCameraPos(0, 0, 0)
748 virtual DtWeatherEffect* create(
int particleCount,
float particleSize,
float radius,
756 static const std::string& theClassName();
float myTexCoordAnimScale1
Definition: DtWeatherEffect.h:671
float myLifeTimeInit
Definition: DtWeatherEffect.h:444
osg::ref_ptr< osg::BlendFunc > myBlendFunc
Definition: DtWeatherEffect.h:654
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
float myWindLiftMultiplier
Definition: DtWeatherEffect.h:637
float mySurfaceBoundsX
Definition: DtWeatherEffect.h:95
osg::Vec3d myBasisPos
Definition: DtWeatherEffect.h:622
A structure used to define a mesh group (voa, positions, coords).
Definition: DtWeatherEffect.h:398
float mySurfaceHitMaxSlope
Definition: DtWeatherEffect.h:629
float myWindMax
Definition: DtWeatherEffect.h:640
BlendData myFadeByIntensity
Definition: DtWeatherEffect.h:647
float myBlendMax
Definition: DtWeatherEffect.h:467
float myBlendMin
Definition: DtWeatherEffect.h:466
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
bool myAdditiveBlend
Definition: DtWeatherEffect.h:89
osg::Vec3 myGravity
Definition: DtWeatherEffect.h:684
float mySurfaceAltitude
Definition: DtWeatherEffect.h:98
Particle ** myRenderList
Definition: DtWeatherEffect.h:706
Implementation independent random number generator.
Definition: DtRandomNumberGenerator.h:20
osg::Vec3 myCameraPos
Definition: DtWeatherEffect.h:616
float myTexCoordAnimDirOffsetU
Definition: DtWeatherEffect.h:672
GLint mySurfaceProjUnfmLoc
Definition: DtWeatherEffect.h:88
GLint mySurfaceUnfmLoc
Definition: DtWeatherEffect.h:87
osg::Vec3d myCamMove
Definition: DtWeatherEffect.h:81
float myTexturePatternMix1
Definition: DtWeatherEffect.h:675
float myTexCoordAnimDirOffsetV
Definition: DtWeatherEffect.h:673
bool myOrientFlat
Definition: DtWeatherEffect.h:683
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: DtWeatherEffect.h:126
bool myBasisDirty
Definition: DtWeatherEffect.h:624
SimulationUpdateJobData()
Definition: DtWeatherEffect.h:592
DtIntersector is an abstract class that provides the interface for requesting intersections with the ...
Definition: DtIntersector.h:25
unsigned int myVboTexCoords0Array
Definition: DtWeatherEffect.h:416
Definition: DtWeatherEffect.h:125
bool mySortEnable
Definition: DtWeatherEffect.h:681
SortJobData()
Definition: DtWeatherEffect.h:608
A structure to hold data for a sorting job.
Definition: DtWeatherEffect.h:606
osg::ref_ptr< osg::Vec4Array > myMove
Definition: DtWeatherEffect.h:411
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
DrawData()
Definition: DtWeatherEffect.h:50
int mySurfaceHeightCount
Definition: DtWeatherEffect.h:94
float myWindBlownMinTime
Definition: DtWeatherEffect.h:693
float myTimeStep
Definition: DtWeatherEffect.h:601
this class is used to split work up between threads.
Definition: DtJobSplitter.h:64
float myRadiusFadeInFalloff
Definition: DtWeatherEffect.h:686
float myDepthProximityStart
Definition: DtWeatherEffect.h:678
Particle()
Definition: DtWeatherEffect.h:422
osg::Vec3d myCamPos
Definition: DtWeatherEffect.h:80
bool myAppliedHeightMap
Definition: DtWeatherEffect.h:91
bool myCameraStreak
Definition: DtWeatherEffect.h:658
SurfaceHitType mySurfaceHitType
Definition: DtWeatherEffect.h:627
GLint myParametersUnfmLoc
Definition: DtWeatherEffect.h:84
bool myIsGeoCentric
Definition: DtWeatherEffect.h:82
DtWeatherEffect * myEffect
Definition: DtWeatherEffect.h:615
unsigned int myVboMoveArray
Definition: DtWeatherEffect.h:415
float myTextureAtlasRow
Definition: DtWeatherEffect.h:667
BlendData myParticlesByIntensity
Definition: DtWeatherEffect.h:650
osg::Vec3 myVelocity
Definition: DtWeatherEffect.h:442
float myTextureAtlasRows
Definition: DtWeatherEffect.h:665
unsigned char myUsePhysics
Definition: DtWeatherEffect.h:445
bool myAdditiveBlend
Definition: DtWeatherEffect.h:653
float mySurfaceHitOffset
Definition: DtWeatherEffect.h:628
float myScaleAnimMaxX
Definition: DtWeatherEffect.h:660
float myTextureAtlasCols
Definition: DtWeatherEffect.h:664
DtRandomNumberGenerator myRandomNumberGen
Definition: DtWeatherEffect.h:715
unsigned int myRandomSeed
Definition: DtWeatherEffect.h:631
float myWindBlownMaxSpeed
Definition: DtWeatherEffect.h:692
float myTexturePatternMix0
Definition: DtWeatherEffect.h:674
creator for DtWeatherEffect
Definition: DtWeatherEffect.h:722
A structure used to hold data for drawing.
Definition: DtWeatherEffect.h:48
osg::Vec3d myLastBasisPos
Definition: DtWeatherEffect.h:623
osg::Matrixf mySurfaceMatrix
Definition: DtWeatherEffect.h:99
float myWindBlownMinSpeed
Definition: DtWeatherEffect.h:691
float myElevationRange
Definition: DtWeatherEffect.h:101
float myInitRotationRad
Definition: DtWeatherEffect.h:643
Contains makVrv::DtVirtualBaseClass class.
A drawable for drawing weather effects such as hail. The class serves as a place to setup common stat...
Definition: DtWeatherEffectDrawable.h:36
Contains makVrv::DtRandomNumberGenerator class.
BlendData()
Definition: DtWeatherEffect.h:455
bool myStateDirty
Definition: DtWeatherEffect.h:90
osg::ref_ptr< osg::Vec4Array > myPoints
Definition: DtWeatherEffect.h:410
float myIntensity
Definition: DtWeatherEffect.h:646
float myTexCoordAnimDirSpeedV
Definition: DtWeatherEffect.h:669
osg::Vec3 myScroll
Definition: DtWeatherEffect.h:632
int myRenderParticleCount
Definition: DtWeatherEffect.h:707
SortJobData mySortJobData
Definition: DtWeatherEffect.h:712
Contains makVrv::DtJobSplitter class.
float myWindSpeedMultiplier
Definition: DtWeatherEffect.h:636
float myValueMax
Definition: DtWeatherEffect.h:465
DtJobSplitterJob mySimulationUpdateJob
Definition: DtWeatherEffect.h:710
float myNearClip
Definition: DtWeatherEffect.h:83
this class is used to create weather effects around the eye to represent effects such as mist...
Definition: DtWeatherEffect.h:43
float myWindTurbulence
Definition: DtWeatherEffect.h:638
float myScaleAnimMaxY
Definition: DtWeatherEffect.h:662
float mySurfaceHitTimer
Definition: DtWeatherEffect.h:630
int myParticleActiveCount
Definition: DtWeatherEffect.h:704
EffectType
An enumeration to define the effect type. Precipitation is an ageless effect that's infinite in a scr...
Definition: DtWeatherEffect.h:109
float mySortDepth
Definition: DtWeatherEffect.h:439
const unsigned int * mySurfaceHeights
Definition: DtWeatherEffect.h:93
A structure to hold blending control data for things like particle amount per intensity. Ouput is 0 when blend < myBlendMin. Output is in the range of (myValueMin to myValueMax) when blend is (myBlendMin to myBlendMax). Ouput is myValueMax when blend >= myBlendMax.
Definition: DtWeatherEffect.h:453
float mySurfaceBoundsY
Definition: DtWeatherEffect.h:96
float myDepthProximityRange
Definition: DtWeatherEffect.h:679
float myDepthSoftness
Definition: DtWeatherEffect.h:676
float myRotationVelocity
Definition: DtWeatherEffect.h:644
int myWindBlownSpawnCount
Definition: DtWeatherEffect.h:690
float myDragCoefficient
Definition: DtWeatherEffect.h:641
osg::Vec3 myVelocity
Definition: DtWeatherEffect.h:642
float myWindDirectionRad
Definition: DtWeatherEffect.h:634
A structure used to define a simulation particle.
Definition: DtWeatherEffect.h:420
osg::ref_ptr< osg::Vec2Array > myTexCoords0
Definition: DtWeatherEffect.h:412
float myTextureAtlasCol
Definition: DtWeatherEffect.h:666
osg::Vec3 myBaseColor
Definition: DtWeatherEffect.h:652
float myEffectFade
Definition: DtWeatherEffect.h:645
Particle * myParent
Definition: DtWeatherEffect.h:437
float myRadiusFadeOutStart
Definition: DtWeatherEffect.h:687
double myCurrentTime
Definition: DtWeatherEffect.h:602
BlendData myTexCoordAnimSpeedByWind
Definition: DtWeatherEffect.h:649
GLint myDepthProxyUnfmLoc
Definition: DtWeatherEffect.h:86
DtGlVaoManager * myVaoManager
Definition: DtWeatherEffect.h:697
bool myClampToSurface
Definition: DtWeatherEffect.h:682
GLint mySoftnessUnfmLoc
Definition: DtWeatherEffect.h:85
Particle * myParticlesActive
Definition: DtWeatherEffect.h:703
osg::Vec4 myMove
Definition: DtWeatherEffect.h:441
DtDe & myDe
Definition: DtWeatherEffect.h:759
float myScaleSpeed
Definition: DtWeatherEffect.h:663
float myRadiusFadeOutFalloff
Definition: DtWeatherEffect.h:688
float myWindMin
Definition: DtWeatherEffect.h:639
osg::RenderInfo * myRenderInfo
Definition: DtWeatherEffect.h:78
float myWindSpeedMps
Definition: DtWeatherEffect.h:635
A structure to hold data for a simluation update job.
Definition: DtWeatherEffect.h:590
SimulationUpdateJobData mySimulationUpdateJobData
Definition: DtWeatherEffect.h:709
A generic structure to hold data for a job for use with DtJobSplitter.
Definition: DtJobSplitter.h:26
MeshGroup * myMeshGroup
Definition: DtWeatherEffect.h:696
float myScaleAnimMinX
Definition: DtWeatherEffect.h:659
float myStreakAdjustment
Definition: DtWeatherEffect.h:656
float mySurfaceCornerRadius
Definition: DtWeatherEffect.h:97
DtDe & myDe
Definition: DtWeatherEffect.h:619
float myDepthProximityMix
Definition: DtWeatherEffect.h:677
bool myStreakAdjustmentEnable
Definition: DtWeatherEffect.h:657
This class is used to manage an opengl vertex array object (VAO) dealing with multiple opengl context...
Definition: DtGlVaoManager.h:65
float myTexCoordAnimDirSpeedU
Definition: DtWeatherEffect.h:668
float myLifeTime
Definition: DtWeatherEffect.h:443
float myDepthProximityInvRange
Definition: DtWeatherEffect.h:680
float myTexCoordAnimScale0
Definition: DtWeatherEffect.h:670
float myRadius
Definition: DtWeatherEffect.h:633
Contains DLL export macros.
unsigned int myVboPositionArray
Definition: DtWeatherEffect.h:414
EffectType myEffectType
Definition: DtWeatherEffect.h:626
Particle * myParticlesMemoryPool
Definition: DtWeatherEffect.h:699
float myScaleAnimMinY
Definition: DtWeatherEffect.h:661
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
osg::Vec4 myPosition
Definition: DtWeatherEffect.h:440
float myRadiusFadeInStart
Definition: DtWeatherEffect.h:685
float myParticleSize
Definition: DtWeatherEffect.h:651
SurfaceHitType
An enumeration to define a surface hit effect. A surface hit effect creates particles based on surfac...
Definition: DtWeatherEffect.h:122
float myValueMin
Definition: DtWeatherEffect.h:464
voidpf uLong offset
Definition: ioapi.h:42
BlendData myFadeByWind
Definition: DtWeatherEffect.h:648
Contains the DtGlVaoManager class declaration.
DtJobSplitterJob mySortJob
Definition: DtWeatherEffect.h:713
DtWeatherEffectsObject * myWeatherEffectsObject
Definition: DtWeatherEffect.h:79
float myElevationMin
Definition: DtWeatherEffect.h:100
unsigned char myFadeCurve
Definition: DtWeatherEffect.h:446
DtWeatherEffect * myEffect
Definition: DtWeatherEffect.h:600
int myParticleMemoryPoolCount
Definition: DtWeatherEffect.h:700
float myWindBlownMaxTime
Definition: DtWeatherEffect.h:694
MeshGroup()
Definition: DtWeatherEffect.h:400
const DtWeatherEffectDrawable * myDrawable
Definition: DtWeatherEffect.h:92
Particle * myParticlesFree
Definition: DtWeatherEffect.h:702
float myStreak
Definition: DtWeatherEffect.h:655
The weather effects object for passing settings from the master to the slave for weather effects...
Definition: DtWeatherEffectsObject.h:27
osg::Matrixd myBasisRot
Definition: DtWeatherEffect.h:621
Particle * myChild
Definition: DtWeatherEffect.h:438