VR-Forces 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) 2026 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 
17 
18 #include <vrvOsg/vrvOsg.h>
19 #include <vrvOsg/DtWeatherLayer.h>
20 
22 
23 #include <matrix/vlVector.h>
24 
25 #include <osg/Matrixd>
26 #include <osg/Vec3d>
27 #include <osg/Vec4d>
28 
29 #include <boost/unordered_map.hpp>
30 #include <vector>
31 
32 
33 namespace makVrv
34 {
35  // Forward declarations.
36  class DtJobSplitter;
37  class DtWeatherAreaCreator;
38  class DtIntersector;
39 
57  {
58  friend class DtWeatherAreaFactory;
59 
60  public:
61 
63  virtual ~DtWeatherArea();
64 
66  DtWeatherArea() = delete;
67 
69  DtWeatherArea(const DtWeatherArea &other) = delete;
70 
72  DtWeatherArea &operator=(const DtWeatherArea &other) = delete;
73 
74  protected:
75 
78 
79  public:
82  virtual void setEnabled(bool enabled);
83 
85  virtual bool enabled() const;
86 
90  virtual bool culled() const;
91 
95  virtual void setBounds(const DtVector& bounds, float cornerRadius);
96 
101  virtual void setTransform(const DtVector& position, float orientation, bool relativeToCamera = false);
102 
104  virtual const osg::Vec3d& position() const;
105 
107  virtual const osg::Matrixd& rotation() const;
108 
110  virtual float boundsX() const;
111 
113  virtual float boundsY() const;
114 
116  virtual float boundsZ() const;
117 
119  virtual float boundsCornerRadius() const;
120 
124  virtual const unsigned int* packedData(int& sizeX, int& sizeY) const;
125 
132  virtual void cullUpdate(const osg::Vec3d& camPos,
133  const Frustum_64& frustum, DtJobSplitter* jobSplitter,
134  const osg::Camera* camera);
135 
138  virtual void drawWeatherLayerEffects(DtWeatherEffect::DrawData& drawData);
139 
146  static float computeBoundsDistance2d(const osg::Vec3d& position,
147  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition,
148  const osg::Matrixd& boundsRotation);
149 
156  static float computeBoundsDistance3d(const osg::Vec3d& position,
157  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition,
158  const osg::Matrixd& boundsRotation);
159 
167  static float computeBoundsDistance2dAndTop(const osg::Vec3d& position,
168  const osg::Vec4d& bounds, const osg::Vec3d& boundsPosition,
169  const osg::Matrixd& boundsRotation);
170 
175  virtual float computeBoundsDistance2d(const osg::Vec3d& position, float boundsScale) const;
176 
180  virtual float computeBoundsDistance3d(const osg::Vec3d& position) const;
181 
186  virtual float computeBoundsDistance2dAndTop(const osg::Vec3d& position) const;
187 
190  virtual void setPrecipitationIntensity(const float intensity);
191 
193  virtual const float precipitationIntensity() const;
194 
197  virtual void setPrecipitationType(const DtSkyObject::PrecipitationType type);
198 
200  virtual const DtSkyObject::PrecipitationType precipitationType() const;
201 
204  virtual void setGroundRainAccumulation(const float depth);
205 
207  virtual const float groundRainAccumulation() const;
208 
211  virtual void setFogColor(const DtVector& color);
212 
214  virtual const DtVector& fogColor() const;
215 
218  virtual void setVisibilityDistance(const float distance);
219 
221  virtual const float visibilityDistance() const;
222 
225  virtual void setOvercast(const float overcast);
226 
228  virtual const float overcast() const;
229 
233  virtual void setGlobalWind(const float windDirectionRad,
234  const float windSpeedMps);
235 
239  virtual void setWind(const float windDirectionRad,
240  const float windSpeedMps);
241 
244  virtual void setLightningEnabled(const bool enabled);
245 
247  virtual const bool lightningEnabled() const;
248 
252  virtual void cloudLayerAdded(DtCloudLayerId layerId, int cloudType);
253 
256  virtual void cloudLayerRemoved(DtCloudLayerId layerId);
257 
263  virtual bool computeLocalPrecipitation(const osg::Vec3d& location,
264  int& type, float& intensity);
265 
271  virtual bool computeLocalGroundRainAccumulation(const osg::Vec3d& location,
272  float& depth, float& blend);
273 
281  virtual bool computeLocalWind(const osg::Vec3d& location, float& speedMps,
282  float& directionRad, float& blend) const;
289  virtual bool computeLocalVisibility(const osg::Vec3d& location,
290  float& visibilityMeters, float& blend) const;
294  virtual void addWeatherLayer(DtWeatherLayer::LayerType layerType);
295 
299  virtual void removeWeatherLayer(DtWeatherLayer::LayerType layerType);
300 
301  // \brief A scale value that is used to multiply the bounds by when performing bounds calculations
302  // specific to precipitation. This value is generally used to match visual precipitation coverage
303  // with the bounds of the area. This also helps fade the precipitation in and out as the
304  // view approaches/departs the bounds edge.
305  static float precipitationBoundsScale();
306 
307  protected:
308 
310  virtual void updateTransform();
311 
316  virtual bool clampPositionToTerrain(osg::Vec3d& position, float clampDistance) const;
317 
320  virtual bool isPositionBelowSealevel(const DtVector& position) const;
321 
322  protected:
323 
325 
326  bool myEnabled;
327  bool myCulled;
328 
329  DtVector mySetPosition;
332 
333  osg::Vec3d myPosition; // computed world position
334  osg::Matrixd myRotation; // computed world rotation
335 
336  float myBoundsX;
337  float myBoundsY;
338  float myBoundsZ;
340 
343 
345 
347 
348  DtVector myFogColor;
350  float myOvercast;
351 
354 
355  std::vector<DtWeatherLayer*> myWeatherLayers;
356 
357  DtIntersector* myIntersector = nullptr;
358 
359  // This distance is used to fade local precipitation as the view approaches\departs the bounds edge.
360  static const float thePrecipitationEdgeFadeRange;
361 
362  // This distance is used to fade local wind as the view approaches\departs the bounds edge.
363  static const float theWindEdgeFadeRange;
364 
365  // This distance is used to fade local visibility as the view approaches\departs the bounds edge.
366  static const float theVisibilityEdgeFadeRange;
367 
368  // A scale value that is used to multiply the bounds by when performing bounds calculations
369  // specific to precipitation. This value is generally used to match visual precipitation coverage
370  // with the bounds of the area. This also helps fade the precipitation in and out as the
371  // view approaches/departs the bounds edge.
372  static const float thePrecipitationBoundsScale;
373  };
374 
375 
376 
380  {
381  public:
382 
385  enum AreaType
386  {
391  AreaTypeEnvironmental
392  };
393 
396 
398  virtual ~DtWeatherAreaFactory();
399 
401  DtWeatherAreaFactory() = delete;
402 
404  DtWeatherAreaFactory(const DtWeatherAreaFactory &other) = delete;
405 
407  DtWeatherAreaFactory &operator=(const DtWeatherAreaFactory &other) = delete;
408 
411  static DtWeatherAreaFactory& instance(DtDe& de);
412 
414  static const std::string& theClassName();
415 
417  virtual DtWeatherArea* create(AreaType areaType) const;
418 
419  protected:
420 
422  };
423 
424 }
425 
426 
427 
428 
DtSkyObject::PrecipitationType myPrecipitationType
Definition: DtWeatherArea.h:342
AreaType
brief Weather area type enumerations. Used for identifying specific areas.
Definition: DtWeatherArea.h:385
static const float theWindEdgeFadeRange
Definition: DtWeatherArea.h:363
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:333
static const float theVisibilityEdgeFadeRange
Definition: DtWeatherArea.h:366
#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:26
float myWindSpeedMps
Definition: DtWeatherArea.h:353
DtDe & myDe
Definition: DtWeatherArea.h:421
float myBoundsZ
Definition: DtWeatherArea.h:338
Factory that is used to create weather areas.
Definition: DtWeatherArea.h:379
Contains makVrv::DtDe class.
this class is used to split work up between threads.
Definition: DtJobSplitter.h:64
float myGroundRainAccumulation
Definition: DtWeatherArea.h:344
Definition: DtWeatherArea.h:387
float myBoundsCornerRadius
Definition: DtWeatherArea.h:339
bool myLightningEnabled
Definition: DtWeatherArea.h:346
Camera forward declarations.
Contains makVrv::DtSkyObject class.
A structure used to hold data for drawing.
Definition: DtWeatherEffect.h:72
bool myEnabled
Definition: DtWeatherArea.h:326
float myOvercast
Definition: DtWeatherArea.h:350
Contains makVrv::DtVirtualBaseClass class.
osg::Matrixd myRotation
Definition: DtWeatherArea.h:334
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...
static const float thePrecipitationBoundsScale
Definition: DtWeatherArea.h:372
DtVector myFogColor
Definition: DtWeatherArea.h:348
DtVector mySetPosition
Definition: DtWeatherArea.h:329
float myPrecipitationIntensity
Definition: DtWeatherArea.h:341
static const float thePrecipitationEdgeFadeRange
Definition: DtWeatherArea.h:360
bool myCulled
Definition: DtWeatherArea.h:327
float myWindDirectionRad
Definition: DtWeatherArea.h:352
float myVisibilityDistance
Definition: DtWeatherArea.h:349
std::vector< DtWeatherLayer * > myWeatherLayers
Definition: DtWeatherArea.h:355
bool mySetRelativeToCamera
Definition: DtWeatherArea.h:331
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:324
float mySetOrientation
Definition: DtWeatherArea.h:330
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:76
float myBoundsX
Definition: DtWeatherArea.h:336
float myBoundsY
Definition: DtWeatherArea.h:337
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:56
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 Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)