VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgTerrainPatchObject.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
15 #include <vrvOsg/DtFastGroup.h>
19 
22 
23 #include <boost/unordered_map.hpp>
24 
25 namespace osgEarth
26 {
27  class ElevationQuery;
28  class MapNode;
29 }
30 
31 namespace makVrv
32 {
33 
34  class DtDe;
35  class DtTerrainPatchGroup;
36  class DtOsgExtractedNodesLogic;
37 
43  {
44  public:
46  DtOsgTerrainPatchObject(DtDe& de, DtUniqueID elementId);
47 
49  virtual ~DtOsgTerrainPatchObject();
50 
52  //
53 
55  virtual void setTerrainDefinition(const std::string& modelDefinitionName);
56 
58  virtual void enableOverlay(int type, const std::string& definition);
59 
61  virtual void disableOverlay(int type);
62 
64  virtual void disableAllOverlays();
65 
67  virtual void showLightPoints(bool show);
68 
70  virtual void setOverlayScale(int type, double x, double y);
71 
73  virtual void setWrapMode(int type, int);
74 
76  virtual void setBlendMode(int type, int);
77 
79  virtual void setOverlayOffset(int type, double x, double y);
80 
82  virtual void setLayerEnabled(const std::string& rule, bool status);
83 
85  virtual void setRasterLayerPosition(int type, int pos);
86  //
88 
89  virtual std::string overlayDefinition(int type);
90 
91  virtual std::vector<double> overlayScale(int type);
92  virtual std::vector<double> overlayOffset(int type);
93  virtual DtTerrainOverlayOperation defaultOverlay(int type);
94  virtual DtTerrainOverlayOperation currentOverlay(int type);
95 
97  virtual void getBoundingBoxMinMax(DtVector& min, DtVector& max) const;
98 
100  virtual void getTerrainExtents(DtVector& nw, DtVector& ne, DtVector& sw, DtVector& se) const;
101 
103  virtual DtVector getDatabaseOrigin() const;
104 
106  virtual void getBoundingBoxCenter(float& x, float& y, float& z) const;
107 
108  //Get the terrain group node.
109  osg::Group* terrainGroupNode();
110 
112  virtual void extractNodes(const std::string& ruleset, bool isRegEx);
113 
115  virtual void extractOceanNodes(const std::string& ruleset, bool isRegEx);
116 
118  virtual bool haveExtractedOcean() const;
119 
122  virtual int countNodes(const std::string& rule) const;
123 
126  virtual bool getExtractedNodePosition(const std::string& rule,
127  unsigned int index, double& x, double& y, double& z) const;
128 
131  virtual bool getExtractedNodeOrientation( const std::string& rule,
132  unsigned int index, double& x, double& y, double& z, double& w) const;
133 
136  virtual void moveNode(DtSceneObject* object,
137  DtModel* model,const std::string& rule, unsigned int index);
138 
140  virtual osg::Node* findNode(const std::string& rule, unsigned int index);
141 
143  virtual bool isGlobalScaleTerrain() const;
144 
146  virtual bool getTerrainIntersection(double x, double y, double z,
147  double vx, double vy, double vz, double& retX, double& retY, double& retZ );
148 
152  virtual void clearElevationCache();
153 
156  bool isOsgEarth() const;
157 
159  osgEarth::MapNode *mapNode();
160  const osgEarth::MapNode *mapNode() const;
161 
162  void installOsgEarthFeatureDataCallback( const std::string& featureName,
164 
166  virtual const DtTextureVisitor::TextureMap& foundTextures() const;
167 
168  virtual void setOsgEarthMaterialValues( float ambient, float diffuse,
169  float specular, float shininess );
170  virtual void getOsgEarthMaterialValues( float& ambient, float& diffuse,
171  float& specular, float& shininess );
172 
174  virtual osg::ref_ptr<DtFastGroup> getOsgEarthModelsNode(){return myOsgEarthModelsNode;}
175 
177  DtMetaFileManager::LinkageValueVec& terrainPatchMetaFileFeatures();
178 
180  std::vector<DtVirtualBaseClass*>& terrainAttachments();
181 
183  void appendLighPoints(DtLightPointVisitor::LightPointNodeObsVec& osgLightPoints);
184 
186  virtual void setTerrainTreeScaleRandomization( bool isRandomized );
187 
189  virtual bool isTerrainTreeScaleRandomizationEnabled() const;
190 
192  virtual void setTerrainTreeMinScale( double minScale);
193 
195  virtual double terrainTreeMinScale() const;
196 
198  virtual void setTerrainTreeMaxScale( double maxScale);
199 
201  virtual double terrainTreeMaxScale() const;
202 
204  virtual void setTerrainTreeOrientationRandomization( bool isRandomized );
205 
207  virtual bool isTerrainTreeOrientationRandomizationEnabled() const;
208 
210  bool isDestructing();
211 
214  void useICO(bool enable);
215 
216  private:
220 
221  protected:
222 
224  void removeChildNodesAndCache();
225 
226  static void graphBoundingBox(const osg::Node* node, osg::BoundingBox &bbox);
227 
228  //Remove the node from it's parent, and if the parent has no other
229  //Children remove it from it's parent too recursively.
230  void removeEmptyParent(osg::Node* node);
231  void updateBounds();
232 
234  virtual bool getElevation(double lonRadians, double latRadians,
235  double& retElevation );
236 
237  virtual void setPerPixelLightingEnabled( bool setting );
238 
239  virtual void slot_perPixelLightingChanged( bool newVal );
240  virtual void slot_usePixelShaderForOsgEarthModelsChanged();
241  virtual void slot_postUpdate();
242  virtual void setOsgEarthMaterial( float ambient, float diffuse,
243  float specular, float shininess );
244  virtual void setOsgEarthMaterialOnNode( osg::Node& node, float ambient, float diffuse,
245  float specular, float shininess );
246  virtual void setOsgEarthMaterialOnStateSet( osg::StateSet& ss, float ambient, float diffuse,
247  float specular, float shininess );
248 
249  virtual void slot_terrainPaged();
250 
252  // demand if necessary.
253  osgEarth::ElevationQuery* getOrCreateElevationQuery();
254 
255  // Installs a data broker and feature data processing callbacks.
256  void installOsgEarthFeatureDataProcessors();
257 
258  // Sets up the osgEarth GeometryCompiler with custom defaults.
259  void configureOsgEarthFeatureGeometryCompiler();
260 
261  protected:
262 
263 
265  osg::ref_ptr<DtTerrainPatchGroup> myRoot;
266 
268  osg::ref_ptr<DtFastGroup> myTerrainGroup;
269 
270  osg::ref_ptr<osgEarth::MapNode> myMapNode;
271  osg::ref_ptr<DtFastGroup> myOsgEarthModelsNode;
272 
279  volatile bool myTerrainPagedThisFrame;
287 
288  // List of node pointers that have meta data associated with them
290  // Vector of node with .meta file info associated with them
291  // on this terrain so they can be deleted on page destruction
292  std::vector<DtVirtualBaseClass*> myTerrainAttachments;
293 
295  osgEarth::ElevationQuery* myElevationQuery;
296 
298  osg::ref_ptr<DtOsgEarthFeatureDataBroker> myOsgEarthFeatureDataBroker;
299 
303 
309 
312 
315  };
316 }

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)