VR-Forces 4.8 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) 2020 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 
40  {
41  public:
42  // Inner class for generating texture for snow blowing across the ground effect
43  class SnowEffectGeneration : public osg::Operation
44  {
45  public:
47  SnowEffectGeneration(DtShaderEffectSnow& effectManager, DtDe& de);
48 
50  virtual ~SnowEffectGeneration();
51 
52  private:
58  SnowEffectGeneration &operator=(const SnowEffectGeneration&);
59 
60  protected:
61 
63  virtual void operator () (osg::Object* sv);
64 
66  virtual void release();
67 
69  virtual GLuint genComputeProg();
70 
72  virtual void windSpeedChanged(float speed);
73 
75  virtual void windDirectionChanged(float direction);
76  protected:
78 
81 
83 
89  int myCurLine;
90  double myLastSimTime;
93  std::vector<float> myBlowingSnowLine;
94  //x,y wind direction, z wind speed.
95  osg::Vec3 myWindUniform;
96 
98  };
99 
100 
101  public:
103  virtual ~DtShaderEffectSnow();
104 
105  protected:
108 
109  private:
115  DtShaderEffectSnow &operator=(const DtShaderEffectSnow&);
116 
117  public:
120  virtual void initializeEffect(const std::vector<osg::StateSet*>& statesets,
121  DtIndirectTextureProcessor* textureProcessor, DtOsgRenderer& osgRenderer);
122 
124  virtual void releaseGLObjects(osg::State* state);
125 
127  virtual void registerWeatherEffectsObject(DtOsgWeatherEffectsObject* weatherEffectsObject);
128 
130  virtual void reloadShader();
131 
133  virtual void updateImGui();
134 
136  virtual void updateUniforms();
137 
138  public:
140  static DtShaderEffectSnow& instance(DtDe& de);
141 
143  static const std::string& theClassName();
144 
145  protected:
146 
148  virtual void slot_snowAccumulationChanged(double depth);
149 
151  virtual void slot_snowRoadAccumulationChanged(double depth);
152 
154  virtual void slot_snowMinimumElevationChanged(double elevation);
155 
157  virtual void slot_snowElevationTransitionChagned(double elevation);
158 
160  virtual SnowEffectGeneration* createSnowEffectJob();
161 
162  protected:
163 
165 
170 
174 
180 
183 
185 
186  osg::Vec4 mySnowColor;
187 
189 
191 
193  };
194 }
osg::ref_ptr< osg::Uniform > mySnowMaskedRoadUniform
Definition: DtShaderEffectSnow.h:169
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:125
Implementation independent random number generator.
Definition: DtRandomNumberGenerator.h:23
osg::ref_ptr< osg::Uniform > myEnableSnowUniform
Definition: DtShaderEffectSnow.h:166
float mySnowUpThresholdMin
Definition: DtShaderEffectSnow.h:177
DtShaderEffect injects custom shaders into the scenes, There are derrived classes of this for snow an...
Definition: DtShaderEffect.h:34
double myLastSimTime
Definition: DtShaderEffectSnow.h:90
Definition: DtShaderEffectSnow.h:43
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtRandomNumberGenerator myRandomNumberGen
Definition: DtShaderEffectSnow.h:77
unsigned int GLuint
Definition: DtGlTextureBufferObject.h:17
float mySnowUpThresholdRange
Definition: DtShaderEffectSnow.h:176
double myLastDropTime
Definition: DtShaderEffectSnow.h:92
DtSignalConnectionManager mySignals
Definition: DtShaderEffectSnow.h:97
std::vector< float > myBlowingSnowLine
Definition: DtShaderEffectSnow.h:93
DtSignalConnectionManager myConnections
Definition: DtShaderEffectSnow.h:164
DtDe & myDe
Definition: DtShaderEffectSnow.h:80
GLuint mySnowEffectTextureId
Definition: DtShaderEffectSnow.h:171
Contains makVrv::DtShaderEffect class.
DtOsgRenderer & myOsgRenderer
Definition: DtShaderEffectSnow.h:192
bool myClearedLines
Definition: DtShaderEffectSnow.h:84
int mySimTimeUniformLoc
Definition: DtShaderEffectSnow.h:86
Contains makVrv::DtRandomNumberGenerator class.
float mySnowMaskedRoadMax
Definition: DtShaderEffectSnow.h:181
GLuint myComputeId
Definition: DtShaderEffectSnow.h:82
int myBlownSnowTexUniformLoc
Definition: DtShaderEffectSnow.h:87
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:24
osg::Vec3 myWindUniform
Definition: DtShaderEffectSnow.h:95
Definition: DtIndirectTextureProcessor.h:41
osg::ref_ptr< osg::Uniform > mySnowUpThresholdUniform
Definition: DtShaderEffectSnow.h:167
SnowEffectGeneration * mySnowEffectGenerationJob
Definition: DtShaderEffectSnow.h:190
DtOsgWeatherEffectsObject * myWeatherEffectsObject
Definition: DtShaderEffectSnow.h:188
Base class to provide boost signal/slot management.
int myWindUniformLoc
Definition: DtShaderEffectSnow.h:88
bool mySnowEnabled
Definition: DtShaderEffectSnow.h:175
int myCurLine
Definition: DtShaderEffectSnow.h:89
osg::ref_ptr< osg::Texture2D > mySnowEffectTexture
Definition: DtShaderEffectSnow.h:173
float mySnowElevationRange
Definition: DtShaderEffectSnow.h:179
GLuint64 mySnowEffectImageHandle
Definition: DtShaderEffectSnow.h:172
Contains DLL export macros.
osg::ref_ptr< osg::Uniform > mySnowColorUniform
Definition: DtShaderEffectSnow.h:168
float mySnowElevationMin
Definition: DtShaderEffectSnow.h:178
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
int myOutputTextureUniformLoc
Definition: DtShaderEffectSnow.h:85
DtShaderEffectSnow & myShaderEffectManager
Definition: DtShaderEffectSnow.h:79
bool myEnableBlowingSnow
Definition: DtShaderEffectSnow.h:184
An OSG implementation of the weather effects object.
Definition: DtOsgWeatherEffectsObject.h:22
osg::Vec4 mySnowColor
Definition: DtShaderEffectSnow.h:186
double myLastWindTime
Definition: DtShaderEffectSnow.h:91
DtShaderEffectSnow injects custom shaders into the scene, Handles snow on the ground causing the grou...
Definition: DtShaderEffectSnow.h:39
float mySnowMaskedRoadRange
Definition: DtShaderEffectSnow.h:182

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)