VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGroundFogGroup.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
14 #include <osg/Group>
15 
19 
22 
23 #include <vrvCore/DtCloudLayer.h>
24 
25 
26 namespace makVrv
27 {
28  // Forward declarations.
29  class DtGroundFogEffectDrawable;
30  class DtGroundFogPatchDrawable;
31  class DtJobSplitter;
32 
33 
47  class DT_DLL_VRVOSG DtGroundFogGroup : public osg::Group
48  {
49  public:
50 
53  {
54  SENSOR_MATERIAL_NONE = 0,
58  SENSOR_MATERIAL_COUNT
59  };
60 
63 
65  DtGroundFogGroup(const DtGroundFogGroup& orig, const osg::CopyOp& opr);
66 
68  virtual ~DtGroundFogGroup();
69 
70  private:
71 
73  DtGroundFogGroup(const DtGroundFogGroup &other);
74 
76  DtGroundFogGroup &operator=(const DtGroundFogGroup &other);
77 
78  public:
79 
81  virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new DtGroundFogGroup(*this, copyop); }
82  virtual osg::Object* cloneType() const { return NULL; }
83 
85  virtual void releaseGroundFogPatchGLObjects(osg::State* state) const;
86 
88  virtual void releaseGroundFogEffectGLObjects(osg::State* state) const;
89 
91  virtual void deleteGeode();
92 
93  // !\brief Gets the sensor node associated with the given material type
94  // !\param matType The material type enumeration.
95  virtual osg::Node* getOrCreateSensorNode(SENSOR_MATERIAL matType);
96 
98  virtual void removeCloudLayer(DtCloudLayerId layerId);
99 
101  virtual void removeCloudLayers();
102 
104  virtual void addGroundFog(DtCloudLayerId layerId, const DtVector& position, float orientation, float cornerRadius,
105  const DtVector& bounds, double density, bool infinite, bool relative, bool altitudeIsHAT);
106 
108  virtual void addPatchyGroundFog(DtCloudLayerId layerId, const DtVector& position, float orientation, float cornerRadius,
109  const DtVector& bounds, double density, bool relative);
110 
112  virtual void addSandstorm(DtCloudLayerId layerId, const DtVector& position, float orientation, float cornerRadius,
113  const DtVector& bounds, double density, bool infinite, bool relative, bool altitudeIsHAT);
114 
118  virtual void setCloudLayerDensity(DtCloudLayerId layerId, float density);
119 
123  virtual void setCloudLayerEnabled(DtCloudLayerId layerId, bool enabled);
124 
126  virtual void setCloudLayerPositionAndOrientation(DtCloudLayerId layerId, const DtVector& position, float orientation);
127 
133  virtual void setCloudLayerBaseColor(DtCloudLayerId layerId, float red, float green, float blue);
134 
138  virtual void setCloudLayerParticleSizeVariation(DtCloudLayerId layerId, float variation);
139 
143  virtual void setCloudLayerPatternedLook(DtCloudLayerId layerId, bool patternedEnable);
144 
148  virtual void setWind(float windDirectionRad, float windSpeedMps);
149 
151  virtual void drawGroundFogPatchAreas(DtGroundFogPatchArea::DrawData& drawData);
152 
154  virtual void drawGroundFogEffects(DtGroundFogEffect::DrawData& drawData);
155 
156  protected:
157 
160  {
162  : myLayerId(0)
163  , myEnabled(true)
164  , myBasisPos(0,0,0)
165  , myCameraBasisDirty(false)
166  , myPosition(0,0,0)
167  , myAltitude(0)
168  , myDensity(0.001f)
169  , myAltitudeBlend(0)
170  , myDensityBlend(0)
171  , myCornerRadius(1)
172  , myBounds(1,1,1)
173  , myBaseColor(1,1,1)
174  {
175  //intentional nop
176  }
177 
179  bool myEnabled;
180  osg::Vec3d myPosition;
181  osg::Vec3d myBasisPos;
182  osg::Matrixd myBasisRot;
183  bool myCameraBasisDirty; // true when transform was set relative to camera
184  float myAltitude;
185  float myDensity;
189  DtVector myBounds; // x = length, y = width, z = thickness
190  osg::Vec3 myBaseColor;
191  };
192 
194  virtual void traverse(osg::NodeVisitor& nv);
195 
197  virtual void disableHeightFog();
198 
201  virtual void cullUpdate(osg::Camera* cam);
202 
205  virtual void cullUpdateHeightFog(osg::Camera* cam);
206 
210  virtual void computeBasis(const osg::Vec3d& inGeocentricPos, osg::Matrixd& rotOut);
211 
215  void setHeightFogTransform(HeightFogItem* item, const DtVector& position, bool relativeToCamera);
216 
217  protected:
218 
220 
221  osg::ref_ptr<osg::Node> mySensorNodes[SENSOR_MATERIAL_COUNT];
222 
226 
230 
231  typedef std::map< int, HeightFogItem > DtHeightFogMap;
233 
234  std::vector<osg::Vec4d> myCullingPlanes;
235 
237 
238  private:
239 
242  osg::Node* getChildNodeByName(osg::Group* parent, const char* name);
243 
245  typedef std::map< DtCloudLayerId, DtGroundFogPatchArea* > DtGroundFogPatchAreaMap;
247  };
248 
251  {
252 
253  public:
254 
256  static DtGroundFogGroupCreator& instance(DtDe& theIG);
257 
259  static void registerInstance(DtDe& theIG, DtGroundFogGroupCreator* anInstance);
260 
262  virtual DtGroundFogGroup* create(DtDe&);
263  };
264 }
265 
266 
float myAltitude
Definition: DtGroundFogGroup.h:184
std::map< DtCloudLayerId, DtGroundFogPatchArea * > DtGroundFogPatchAreaMap
This is mutable because it&#39;s used as part of the const drawImplementation.
Definition: DtGroundFogGroup.h:245
DtVector myBounds
Definition: DtGroundFogGroup.h:189
bool myCameraBasisDirty
Definition: DtGroundFogGroup.h:183
Virtual base class.
Definition: DtVirtualBaseClass.h:22
float myCornerRadius
Definition: DtGroundFogGroup.h:188
A structure used to hold data for drawing.
Definition: DtGroundFogEffect.h:40
Creator that is used to create the ground fog group.
Definition: DtGroundFogGroup.h:250
float myDensityBlend
Definition: DtGroundFogGroup.h:187
osg::Vec3d myPosition
Definition: DtGroundFogGroup.h:180
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::ref_ptr< makVrv::DtGroundFogPatchDrawable > myGroundFogPatchDrawable
Definition: DtGroundFogGroup.h:225
int myLayerId
Definition: DtGroundFogGroup.h:178
Contains makVrv::DtGroundFogPatchArea class.
this class is used to split work up between threads.
Definition: DtJobSplitter.h:64
osg::ref_ptr< makVrv::DtGroundFogEffectDrawable > myEffectDrawable
Definition: DtGroundFogGroup.h:229
osg::ref_ptr< osg::Group > myGroundFogSensorGroup
Definition: DtGroundFogGroup.h:223
virtual osg::Object * cloneType() const
Definition: DtGroundFogGroup.h:82
A structure to hold data for a height fog object.
Definition: DtGroundFogGroup.h:159
Contains makVrv::DtVirtualBaseClass class.
A group node which serves as a root for patchy ground fog areas, and effects in addition to infinite ...
Definition: DtGroundFogGroup.h:47
osg::Vec3d myBasisPos
Definition: DtGroundFogGroup.h:181
SENSOR_MATERIAL
brief Sensor material type enumerations used for sensorfx.
Definition: DtGroundFogGroup.h:52
DtDe & myDe
Definition: DtGroundFogGroup.h:219
bool myEnabled
Definition: DtGroundFogGroup.h:179
float myAltitudeBlend
Definition: DtGroundFogGroup.h:186
Contains vrvCore::DtCloudLayerRecord declaration.
float myDensity
Definition: DtGroundFogGroup.h:185
osg::ref_ptr< osg::Geode > myGroundFogGeode
Definition: DtGroundFogGroup.h:224
Base class to provide boost signal/slot management.
virtual osg::Object * clone(const osg::CopyOp &copyop) const
required functions for derriving from osg::Group
Definition: DtGroundFogGroup.h:81
DtGroundFogPatchAreaMap myMutableGroundFogPatchAreaMap
Definition: DtGroundFogGroup.h:246
std::vector< osg::Vec4d > myCullingPlanes
Definition: DtGroundFogGroup.h:234
long long DtCloudLayerId
Definition: DtCloudLayer.h:26
Contains makVrv::DtGroundFogEffect class.
Contains DLL export macros.
osg::Matrixd myBasisRot
Definition: DtGroundFogGroup.h:182
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtHeightFogMap myHeightFogMap
Definition: DtGroundFogGroup.h:232
Contains the makVrv::DtOsgCullVisitorParameters class.
osg::ref_ptr< osg::Group > myEffectSensorGroup
Definition: DtGroundFogGroup.h:227
HeightFogItem()
Definition: DtGroundFogGroup.h:161
osg::Vec3 myBaseColor
Definition: DtGroundFogGroup.h:190
A structure used to hold data for drawing.
Definition: DtGroundFogPatchArea.h:69
osg::ref_ptr< osg::Geode > myEffectGeode
Definition: DtGroundFogGroup.h:228
std::map< int, HeightFogItem > DtHeightFogMap
Definition: DtGroundFogGroup.h:231
DtJobSplitter * myJobSplitter
Definition: DtGroundFogGroup.h:236

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)