VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtShaderEffectManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <vrvOsg/DtGpuOperation.h>
15 
18 
19 #include <string>
20 
21 #include <osg/ref_ptr>
22 #include <osg/Vec3d>
23 #include <osg/Matrixd>
24 #include <osg/OperationThread>
25 #include <osg/Object>
26 #include <osg/State>
27 #include <osg/RenderInfo>
28 
29 namespace makVrv
30 {
31  class DtOsgWeatherEffectsObject;
32  class DtShaderEffect;
33  class DtOsgChannel;
34  class DtOsgRenderer;
35 
41  {
42  protected:
43 
44  typedef std::set<DtShaderEffect*> ShaderEffectSet;
45 
46  public:
47 
50  {
51  public:
52  osg::Vec3d myLocalPostion;
55  };
56 
57  // Inner class for passing the current render info from the main thread.
58  // Calls findTextureAddresses in order to setup the texture addresses as they are
59  // made resident
61  {
62  public:
64  DtTextureAddressOp(DtShaderEffectManager& effectManager, DtDe& de);
65  virtual ~DtTextureAddressOp();
66  public:
68  virtual void execute(void);
69  protected:
71  };
72 
73  public:
75  virtual ~DtShaderEffectManager();
76 
78  DtShaderEffectManager() = delete;
82  DtShaderEffectManager &operator=(const DtShaderEffectManager&) = delete;
83 
84  protected:
87 
88  public:
91  virtual void initializeEffects();
92 
94  virtual void updateTextureUniforms();
95 
97  virtual void update();
98 
100  virtual void updateChannel(DtOsgChannel* channel, osg::Vec3d pos);
101 
103  virtual void registerWeatherEffectsObject(DtOsgWeatherEffectsObject* weatherEffectsObject);
104 
106  virtual void slot_reloadShader();
107 
109  virtual void slot_windSpeedChanged(float metersPerSecond);
110 
112  virtual void slot_windDirectionChanged(float radians);
113 
115  virtual DtOsgWeatherEffectsObject* findWeatherEffectsObject();
116 
118  virtual const DtOsgWeatherEffectsObject* findWeatherEffectsObject() const;
119 
121  virtual void releaseGLObjects(osg::State* state);
122 
124  virtual bool anyEffectDirty(osg::Camera* camera);
125 
131  virtual void installEffectsToCamera(osg::Camera* camera);
132 
133  public:
135  static DtShaderEffectManager& instance(DtDe& de);
136 
138  static const std::string& theClassName();
139 
140  protected:
141 
143  virtual void updateImGui();
144 
146  virtual void updateUniforms();
147 
151  virtual DtShaderEffectPerChannelData& getOrCreatePerChannelData(
152  osg::Camera* camera, bool createShaderEffects);
153 
155  virtual void flushInvalidChannels();
156 
159  virtual void initializeChannelEffects();
160 
162  virtual DtTextureAddressOp* createTextureAddressOp();
163  protected:
164 
166 
168 
170 
171  typedef std::map< osg::observer_ptr<osg::Camera>, DtShaderEffectPerChannelData*> PerChannelDataMap;
173 
176 
178 
179  DtTextureAddressOp* myTextureAddressOp = nullptr;
180 
181  float myWindSpeed;
183  };
184 }
osg::ref_ptr< osg::CoordinateSystemNode > CoordinateSystemNodeRef
Definition: DtShaderEffectManager.h:174
float myWindDirection
Definition: DtShaderEffectManager.h:182
DtOsgWeatherEffectsObject * myWeatherEffectsObject
Definition: DtShaderEffectManager.h:177
The DtOsgRenderer is the component responsible for rendering 3D images onto the screen via OpenSceneG...
Definition: DtOsgRenderer.h:91
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
ShaderEffectSet myShaderEffectSet
Definition: DtShaderEffectManager.h:54
Encapsulate an operation that needs to happen on the gpu This can be anything (transfer, compute, drawing, etc) It is called from DtGpuArena/DtGpuArenaUserData.
Definition: DtGpuOperation.h:20
DtShaderEffectManager & myShaderEffectManager
Definition: DtShaderEffectManager.h:70
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtShaderEffectManager injects custom shaders into the scenes, uses DtShaderEffect objects to add rend...
Definition: DtShaderEffectManager.h:40
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:58
osg::Vec3d myLocalPostion
Definition: DtShaderEffectManager.h:52
float myWindSpeed
Definition: DtShaderEffectManager.h:181
Contains the DtGpuOperation class declaration.
Contains makVrv::DtVirtualBaseClass class.
DtDe & myDe
Definition: DtShaderEffectManager.h:165
std::set< DtShaderEffect * > ShaderEffectSet
Definition: DtShaderEffectManager.h:44
CoordinateSystemNodeRef myCoordSystemNode
Definition: DtShaderEffectManager.h:175
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
Structure for holding per channel data for the effects.
Definition: DtShaderEffectManager.h:49
osg::Matrixd myLocalMatrixTranformInverse
Definition: DtShaderEffectManager.h:53
Base class to provide boost signal/slot management.
std::map< osg::observer_ptr< osg::Camera >, DtShaderEffectPerChannelData * > PerChannelDataMap
Definition: DtShaderEffectManager.h:171
DtSignalConnectionManager myConnections
Definition: DtShaderEffectManager.h:167
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
Definition: DtShaderEffectManager.h:60
DtOsgRenderer & myOsgRenderer
Definition: DtShaderEffectManager.h:169
PerChannelDataMap myPerChannelDataMap
Definition: DtShaderEffectManager.h:172
An OSG implementation of the weather effects object.
Definition: DtOsgWeatherEffectsObject.h:22

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)