VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtWeatherArea.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/DtUniqueID.h>
13 #include <vrvCore/DtDe.h>
14 #include <vrvCore/DtSkyObject.h>
15 
16 #include <vrvOsg/vrvOsg.h>
17 #include <vrvOsg/DtWeatherLayer.h>
18 
20 
21 #include <matrix/vlVector.h>
22 
23 #include <osg/Matrixd>
24 #include <osg/Vec3d>
25 #include <osg/Vec4d>
26 
27 #include <boost/unordered_map.hpp>
28 #include <vector>
29 
30 
31 namespace makVrv
32 {
33  // Forward declarations.
34  class DtJobSplitter;
35  class DtWeatherAreaCreator;
36 
54  {
55  friend class DtWeatherAreaFactory;
56 
57  public:
58 
60  virtual ~DtWeatherArea();
61 
63  DtWeatherArea() = delete;
64 
66  DtWeatherArea(const DtWeatherArea &other) = delete;
67 
69  DtWeatherArea &operator=(const DtWeatherArea &other) = delete;
70 
71  protected:
72 
75 
76  public:
79  virtual void setEnabled(bool enabled);
80 
82  virtual bool enabled() const;
83 
87  virtual bool culled() const;
88 
92  virtual void setBounds(const DtVector& bounds, float cornerRadius);
93 
98  virtual void setTransform(const DtVector& position, float orientation, bool relativeToCamera = false);
99 
101  virtual const osg::Vec3d& position() const;
102 
104  virtual const osg::Matrixd& rotation() const;
105 
107  virtual float boundsX() const;
108 
110  virtual float boundsY() const;
111 
113  virtual float boundsZ() const;
114 
116  virtual float boundsCornerRadius() const;
117 
121  virtual const unsigned int* packedData(int& sizeX, int& sizeY) const;
122 
126  virtual void cullUpdate(const osg::Vec3d& camPos, const osg::Matrixd& viewMatrixI,
127  const std::vector<osg::Vec4d>& cullingPlanes, DtJobSplitter* jobSplitter) {}
128 
135  static float computeBoundsDistance2D(const osg::Vec3d& position,
136  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition, const osg::Matrixd& boundsRotation);
137 
144  static float computeBoundsDistance3D(const osg::Vec3d& position,
145  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition, const osg::Matrixd& boundsRotation);
146 
150  virtual float computeBoundsDistance2D(const osg::Vec3d& position);
151 
155  virtual float computeBoundsDistance3D(const osg::Vec3d& position);
156 
159  virtual bool usesWeatherLayerType(DtWeatherLayer::LayerType layerType) const;
160 
163  virtual void setPrecipitationIntensity(const float intensity);
164 
166  virtual const float precipitationIntensity() const;
167 
170  virtual void setPrecipitationType(const DtSkyObject::PrecipitationType type);
171 
173  virtual const DtSkyObject::PrecipitationType precipitationType() const;
174 
177  virtual void setGroundRainAccumulation(const float depth);
178 
180  virtual const float groundRainAccumulation() const;
181 
184  virtual void setFogColor(const DtVector& color);
185 
187  virtual const DtVector& fogColor() const;
188 
191  virtual void setVisibilityDistance(const float distance);
192 
194  virtual const float visibilityDistance() const;
195 
198  virtual void setOvercast(const float overcast);
199 
201  virtual const float overcast() const;
202 
206  virtual void setWind(const float windDirectionRad, const float windSpeedMps);
207 
210  virtual void setLightningEnabled(const bool enabled);
211 
213  virtual const bool lightningEnabled() const;
214 
220  virtual bool computeLocalPrecipitation(const osg::Vec3d& location,
221  int& type, float& intensity);
222 
228  virtual bool computeLocalGroundRainAccumulation(const osg::Vec3d& location,
229  float& depth, float& blend);
230 
231  protected:
232 
234  virtual void updateTransform();
235 
239  virtual void computeBasis(const osg::Vec3d& inGeocentricPos, osg::Matrixd& rotOut) const;
240 
245  virtual bool clampPositionToTerrain(osg::Vec3d& position, float clampDistance) const;
246 
251  virtual bool isSphereVisible(const std::vector<osg::Vec4d>& planes, const osg::Vec3d& center, double radius) const;
252 
253  protected:
254 
256 
257  bool myEnabled;
258  bool myCulled;
259 
263 
264  osg::Vec3d myPosition; // computed world position
265  osg::Matrixd myRotation; // computed world rotation
266 
267  float myBoundsX;
268  float myBoundsY;
269  float myBoundsZ;
271 
275 
277 
279 
282  float myOvercast;
283 
286  };
287 
288 
289 
293  {
294  public:
295 
298  enum AreaType
299  {
304  AreaTypeEnvironmental
305  };
306 
309 
311  virtual ~DtWeatherAreaFactory();
312 
314  DtWeatherAreaFactory() = delete;
315 
317  DtWeatherAreaFactory(const DtWeatherAreaFactory &other) = delete;
318 
320  DtWeatherAreaFactory &operator=(const DtWeatherAreaFactory &other) = delete;
321 
324  static DtWeatherAreaFactory& instance(DtDe& de);
325 
327  static const std::string& theClassName();
328 
330  virtual DtWeatherArea* create(AreaType areaType) const;
331 
332  protected:
333 
335  };
336 
337 }
338 
339 
340 
341 
DtSkyObject::PrecipitationType myPrecipitationType
Definition: DtWeatherArea.h:274
AreaType
brief Weather area type enumerations.
Definition: DtWeatherArea.h:298
Contains makVrv::DtWeatherLayer class.
Virtual base class.
Definition: DtVirtualBaseClass.h:19
osg::Vec3d myPosition
Definition: DtWeatherArea.h:264
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
float myWindSpeedMps
Definition: DtWeatherArea.h:285
DtDe & myDe
Definition: DtWeatherArea.h:334
float myBoundsZ
Definition: DtWeatherArea.h:269
Factory that is used to create weather areas.
Definition: DtWeatherArea.h:292
Contains makVrv::DtDe class.
this class is used to split work up between threads.
Definition: DtJobSplitter.h:64
float myGroundRainAccumulation
Definition: DtWeatherArea.h:276
Definition: DtWeatherArea.h:300
virtual void cullUpdate(const osg::Vec3d &camPos, const osg::Matrixd &viewMatrixI, const std::vector< osg::Vec4d > &cullingPlanes, DtJobSplitter *jobSplitter)
Culls the area based on the current camera.
Definition: DtWeatherArea.h:126
float myBoundsCornerRadius
Definition: DtWeatherArea.h:270
bool myLightningEnabled
Definition: DtWeatherArea.h:278
Contains makVrv::DtSkyObject class.
bool myEnabled
Definition: DtWeatherArea.h:257
float myOvercast
Definition: DtWeatherArea.h:282
Contains makVrv::DtVirtualBaseClass class.
osg::Matrixd myRotation
Definition: DtWeatherArea.h:265
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points.
DtVector myFogColor
Definition: DtWeatherArea.h:280
DtVector mySetPosition
Definition: DtWeatherArea.h:260
float myPrecipitationIntensity
Definition: DtWeatherArea.h:273
bool myCulled
Definition: DtWeatherArea.h:258
float myWindDirectionRad
Definition: DtWeatherArea.h:284
float myVisibilityDistance
Definition: DtWeatherArea.h:281
bool mySetRelativeToCamera
Definition: DtWeatherArea.h:262
Contains makVrv::DtUniqueID type.
Contains DLL export macros.
PrecipitationType
Precipitation types.
Definition: DtSkyObject.h:74
DtDe & myDe
Definition: DtWeatherArea.h:255
float mySetOrientation
Definition: DtWeatherArea.h:261
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
float myBoundsX
Definition: DtWeatherArea.h:267
float myBoundsY
Definition: DtWeatherArea.h:268
float myPrecipitationBoundsScale
Definition: DtWeatherArea.h:272
A weather area represents localized environmental conditions such as blowing dust, blowing sand, or blowing snow.
Definition: DtWeatherArea.h:53
LayerType
brief Layer type enumerations.
Definition: DtWeatherLayer.h:49

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)