VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgWaterRipplesManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2026 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 #include <vrvOsg/DtGpuOperation.h>
14 
16 
18 
21 
22 #include <osg/observer_ptr>
23 #include <osg/ref_ptr>
24 
25 #include <map>
26 #include <vector>
27 
28 namespace osg
29 {
30  class Camera;
31  class State;
32  class StateSet;
33  class Texture;
34  class Vec3d;
35 }
36 
37 namespace makVrv
38 {
39  // Forward declarations.
40  class DtOsgChannel;
41  class DtOsgWaterRipples;
42  class DtOsgWaterRipplesManager;
43  class DtTerrainPatchObject;
44 
45 
46 
57  {
58  public:
59 
62  {
64  : myTerrainPatch(tpo)
65  {
66  // intentional noop
67  }
68 
69  TerrainPatchInfo() = delete;
70 
72  };
73 
76  {
77  public:
78  DtOsgWaterRipples* myWaterRipples = nullptr;
79  bool myEnableInShader = true;
80  };
81 
82  // Inner class for passing the current render info from the main thread.
83  // Calls findTextureAddresses in order to setup the texture addresses as they are
84  // made resident
86  {
87  public:
90  virtual ~TextureAddressOp();
91  public:
93  virtual void execute();
94  protected:
96  };
97 
100  static DtOsgWaterRipplesManager& instance(DtDe& de);
101 
103  static void registerInstance(DtDe& de);
104 
105  public:
106 
107  virtual ~DtOsgWaterRipplesManager();
108 
110  DtOsgWaterRipplesManager(const DtOsgWaterRipplesManager& other) = delete;
111 
113  DtOsgWaterRipplesManager(const DtOsgWaterRipplesManager&& other) = delete;
114 
116  DtOsgWaterRipplesManager& operator=(const DtOsgWaterRipplesManager& other) = delete;
117 
119  DtOsgWaterRipplesManager& operator=(const DtOsgWaterRipplesManager&& other) = delete;
120 
121 
122  public:
123 
125  virtual void releaseGLObjects(osg::State* state);
126 
128  virtual void freePerChannelData();
129 
132  virtual void updateChannel(DtOsgChannel* channel, const osg::Vec3d& cameraPos);
133 
135  virtual void initializeWaterRipples();
136 
138  virtual void updateTextureUniforms();
139 
141  virtual void update();
142 
143  protected:
144 
146  virtual bool shouldShowInChannel(DtOsgChannel* channel) const;
147 
150  virtual DtOsgWaterRipplesManager::TextureAddressOp* createTextureAddressOp();
151 
153  DtOsgWaterRipplesManager::PerChannelData& getOrCreatePerChannelData(osg::Camera* camera);
154 
156  virtual void flushInvalidChannels();
157 
160  virtual void initializePerChannelData();
161 
163  virtual void updateImGui();
164 
166  virtual void updateImGuiPreset(DtWaterRipplesManager::PresetInfo& preset);
167 
169  virtual void onApplyPreset(DtWaterRipplesManager::PresetInfo& preset, bool applyNoiseAndShape);
170 
172  virtual void updateUniforms();
173 
176  virtual int getTextureSizeForIndex(int index) const;
177 
180  virtual int getTextureIndexForSize(int size) const;
181 
183  virtual osg::StateSet* getMapNodeStateSet(DtTerrainPatchObject& tpo) const;
184 
189  static bool presetsDiffer(const DtWaterRipplesManager::PresetInfo& a,
190  const DtWaterRipplesManager::PresetInfo& b, bool& outProceduralChange, bool& outRuntimeChange);
191 
193  virtual void slot_waterRipplesPresetChanged(const makArchives::DtWaterRipplesSettingsRecord::PresetInfo& presetInfo);
194 
197  virtual void slot_terrainPatchCreated(DtTerrainPatchObject& patch);
198 
201  virtual void slot_terrainPatchAboutToBeDeleted(DtTerrainPatchObject& patch);
202 
203  protected:
204 
208 
209  protected:
210 
212 
214 
215  typedef std::map< osg::observer_ptr<osg::Camera>, DtOsgWaterRipplesManager::PerChannelData*> PerChannelDataMap;
217 
218  std::map<DtTerrainPatchObject*, DtOsgWaterRipplesManager::TerrainPatchInfo*> myTerrainPatchMap;
219 
220  std::vector<DtWaterRipplesManager::PresetInfo> myPresets;
221 
222  std::vector<int> myTextureSizes;
223  };
224 
225 }
226 
227 
Definition: DtOsgWaterRipplesManager.h:85
std::vector< DtWaterRipplesManager::PresetInfo > myPresets
Definition: DtOsgWaterRipplesManager.h:220
The DtOsgWaterRipples class provides water ripple effects for water bodies.
Definition: DtOsgWaterRipples.h:65
DtSignalConnectionManager myConnections
Definition: DtOsgWaterRipplesManager.h:211
std::map< DtTerrainPatchObject *, DtOsgWaterRipplesManager::TerrainPatchInfo * > myTerrainPatchMap
Definition: DtOsgWaterRipplesManager.h:218
DtOsgWaterRipplesManager & myManager
Definition: DtOsgWaterRipplesManager.h:95
Abstract base for any operation that runs on the GPU via DtGpuArena.
Definition: DtGpuOperation.h:30
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
voidpf void uLong size
Definition: ioapi.h:39
DtOsgWaterRipplesManager::PerChannelDataMap myPerChannelDataMap
Definition: DtOsgWaterRipplesManager.h:216
std::map< osg::observer_ptr< osg::Camera >, DtOsgWaterRipplesManager::PerChannelData * > PerChannelDataMap
Definition: DtOsgWaterRipplesManager.h:215
Contains makArchives::DtWaterRipplesSettingsRecord class.
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:58
TerrainPatchInfo(DtTerrainPatchObject *tpo)
Definition: DtOsgWaterRipplesManager.h:63
Information about a terrain patch that has water ripples.
Definition: DtOsgWaterRipplesManager.h:61
A DtTerrainPatchObject contains the methods for loading a file as a terrain. When loading a file as a...
Definition: DtTerrainPatchObject.h:35
Contains the DtGpuOperation class declaration.
The DtWaterRipplesManager class provides a manager for managing water ripple effects for water bodies...
Definition: DtWaterRipplesManager.h:29
std::vector< int > myTextureSizes
Definition: DtOsgWaterRipplesManager.h:222
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
Information about a water ripple preset.
Definition: DtWaterRipplesManager.h:34
Definition: DtWaterRipplesSettingsRecord.h:25
Base class to provide boost signal/slot management.
TextureAddressOp * myTextureAddressOp
Definition: DtOsgWaterRipplesManager.h:213
Holds per channel data for water ripples.
Definition: DtOsgWaterRipplesManager.h:75
Contains DLL export macros.
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
DtTerrainPatchObject * myTerrainPatch
Definition: DtOsgWaterRipplesManager.h:71
The DtOsgWaterRipplesManager class provides a manager for managing water ripple effects for water bod...
Definition: DtOsgWaterRipplesManager.h:56
Contains makVrv::DtWaterRipplesManager class.

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)