VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCloudDrawable.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/DtDe.h>
13 #include <vrvOsg/vrvOsg.h>
14 
17 
18 #include <osg/Camera>
19 #include <osg/Drawable>
20 #include <map>
21 
22 namespace SilverLining
23 {
24  class Atmosphere;
25  class CloudLayer;
26  class ThreadCameraStreamData;
27 }
28 
29 namespace makVrv
30 {
31  class DtSilverliningGroup;
32  class DtGlRenderTexture;
33  class DtChannelManager;
34  class DtChannel;
35  class DtSilverLiningCubeMapManager;
36  class DtIntersector;
37  class DtCoordinateSystem;
38  class DtOsgFrameTextureBlitterManager;
39 
42 
45 
47  template <>
48  inline const char* creatorTypeName<DtCloudDrawable>(void) { return "DtCloudDrawableCreator"; }
49 
52  class DT_DLL_VRVOSG DtCloudDrawable : public osg::Drawable
53  {
54  public:
55 
57 
59  DtCloudDrawable(const DtCloudDrawable& copy, const osg::CopyOp& op);
60 
62  virtual ~DtCloudDrawable();
63  protected:
66  private:
68  DtCloudDrawable& operator=(const DtCloudDrawable& rhs) = delete;
69  public:
71  virtual osg::Object* cloneType() const { return nullptr; }
72  virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new DtCloudDrawable(*this, copyop); }
73 
75  virtual void releaseGLObjects(osg::State* state) const;
76 
78  virtual void slot_channelDestroyed(DtChannelManager* channelManager, DtChannel* channel);
79 
81  virtual unsigned int findCubeMap(const osg::ref_ptr<const osg::Camera> osgCamera) const;
82 
84  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
85 
87  virtual void setGeocentricMode(bool mode);
88 
91  virtual void cleanupCloudLayer(SilverLining::Atmosphere* atmosphere, unsigned int layerHandle);
92 
94  virtual DtSilverLiningCubeMapManager* cubeMapManager();
95  protected:
97  virtual void fadeCloudsWithAltitude(const osg::Vec3d& osgCameraPosition, SilverLining::CloudLayer * layer, SilverLining::ThreadCameraStreamData* tcsData);
98 
100  virtual void fadeCloudsWithAltitude(const osg::Vec3d& osgCameraPosition, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
101 
103  virtual void updateCloudAltitudes(const osg::Vec3d& osgCameraPosition, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
104 
105  //helper functions for setting up the virtual program shaders and uniforms.
106  virtual void updateShader(osg::Node *node, osg::State& state, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData) const;
107  virtual void updateOpenGLState(osg::State &state, SilverLining::Atmosphere* atmosphere, osg::Camera* osgCamera, SilverLining::ThreadCameraStreamData* tcsData) const;
108  virtual void setIsReflectionUniform(const osg::State &state, SilverLining::Atmosphere* atm, bool isReflection, SilverLining::ThreadCameraStreamData* tcsData) const;
109 
111  virtual void connectSingals();
112 
114  virtual void initUniforms();
115 
117  virtual void disconnectSignals();
118 
121  virtual void slot_environmentChanged(const std::string& name);
122 
124  virtual bool computeHeightAboveTerrain(const osg::Vec3d& localPosition, double& heightOfGround) const;
125 
127  virtual void updateCloudLayerAltitudes(SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
128 
130  virtual void updateCubeMap(SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData, const osg::Camera* osgCamera, const osg::Vec3d& osgCameraPosition
131  , osg::State& state);
132 
136  virtual bool updateDepthTextureIfNecessary(osg::RenderInfo& renderInfo,
137  SilverLining::Atmosphere* atmosphere) const;
138 
140  virtual bool anyLayerNeedsDepthTexture(void) const;
141 
143  virtual void unbindDepthTexture(osg::RenderInfo& renderInfo) const;
144 
145  virtual void updateSoftnessAndSmoothCloudsFromImGui() const;
146 
148  virtual void slot_coordinateSystemChanged();
149 
150 
151  protected:
152 
153  //variable for keeping the user shader list around so it can be deleted after new shaders are loaded.
154  mutable std::vector<unsigned int> myUserShaderVector;
155 
158 
160 
161  osg::Vec3d myLastHOTUpdatePos;
163  double myHOT;
164 
168  std::map<SilverLining::CloudLayer *, double> myOriginalAltitudesMap;
169 
180 
181  //cached pointer to stateset for this drawable
183 
184  bool myShadingRateIsSupported; // true if shading rate extension is supported
185 
187  mutable bool myEnableSmoothClouds;
188  mutable float mySmoothCloudsDist;
189  mutable double myLastImGuiSimTime;
190 
192 
194 
195  DtIntersector* myIntersector = nullptr;
196 
199  DtCoordinateSystem* myCoordinateSystem = nullptr;
200 
202 
203  };
204 }
osg::ref_ptr< osg::Uniform > myMutableViewportUniform
Definition: DtCloudDrawable.h:175
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition: DtCloudDrawable.h:72
DtOsgFrameTextureBlitterManager & myFrameTextureBlitterManager
Definition: DtCloudDrawable.h:201
osg::ref_ptr< osg::Uniform > myMutableViewMatrixInverseUniform
Definition: DtCloudDrawable.h:177
DtDe & myDe
Definition: DtCloudDrawable.h:157
std::vector< unsigned int > myUserShaderVector
Definition: DtCloudDrawable.h:154
bool myForceHOTUpdate
Definition: DtCloudDrawable.h:162
DtSilverliningGroup * myParent
Definition: DtCloudDrawable.h:156
A drawable for drawing the cloud layer.
Definition: DtCloudDrawable.h:52
osg::ref_ptr< osg::Uniform > myMutableSoftnessUniform
mutable due to osg drawImplementation limitations. Used to setup uniforms so they the opengl calls ar...
Definition: DtCloudDrawable.h:172
bool mySkipUpdateAltitudes
This flag is used to skip updating the altitude when an environment changed, since the actual change ...
Definition: DtCloudDrawable.h:167
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
DtIntersector is an abstract class that provides the interface for requesting intersections with the ...
Definition: DtIntersector.h:25
osg::ref_ptr< osg::Uniform > myMutableIsStarUniform
Definition: DtCloudDrawable.h:179
double myHOT
Definition: DtCloudDrawable.h:163
DtSignalConnectionManager myConnections
Definition: DtCloudDrawable.h:193
Contains makVrv::DtDe class.
osg::Vec3d myLastHOTUpdatePos
Definition: DtCloudDrawable.h:161
A group node which adds a silver-lining sky and will light all Children with the proper lighting para...
Definition: DtSilverliningGroup.h:82
virtual osg::Object * cloneType() const
required functions for derriving from osg::Drawable
Definition: DtCloudDrawable.h:71
double myLastImGuiSimTime
Definition: DtCloudDrawable.h:189
osg::ref_ptr< osg::Uniform > myMutableIsSunMoonDiskUniform
Definition: DtCloudDrawable.h:178
DtSilverLiningCubeMapManager * myCubeMapManager
Definition: DtCloudDrawable.h:191
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
The abstract Channel Class.
Definition: DtChannel.h:35
friend DtCloudDrawableCreator
Definition: DtCloudDrawable.h:56
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
const char * creatorTypeName< DtCloudDrawable >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtCloudDrawable.h:48
manages cube maps for multiple cameras(windows/views/channels)
Definition: DtSilverLiningCubeMapManager.h:67
DtVirtualBaseClassCreator< DtCloudDrawable, DtSilverliningGroup * > DtCloudDrawableCreator
creator
Definition: DtCloudDrawable.h:41
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:41
osg::ref_ptr< osg::Uniform > myMutableIsReflectionUniform
Definition: DtCloudDrawable.h:176
Base class for handling DtChannels. Derived classes should override the tick() method and advance the...
Definition: DtChannelManager.h:32
Base class to provide boost signal/slot management.
const char int mode
Definition: ioapi.h:38
Contains DLL export macros.
DtOsgFrameTextureBlitterManager responsible for copying depth buffer to render to target...
Definition: DtOsgFrameTextureBlitterManager.h:46
osg::ref_ptr< osg::Uniform > myMutablePersMatrixUniform
Definition: DtCloudDrawable.h:174
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:70
bool myShadingRateIsSupported
Definition: DtCloudDrawable.h:184
float mySmoothCloudsDist
Definition: DtCloudDrawable.h:188
std::map< SilverLining::CloudLayer *, double > myOriginalAltitudesMap
Definition: DtCloudDrawable.h:168
bool myEnableSmoothClouds
mutable due to osg drawImplementation limitations. Used for imgui settings for cloud smoothing...
Definition: DtCloudDrawable.h:187
osg::ref_ptr< osg::StateSet > myStateSet
Definition: DtCloudDrawable.h:182
osg::ref_ptr< osg::Uniform > myMutableInvPersMatrixUniform
Definition: DtCloudDrawable.h:173
Definition: vrfObjectManipulationHandlerBaseClass.h:66
bool myGeocentricFlag
Definition: DtCloudDrawable.h:159

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)