VR-Forces Developer's Guide
 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) 2025 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <vrvCore/DtKeyedData.h>
17 
20 
21 #include <osg/Camera>
22 #include <osg/View>
23 #include <osg/Drawable>
24 #include <osg/Texture2D>
25 
26 namespace osg
27 {
28  class State;
29 }
30 
31 namespace makVrv
32 {
33  // forward declarations
34  class DtDe;
35  class DtHeightMapManager;
36  class DtTerrainPatchObject;
37  class DtCoordinateSystem;
38 
41 
44 
46  template <>
47  inline const char* creatorTypeName<DtHeightMapManager>(void) { return "DtHeightMapManagerCreator"; }
48 
49 
53  {
54  public:
56  virtual ~DtHeightMapManager();
57 
58  protected:
59  //friend so that it and only it can create the DtHeightMapManagers
61 
63  DtHeightMapManager(DtDe& de, const std::string& name, osg::View*& view);
64 
65  private:
67  DtHeightMapManager() = delete;
69  DtHeightMapManager(const DtHeightMapManager& other) = delete;
71  DtHeightMapManager& operator=(const DtHeightMapManager& other) = delete;
72 
73  public:
74 
76  virtual void setupHeightMap(void);
77 
79  virtual float heightMapResolution() const;
80 
83  virtual void updateHeightCamera(unsigned int frameNum, const osg::Vec3d& currentPosition, osg::State& state);
84 
86  virtual void enableHeightMapCamera(bool enable);
87 
89  virtual bool heightCameraEnabled() const;
90 
92  virtual const osg::Matrix& heightMapMatrix() const;
93 
95  virtual const osg::ref_ptr<osg::Texture2D> heightMapTexture() const;
96 
98  virtual osg::Camera* heightCamera();
99 
101  virtual void postDrawFBOCallback(osg::RenderInfo& renderInfo);
102 
104  virtual bool heightMapChanged(void) const;
105 
107  virtual const osg::View* osgView() const;
108 
112  virtual void notifyOfReleasedObjects();
113 
114  protected:
116  virtual void clearHeightmap();
117 
119  virtual void updateHeightMapMatrix();
120 
122  virtual osg::Matrixd oglRevDepthOrtho(double left, double right,
123  double bottom, double top,
124  double zNear, double zFar);
125 
129  virtual void computeBasis(const osg::Vec3d& inGeocentricPos, osg::Matrixd& rotOut);
130 
136  virtual void computeHeightCameraTransform(double cameraHeight, const osg::Vec3d& axisX, const osg::Vec3d& axisZ);
137 
144  virtual void computeCameraHeightAndEarthRadii(const osg::Vec3d& updatePosition,
145  double& outCameraHeight, osg::Vec3d& outEarthRadii, double& outErrorAdjustment) const;
146 
150  virtual void updateShaderUniforms(const osg::Vec3d& earthRadii, const double errorAdjustment);
151 
154  virtual void slot_oceanHeightMapTextureSizeChanged(int pixels);
155 
157  virtual void slot_oceanHeightMapResolutionChanged(float resolution);
158 
160  virtual void slot_terrainDataChanged(DtTerrainPatchObject& tpo);
161 
163  virtual void slot_wireframeModeChanged();
164 
166  virtual void slot_coordinateSystemChanged();
167 
169  virtual int heightMapTextureSize() const;
170 
172  virtual void slot_preTick();
173 
175  // then it's prepped for update so OSG will update it.
176  virtual void validateHeightMapTexture(unsigned int osgContextID);
177 
178  protected:
179 
183  unsigned int myHeightUpdateFrame;
188 
189  const bool myShadingRateIsSupported; // true if shading rate extension is supported
190 
193  osg::Matrix myHeightMapMatrix;
196 
198 
199  //Doesn't need to be a ref pointer since it is never accessed. Only used to compare to another pointer.
200  osg::View* myOsgView;
201 
204  DtCoordinateSystem* myCoordinateSystem = nullptr;
205 
206  bool myHeightMapChanged = false;
207 
208  const unsigned int myHeightCameraNodeMask;
209 
211  };
212 }
This represents an arbitrary user pointer/data within DtKeyedData.
Definition: DtKeyedData.h:95
Contains makVrv::DtDrawFBOCallback class.
bool myValidateHeightMapTexture
Definition: DtHeightMapManager.h:210
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::Matrixd myHeightReferenceBasis
Definition: DtHeightMapManager.h:181
float myResolution
Definition: DtHeightMapManager.h:185
double myLastUpdateTime
Definition: DtHeightMapManager.h:187
bool myForceUpdate
Definition: DtHeightMapManager.h:184
A DtTerrainPatchObject contains the methods for loading a file as a terrain. When loading a file as a...
Definition: DtTerrainPatchObject.h:35
osg::View * myOsgView
Definition: DtHeightMapManager.h:200
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
osg::Vec3d myLastHeightReferencePos
Definition: DtHeightMapManager.h:180
osg::ref_ptr< osg::Camera > myHeightCamera
Definition: DtHeightMapManager.h:195
friend DtHeightMapManagerCreator
Definition: DtHeightMapManager.h:60
osg::ref_ptr< osg::Texture2D > myDepthTexture
Definition: DtHeightMapManager.h:192
unsigned int myHeightUpdateFrame
Definition: DtHeightMapManager.h:183
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
DtVirtualBaseClassCreator< DtHeightMapManager, const std::string &, osg::View *& > DtHeightMapManagerCreator
creator
Definition: DtHeightMapManager.h:40
int myHeightMapDimension
Definition: DtHeightMapManager.h:194
bool mySavedPerfOverlayOn
Definition: DtHeightMapManager.h:186
osg::ref_ptr< osg::Texture2D > myHeightMap
Definition: DtHeightMapManager.h:191
osg::Matrix myHeightMapMatrix
Definition: DtHeightMapManager.h:193
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
Base class to provide boost signal/slot management.
DtSignalConnectionManager myConnections
Definition: DtHeightMapManager.h:197
A class to manage automatic periodic updating of a height map generated from the database dynamically...
Definition: DtHeightMapManager.h:52
Contains DLL export macros.
const char * creatorTypeName< DtHeightMapManager >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtHeightMapManager.h:47
const unsigned int myHeightCameraNodeMask
Definition: DtHeightMapManager.h:208
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:76
const bool myShadingRateIsSupported
Definition: DtHeightMapManager.h:189
osg::Vec3d myLastHeightUpdatePos
Definition: DtHeightMapManager.h:182
Contains the DtKeyedData class declaration.

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)