VR-Forces 5.0.2 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 slot_channelDestroyed(DtChannelManager* channelManager, DtChannel* channel);
76 
78  virtual unsigned int findCubeMap(const osg::ref_ptr<const osg::Camera> osgCamera) const;
79 
81  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
82 
84  virtual void setGeocentricMode(bool mode);
85 
88  virtual void cleanupCloudLayer(SilverLining::Atmosphere* atmosphere, unsigned int layerHandle);
89 
91  virtual DtSilverLiningCubeMapManager* cubeMapManager();
92  protected:
94  virtual void fadeCloudsWithAltitude(const osg::Vec3d& osgCameraPosition, SilverLining::CloudLayer * layer, SilverLining::ThreadCameraStreamData* tcsData);
95 
97  virtual void fadeCloudsWithAltitude(const osg::Vec3d& osgCameraPosition, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
98 
100  virtual void updateCloudAltitudes(const osg::Vec3d& osgCameraPosition, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
101 
102  //helper functions for setting up the virtual program shaders and uniforms.
103  virtual void updateShader(osg::Node *node, osg::State& state, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData) const;
104  virtual void updateOpenGLState(osg::State &state, SilverLining::Atmosphere* atmosphere, osg::Camera* osgCamera, SilverLining::ThreadCameraStreamData* tcsData) const;
105  virtual void setIsReflectionUniform(const osg::State &state, SilverLining::Atmosphere* atm, bool isReflection, SilverLining::ThreadCameraStreamData* tcsData) const;
106 
108  virtual void connectSingals();
109 
111  virtual void initUniforms();
112 
114  virtual void disconnectSignals();
115 
118  virtual void slot_environmentChanged(const std::string& name);
119 
121  virtual bool computeHeightAboveTerrain(const osg::Vec3d& localPosition, double& heightOfGround) const;
122 
124  virtual void updateCloudLayerAltitudes(SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
125 
127  virtual void updateCubeMap(SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData, const osg::Camera* osgCamera, const osg::Vec3d& osgCameraPosition
128  , osg::State& state);
129 
133  virtual bool updateDepthTextureIfNecessary(osg::RenderInfo& renderInfo,
134  SilverLining::Atmosphere* atmosphere) const;
135 
137  virtual bool anyLayerNeedsDepthTexture(void) const;
138 
140  virtual void unbindDepthTexture(osg::RenderInfo& renderInfo) const;
141 
142  virtual void updateSoftnessAndSmoothCloudsFromImGui() const;
143 
145  virtual void slot_coordinateSystemChanged();
146 
147 
148  protected:
149 
150  //variable for keeping the user shader list around so it can be deleted after new shaders are loaded.
151  mutable std::vector<unsigned int> myUserShaderVector;
152 
155 
157 
158  osg::Vec3d myLastHOTUpdatePos;
160  double myHOT;
161 
165  std::map<SilverLining::CloudLayer *, double> myOriginalAltitudesMap;
166 
177 
178  //cached pointer to stateset for this drawable
180 
181  bool myShadingRateIsSupported; // true if shading rate extension is supported
182 
184  mutable bool myEnableSmoothClouds;
185  mutable float mySmoothCloudsDist;
186  mutable double myLastImGuiSimTime;
187 
189 
191 
192  DtIntersector* myIntersector = nullptr;
193 
196  DtCoordinateSystem* myCoordinateSystem = nullptr;
197 
199 
200  };
201 }
osg::ref_ptr< osg::Uniform > myMutableViewportUniform
Definition: DtCloudDrawable.h:172
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition: DtCloudDrawable.h:72
DtOsgFrameTextureBlitterManager & myFrameTextureBlitterManager
Definition: DtCloudDrawable.h:198
osg::ref_ptr< osg::Uniform > myMutableViewMatrixInverseUniform
Definition: DtCloudDrawable.h:174
DtDe & myDe
Definition: DtCloudDrawable.h:154
std::vector< unsigned int > myUserShaderVector
Definition: DtCloudDrawable.h:151
bool myForceHOTUpdate
Definition: DtCloudDrawable.h:159
DtSilverliningGroup * myParent
Definition: DtCloudDrawable.h:153
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:169
bool mySkipUpdateAltitudes
This flag is used to skip updating the altitude when an environment changed, since the actual change ...
Definition: DtCloudDrawable.h:164
#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:176
double myHOT
Definition: DtCloudDrawable.h:160
DtSignalConnectionManager myConnections
Definition: DtCloudDrawable.h:190
Contains makVrv::DtDe class.
osg::Vec3d myLastHOTUpdatePos
Definition: DtCloudDrawable.h:158
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:186
osg::ref_ptr< osg::Uniform > myMutableIsSunMoonDiskUniform
Definition: DtCloudDrawable.h:175
DtSilverLiningCubeMapManager * myCubeMapManager
Definition: DtCloudDrawable.h:188
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:68
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:40
osg::ref_ptr< osg::Uniform > myMutableIsReflectionUniform
Definition: DtCloudDrawable.h:173
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:171
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:181
float mySmoothCloudsDist
Definition: DtCloudDrawable.h:185
std::map< SilverLining::CloudLayer *, double > myOriginalAltitudesMap
Definition: DtCloudDrawable.h:165
bool myEnableSmoothClouds
mutable due to osg drawImplementation limitations. Used for imgui settings for cloud smoothing...
Definition: DtCloudDrawable.h:184
osg::ref_ptr< osg::StateSet > myStateSet
Definition: DtCloudDrawable.h:179
osg::ref_ptr< osg::Uniform > myMutableInvPersMatrixUniform
Definition: DtCloudDrawable.h:170
Definition: vrfObjectManipulationHandlerBaseClass.h:66
bool myGeocentricFlag
Definition: DtCloudDrawable.h:156

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)