VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtCloudDrawable.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2008 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: DtCloudDrawable.h,v $ $Revision: 1.9 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 #ifndef DtCloudDrawable_H_
14 #define DtCloudDrawable_H_
15 
16 #include <vrvCore/DtDe.h>
17 #include <vrvOsg/vrvOsg.h>
18 #include <osg/Camera>
19 #include <osg/Drawable>
20 #include <map>
21 
22 namespace SilverLining
23 {
24  class Atmosphere;
25  class CloudLayer;
26 }
27 
28 namespace makVrv
29 {
30  class DtSilverliningGroup;
31 
34  class DT_DLL_VRVOSG DtCloudDrawable : public osg::Drawable
35  {
36  public:
37 
40 
42  DtCloudDrawable(const DtCloudDrawable& copy,const osg::CopyOp& op);
43 
45  virtual ~DtCloudDrawable();
46 
48  META_Object(vrvOsg,DtCloudDrawable)
49 
50 
51  void setCrepuscularRays(bool enabled);
52 
54  void updateCubeMaps(bool fullRegenerate);
55 
57  unsigned int getCubeMap(const osg::ref_ptr<osg::Camera> camera) const;
58 
60  unsigned int getPrimaryCubeMap() const;
61 
63  virtual void drawImplementation(osg::RenderInfo& renderInfo) const;
64 
66  void setGeocentricMode(bool mode);
67 
68  protected:
69 
70  void fadeCloudsWithAltitude(double altitudeMSL, SilverLining::Atmosphere *atm);
71  void updateCloudAltitudes(const osg::Vec3d& localPosition, SilverLining::Atmosphere *atm);
72 
73  //helper functions for seting up the virtual program shaders and uniforms.
74  void updateShader(osg::Node *node, osg::State& state, SilverLining::Atmosphere *atm) const;
75  void updateOpenGLState(osg::State &state, SilverLining::Atmosphere *atm, osg::Camera *cam) const;
76  void setIsReflectionUniform(SilverLining::Atmosphere* atm, bool isReflection) const;
77 
78  //variable for keeping the user shader list around so it can be deleted after new shaders are loaded.
79  mutable std::vector<unsigned int> myUserShaderVector;
80 
84 
85  osg::Vec3d myLastHOTUpdatePos;
87  double myHOT;
88 
89  std::map<SilverLining::CloudLayer *, double> myOriginalAltitudesMap;
90 
91  mutable std::map<osg::Camera *, osg::Vec3d> myMutableLastCubeMapUpdateMap;
92  mutable std::map<osg::ref_ptr<osg::Camera>, bool> myMutableNeedsCubeMapFlagMap;
93  mutable std::map<osg::Camera *, unsigned int> myMutableCubeMaps;
94  mutable std::map<osg::Camera *, unsigned int> myMutableCubeMapFaceCount;
95  mutable std::map<osg::Camera *, bool> myMutableNeedsCubeMapFullRegenerationMap;
96 
97  mutable unsigned int myMutableLastFrameNum;
98  mutable unsigned int myMutablePrimaryCubeMap;
99 
100  bool computeHeightAboveTerrain(const osg::Vec3d& localPosition, double& heightOfGround);
101  void updateCloudLayerAltitudes(SilverLining::Atmosphere* atm);
102  };
103 }
104 
105 #endif
106 
107 

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)