VR-Forces 4.6.1 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) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #ifndef DtCloudDrawable_H_
11 #define DtCloudDrawable_H_
12 
13 #include <vrvCore/DtDe.h>
14 #include <vrvOsg/vrvOsg.h>
15 #include <osg/Camera>
16 #include <osg/Drawable>
17 #include <map>
18 
19 namespace SilverLining
20 {
21  class Atmosphere;
22  class CloudLayer;
23 }
24 
25 namespace makVrv
26 {
27  class DtSilverliningGroup;
28 
31  class DT_DLL_VRVOSG DtCloudDrawable : public osg::Drawable
32  {
33  public:
34 
37 
39  DtCloudDrawable(const DtCloudDrawable& copy,const osg::CopyOp& op);
40 
42  virtual ~DtCloudDrawable();
43 
45  META_Object(vrvOsg,DtCloudDrawable)
46 
47  virtual void releaseGLObjects(osg::State* state) const;
48 
50  void setCrepuscularRays(bool enabled);
51 
53  void updateCubeMaps(bool fullRegenerate);
54 
56  unsigned int getCubeMap(const osg::ref_ptr<osg::Camera> camera) const;
57 
59  unsigned int getPrimaryCubeMap() const;
60 
62  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
63 
65  void setGeocentricMode(bool mode);
66 
67  protected:
68 
69  void fadeCloudsWithAltitude(double altitudeMSL, SilverLining::CloudLayer * layer);
70  void updateCloudAltitudes(const osg::Vec3d& localPosition, SilverLining::Atmosphere *atm);
71 
72  //helper functions for seting up the virtual program shaders and uniforms.
73  void updateShader(osg::Node *node, osg::State& state, SilverLining::Atmosphere *atm) const;
74  void updateOpenGLState(osg::State &state, SilverLining::Atmosphere *atm, osg::Camera *cam) const;
75  void setIsReflectionUniform(SilverLining::Atmosphere* atm, bool isReflection) const;
76 
78  void connectSingals();
79 
81  virtual void disconnectSignals();
82 
85  virtual void slot_environmentChanged(const std::string& name);
86 
87  //variable for keeping the user shader list around so it can be deleted after new shaders are loaded.
88  mutable std::vector<unsigned int> myUserShaderVector;
89 
92 
95 
96  osg::Vec3d myLastHOTUpdatePos;
98  double myHOT;
99 
103  std::map<SilverLining::CloudLayer *, double> myOriginalAltitudesMap;
104 
105  struct CubeMapData
106  {
107  osg::Vec3d myLastUpdatePos;
108  unsigned int myID;
109  unsigned int myCurrentUpdateFace;
112  };
113  mutable std::map<osg::observer_ptr<osg::Camera>, CubeMapData *> myCubeMapDataMap;
114 
115  mutable unsigned int myMutableLastFrameNum;
116  mutable unsigned int myMutablePrimaryCubeMap;
117 
118  bool computeHeightAboveTerrain(const osg::Vec3d& localPosition, double& heightOfGround);
119  void updateCloudLayerAltitudes(SilverLining::Atmosphere* atm);
120  };
121 }
122 
123 #endif
124 
125 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)