VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtWaterOnScreenEffect.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2014 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvTriton/vrvTriton.h>
13 #include <matrix/vlVector.h>
14 
15 #include <vrvOsg/vrvOsg.h>
16 
17 #include <vrvOsg/DtPostProcessor.h>
18 
20 
21 #include <osg/Texture2D>
22 #include <osg/Image>
23 
24 
25 // The dimension of the grid used to divide the screen into discrete
26 // locations for water drops.
27 #define GRID_DIMENSION 200
28 // The texture size of the normal map used for post processing. This has
29 // a big impact on performance, so don't make it bigger than necessary.
30 // Having it kind of low is also useful for blurring the drops a bit and
31 // giving a cheap depth of field effect on them.
32 #define TEXSIZE 768
33 
34 namespace makVrv
35 {
36  class DropParticle;
37  class RaindropParticle;
38  class SplashParticle;
39  class DtWindow;
40  class DtObserverObject;
41 
46  {
47  public:
49  DtWaterOnScreen(DtDe& de, const std::string& postProcessType, bool handles2D);
50 
52  virtual ~DtWaterOnScreen();
53 
55  void activateRaindrops(bool on);
56 
59  void activateSplashes(bool on);
60 
62  void activateSpray(bool on);
63 
65  void setIsUnderwater(bool underwater);
66 
69  void addRainDrop(float x, float y, float radius);
70 
73  void addOceanSplash(float intensity);
74 
76  void setSplashIntensity(float intensity);
77 
79  void setSprayIntensity(float intensity);
80 
82  virtual void update(DtChannel *channel);
83 
85  int getNumActiveDrops() const;
86 
88  class GridCell
89  {
90  public:
91  GridCell();
92 
93  DropParticle *drop;
95  };
96 
100  void addSplashEffects(const DtObserverObject *observer, bool hasWaveSplashEffect);
101 
105  void addSprayEffects(const DtObserverObject *observer, bool hasOceanSprayEffect);
106 
107  protected:
108  virtual void initialize();
109 
110  void clearNormalMap();
111 
112  void updateAndDrawDrops(double elapsedTime);
113 
114  void addRaindrops(double time, float heading, float observerVelocity);
115 
116  void addSpray(double time, float heading);
117 
118  void clearDrops();
119 
120  void reset();
121 
122  void setActiveStatus();
123 
124  void slot_windowRemoved(DtWindow* window);
125 
126  osg::ref_ptr<osg::Texture2D> myNormalMap;
127  osg::ref_ptr<osg::Image> myNormalImage;
129 
131  double myLastDropEmissionTime, myLastSprayEmissionTime;
132 
133  bool myRaindropsActiveFlag, mySplashesActiveFlag, mySprayActiveFlag;
134  bool myActiveFlag, myUnderwaterFlag;
135 
136  float mySplashIntensity, mySprayIntensity;
137 
139 
141 
142  unsigned char myNormalMapClearData[TEXSIZE*TEXSIZE*4];
144  unsigned char myNormalImageData[TEXSIZE*TEXSIZE*4];
145 
147  };
148 
149  //
150  // Creator
151  //
152 
157  : public DtPostProcessorCreator
158  {
159  public:
162 
165 
167  virtual ~DtWaterOnScreenCreator();
168 
169  protected:
171  virtual DtPostProcessor* create(DtDe& de, const std::string& postProcessType);
172  };
173 }

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)