VR-Forces 4.10 Class Documentation
 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) 2021 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 
39 
42 
44  template <>
45  inline const char* creatorTypeName<DtCloudDrawable>(void) { return "DtCloudDrawableCreator"; }
46 
49  class DT_DLL_VRVOSG DtCloudDrawable : public osg::Drawable
50  {
51  public:
52 
54 
56  DtCloudDrawable(const DtCloudDrawable& copy, const osg::CopyOp& op);
57 
59  virtual ~DtCloudDrawable();
60  protected:
63  private:
65  DtCloudDrawable& operator=(const DtCloudDrawable& rhs) = delete;
66  public:
68  virtual osg::Object* cloneType() const { return nullptr; }
69  virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new DtCloudDrawable(*this, copyop); }
70 
72  virtual void releaseGLObjects(osg::State* state) const;
73 
75  virtual void slot_channelDestroyed(DtChannelManager* channelManager, DtChannel* channel);
76 
78  virtual void updateCubeMaps(bool fullRegenerate);
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 
93  protected:
95  virtual void fadeCloudsWithAltitude(const osg::Vec3d& osgCameraPosition, SilverLining::CloudLayer * layer, SilverLining::ThreadCameraStreamData* tcsData);
96 
98  virtual void fadeCloudsWithAltitude(const osg::Vec3d& osgCameraPosition, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
99 
101  virtual void updateCloudAltitudes(const osg::Vec3d& osgCameraPosition, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
102 
103  //helper functions for setting up the virtual program shaders and uniforms.
104  virtual void updateShader(osg::Node *node, osg::State& state, SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData) const;
105  virtual void updateOpenGLState(osg::State &state, SilverLining::Atmosphere* atmosphere, osg::Camera* osgCamera, SilverLining::ThreadCameraStreamData* tcsData) const;
106  virtual void setIsReflectionUniform(osg::State &state, SilverLining::Atmosphere* atm, bool isReflection, SilverLining::ThreadCameraStreamData* tcsData) const;
107 
109  virtual void connectSingals();
110 
112  virtual void initUniforms();
113 
115  virtual void disconnectSignals();
116 
119  virtual void slot_environmentChanged(const std::string& name);
120 
121  virtual bool computeHeightAboveTerrain(const osg::Vec3d& localPosition, double& heightOfGround) const;
122 
123  virtual void updateCloudLayerAltitudes(SilverLining::Atmosphere* atmosphere, SilverLining::ThreadCameraStreamData* tcsData);
124 
127  virtual void updateDepthTexture(osg::RenderInfo& renderInfo) const;
128 
130  virtual void unbindDepthTexture(osg::RenderInfo& renderInfo) const;
131 
132  virtual void updateSoftnessAndSmoothCloudsFromImGui() const;
133 
134  protected:
135 
136  //variable for keeping the user shader list around so it can be deleted after new shaders are loaded.
137  mutable std::vector<unsigned int> myUserShaderVector;
138 
141 
143 
144  osg::Vec3d myLastHOTUpdatePos;
146  double myHOT;
147 
151  std::map<SilverLining::CloudLayer *, double> myOriginalAltitudesMap;
152 
163 
164  //cached pointer to stateset for this drawable
166 
167  bool myShadingRateIsSupported; // true if shading rate extension is supported
168 
170  mutable bool myEnableSmoothClouds;
171  mutable float mySmoothCloudsDist;
172  mutable double myLastImGuiSimTime;
173 
175 
177  };
178 }
osg::ref_ptr< osg::Uniform > myMutableViewportUniform
Definition: DtCloudDrawable.h:158
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Definition: DtCloudDrawable.h:69
osg::ref_ptr< osg::Uniform > myMutableViewMatrixInverseUniform
Definition: DtCloudDrawable.h:160
DtDe & myDe
Definition: DtCloudDrawable.h:140
std::vector< unsigned int > myUserShaderVector
Definition: DtCloudDrawable.h:137
bool myForceHOTUpdate
Definition: DtCloudDrawable.h:145
DtSilverliningGroup * myParent
Definition: DtCloudDrawable.h:139
A drawable for drawing the cloud layer.
Definition: DtCloudDrawable.h:49
osg::ref_ptr< osg::Uniform > myMutableSoftnessUniform
mutable due to osg drawImplementation limitations.
Definition: DtCloudDrawable.h:155
bool mySkipUpdateAltitudes
This flag is used to skip updating the altitude when an environmented changed, since the actual chang...
Definition: DtCloudDrawable.h:150
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
osg::ref_ptr< osg::Uniform > myMutableIsStarUniform
Definition: DtCloudDrawable.h:162
double myHOT
Definition: DtCloudDrawable.h:146
DtSignalConnectionManager myConnections
Definition: DtCloudDrawable.h:176
Contains makVrv::DtDe class.
osg::Vec3d myLastHOTUpdatePos
Definition: DtCloudDrawable.h:144
A group node which adds a silver-lining sky and will light all Children with the proper lighting para...
Definition: DtSilverliningGroup.h:79
virtual osg::Object * cloneType() const
required functions for derriving from osg::Drawable
Definition: DtCloudDrawable.h:68
double myLastImGuiSimTime
Definition: DtCloudDrawable.h:172
osg::ref_ptr< osg::Uniform > myMutableIsSunMoonDiskUniform
Definition: DtCloudDrawable.h:161
DtSilverLiningCubeMapManager * myCubeMapManager
Definition: DtCloudDrawable.h:174
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
The abstract Channel Class.
Definition: DtChannel.h:30
friend DtCloudDrawableCreator
Definition: DtCloudDrawable.h:53
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:45
manages cube maps for multiple cameras(windows/views/channels)
Definition: DtSilverLiningCubeMapManager.h:51
DtVirtualBaseClassCreator< DtCloudDrawable, DtSilverliningGroup * > DtCloudDrawableCreator
creator
Definition: DtCloudDrawable.h:38
osg::ref_ptr< osg::Uniform > myMutableIsReflectionUniform
Definition: DtCloudDrawable.h:159
Base class for handling DtChannels.
Definition: DtChannelManager.h:32
Base class to provide boost signal/slot management.
const char int mode
Definition: ioapi.h:38
Contains DLL export macros.
osg::ref_ptr< osg::Uniform > myMutablePersMatrixUniform
Definition: DtCloudDrawable.h:157
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
bool myShadingRateIsSupported
Definition: DtCloudDrawable.h:167
float mySmoothCloudsDist
Definition: DtCloudDrawable.h:171
std::map< SilverLining::CloudLayer *, double > myOriginalAltitudesMap
Definition: DtCloudDrawable.h:151
bool myEnableSmoothClouds
mutable due to osg drawImplementation limitations. Used for imgui settings for cloud smoothing...
Definition: DtCloudDrawable.h:170
osg::ref_ptr< osg::StateSet > myStateSet
Definition: DtCloudDrawable.h:165
osg::ref_ptr< osg::Uniform > myMutableInvPersMatrixUniform
Definition: DtCloudDrawable.h:156
Definition: vrfObjectManipulationHandlerBaseClass.h:65
bool myGeocentricFlag
Definition: DtCloudDrawable.h:142

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)