VR-Forces 4.6.1 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) 2018 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
15 
16 #include <vrvOsg/DtFastGroup.h>
20 
23 
25 
26 #include <boost/unordered_map.hpp>
27 
28 
29 namespace osgEarth
30 {
31  class ElevationQuery;
32  class MapNode;
33 }
34 
35 namespace makVrv
36 {
37 
38  class DtDe;
39  class DtTerrainPatchGroup;
40  class DtOsgNodesExtractor;
41  class DtOsgLightPointManager;
42 
48  {
49  public:
52  {
53  USE_GLOBAL, // use the global setting
54  FORCE_OFF, // force alpha to coverage off
55  FORCE_ON //force alpha to coverage on for this model
56  };
57 
58  public:
60  DtOsgTerrainPatchObject(DtDe& de, DtUniqueID elementId);
61 
63  virtual ~DtOsgTerrainPatchObject();
64 
66  //
67 
69  virtual void setTerrainDefinition(const std::string& modelDefinitionName);
70 
71  virtual void slot_atcGlobalTerrainEnableChanged();
72 
74  virtual void enableOverlay(int type, const std::string& definition);
75 
77  virtual void disableOverlay(int type);
78 
80  virtual void disableAllOverlays();
81 
83  virtual void setOverlayScale(int type, double x, double y);
84 
86  virtual void setWrapMode(int type, int);
87 
89  virtual void setBlendMode(int type, int);
90 
92  virtual void setOverlayOffset(int type, double x, double y);
93 
95  virtual void setLayerEnabled(const std::string& rule, bool status);
96 
98  virtual void setRasterLayerPosition(int type, int pos);
99 
100  //
102 
103  virtual std::string overlayDefinition(int type);
104 
105  virtual std::vector<double> overlayScale(int type);
106  virtual std::vector<double> overlayOffset(int type);
107  virtual DtTerrainOverlayOperation defaultOverlay(int type);
108  virtual DtTerrainOverlayOperation currentOverlay(int type);
109 
111  virtual void getBoundingBoxMinMax(DtVector& min, DtVector& max) const;
112 
114  virtual void getTerrainExtents(DtVector& nw, DtVector& ne, DtVector& sw, DtVector& se) const;
115 
117  virtual DtVector getDatabaseOrigin() const;
118 
120  virtual void getBoundingBoxCenter(float& x, float& y, float& z) const;
121 
122  //Get the terrain group node.
123  osg::Group* terrainGroupNode();
124 
126  virtual void extractNodes(const std::string& ruleset, bool isRegEx);
127 
129  virtual void extractOceanNodes(const std::string& ruleset, bool isRegEx);
130 
132  virtual void extractSpeedTreeNodes(const std::string& rule, bool isRegEx, const std::string& modelDefinition);
133 
135  virtual void realizeExtractedSpeedTrees(const DtVectorTreeRecords& trees);
136 
138  virtual bool haveExtractedOcean() const;
139 
142  virtual int countNodes(const std::string& rule) const;
143 
146  virtual bool getExtractedNodePosition(const std::string& rule,
147  unsigned int index, double& x, double& y, double& z) const;
148 
151  virtual bool getExtractedNodeOrientation(const std::string& rule,
152  unsigned int index, double& x, double& y, double& z, double& w) const;
153 
156  virtual void moveNode(DtSceneObject* object,
157  DtModel* model, const std::string& rule, unsigned int index);
158 
160  virtual osg::Node* findNode(const std::string& rule, unsigned int index);
161 
163  virtual bool isGlobalScaleTerrain() const;
164 
166  virtual bool getTerrainIntersection(double x, double y, double z,
167  double vx, double vy, double vz, double& retX, double& retY, double& retZ);
168 
172  virtual void clearElevationCache();
173 
176  bool isOsgEarth() const;
177 
179  osgEarth::MapNode *mapNode();
180  const osgEarth::MapNode *mapNode() const;
181 
182  void installOsgEarthFeatureDataCallback(const std::string& featureName,
184 
186  virtual const DtTextureVisitor::TextureMap& foundTextures() const;
187 
188  virtual void setOsgEarthMaterialValues(float ambient, float diffuse,
189  float specular, float shininess);
190  virtual void getOsgEarthMaterialValues(float& ambient, float& diffuse,
191  float& specular, float& shininess);
192 
194  virtual osg::ref_ptr<DtFastGroup> getOsgEarthModelsNode(){ return myOsgEarthModelsNode; }
195 
197  DtMetaFileManager::LinkageValueVec& terrainPatchMetaFileFeatures();
198 
200  std::vector<DtVirtualBaseClass*>& terrainAttachments();
201 
203  virtual void setTerrainTreeScaleRandomization(bool isRandomized);
204 
206  virtual bool isTerrainTreeScaleRandomizationEnabled() const;
207 
209  virtual void setTerrainTreeMinScale(double minScale);
210 
212  virtual double terrainTreeMinScale() const;
213 
215  virtual void setTerrainTreeMaxScale(double maxScale);
216 
218  virtual double terrainTreeMaxScale() const;
219 
221  virtual void setTerrainTreeOrientationRandomization(bool isRandomized);
222 
224  virtual bool isTerrainTreeOrientationRandomizationEnabled() const;
225 
227  bool isDestructing();
228 
231  virtual void useICO(bool enable);
232 
234  virtual void setMaxPagedLODs(unsigned int maxPagedLODs);
235 
237  virtual void updateMaxPagedLODs();
238 
240  virtual void slot_channelCreated();
241 
243  virtual void slot_channelToBeDestroyed();
244 
246  virtual bool alphaToCoverageEnabled();
247 
248  private:
252 
253  protected:
254 
256  void removeChildNodesAndCache();
257 
259  void clearStateGraphForAllChannels(void);
260 
261  static void graphBoundingBox(const osg::Node* node, osg::BoundingBox &bbox);
262 
263  //Remove the node from it's parent, and if the parent has no other
264  //Children remove it from it's parent too recursively.
265  void removeEmptyParent(osg::Node* node);
266  void updateBounds();
267 
269  virtual bool getElevation(double lonRadians, double latRadians,
270  double& retElevation);
271 
272  virtual void setPerPixelLightingEnabled(bool setting);
273 
274  virtual void slot_perPixelLightingChanged(bool newVal);
275  virtual void slot_usePixelShaderForOsgEarthModelsChanged();
276  virtual void slot_postUpdate();
277  virtual void setOsgEarthMaterial(float ambient, float diffuse,
278  float specular, float shininess);
279  virtual void setOsgEarthMaterialOnNode(osg::Node& node, float ambient, float diffuse,
280  float specular, float shininess);
281  virtual void setOsgEarthMaterialOnStateSet(osg::StateSet& ss, float ambient, float diffuse,
282  float specular, float shininess);
283 
284  virtual void slot_terrainPaged();
285 
287  // demand if necessary.
288  osgEarth::ElevationQuery* getOrCreateElevationQuery();
289 
290  // Installs a data broker and feature data processing callbacks.
291  void installOsgEarthFeatureDataProcessors();
292 
293  // Sets up the osgEarth GeometryCompiler with custom defaults.
294  void configureOsgEarthFeatureGeometryCompiler();
295 
296  protected:
297 
298 
300  osg::ref_ptr<DtTerrainPatchGroup> myRoot;
301 
303  osg::ref_ptr<DtFastGroup> myTerrainGroup;
304 
305  osg::ref_ptr<osgEarth::MapNode> myMapNode;
306  osg::ref_ptr<DtFastGroup> myOsgEarthModelsNode;
307 
310 
314  volatile bool myTerrainPagedThisFrame;
322 
323  // List of node pointers that have meta data associated with them
325  // Vector of node with .meta file info associated with them
326  // on this terrain so they can be deleted on page destruction
327  std::vector<DtVirtualBaseClass*> myTerrainAttachments;
328 
330  osgEarth::ElevationQuery* myElevationQuery;
331 
333  osg::ref_ptr<DtOsgEarthFeatureDataBroker> myOsgEarthFeatureDataBroker;
334 
340 
343 
345 
346 
347  friend class DtOsgNodesExtractor;
348 
350 
352 
353  unsigned int myMaxPagedLods;
354 
356  };
357 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)