VR-Forces 5.0.2 Developer's Guide
 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) 2022 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  class DtIntersector;
37 
55  {
56  friend class DtWeatherAreaFactory;
57 
58  public:
59 
61  virtual ~DtWeatherArea();
62 
64  DtWeatherArea() = delete;
65 
67  DtWeatherArea(const DtWeatherArea &other) = delete;
68 
70  DtWeatherArea &operator=(const DtWeatherArea &other) = delete;
71 
72  protected:
73 
76 
77  public:
80  virtual void setEnabled(bool enabled);
81 
83  virtual bool enabled() const;
84 
88  virtual bool culled() const;
89 
93  virtual void setBounds(const DtVector& bounds, float cornerRadius);
94 
99  virtual void setTransform(const DtVector& position, float orientation, bool relativeToCamera = false);
100 
102  virtual const osg::Vec3d& position() const;
103 
105  virtual const osg::Matrixd& rotation() const;
106 
108  virtual float boundsX() const;
109 
111  virtual float boundsY() const;
112 
114  virtual float boundsZ() const;
115 
117  virtual float boundsCornerRadius() const;
118 
122  virtual const unsigned int* packedData(int& sizeX, int& sizeY) const;
123 
130  virtual void cullUpdate(const osg::Vec3d& camPos,
131  const std::vector<osg::Vec4d>& cullingPlanes, DtJobSplitter* jobSplitter,
132  const osg::Camera* camera);
133 
136  virtual void drawWeatherLayerEffects(DtWeatherEffect::DrawData& drawData);
137 
144  static float computeBoundsDistance2d(const osg::Vec3d& position,
145  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition,
146  const osg::Matrixd& boundsRotation);
147 
154  static float computeBoundsDistance3d(const osg::Vec3d& position,
155  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition,
156  const osg::Matrixd& boundsRotation);
157 
165  static float computeBoundsDistance2dAndTop(const osg::Vec3d& position,
166  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition,
167  const osg::Matrixd& boundsRotation);
168 
172  virtual float computeBoundsDistance2d(const osg::Vec3d& position);
173 
177  virtual float computeBoundsDistance3d(const osg::Vec3d& position);
178 
183  virtual float computeBoundsDistance2dAndTop(const osg::Vec3d& position);
184 
187  virtual void setPrecipitationIntensity(const float intensity);
188 
190  virtual const float precipitationIntensity() const;
191 
194  virtual void setPrecipitationType(const DtSkyObject::PrecipitationType type);
195 
197  virtual const DtSkyObject::PrecipitationType precipitationType() const;
198 
201  virtual void setGroundRainAccumulation(const float depth);
202 
204  virtual const float groundRainAccumulation() const;
205 
208  virtual void setFogColor(const DtVector& color);
209 
211  virtual const DtVector& fogColor() const;
212 
215  virtual void setVisibilityDistance(const float distance);
216 
218  virtual const float visibilityDistance() const;
219 
222  virtual void setOvercast(const float overcast);
223 
225  virtual const float overcast() const;
226 
230  virtual void setGlobalWind(const float windDirectionRad,
231  const float windSpeedMps);
232 
236  virtual void setWind(const float windDirectionRad,
237  const float windSpeedMps);
238 
241  virtual void setLightningEnabled(const bool enabled);
242 
244  virtual const bool lightningEnabled() const;
245 
249  virtual void cloudLayerAdded(DtCloudLayerId layerId, int cloudType);
250 
253  virtual void cloudLayerRemoved(DtCloudLayerId layerId);
254 
260  virtual bool computeLocalPrecipitation(const osg::Vec3d& location,
261  int& type, float& intensity);
262 
268  virtual bool computeLocalGroundRainAccumulation(const osg::Vec3d& location,
269  float& depth, float& blend);
270 
274  virtual void addWeatherLayer(DtWeatherLayer::LayerType layerType);
275 
279  virtual void removeWeatherLayer(DtWeatherLayer::LayerType layerType);
280 
281  protected:
282 
284  virtual void updateTransform();
285 
289  virtual void computeBasis(const osg::Vec3d& inGeocentricPos, osg::Matrixd& rotOut) const;
290 
295  virtual bool clampPositionToTerrain(osg::Vec3d& position, float clampDistance) const;
296 
301  virtual bool isSphereVisible(const std::vector<osg::Vec4d>& planes, const osg::Vec3d& center, double radius) const;
302 
305  virtual bool isPositionBelowSealevel(const DtVector& position) const;
306 
307  protected:
308 
310 
311  bool myEnabled;
312  bool myCulled;
313 
317 
318  osg::Vec3d myPosition; // computed world position
319  osg::Matrixd myRotation; // computed world rotation
320 
321  float myBoundsX;
322  float myBoundsY;
323  float myBoundsZ;
325 
329 
331 
333 
336  float myOvercast;
337 
340 
341  std::vector<DtWeatherLayer*> myWeatherLayers;
342 
343  DtIntersector* myIntersector = nullptr;
344  };
345 
346 
347 
351  {
352  public:
353 
356  enum AreaType
357  {
362  AreaTypeEnvironmental
363  };
364 
367 
369  virtual ~DtWeatherAreaFactory();
370 
372  DtWeatherAreaFactory() = delete;
373 
375  DtWeatherAreaFactory(const DtWeatherAreaFactory &other) = delete;
376 
378  DtWeatherAreaFactory &operator=(const DtWeatherAreaFactory &other) = delete;
379 
382  static DtWeatherAreaFactory& instance(DtDe& de);
383 
385  static const std::string& theClassName();
386 
388  virtual DtWeatherArea* create(AreaType areaType) const;
389 
390  protected:
391 
393  };
394 
395 }
396 
397 
398 
399 
DtSkyObject::PrecipitationType myPrecipitationType
Definition: DtWeatherArea.h:328
AreaType
brief Weather area type enumerations. Used for identifying specific areas.
Definition: DtWeatherArea.h:356
Contains makVrv::DtWeatherLayer class.
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
osg::Vec3d myPosition
Definition: DtWeatherArea.h:318
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtIntersector is an abstract class that provides the interface for requesting intersections with the ...
Definition: DtIntersector.h:25
float myWindSpeedMps
Definition: DtWeatherArea.h:339
DtDe & myDe
Definition: DtWeatherArea.h:392
float myBoundsZ
Definition: DtWeatherArea.h:323
Factory that is used to create weather areas.
Definition: DtWeatherArea.h:350
Contains makVrv::DtDe class.
this class is used to split work up between threads.
Definition: DtJobSplitter.h:64
float myGroundRainAccumulation
Definition: DtWeatherArea.h:330
Definition: DtWeatherArea.h:358
float myBoundsCornerRadius
Definition: DtWeatherArea.h:324
bool myLightningEnabled
Definition: DtWeatherArea.h:332
Contains makVrv::DtSkyObject class.
A structure used to hold data for drawing.
Definition: DtWeatherEffect.h:48
bool myEnabled
Definition: DtWeatherArea.h:311
float myOvercast
Definition: DtWeatherArea.h:336
Contains makVrv::DtVirtualBaseClass class.
osg::Matrixd myRotation
Definition: DtWeatherArea.h:319
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
DtVector myFogColor
Definition: DtWeatherArea.h:334
DtVector mySetPosition
Definition: DtWeatherArea.h:314
float myPrecipitationIntensity
Definition: DtWeatherArea.h:327
bool myCulled
Definition: DtWeatherArea.h:312
float myWindDirectionRad
Definition: DtWeatherArea.h:338
float myVisibilityDistance
Definition: DtWeatherArea.h:335
std::vector< DtWeatherLayer * > myWeatherLayers
Definition: DtWeatherArea.h:341
bool mySetRelativeToCamera
Definition: DtWeatherArea.h:316
long long DtCloudLayerId
Definition: DtCloudLayer.h:26
Contains makVrv::DtUniqueID type.
Contains DLL export macros.
PrecipitationType
Precipitation types.
Definition: DtSkyObject.h:74
DtDe & myDe
Definition: DtWeatherArea.h:309
float mySetOrientation
Definition: DtWeatherArea.h:315
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
float myBoundsX
Definition: DtWeatherArea.h:321
float myBoundsY
Definition: DtWeatherArea.h:322
float myPrecipitationBoundsScale
Definition: DtWeatherArea.h:326
A weather area represents localized environmental conditions such as blowing dust, blowing sand, or blowing snow. The default (base class) weather area is mainly used as a bounds for localized environmental information such as precipitation intensity. AreaTypeBlowingDust, AreaTypeBlowingSand, AreaTypeBlowingSnow are specialized weather areas that represent 1 specific environmental condition.
Definition: DtWeatherArea.h:54
LayerType
brief Layer type enumerations. Layer types help with descibing the layer for tying layer to areas...
Definition: DtWeatherLayer.h:53

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)