VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtHeightMapManager.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 
15 
18 
19 #include <osg/Camera>
20 #include <osg/View>
21 #include <osg/Drawable>
22 #include <osg/Texture2D>
23 
24 namespace makVrv
25 {
26  // forward declarations
27  class DtDe;
28  class DtHeightMapManager;
29  class DtTerrainPatchObject;
30 
31 
34  struct DT_DLL_VRVOSG DtDrawableCullHeightMapCallback : public osg::Callback
35  {
36  public:
38  DtDrawableCullHeightMapCallback(osg::View* view);;
39 
40  protected:
43 
44  private:
50  DtDrawableCullHeightMapCallback &operator=(const DtDrawableCullHeightMapCallback &other) = delete;
51 
52  public:
54  virtual bool run(osg::Object* object, osg::Object* data);
55 
56  protected:
57  //Doesn't need to be a ref pointer since it is never accessed. Only used to compare to another pointer.
58  osg::View* myView;
59  };
60 
64  {
65  public:
68 
69  protected:
72 
73  private:
79  DtHeightMapPostDrawFBOCallback &operator=(const DtHeightMapPostDrawFBOCallback &other) = delete;
80 
81  public:
83  virtual void operator () (osg::RenderInfo& renderInfo) const;
84 
85  protected:
88  };
89 
90 
91 
95  {
96  public:
98  virtual ~DtHeightMapManager();
99 
100  protected:
101  //friend so that it and only it can create the DtHeightMapManagers
103 
105  DtHeightMapManager(DtDe& de, osg::View* view);
106 
107  private:
109  DtHeightMapManager() = delete;
111  DtHeightMapManager(const DtHeightMapManager &other) = delete;
113  DtHeightMapManager &operator=(const DtHeightMapManager &other) = delete;
114 
115  public:
116 
118  virtual void setupHeightMap( void );
119 
121  virtual void setHeightMapResolution(float resolution);
122 
124  virtual float heightMapResolution() const;
125 
128  virtual void setHeightMapTextureSize(int pixels);
129 
131  virtual int heightMapTextureSize() const;
132 
135  virtual bool updateHeightCamera(unsigned int frameNum,
136  const osg::Vec3d& currentPosition, bool isGeocentric );
137 
139  virtual void setHeightCameraAttachment(bool enabled);
140 
142  virtual bool heightCameraAttached() const;
143 
145  virtual const osg::Matrix& heightMapMatrix() const;
146 
148  virtual const osg::ref_ptr<osg::Texture2D> heightMapTexture() const;
149 
151  virtual void slot_terrainDataChanged(DtTerrainPatchObject& tpo);
152 
154  virtual void slot_wireframeModeChanged();
155 
157  virtual osg::Camera* heightCamera();
158 
160  virtual void syncHeightMapToGpu(const osg::State* state, const osg::Camera* camera);
161 
163  virtual void postDrawFBOCallback(osg::RenderInfo& renderInfo);
164 
165  protected:
167  virtual void cleanup();
168 
170  virtual void updateHeightMapMatrix();
171 
173  virtual osg::Matrixd oglRevDepthOrtho(double left, double right,
174  double bottom, double top,
175  double zNear, double zFar);
176 
180  virtual void computeBasis(const osg::Vec3d& inGeocentricPos, osg::Matrixd& rotOut);
181 
182  protected:
183 
187  unsigned int myHeightUpdateFrame;
194 
195  bool myShadingRateIsSupported; // true if shading rate extension is supported
196 
199  osg::Matrix myHeightMapMatrix;
203 
205 
207 
208  //Doesn't need to be a ref pointer since it is never accessed. Only used to compare to another pointer.
209  osg::View* myOsgView;
210  };
211 
212 
213 
217  {
218  protected:
221 
223  virtual ~DtHeightMapManagerCreator();
224 
225  private:
229  DtHeightMapManagerCreator &operator=(const DtHeightMapManagerCreator &other) = delete;
230 
231  public:
233  static DtHeightMapManagerCreator& instance(DtDe& de);
234 
236  static void registerInstance(DtDe& de,
237  DtHeightMapManagerCreator* instance);
238 
239  public:
241  virtual DtHeightMapManager* create(DtDe& de, osg::View* view);
242  };
243 
244 
245 
249  {
250  public:
251 
253  static DtHeightMapManagerSignaler& instance(DtDe&);
254 
256  virtual ~DtHeightMapManagerSignaler();
257 
258  private:
261 
263  DtHeightMapManagerSignaler &operator=(const DtHeightMapManagerSignaler &other) = delete;
264 
265  public:
267  boost::signalslib::signal<void(DtHeightMapManager& manager)> signal_heightMapChanged;
268 
270  boost::signalslib::signal<void()> signal_cameraChanged;
271 
273  boost::signalslib::signal<void(DtHeightMapManager& manager, const osg::State* state, const osg::Camera* camera)> signal_syncHeightMapToGpu;
274 
275  protected:
276 
278  };
279 }
The signaler object for the DtHeightMapManager class.
Definition: DtHeightMapManager.h:248
bool myHeightCameraAttached
Definition: DtHeightMapManager.h:188
Contains makVrv::DtDrawFBOCallback class.
Virtual base class.
Definition: DtVirtualBaseClass.h:19
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::Matrixd myHeightReferenceBasis
Definition: DtHeightMapManager.h:185
DtDe & myDe
Definition: DtHeightMapManager.h:204
boost::signalslib::signal< void(DtHeightMapManager &manager, const osg::State *state, const osg::Camera *camera)> signal_syncHeightMapToGpu
emitted when height map should be synced to gpu
Definition: DtHeightMapManager.h:273
float myResolution
Definition: DtHeightMapManager.h:191
boost::signalslib::signal< void(DtHeightMapManager &manager)> signal_heightMapChanged
Emitted when the height map changes.
Definition: DtHeightMapManager.h:267
double myLastUpdateTime
Definition: DtHeightMapManager.h:193
bool myForceUpdate
Definition: DtHeightMapManager.h:190
A DtTerrainPatchObject contains the methods for loading a file as a terrain.
Definition: DtTerrainPatchObject.h:37
osg::View * myOsgView
Definition: DtHeightMapManager.h:209
bool myHeightMapCameraUpdateReady
Definition: DtHeightMapManager.h:189
Contains makVrv::DtVirtualBaseClass class.
osg::Vec3d myLastHeightReferencePos
Definition: DtHeightMapManager.h:184
osg::ref_ptr< osg::Camera > myHeightCamera
Definition: DtHeightMapManager.h:201
bool myShadingRateIsSupported
Definition: DtHeightMapManager.h:195
osg::ref_ptr< osg::Texture2D > myDepthTexture
Definition: DtHeightMapManager.h:198
unsigned int myHeightUpdateFrame
Definition: DtHeightMapManager.h:187
osg::View * myView
Definition: DtHeightMapManager.h:58
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtHeightMapManager creator.
Definition: DtHeightMapManager.h:216
int myHeightMapDimension
Definition: DtHeightMapManager.h:200
DtDe & myDe
Definition: DtHeightMapManager.h:87
DtHeightMapManager * myHeightMapManager
Definition: DtHeightMapManager.h:86
bool mySavedPerfOverlayOn
Definition: DtHeightMapManager.h:192
osg::ref_ptr< osg::Texture2D > myHeightMap
Definition: DtHeightMapManager.h:197
boost::signalslib::signal< void()> signal_cameraChanged
Emitted when an associated camera has changed.
Definition: DtHeightMapManager.h:270
osg::Matrix myHeightMapMatrix
Definition: DtHeightMapManager.h:199
Definition: DtDrawFBOCallback.h:62
Base class to provide boost signal/slot management.
DtSignalConnectionManager myConnections
Definition: DtHeightMapManager.h:206
A class to manage automatic periodic updating of a height map generated from the database dynamically...
Definition: DtHeightMapManager.h:94
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
Cull callback used to prevent the height map camera from rendering anything for any views that are no...
Definition: DtHeightMapManager.h:34
callback which is connected to the post draw callback for the height map camera to setup the height m...
Definition: DtHeightMapManager.h:63
bool myHeightMapUseReverseZ
Definition: DtHeightMapManager.h:202
osg::Vec3d myLastHeightUpdatePos
Definition: DtHeightMapManager.h:186

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)