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 
131  virtual void computeHeightCameraTransform(double cameraHeight, const osg::Vec3d& axisX, const osg::Vec3d& axisZ);
132 
139  virtual void computeCameraHeightAndEarthRadii(const osg::Vec3d& updatePosition,
140  double& outCameraHeight, osg::Vec3d& outEarthRadii, double& outErrorAdjustment) const;
141 
145  virtual void updateShaderUniforms(const osg::Vec3d& earthRadii, const double errorAdjustment);
146 
149  virtual void slot_oceanHeightMapTextureSizeChanged(int pixels);
150 
152  virtual void slot_oceanHeightMapResolutionChanged(float resolution);
153 
155  virtual void slot_terrainDataChanged(DtTerrainPatchObject& tpo);
156 
158  virtual void slot_wireframeModeChanged();
159 
161  virtual void slot_coordinateSystemChanged();
162 
164  virtual int heightMapTextureSize() const;
165 
167  virtual void slot_preTick();
168 
170  // then it's prepped for update so OSG will update it.
171  virtual void validateHeightMapTexture(unsigned int osgContextID);
172 
173  protected:
174 
178  unsigned int myHeightUpdateFrame;
183 
184  const bool myShadingRateIsSupported; // true if shading rate extension is supported
185 
188  osg::Matrix myHeightMapMatrix;
191 
193 
194  //Doesn't need to be a ref pointer since it is never accessed. Only used to compare to another pointer.
195  osg::View* myOsgView;
196 
199  DtCoordinateSystem* myCoordinateSystem = nullptr;
200 
201  bool myHeightMapChanged = false;
202 
203  const unsigned int myHeightCameraNodeMask;
204 
206  };
207 }
This represents an arbitrary user pointer/data within DtKeyedData.
Definition: DtKeyedData.h:95
Contains makVrv::DtDrawFBOCallback class.
bool myValidateHeightMapTexture
Definition: DtHeightMapManager.h:205
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::Matrixd myHeightReferenceBasis
Definition: DtHeightMapManager.h:176
float myResolution
Definition: DtHeightMapManager.h:180
double myLastUpdateTime
Definition: DtHeightMapManager.h:182
bool myForceUpdate
Definition: DtHeightMapManager.h:179
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:195
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
osg::Vec3d myLastHeightReferencePos
Definition: DtHeightMapManager.h:175
osg::ref_ptr< osg::Camera > myHeightCamera
Definition: DtHeightMapManager.h:190
friend DtHeightMapManagerCreator
Definition: DtHeightMapManager.h:60
osg::ref_ptr< osg::Texture2D > myDepthTexture
Definition: DtHeightMapManager.h:187
unsigned int myHeightUpdateFrame
Definition: DtHeightMapManager.h:178
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:189
bool mySavedPerfOverlayOn
Definition: DtHeightMapManager.h:181
osg::ref_ptr< osg::Texture2D > myHeightMap
Definition: DtHeightMapManager.h:186
osg::Matrix myHeightMapMatrix
Definition: DtHeightMapManager.h:188
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:192
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:203
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:184
osg::Vec3d myLastHeightUpdatePos
Definition: DtHeightMapManager.h:177
Contains the DtKeyedData class declaration.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)