20 #include <osg/BlendFunc>
21 #include <osg/RenderInfo>
29 class DtWeatherEffectDrawable;
30 class DtWeatherEffectsObject;
76 , myWeatherEffectsObject(0)
79 , myIsGeoCentric(false)
81 , myParametersUnfmLoc(0)
82 , mySoftnessUnfmLoc(0)
83 , myDepthProxyUnfmLoc(0)
85 , mySurfaceProjUnfmLoc(0)
86 , myAdditiveBlend(false)
88 , myAppliedHeightMap(false)
91 , mySurfaceHeightCount(0)
94 , mySurfaceCornerRadius(1)
95 , mySurfaceAltitude(0)
97 , myElevationRange(100000.0f)
139 SurfaceHitTypeNone = 0,
173 virtual void init(
int particleCount,
float particleSize,
float radius,
DtWeatherEffectType type,
unsigned int randomSeed);
176 virtual void releaseGLObjects(osg::State* state)
const;
182 virtual void simulationUpdate(
float timeStep,
double currentTime,
DtJobSplitter* jobSplitter);
187 virtual void postSimulationUpdate(
float timeStep,
double currentTime);
198 virtual void cullUpdate(
const osg::Vec3d& camPos,
const osg::Matrixd& basis,
DtJobSplitter* jobSplitter);
205 virtual void setSurfaceHitType(SurfaceHitType type);
209 virtual void setSurfaceHitOffset(
float offset);
213 virtual void setSurfaceHitMaxSlope(
float degrees);
221 virtual void setWindBlownParameters(
int spawnCount,
float minSpeed,
float maxSpeed,
float minTime,
float maxTime);
226 virtual void setWind(
float windDirectionRad,
float windSpeedMps);
230 virtual void setWindSpeedMultiplier(
float multiplier);
234 virtual void setWindLiftMultiplier(
float multiplier);
238 virtual void setWindTurbulence(
float multiplier);
243 virtual void setWindVariation(
float minWind,
float maxWind);
252 virtual void setScaleAnimation(
float minX,
float maxX,
float minY,
float maxY,
float time);
258 virtual void setStreak(
float multiplier);
264 virtual void setCameraStreakEnable(
bool enable);
271 virtual void setStreakAdjustmentEnable(
bool enable);
274 virtual void setOrientFlat(
bool enable);
278 virtual void setIntensity(
float intensity);
287 virtual void setFadePerIntensity(
float fadeMin,
float fadeMax,
float intensityMin,
float intensityMax);
296 virtual void setFadePerWind(
float fadeMin,
float fadeMax,
float windMin,
float windMax);
305 virtual void setTextureCoordAnimationPerWind(
float multMin,
float multMax,
float windMin,
float windMax);
314 virtual void setParticlesPerIntensity(
float percentMin,
float percentMax,
float intensityMin,
float intensityMax);
318 virtual void setBaseColor(
const osg::Vec3& color);
322 virtual void setAdditiveBlend(
bool enable);
325 virtual bool additiveBlend()
const;
329 virtual void setVelocity(
float x,
float y,
float z);
333 virtual void setInitRotationVariation(
float rotationDeg);
337 virtual void setRotationVelocity(
float velDeg);
340 virtual float radius()
const;
347 virtual void setTextureAtlasCell(
unsigned char numColumns,
unsigned char numRows,
unsigned char col,
unsigned char row);
354 virtual void setTextureCoordinateAnimation(
float dirSpeedU,
float dirSpeedV,
float scale0,
float scale1);
360 virtual void setTexturePatternChannelMix(
float mix0,
float mix1);
364 virtual void setDepthSoftness(
float softness);
367 virtual float depthSoftness()
const;
373 virtual void setDepthProximity(
float startFade,
float fadeEnd,
float mix);
377 virtual void setDragCoefficient(
float coefficient);
380 virtual float dragCoefficient()
const;
384 virtual void setSortEnable(
bool enable);
387 virtual bool sortEnable()
const;
391 virtual void runSort(
const osg::Vec3& localCamPos);
395 virtual void setClampToSurface(
bool enable);
398 virtual bool clampToSurface()
const;
402 virtual void setGravity(
const osg::Vec3& gravity);
409 virtual void setRadiusFading(
float fadeInStart,
float fadeInEnd,
float fadeOutStart,
float fadeOutEnd);
417 : myVboPositionArray(0)
419 , myVboTexCoords0Array(0)
421 myPoints =
new osg::Vec4Array;
422 myMove =
new osg::Vec4Array;
423 myTexCoords0 =
new osg::Vec2Array;
442 , myPosition(0, 0, 0, 0)
444 , myVelocity(0, 0, 0)
446 , myLifeTimeInit(1.0f)
489 virtual void runSimulationUpdateJob(
float timeStep,
double currentTime);
493 virtual void updateHailSurfaceHit(
float timeStep);
497 virtual void updateWindBlownSurfaceHit(
float timeStep);
501 virtual void computeSortDepth(
const osg::Vec3& reference);
504 virtual void fillSortedParticles();
509 virtual bool bindMeshGroupData(
MeshGroup* meshGroup, osg::RenderInfo& renderInfo)
const;
514 virtual bool bindDynamicMeshGroupData(
MeshGroup* meshGroup, osg::RenderInfo& renderInfo)
const;
520 virtual bool bindVaoToMeshGroup(
GLuint vao,
MeshGroup* meshGroup, osg::RenderInfo& renderInfo)
const;
525 virtual void simulatePrecipitationParticles(
float timeStep,
double currentTime);
531 virtual void simulateParticles(
float timeStep,
double currentTime, osg::Vec3d& basisPosChange);
539 void wrapPosition(
float& posX,
float& posY,
float& posZ);
548 void freeParticle(
Particle* particle);
554 void spawnHailParticle(
const osg::Vec3d& position,
const osg::Vec3& normal,
555 const unsigned char usePhysics);
562 void spawnWindBlownParticle(
const osg::Vec3d& position,
563 const osg::Vec3& normal,
float windRandom,
float cosAng);
568 const osg::Vec3 crossProduct(
const osg::Vec3& v0,
const osg::Vec3& v1);
574 virtual bool updateRandomSeed(
double currentTime );
580 virtual void setRandomSeedSyncTimeInterval(
unsigned int intervalInMs );
585 float computeRandomMinMax(
float fMin,
float fMax);
590 void computeRandomPointInRadius(osg::Vec2& point,
float radius);
597 bool clampPosition(osg::Vec3d& position, osg::Vec3& normal,
const osg::Vec3& up);
602 virtual float computeBlendControl(
const BlendData& data,
float blendPos)
const;
607 static void theSimulationUpdateJob(
void* data);
610 static int theSortBackToFront(
const void* arg0,
const void* arg1);
613 static void theSortJob(
void* data);
638 , myCameraPos(0, 0, 0)
float myTexCoordAnimScale1
Definition: DtWeatherEffect.h:699
float myLifeTimeInit
Definition: DtWeatherEffect.h:460
osg::ref_ptr< osg::BlendFunc > myBlendFunc
Definition: DtWeatherEffect.h:682
DT_DLL_EXAMPLESCENEROOTPLUGIN void init(DtDe &anIG)
float myWindLiftMultiplier
Definition: DtWeatherEffect.h:665
float mySurfaceBoundsX
Definition: DtWeatherEffect.h:119
osg::Vec3d myBasisPos
Definition: DtWeatherEffect.h:650
A structure used to define a mesh group (voa, positions, coords).
Definition: DtWeatherEffect.h:414
float mySurfaceHitMaxSlope
Definition: DtWeatherEffect.h:657
float myWindMax
Definition: DtWeatherEffect.h:668
BlendData myFadeByIntensity
Definition: DtWeatherEffect.h:675
float myBlendMax
Definition: DtWeatherEffect.h:483
float myBlendMin
Definition: DtWeatherEffect.h:482
bool myAdditiveBlend
Definition: DtWeatherEffect.h:113
osg::Vec3 myGravity
Definition: DtWeatherEffect.h:712
float mySurfaceAltitude
Definition: DtWeatherEffect.h:122
Particle ** myRenderList
Definition: DtWeatherEffect.h:734
Implementation independent random number generator.
Definition: DtRandomNumberGenerator.h:20
osg::Vec3 myCameraPos
Definition: DtWeatherEffect.h:644
float myTexCoordAnimDirOffsetU
Definition: DtWeatherEffect.h:700
DtVirtualBaseClassCreator< DtWeatherEffect, const int &, const float &, const float &, const DtWeatherEffectType &, const unsigned int & > DtWeatherEffectCreator
creator
Definition: DtWeatherEffect.h:47
DtWeatherEffectType
An enumeration to define the effect type. Precipitation is an ageless effect that's infinite in a sc...
Definition: DtWeatherEffect.h:39
GLint mySurfaceProjUnfmLoc
Definition: DtWeatherEffect.h:112
GLint mySurfaceUnfmLoc
Definition: DtWeatherEffect.h:111
osg::Vec3d myCamMove
Definition: DtWeatherEffect.h:105
float myTexturePatternMix1
Definition: DtWeatherEffect.h:703
float myTexCoordAnimDirOffsetV
Definition: DtWeatherEffect.h:701
bool myOrientFlat
Definition: DtWeatherEffect.h:711
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: DtWeatherEffect.h:141
bool myBasisDirty
Definition: DtWeatherEffect.h:652
SimulationUpdateJobData()
Definition: DtWeatherEffect.h:620
DtIntersector is an abstract class that provides the interface for requesting intersections with the ...
Definition: DtIntersector.h:25
Definition: DtWeatherEffect.h:140
bool mySortEnable
Definition: DtWeatherEffect.h:709
SortJobData()
Definition: DtWeatherEffect.h:636
A structure to hold data for a sorting job.
Definition: DtWeatherEffect.h:634
DtWeatherEffectType myEffectType
Definition: DtWeatherEffect.h:654
osg::ref_ptr< osg::Vec4Array > myMove
Definition: DtWeatherEffect.h:427
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:18
DrawData()
Definition: DtWeatherEffect.h:74
int mySurfaceHeightCount
Definition: DtWeatherEffect.h:118
float myWindBlownMinTime
Definition: DtWeatherEffect.h:721
unsigned long myNextSyncTime
Definition: DtWeatherEffect.h:745
float myTimeStep
Definition: DtWeatherEffect.h:629
this class is used to split work up between threads.
Definition: DtJobSplitter.h:64
float myRadiusFadeInFalloff
Definition: DtWeatherEffect.h:714
float myDepthProximityStart
Definition: DtWeatherEffect.h:706
Particle()
Definition: DtWeatherEffect.h:438
osg::Vec3d myCamPos
Definition: DtWeatherEffect.h:104
bool myAppliedHeightMap
Definition: DtWeatherEffect.h:115
bool myCameraStreak
Definition: DtWeatherEffect.h:686
SurfaceHitType mySurfaceHitType
Definition: DtWeatherEffect.h:655
GLint myParametersUnfmLoc
Definition: DtWeatherEffect.h:108
bool myIsGeoCentric
Definition: DtWeatherEffect.h:106
DtWeatherEffect * myEffect
Definition: DtWeatherEffect.h:643
float myTextureAtlasRow
Definition: DtWeatherEffect.h:695
BlendData myParticlesByIntensity
Definition: DtWeatherEffect.h:678
osg::Vec3 myVelocity
Definition: DtWeatherEffect.h:458
float myTextureAtlasRows
Definition: DtWeatherEffect.h:693
unsigned char myUsePhysics
Definition: DtWeatherEffect.h:461
bool myAdditiveBlend
Definition: DtWeatherEffect.h:681
float mySurfaceHitOffset
Definition: DtWeatherEffect.h:656
float myScaleAnimMaxX
Definition: DtWeatherEffect.h:688
float myTextureAtlasCols
Definition: DtWeatherEffect.h:692
DtRandomNumberGenerator myRandomNumberGen
Definition: DtWeatherEffect.h:743
unsigned int myRandomSeed
Definition: DtWeatherEffect.h:659
float myWindBlownMaxSpeed
Definition: DtWeatherEffect.h:720
float myTexturePatternMix0
Definition: DtWeatherEffect.h:702
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
A structure used to hold data for drawing.
Definition: DtWeatherEffect.h:72
osg::Vec3d myLastBasisPos
Definition: DtWeatherEffect.h:651
osg::Matrixf mySurfaceMatrix
Definition: DtWeatherEffect.h:123
float myWindBlownMinSpeed
Definition: DtWeatherEffect.h:719
float myElevationRange
Definition: DtWeatherEffect.h:125
float myInitRotationRad
Definition: DtWeatherEffect.h:671
A drawable for drawing weather effects such as hail. The class serves as a place to setup common stat...
Definition: DtWeatherEffectDrawable.h:37
Contains makVrv::DtRandomNumberGenerator class.
BlendData()
Definition: DtWeatherEffect.h:471
bool myStateDirty
Definition: DtWeatherEffect.h:114
osg::ref_ptr< osg::Vec4Array > myPoints
Definition: DtWeatherEffect.h:426
float myIntensity
Definition: DtWeatherEffect.h:674
float myTexCoordAnimDirSpeedV
Definition: DtWeatherEffect.h:697
osg::Vec3 myScroll
Definition: DtWeatherEffect.h:660
Definition: DtWeatherEffect.h:41
int myRenderParticleCount
Definition: DtWeatherEffect.h:735
SortJobData mySortJobData
Definition: DtWeatherEffect.h:740
Contains makVrv::DtJobSplitter class.
float myWindSpeedMultiplier
Definition: DtWeatherEffect.h:664
float myValueMax
Definition: DtWeatherEffect.h:481
DtJobSplitterJob mySimulationUpdateJob
Definition: DtWeatherEffect.h:738
float myNearClip
Definition: DtWeatherEffect.h:107
this class is used to create weather effects around the eye to represent effects such as mist...
Definition: DtWeatherEffect.h:67
float myWindTurbulence
Definition: DtWeatherEffect.h:666
float myScaleAnimMaxY
Definition: DtWeatherEffect.h:690
float mySurfaceHitTimer
Definition: DtWeatherEffect.h:658
int myParticleActiveCount
Definition: DtWeatherEffect.h:732
float mySortDepth
Definition: DtWeatherEffect.h:455
Definition: DtWeatherEffect.h:42
const unsigned int * mySurfaceHeights
Definition: DtWeatherEffect.h:117
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:469
float mySurfaceBoundsY
Definition: DtWeatherEffect.h:120
float myDepthProximityRange
Definition: DtWeatherEffect.h:707
float myDepthSoftness
Definition: DtWeatherEffect.h:704
float myRotationVelocity
Definition: DtWeatherEffect.h:672
int myWindBlownSpawnCount
Definition: DtWeatherEffect.h:718
float myDragCoefficient
Definition: DtWeatherEffect.h:669
osg::Vec3 myVelocity
Definition: DtWeatherEffect.h:670
float myWindDirectionRad
Definition: DtWeatherEffect.h:662
A structure used to define a simulation particle.
Definition: DtWeatherEffect.h:436
osg::ref_ptr< osg::Vec2Array > myTexCoords0
Definition: DtWeatherEffect.h:428
const char * creatorTypeName< DtWeatherEffect >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtWeatherEffect.h:55
float myTextureAtlasCol
Definition: DtWeatherEffect.h:694
osg::Vec3 myBaseColor
Definition: DtWeatherEffect.h:680
float myEffectFade
Definition: DtWeatherEffect.h:673
Particle * myParent
Definition: DtWeatherEffect.h:453
float myRadiusFadeOutStart
Definition: DtWeatherEffect.h:715
double myCurrentTime
Definition: DtWeatherEffect.h:630
BlendData myTexCoordAnimSpeedByWind
Definition: DtWeatherEffect.h:677
GLint myDepthProxyUnfmLoc
Definition: DtWeatherEffect.h:110
DtGlVaoManager * myVaoManager
Definition: DtWeatherEffect.h:725
bool myClampToSurface
Definition: DtWeatherEffect.h:710
GLint mySoftnessUnfmLoc
Definition: DtWeatherEffect.h:109
Particle * myParticlesActive
Definition: DtWeatherEffect.h:731
A generic OpenGL buffer. This can be: -> a vertex buffer -> an index buffer -> a shader storage buffe...
Definition: DtGlBuffer.h:29
osg::Vec4 myMove
Definition: DtWeatherEffect.h:457
unsigned int mySeedSyncInterval
Definition: DtWeatherEffect.h:744
float myScaleSpeed
Definition: DtWeatherEffect.h:691
float myRadiusFadeOutFalloff
Definition: DtWeatherEffect.h:716
float myWindMin
Definition: DtWeatherEffect.h:667
osg::RenderInfo * myRenderInfo
Definition: DtWeatherEffect.h:102
float myWindSpeedMps
Definition: DtWeatherEffect.h:663
A structure to hold data for a simluation update job.
Definition: DtWeatherEffect.h:618
SimulationUpdateJobData mySimulationUpdateJobData
Definition: DtWeatherEffect.h:737
A generic structure to hold data for a job for use with DtJobSplitter.
Definition: DtJobSplitter.h:26
MeshGroup * myMeshGroup
Definition: DtWeatherEffect.h:724
float myScaleAnimMinX
Definition: DtWeatherEffect.h:687
float myStreakAdjustment
Definition: DtWeatherEffect.h:684
float mySurfaceCornerRadius
Definition: DtWeatherEffect.h:121
DtDe & myDe
Definition: DtWeatherEffect.h:647
float myDepthProximityMix
Definition: DtWeatherEffect.h:705
bool myStreakAdjustmentEnable
Definition: DtWeatherEffect.h:685
This class is used to manage an opengl vertex array object (VAO) dealing with multiple opengl context...
Definition: DtGlVaoManager.h:58
float myTexCoordAnimDirSpeedU
Definition: DtWeatherEffect.h:696
float myLifeTime
Definition: DtWeatherEffect.h:459
float myDepthProximityInvRange
Definition: DtWeatherEffect.h:708
float myTexCoordAnimScale0
Definition: DtWeatherEffect.h:698
float myRadius
Definition: DtWeatherEffect.h:661
Contains DLL export macros.
Particle * myParticlesMemoryPool
Definition: DtWeatherEffect.h:727
float myScaleAnimMinY
Definition: DtWeatherEffect.h:689
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:72
osg::Vec4 myPosition
Definition: DtWeatherEffect.h:456
float myRadiusFadeInStart
Definition: DtWeatherEffect.h:713
float myParticleSize
Definition: DtWeatherEffect.h:679
SurfaceHitType
An enumeration to define a surface hit effect. A surface hit effect creates particles based on surfac...
Definition: DtWeatherEffect.h:137
float myValueMin
Definition: DtWeatherEffect.h:480
voidpf uLong offset
Definition: ioapi.h:42
BlendData myFadeByWind
Definition: DtWeatherEffect.h:676
Contains the DtGlVaoManager class declaration.
DtJobSplitterJob mySortJob
Definition: DtWeatherEffect.h:741
DtWeatherEffectsObject * myWeatherEffectsObject
Definition: DtWeatherEffect.h:103
float myElevationMin
Definition: DtWeatherEffect.h:124
unsigned char myFadeCurve
Definition: DtWeatherEffect.h:462
DtWeatherEffect * myEffect
Definition: DtWeatherEffect.h:628
int myParticleMemoryPoolCount
Definition: DtWeatherEffect.h:728
float myWindBlownMaxTime
Definition: DtWeatherEffect.h:722
MeshGroup()
Definition: DtWeatherEffect.h:416
const DtWeatherEffectDrawable * myDrawable
Definition: DtWeatherEffect.h:116
Particle * myParticlesFree
Definition: DtWeatherEffect.h:730
float myStreak
Definition: DtWeatherEffect.h:683
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:649
Particle * myChild
Definition: DtWeatherEffect.h:454