VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtShaderEffectRain.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <vrvOsg/DtShaderEffect.h>
15 
17 
20 
21 #include <osg/ref_ptr>
22 #include <osg/Texture2D>
23 #include <osg/Uniform>
24 #include <osg/Object>
25 #include <osg/StateSet>
26 #include <osg/OperationThread>
27 #include <osg/Vec4>
28 #include <osg/State>
29 
30 #include <string>
31 #include <vector>
32 
33 namespace makVrv
34 {
35  class DtOsgWeatherEffectsObject;
36  class DtIndirectTextureProcessor;
37  class DtGlProgram;
39 
42 
44  template <>
45  inline const char* creatorTypeName<DtShaderEffectRain>(void) { return "DtShaderEffectRainCreator"; }
46 
52  {
53  public:
54 
55  // Inner class for generating a texture for rain hitting the puddles
56  class RainEffectGeneration : public osg::Operation
57  {
58  public:
60  RainEffectGeneration(DtShaderEffectRain& effectManager, DtDe& de);
61 
63  virtual ~RainEffectGeneration();
64 
66  RainEffectGeneration() = delete;
70  RainEffectGeneration &operator=(const RainEffectGeneration&) = delete;
71 
72  protected:
73 
75  virtual void operator () (osg::Object* sv);
76 
78  virtual void release();
79 
81  virtual DtGlProgram* genComputeProg();
82 
83  protected:
85 
88 
90 
96  double myLastSimTime;
97 
98  std::vector<float> myRainDrops;
99  };
100 
101  public:
102 
105 
107  virtual ~DtShaderEffectRain();
108 
110  DtShaderEffectRain() = delete;
112  DtShaderEffectRain(const DtShaderEffectRain&) = delete;
114  DtShaderEffectRain &operator=(const DtShaderEffectRain&) = delete;
115 
116  public:
119  virtual void initializeEffect(const std::vector<osg::StateSet*>& stateSets,
120  DtIndirectTextureProcessor* textureProcessor, DtOsgRenderer& osgRenderer);
121 
123  virtual void registerWeatherEffectsObject(DtOsgWeatherEffectsObject* weatherEffectsObject);
124 
126  virtual void releaseGLObjects(osg::State* state) override;
127 
129  virtual void updateImGui();
130 
132  virtual void updateUniforms();
133 
135  virtual void setCameraLocation(const DtVector& location);
136 
137  // \brief gets the location for localized effects.
138  virtual const DtVector& cameraLocation() const;
139 
140  protected:
141 
143  virtual RainEffectGeneration* createRainEffectJob();
144 
146  virtual void slot_rainAccumulationChanged(double depth);
147 
149  virtual void updateEnabledState(const float depth);
150 
151  public:
152 
154  static const std::string& theClassName();
155 
156  protected:
157 
159 
164 
167 
169 
173 
177 
179 
180  osg::Vec4 myRainColor;
181 
183 
185 
187 
189  };
190 }
float myRainMaskedRoadRange
Definition: DtShaderEffectRain.h:175
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:90
Implementation independent random number generator.
Definition: DtRandomNumberGenerator.h:20
DtShaderEffect injects custom shaders into the scenes, There are derrived classes of this for snow an...
Definition: DtShaderEffect.h:36
osg::ref_ptr< osg::Uniform > myRainColorUniform
Definition: DtShaderEffectRain.h:162
osg::ref_ptr< osg::Texture2D > myRainEffectTexture
Definition: DtShaderEffectRain.h:166
double myLastSimTime
Definition: DtShaderEffectRain.h:96
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
float myRainUpThresholdMin
Definition: DtShaderEffectRain.h:172
DtShaderEffectRain injects custom shaders into the scene, Handles rain on the ground causing the grou...
Definition: DtShaderEffectRain.h:51
GLuint myRainEffectTextureId
Definition: DtShaderEffectRain.h:165
osg::ref_ptr< osg::Uniform > myEnableRainUniform
Definition: DtShaderEffectRain.h:160
osg::Vec4 myRainColor
Definition: DtShaderEffectRain.h:180
DtVirtualBaseClassCreator< DtShaderEffectRain > DtShaderEffectRainCreator
creator
Definition: DtShaderEffectRain.h:38
bool myClearedDrops
Definition: DtShaderEffectRain.h:91
DtRandomNumberGenerator myRandomNumberGen
Definition: DtShaderEffectRain.h:84
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlProgram.h:65
Contains makVrv::DtShaderEffect class.
int myCurrentRainDrop
Definition: DtShaderEffectRain.h:95
bool myEnablePuddleEffects
Definition: DtShaderEffectRain.h:178
osg::ref_ptr< osg::Uniform > myRainUpThresholdUniform
Definition: DtShaderEffectRain.h:161
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
Contains makVrv::DtRandomNumberGenerator class.
const char * creatorTypeName< DtShaderEffectRain >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtShaderEffectRain.h:45
DtGlProgram * myComputeProgram
Definition: DtShaderEffectRain.h:89
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
float myRainMaskedRoadMax
Definition: DtShaderEffectRain.h:174
float myRainUpThresholdRange
Definition: DtShaderEffectRain.h:171
DtSignalConnectionManager myConnections
Definition: DtShaderEffectRain.h:158
Definition: DtIndirectTextureProcessor.h:40
DtShaderEffectRain & myShaderEffectManager
Definition: DtShaderEffectRain.h:86
int mySimTimeUniformLoc
Definition: DtShaderEffectRain.h:93
DtVector myCameraLocation
Definition: DtShaderEffectRain.h:186
Base class to provide boost signal/slot management.
DtOsgWeatherEffectsObject * myWeatherEffectsObject
Definition: DtShaderEffectRain.h:182
std::vector< float > myRainDrops
Definition: DtShaderEffectRain.h:98
int myRainDropsTexUniformLoc
Definition: DtShaderEffectRain.h:94
DtOsgRenderer & myOsgRenderer
Definition: DtShaderEffectRain.h:168
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
int myOutputTextureUniformLoc
Definition: DtShaderEffectRain.h:92
DtDe & myDe
Definition: DtShaderEffectRain.h:87
float myPrecipitationIntensity
Definition: DtShaderEffectRain.h:188
An OSG implementation of the weather effects object.
Definition: DtOsgWeatherEffectsObject.h:22
float myRainAccumulationDepth
Definition: DtShaderEffectRain.h:176
bool myRainEnabled
Definition: DtShaderEffectRain.h:170
Definition: DtShaderEffectRain.h:56
osg::ref_ptr< osg::Uniform > myRainMaskedRoadUniform
Definition: DtShaderEffectRain.h:163
RainEffectGeneration * myRainEffectGenerationJob
Definition: DtShaderEffectRain.h:184

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)