VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgTerrainPatchObject.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>
14 #include <vrvOsg/DtFastGroup.h>
18 
20 
24 
25 
26 namespace osgEarth
27 {
28  class MapNode;
29  class Wind;
30  class BingImageLayer;
31 
32  namespace Util
33  {
34  class ElevationQuery;
35  }
36 }
37 
38 namespace makVrv
39 {
40 
41  class DtDe;
42  class DtTerrainPatchGroup;
43  class DtOsgNodesExtractor;
44  class DtOsgLightPointManager;
45  class DtPagedTilesIndirectManager;
46 
52  {
53  public:
56  {
57  USE_GLOBAL, // use the global setting
58  FORCE_OFF, // force alpha to coverage off
59  FORCE_ON //force alpha to coverage on for this model
60  };
61 
62  public:
64  DtOsgTerrainPatchObject(DtDe& de, DtUniqueID elementId);
65 
67  virtual ~DtOsgTerrainPatchObject();
68 
70  //
71 
73  virtual void setTerrainDefinition(const std::string& modelDefinitionName);
74 
76  virtual void slot_atcGlobalTerrainEnableChanged();
77 
80  virtual void slot_terrainInstancesReadyToRender(const DtPagedTilesIndirectManager& pagedTilesIndirectManager);
81 
83  virtual void enableOverlay(int type, const std::string& definition);
84 
86  virtual void disableOverlay(int type);
87 
89  virtual void disableAllOverlays();
90 
92  virtual void setOverlayScale(int type, double x, double y);
93 
95  virtual void setWrapMode(int type, int);
96 
98  virtual void setBlendMode(int type, int);
99 
101  virtual void setOverlayOffset(int type, double x, double y);
102 
104  virtual void setLayerEnabled(const std::string& rule, bool status);
105 
107  virtual void setRasterLayerPosition(int type, int pos);
108 
110  virtual void setIsMinimapOnly(bool isForMinimap);
112  virtual bool isMinimapOnly() const;
114  //
116 
117  virtual std::string overlayDefinition(int type);
118 
119  virtual std::vector<double> overlayScale(int type);
120  virtual std::vector<double> overlayOffset(int type);
121  virtual DtTerrainOverlayOperation defaultOverlay(int type);
122  virtual DtTerrainOverlayOperation currentOverlay(int type);
123 
125  virtual void getBoundingBoxMinMax(DtVector& min, DtVector& max) const;
126 
128  virtual void getTerrainExtents(DtVector& nw, DtVector& ne, DtVector& sw, DtVector& se) const;
129 
131  virtual DtVector getDatabaseOrigin() const;
132 
134  virtual void getBoundingBoxCenter(float& x, float& y, float& z) const;
135 
136  //Get the terrain group node.
137  osg::Group* terrainGroupNode();
138 
140  virtual void extractNodes(const std::string& ruleset, bool isRegEx);
141 
143  virtual void extractOceanNodes(const std::string& ruleset, bool isRegEx);
144 
146  virtual void extractSpeedTreeNodes(const std::string& rule, bool isRegEx, const std::string& modelDefinition);
147 
149  virtual void realizeExtractedSpeedTrees(const DtVectorTreeRecords& trees);
150 
152  virtual bool haveExtractedOcean() const;
153 
156  virtual int countNodes(const std::string& rule) const;
157 
160  virtual bool getExtractedNodePosition(const std::string& rule,
161  unsigned int index, double& x, double& y, double& z) const;
162 
165  virtual bool getExtractedNodeOrientation(const std::string& rule,
166  unsigned int index, double& x, double& y, double& z, double& w) const;
167 
170  virtual void moveNode(DtSceneObject* object,
171  DtModel* model, const std::string& rule, unsigned int index);
172 
174  virtual osg::Node* findNode(const std::string& rule, unsigned int index);
175 
177  virtual bool isGlobalScaleTerrain() const;
178 
180  virtual bool getTerrainIntersection(double x, double y, double z,
181  double vx, double vy, double vz, double& retX, double& retY, double& retZ);
182 
186  virtual void clearElevationCache();
187 
190  bool isOsgEarth() const;
191 
193  osgEarth::MapNode *mapNode();
194  const osgEarth::MapNode *mapNode() const;
195 
196  void installOsgEarthFeatureDataCallback(const std::string& featureName,
198 
200  virtual const DtTextureVisitor::TextureMap& foundTextures() const;
201 
202  virtual void setOsgEarthMaterialValues(float ambient, float diffuse,
203  float specular, float shininess);
204  virtual void getOsgEarthMaterialValues(float& ambient, float& diffuse,
205  float& specular, float& shininess);
206 
208  DtMetaFileManager::LinkageValueVec& terrainPatchMetaFileFeatures();
209 
211  std::vector<DtVirtualBaseClass*>& terrainAttachments();
212 
214  virtual void setTerrainTreeScaleRandomization(bool isRandomized);
215 
217  virtual bool isTerrainTreeScaleRandomizationEnabled() const;
218 
220  virtual void setTerrainTreeMinScale(double minScale);
221 
223  virtual double terrainTreeMinScale() const;
224 
226  virtual void setTerrainTreeMaxScale(double maxScale);
227 
229  virtual double terrainTreeMaxScale() const;
230 
232  virtual void setTerrainTreeOrientationRandomization(bool isRandomized);
233 
235  virtual bool isTerrainTreeOrientationRandomizationEnabled() const;
236 
238  bool isDestructing();
239 
242  virtual void useICO(bool enable);
243 
245  virtual void setMaxPagedLODs(unsigned int maxPagedLODs);
246 
248  virtual void updateMaxPagedLODs();
249 
251  virtual void slot_channelCreated();
252 
254  virtual void slot_windowCreated();
255 
256 
258  virtual void slot_channelToBeDestroyed();
259 
261  virtual bool alphaToCoverageEnabled();
262 
265  virtual void postExtractionProcessing();
266 
268  virtual bool indirectEnabled();
269 
272  virtual void toggleVisibility(bool visibility);
273 
280  static void authorizeBingImageryLayer(osgEarth::BingImageLayer* bingImageLayer, bool openLayer = true);
281 
283  virtual DtOsgEarthFeatureDataBroker* getOsgEarthFeatureDataBroker();
284 
285  private:
289 
290  protected:
291 
293  void removeChildNodesAndCache();
294 
296  void clearStateGraphForAllChannels(void);
297 
298  static void graphBoundingBox(const osg::Node* node, osg::BoundingBox &bbox);
299 
300  //Remove the node from it's parent, and if the parent has no other
301  //Children remove it from it's parent too recursively.
302  void removeEmptyParent(osg::Node* node);
303  void updateBounds();
304 
306  virtual bool getElevation(double lonRadians, double latRadians,
307  double& retElevation);
308 
309  virtual void setPerPixelLightingEnabled(bool setting);
310 
311  virtual void slot_perPixelLightingChanged(bool newVal);
312  virtual void slot_usePixelShaderForOsgEarthModelsChanged();
313  virtual void slot_postUpdate();
314  virtual void setOsgEarthMaterial(float ambient, float diffuse,
315  float specular, float shininess);
316  virtual void setOsgEarthMaterialOnNode(osg::Node& node, float ambient, float diffuse,
317  float specular, float shininess);
318  virtual void setOsgEarthMaterialOnStateSet(osg::StateSet& ss, float ambient, float diffuse,
319  float specular, float shininess);
320 
321  virtual void slot_terrainPaged();
322 
324  // demand if necessary.
325  osgEarth::Util::ElevationQuery* getOrCreateElevationQuery();
326 
327  // Installs a data broker and feature data processing callbacks.
328  void installOsgEarthFeatureDataProcessors();
329 
330  // Sets up the osgEarth GeometryCompiler with custom defaults.
331  virtual void configureOsgEarthFeatureGeometryCompiler();
332 
334  virtual void setupMapNodeIntersectFlag();
335 
336  virtual void setGlobalWindSpeed(float metersPerSecond);
337 
338  virtual void setGlobalWindDirection(float radians);
339 
340  protected:
343 
346 
348 
351 
355  volatile bool myTerrainPagedThisFrame;
363 
364  // List of node pointers that have meta data associated with them
366  // Vector of node with .meta file info associated with them
367  // on this terrain so they can be deleted on page destruction
368  std::vector<DtVirtualBaseClass*> myTerrainAttachments;
369 
371  osgEarth::Util::ElevationQuery* myElevationQuery;
372 
375 
381 
384 
386 
387  friend class DtOsgNodesExtractor;
388 
390 
392 
394 
395  unsigned int myMaxPagedLods;
396 
398 
400 
403  boost::signalslib::connection myPagedTilesIndirectManagerConnection;
404 
406  std::vector<RefNode> myIndirectedNodes;
407  std::string myActualFilename;
408 
409  // This is used to implement global wind effects on procedural terrain patches
411 
413 
414  };
415 }
Declaration of the makVrv::DtLightPointVisitor class.
volatile bool myTerrainPagedThisFrame
Definition: DtOsgTerrainPatchObject.h:355
boost::unordered_map< int, std::string > TextureMap
typdef a map of textures
Definition: DtTextureVisitor.h:38
Declaration of the makVrv::DtTextureVisitor class.
boost::signalslib::connection myPagedTilesIndirectManagerConnection
connection to listen in on when instances were added to the terrain skin only for non-metaflight ...
Definition: DtOsgTerrainPatchObject.h:403
DtMetaFileManager::LinkageValueVec myTerrainPatchMetaFileFeatures
Definition: DtOsgTerrainPatchObject.h:365
handles the management of paged tiles and terrain patches being added to the indirect rendering syste...
Definition: DtPagedTilesIndirectManager.h:55
osg::ref_ptr< DtFastGroup > myTerrainGroup
The myTerrainGroup node holds all the terrain polygons except for reforested trees.
Definition: DtOsgTerrainPatchObject.h:345
Definition: DtOsgTerrainPatchObject.h:57
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
osg::ref_ptr< osgEarth::MapNode > myMapNode
Definition: DtOsgTerrainPatchObject.h:347
bool myHaveExtractedOcean
Definition: DtOsgTerrainPatchObject.h:353
std::string myActualFilename
Definition: DtOsgTerrainPatchObject.h:407
Definition: DtOsgNodesExtractor.h:29
Contains makVrv::DtMetaFileManager class.
Contains makVrv::DtFastGroup class.
osg::ref_ptr< osg::Node > RefNode
Definition: DtOsgTerrainPatchObject.h:405
DtOsgTerrainOverlayManager myOverlayManager
Definition: DtOsgTerrainPatchObject.h:349
std::vector< DtTreeRecord * > DtVectorTreeRecords
Definition: DtTreeRecord.h:137
osg::ref_ptr< DtOsgEarthFeatureDataBroker > myOsgEarthFeatureDataBroker
notifies subscribers of feature data loading via an osgEarth layer.
Definition: DtOsgTerrainPatchObject.h:374
DtOsgLightPointManager & myLightPointManager
Definition: DtOsgTerrainPatchObject.h:397
AlphaToCoverageState
The possible states alpha to coverage on a terrain patch.
Definition: DtOsgTerrainPatchObject.h:55
DtOsgLightPointManager registers LightPoint nodes so their TBO can be created and updated in a single...
Definition: DtOsgLightPointManager.h:105
bool myPendingPerPixelLightingValue
Definition: DtOsgTerrainPatchObject.h:356
bool myGlobalFlag
Definition: DtOsgTerrainPatchObject.h:352
A DtTerrainPatchObject contains the methods for loading a file as a terrain.
Definition: DtTerrainPatchObject.h:37
DtOsgEarthFeatureDataBroker listens to osgEarth feature layers (i.e.
Definition: DtOsgEarthFeatureDataBroker.h:60
float myPendingOsgEarthMaterialDiffuse
Definition: DtOsgTerrainPatchObject.h:359
DT_DLL_shape DtNetworkNode * findNode(DtVectorNetwork *vecNwk, unsigned int firstNode, DtPoint &p, DtSpecificationID ID)
DtOsgNodesExtractor * myExtractedNodesLogic
Definition: DtOsgTerrainPatchObject.h:385
std::vector< RefNode > myIndirectedNodes
Definition: DtOsgTerrainPatchObject.h:406
A DtOsgTerrainPatchObject contains the methods for loading a file as a terrain.
Definition: DtOsgTerrainPatchObject.h:51
std::vector< LinkageValuePair > LinkageValueVec
ex.
Definition: DtMetaFileManager.h:52
unsigned int myMaxPagedLods
Definition: DtOsgTerrainPatchObject.h:395
float myPendingOsgEarthMaterialAmbient
Definition: DtOsgTerrainPatchObject.h:358
bool myTerrainTreeOrientationRandomizationEnabled
Definition: DtOsgTerrainPatchObject.h:380
bool myOsgEarthMaterialChanged
Definition: DtOsgTerrainPatchObject.h:357
osg::ref_ptr< DtTerrainPatchGroup > myRoot
The OSG Hierarchy starts with myRoot and has one child: myTerrainGroup.
Definition: DtOsgTerrainPatchObject.h:342
bool myPerPixelLightingChanged
Definition: DtOsgTerrainPatchObject.h:354
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
float myTerrainTreeMinScale
Definition: DtOsgTerrainPatchObject.h:378
bool myIndirectEnabled
Definition: DtOsgTerrainPatchObject.h:393
float myPendingOsgEarthMaterialShininess
Definition: DtOsgTerrainPatchObject.h:361
float myPendingOsgEarthMaterialSpecular
Definition: DtOsgTerrainPatchObject.h:360
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
bool myIsMinimapOnly
Definition: DtOsgTerrainPatchObject.h:412
bool myDestructing
keeps track of when the object is in the destructor.
Definition: DtOsgTerrainPatchObject.h:383
DtPagedTilesIndirectManager * myPagedTilesIndirectManager
Definition: DtOsgTerrainPatchObject.h:399
Manager for setting up terrain layers in an OpenSceneGraph terrain.
Definition: DtOsgTerrainOverlayManager.h:25
A class specifying a single overlay operation.
Definition: DtTerrainOverlayOperation.h:22
Base class to provide boost signal/slot management.
osg::ref_ptr< osgEarth::Wind > myGlobalWind
Definition: DtOsgTerrainPatchObject.h:410
A DtSceneObject represents an object that can be positioned in the scene by (possibly) attaching it t...
Definition: DtSceneObject.h:41
Definition: DtOsgEarthFeatureDataBroker.h:65
Contains makVrv::DtDynamicTerrainWorld class.
AlphaToCoverageState myAlphaToCoverageState
Definition: DtOsgTerrainPatchObject.h:391
A model which owns a single model instance.
Definition: DtModel.h:55
Contains DLL export macros.
float myTerrainTreeMaxScale
Definition: DtOsgTerrainPatchObject.h:379
Feature Insertion/Removal/Paging Features represent parts of the terrain which are individually ident...
Definition: DtDynamicTerrainWorld.h:99
DtDynamicTerrainWorld::FeatureHandle myDynamicTerrainHandle
Definition: DtOsgTerrainPatchObject.h:389
Contains makVrv::DtOsgEarthFeatureDataBroker class.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtSignalConnectionManager mySignals
Definition: DtOsgTerrainPatchObject.h:362
bool myTerrainTreeScaleRandomizationEnabled
Tree randomization settings.
Definition: DtOsgTerrainPatchObject.h:377
DtTextureVisitor::TextureMap myFoundTextureMap
Definition: DtOsgTerrainPatchObject.h:350
Definition: DtOsgTerrainPatchObject.h:58
osgEarth::Util::ElevationQuery * myElevationQuery
Object used to sample the elevation model at various resolutions.
Definition: DtOsgTerrainPatchObject.h:371
Contains makVrv::DtTerrainPatchObject class.
std::vector< DtVirtualBaseClass * > myTerrainAttachments
Definition: DtOsgTerrainPatchObject.h:368

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)