VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtWaterOnScreenEffect.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * Copyright (c) 2024 MAK Technologies, Inc.
3 * All rights reserved.
4 *****************************************************************************/
5 
6 #pragma once
7 
11 
13 
18 
20 #include <vrvMath/DtVector4.h>
21 
22 #include <matrix/vlVector.h>
23 
24 #include <osg/ref_ptr>
25 
26 namespace makVrv
27 {
28  class DtDropParticle;
29  class DtRaindropParticle;
30  class DtSplashParticle;
31  class DtWindow;
32  class DtObserverObject;
33 
34  class DtGlTexture;
35  class DtGlProgram;
36  class DtGlBuffer;
37 
42  {
43  public:
45  DtWaterOnScreen(DtDe& de, const std::string& postProcessType, bool handles2D);
46 
48  virtual ~DtWaterOnScreen();
49  private:
51  DtWaterOnScreen() = delete;
52 
54  DtWaterOnScreen(const DtWaterOnScreen&) = delete;
55 
57  DtWaterOnScreen& operator=(const DtWaterOnScreen&) = delete;
58  public:
60  virtual void activateRaindrops(bool on);
61 
64  virtual void activateSplashes(bool on);
65 
67  virtual void activateSpray(bool on);
68 
70  virtual void setIsUnderwater(bool underwater);
71 
74  virtual void addRainDrop(float x, float y, float radius);
75 
78  virtual void addOceanSplash(float intensity);
79 
81  virtual void setSplashIntensity(float intensity);
82 
84  virtual void setSprayIntensity(float intensity);
85 
87  virtual bool update(DtChannel *channel);
88 
90  virtual int numActiveDrops() const;
91 
93  virtual void setWaterOnScreenSize(double size);
94 
98  virtual void addSplashEffects(const DtObserverObject *observer, bool hasWaveSplashEffect);
99 
103  virtual void addSprayEffects(const DtObserverObject *observer, bool hasOceanSprayEffect);
104 
108  virtual bool prepForDrawableRender();
109 
110  public:
112  static double waterOnScreenSize();
113 
114  protected:
116  virtual void initialize();
117 
119  virtual void clearNormalMap();
120 
122  virtual void updateDrops(double elapsedTime);
123 
126  virtual bool drawDrops();
127 
130  virtual bool finalizeNormalMap();
131 
133  virtual void addRaindrops(double time, float heading, float observerVelocity, const DtVector& observerLocation);
134 
136  virtual void addSpray(double time, float heading);
137 
139  virtual void clearDrops();
140 
142  virtual void reset();
143 
145  virtual void setActiveStatus();
146 
148  virtual void slot_waterOnScreenSizeChanged(double value);
149 
151  virtual void releaseGLObjects() override;
152 
154  virtual void cleanupGpuMemory(void);
155 
157  virtual void createNormalMapIfNecessary(void);
158 
160  virtual void createNormalMapCombineProgramIfNecessary(void);
161 
163  virtual void createNormalMapFinalizeProgramIfNecessary(void);
164 
166  virtual void initZeroNormals(void);
167 
168  protected:
170  double myLastDropEmissionTime, myLastSprayEmissionTime;
171 
172  bool myRaindropsActiveFlag, mySplashesActiveFlag, mySprayActiveFlag;
173  bool myActiveFlag, myUnderwaterFlag;
174 
175  float mySplashIntensity, mySprayIntensity;
176 
178 
180 
184 
187 
190 
193 
197 
201 
202  struct GridCell
203  {
206  };
207 
210 
213 
215  DtVector4<unsigned int> myZeroNormals[TEXSIZE][TEXSIZE];
216 
218 
221 
222  public:
223  static double theWaterOnScreenSize;
224  };
225 
226  //
227  // Creator
228  //
229 
234  : public DtPostProcessorCreator
235  {
236  public:
238  friend class DtPostProcessManager;
239 
242 
244  virtual ~DtWaterOnScreenCreator();
245 
246  protected:
248  virtual DtPostProcessor* create(DtDe& de, const std::string& postProcessType);
249  };
250 }
double myLastSprayEmissionTime
Definition: DtWaterOnScreenEffect.h:170
DtGlBuffer * myCellsBuffer
The cells&#39; buffer on the gpu (ssbo)
Definition: DtWaterOnScreenEffect.h:212
int myNumActiveDrops
Definition: DtWaterOnScreenEffect.h:177
This class provides an OSG-specific implementation of water drops on the screen.
Definition: DtWaterOnScreenEffect.h:41
Definition: featureContext.h:37
voidpf void uLong size
Definition: ioapi.h:39
DtPostProcessorCreator is the common base class for all post processor creators.
Definition: DtPostProcessor.h:232
DtGlBuffer * myPrecomputedSplashNormalsBuffer
The gpu buffer representing the constant pre-computed splash normals.
Definition: DtWaterOnScreenEffect.h:199
static double theWaterOnScreenSize
Definition: DtWaterOnScreenEffect.h:223
4 dimensional vector
bool myPrecomputedSplashNormalsBufferDirty
Definition: DtWaterOnScreenEffect.h:200
A convenience class to represent an OpenGL Shader Program.
Definition: DtGlProgram.h:66
The abstract Channel Class.
Definition: DtChannel.h:35
bool mySprayActiveFlag
Definition: DtWaterOnScreenEffect.h:172
bool myNormalMapCombineProgramTriedOnce
Definition: DtWaterOnScreenEffect.h:183
osg::ref_ptr< DtWaterOnScreenDrawable > myWaterOnScreenDrawable
Definition: DtWaterOnScreenEffect.h:217
Definition: DtWaterOnScreenEffect.h:202
This abstract base class defines the interface for OS-specific keyboard and mouse event listeners...
Definition: DtObserverObject.h:32
This class provides the OSG-specific management of post-processing effects.
Definition: DtPostProcessManager.h:27
A DtWaterOnScreenCreator instance is registered with the post process element factory to create DtPos...
Definition: DtWaterOnScreenEffect.h:233
DtGlProgram * myNormalMapFinalizeProgram
Definition: DtWaterOnScreenEffect.h:185
bool myNormalMapDirty
Definition: DtWaterOnScreenEffect.h:220
DtGlTexture * myNormalMap
The generated normal map texture.
Definition: DtWaterOnScreenEffect.h:189
#define DT_DLL_VRVPOSTPROCESSOR
Definition: vrvPostProcessor.h:19
Internal struct for one cell of our grid of glass properties.
Definition: DtGridCell.h:19
#define GRID_DIMENSION
Definition: DtWaterOnScreenDefines.h:56
Contains DLL export macros.
bool myUnderwaterFlag
Definition: DtWaterOnScreenEffect.h:173
A generic OpenGL buffer. This can be: -&gt; a vertex buffer -&gt; an index buffer -&gt; a shader storage buffe...
Definition: DtGlBuffer.h:29
Base class to provide boost signal/slot management.
bool myNormalMapFinalizeProgramTriedOnce
Definition: DtWaterOnScreenEffect.h:186
Contains makVrv::DtGridCell struct.
DtGlBuffer * myPrecomputedDropletNormalsBuffer
The gpu buffer representing the constant pre-computed droplet normals.
Definition: DtWaterOnScreenEffect.h:195
Vector4_32 type_intensity_unused
Definition: DtWaterOnScreenEffect.h:205
Vector4_32 x_y_radius_valid
Definition: DtWaterOnScreenEffect.h:204
float mySprayIntensity
Definition: DtWaterOnScreenEffect.h:175
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
Contains makVrv::DtWaterOnScreenDrawable class.
DtGlBuffer * myNormalMapBuffer
The gpu buffer representing the interim normal map (ssbo)
Definition: DtWaterOnScreenEffect.h:192
A helper classes for creating a RTT target, optionally including depth buffer.
Definition: DtGlTexture.h:20
bool myPrecomputedDropletNormalsBufferDirty
Definition: DtWaterOnScreenEffect.h:196
DtGlProgram * myNormalMapCombineProgram
The various normal map mod programs.
Definition: DtWaterOnScreenEffect.h:182
double myLastUpdateTime
Definition: DtWaterOnScreenEffect.h:169
This class provides the OSG-specific implementation of a post processor. A post processor has a type ...
Definition: DtPostProcessor.h:66
bool myDropsStagingDirty
Definition: DtWaterOnScreenEffect.h:219

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)