VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtShaderEffectSnow.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 
18 
19 #include <osg/ref_ptr>
20 #include <osg/Texture2D>
21 #include <osg/Uniform>
22 #include <osg/Object>
23 #include <osg/StateSet>
24 #include <osg/OperationThread>
25 #include <osg/Vec4>
26 #include <osg/State>
27 
28 #include <string>
29 #include <vector>
30 
31 namespace makVrv
32 {
33  class DtOsgWeatherEffectsObject;
34  class DtGlProgram;
36 
39 
41  template <>
42  inline const char* creatorTypeName<DtShaderEffectSnow>(void) { return "DtShaderEffectSnowCreator"; }
43 
49  {
50  public:
51  // Inner class for generating texture for snow blowing across the ground effect
52  class SnowEffectGeneration : public osg::Operation
53  {
54  public:
56  SnowEffectGeneration(DtShaderEffectSnow& effectManager, DtDe& de);
57 
59  virtual ~SnowEffectGeneration();
60 
63  void setWind(const osg::Vec4& wind);
64 
66  SnowEffectGeneration() = delete;
70  SnowEffectGeneration &operator=(const SnowEffectGeneration&) = 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  int myCurLine;
97  double myLastSimTime;
100  std::vector<float> myBlowingSnowLine;
101  //x,y wind direction, z wind speed, w wind angle radians.
102  osg::Vec4 myWindUniform;
103  };
104 
105 
106  public:
108  virtual ~DtShaderEffectSnow();
109 
112 
114  DtShaderEffectSnow() = delete;
116  DtShaderEffectSnow(const DtShaderEffectSnow&) = delete;
118  DtShaderEffectSnow &operator=(const DtShaderEffectSnow&) = delete;
119 
120  public:
123  virtual void initializeEffect(const std::vector<osg::StateSet*>& statesets,
124  DtIndirectTextureProcessor* textureProcessor, DtOsgRenderer& osgRenderer);
125 
127  virtual void releaseGLObjects(osg::State* state) override;
128 
130  virtual void registerWeatherEffectsObject(DtOsgWeatherEffectsObject* weatherEffectsObject);
131 
133  virtual void reloadShader();
134 
136  virtual void updateImGui();
137 
139  virtual void updateUniforms();
140 
142  virtual void slot_elevationalConfigurationUpdated(
144 
145  public:
146 
148  static const std::string& theClassName();
149 
150  protected:
151 
153  virtual void slot_snowAccumulationChanged(double depth);
154 
156  virtual void slot_snowRoadAccumulationChanged(double depth);
157 
159  virtual void slot_snowMinimumElevationChanged(double elevation);
160 
162  virtual void slot_snowElevationTransitionChanged(double elevation);
163 
165  virtual void slot_PreObserverUpdate(double simTime);
166 
168  virtual SnowEffectGeneration* createSnowEffectJob();
169 
170  protected:
171 
173 
179 
183 
189 
192 
194 
195  osg::Vec4 mySnowColor;
196 
197  //x,y wind direction, z wind speed, w wind angle radians.
198  osg::Vec4 myWindUniform;
199 
202 
204 
206 
208  };
209 }
osg::ref_ptr< osg::Uniform > mySnowMaskedRoadUniform
Definition: DtShaderEffectSnow.h:177
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
osg::ref_ptr< osg::Uniform > myEnableSnowUniform
Definition: DtShaderEffectSnow.h:174
float mySnowUpThresholdMin
Definition: DtShaderEffectSnow.h:186
DtShaderEffect injects custom shaders into the scenes, There are derrived classes of this for snow an...
Definition: DtShaderEffect.h:36
double myLastSimTime
Definition: DtShaderEffectSnow.h:97
Definition: DtShaderEffectSnow.h:52
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtRandomNumberGenerator myRandomNumberGen
Definition: DtShaderEffectSnow.h:84
DtGlProgram * myComputeProgram
Definition: DtShaderEffectSnow.h:89
DtVirtualBaseClassCreator< DtShaderEffectSnow > DtShaderEffectSnowCreator
creator
Definition: DtShaderEffectSnow.h:35
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
float mySnowUpThresholdRange
Definition: DtShaderEffectSnow.h:185
double myLastDropTime
Definition: DtShaderEffectSnow.h:99
const char * creatorTypeName< DtShaderEffectSnow >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtShaderEffectSnow.h:42
std::vector< float > myBlowingSnowLine
Definition: DtShaderEffectSnow.h:100
DtSignalConnectionManager myConnections
Definition: DtShaderEffectSnow.h:172
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlProgram.h:65
DtDe & myDe
Definition: DtShaderEffectSnow.h:87
GLuint mySnowEffectTextureId
Definition: DtShaderEffectSnow.h:180
Contains makVrv::DtShaderEffect class.
Record for an elevational configuration A record of this type consists of 1) a base MSL altitude...
Definition: DtEnvironmentRecord.h:236
DtOsgRenderer & myOsgRenderer
Definition: DtShaderEffectSnow.h:207
bool myClearedLines
Definition: DtShaderEffectSnow.h:91
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
int mySimTimeUniformLoc
Definition: DtShaderEffectSnow.h:93
Contains makVrv::DtRandomNumberGenerator class.
float mySnowMaskedRoadMax
Definition: DtShaderEffectSnow.h:190
osg::ref_ptr< osg::Uniform > mySnowWindUniform
Definition: DtShaderEffectSnow.h:178
float myWindOffset
Definition: DtShaderEffectSnow.h:200
int myBlownSnowTexUniformLoc
Definition: DtShaderEffectSnow.h:94
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
osg::Vec4 myWindUniform
Definition: DtShaderEffectSnow.h:102
Definition: DtIndirectTextureProcessor.h:40
osg::ref_ptr< osg::Uniform > mySnowUpThresholdUniform
Definition: DtShaderEffectSnow.h:175
SnowEffectGeneration * mySnowEffectGenerationJob
Definition: DtShaderEffectSnow.h:205
DtOsgWeatherEffectsObject * myWeatherEffectsObject
Definition: DtShaderEffectSnow.h:203
Base class to provide boost signal/slot management.
osg::Vec4 myWindUniform
Definition: DtShaderEffectSnow.h:198
int myWindUniformLoc
Definition: DtShaderEffectSnow.h:95
bool mySnowEnabled
Definition: DtShaderEffectSnow.h:184
int myCurLine
Definition: DtShaderEffectSnow.h:96
osg::ref_ptr< osg::Texture2D > mySnowEffectTexture
Definition: DtShaderEffectSnow.h:182
float mySnowElevationRange
Definition: DtShaderEffectSnow.h:188
GLuint64 mySnowEffectImageHandle
Definition: DtShaderEffectSnow.h:181
Contains DLL export macros.
osg::ref_ptr< osg::Uniform > mySnowColorUniform
Definition: DtShaderEffectSnow.h:176
float mySnowElevationMin
Definition: DtShaderEffectSnow.h:187
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
int myOutputTextureUniformLoc
Definition: DtShaderEffectSnow.h:92
double myLastSimulationTime
Definition: DtShaderEffectSnow.h:201
DtShaderEffectSnow & myShaderEffectManager
Definition: DtShaderEffectSnow.h:86
bool myEnableBlowingSnow
Definition: DtShaderEffectSnow.h:193
An OSG implementation of the weather effects object.
Definition: DtOsgWeatherEffectsObject.h:22
osg::Vec4 mySnowColor
Definition: DtShaderEffectSnow.h:195
double myLastWindTime
Definition: DtShaderEffectSnow.h:98
DtShaderEffectSnow injects custom shaders into the scene, Handles snow on the ground causing the grou...
Definition: DtShaderEffectSnow.h:48
float mySnowMaskedRoadRange
Definition: DtShaderEffectSnow.h:191

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)