VR-Forces 4.5 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 
24 
25 #include <boost/unordered_map.hpp>
26 
27 namespace osgEarth
28 {
29  class ElevationQuery;
30  class MapNode;
31 }
32 
33 namespace makVrv
34 {
35 
36  class DtDe;
37  class DtTerrainPatchGroup;
38  class DtOsgExtractedNodesLogic;
39 
45  {
46  public:
48  DtOsgTerrainPatchObject(DtDe& de, DtUniqueID elementId);
49 
51  virtual ~DtOsgTerrainPatchObject();
52 
54  //
55 
57  virtual void setTerrainDefinition(const std::string& modelDefinitionName);
58 
60  virtual void enableOverlay(int type, const std::string& definition);
61 
63  virtual void disableOverlay(int type);
64 
66  virtual void disableAllOverlays();
67 
69  virtual void showLightPoints(bool show);
70 
72  virtual void setOverlayScale(int type, double x, double y);
73 
75  virtual void setWrapMode(int type, int);
76 
78  virtual void setBlendMode(int type, int);
79 
81  virtual void setOverlayOffset(int type, double x, double y);
82 
84  virtual void setLayerEnabled(const std::string& rule, bool status);
85 
87  virtual void setRasterLayerPosition(int type, int pos);
88 
89  //
91 
92  virtual std::string overlayDefinition(int type);
93 
94  virtual std::vector<double> overlayScale(int type);
95  virtual std::vector<double> overlayOffset(int type);
96  virtual DtTerrainOverlayOperation defaultOverlay(int type);
97  virtual DtTerrainOverlayOperation currentOverlay(int type);
98 
100  virtual void getBoundingBoxMinMax(DtVector& min, DtVector& max) const;
101 
103  virtual void getTerrainExtents(DtVector& nw, DtVector& ne, DtVector& sw, DtVector& se) const;
104 
106  virtual DtVector getDatabaseOrigin() const;
107 
109  virtual void getBoundingBoxCenter(float& x, float& y, float& z) const;
110 
111  //Get the terrain group node.
112  osg::Group* terrainGroupNode();
113 
115  virtual void extractNodes(const std::string& ruleset, bool isRegEx);
116 
118  virtual void extractOceanNodes(const std::string& ruleset, bool isRegEx);
119 
121  virtual bool haveExtractedOcean() const;
122 
125  virtual int countNodes(const std::string& rule) const;
126 
129  virtual bool getExtractedNodePosition(const std::string& rule,
130  unsigned int index, double& x, double& y, double& z) const;
131 
134  virtual bool getExtractedNodeOrientation( const std::string& rule,
135  unsigned int index, double& x, double& y, double& z, double& w) const;
136 
139  virtual void moveNode(DtSceneObject* object,
140  DtModel* model,const std::string& rule, unsigned int index);
141 
143  virtual osg::Node* findNode(const std::string& rule, unsigned int index);
144 
146  virtual bool isGlobalScaleTerrain() const;
147 
149  virtual bool getTerrainIntersection(double x, double y, double z,
150  double vx, double vy, double vz, double& retX, double& retY, double& retZ );
151 
155  virtual void clearElevationCache();
156 
159  bool isOsgEarth() const;
160 
162  osgEarth::MapNode *mapNode();
163  const osgEarth::MapNode *mapNode() const;
164 
165  void installOsgEarthFeatureDataCallback( const std::string& featureName,
167 
169  virtual const DtTextureVisitor::TextureMap& foundTextures() const;
170 
171  virtual void setOsgEarthMaterialValues( float ambient, float diffuse,
172  float specular, float shininess );
173  virtual void getOsgEarthMaterialValues( float& ambient, float& diffuse,
174  float& specular, float& shininess );
175 
177  virtual osg::ref_ptr<DtFastGroup> getOsgEarthModelsNode(){return myOsgEarthModelsNode;}
178 
180  DtMetaFileManager::LinkageValueVec& terrainPatchMetaFileFeatures();
181 
183  std::vector<DtVirtualBaseClass*>& terrainAttachments();
184 
186  void appendLighPoints(DtLightPointVisitor::LightPointNodeObsVec& osgLightPoints);
187 
189  virtual void setTerrainTreeScaleRandomization( bool isRandomized );
190 
192  virtual bool isTerrainTreeScaleRandomizationEnabled() const;
193 
195  virtual void setTerrainTreeMinScale( double minScale);
196 
198  virtual double terrainTreeMinScale() const;
199 
201  virtual void setTerrainTreeMaxScale( double maxScale);
202 
204  virtual double terrainTreeMaxScale() const;
205 
207  virtual void setTerrainTreeOrientationRandomization( bool isRandomized );
208 
210  virtual bool isTerrainTreeOrientationRandomizationEnabled() const;
211 
213  bool isDestructing();
214 
217  virtual void useICO(bool enable);
218 
220  virtual void setMaxPagedLODs( unsigned int maxPagedLODs );
221 
222  private:
226 
227  protected:
228 
230  void removeChildNodesAndCache();
231 
233  void clearStateGraphForAllChannels(void);
234 
235  static void graphBoundingBox(const osg::Node* node, osg::BoundingBox &bbox);
236 
237  //Remove the node from it's parent, and if the parent has no other
238  //Children remove it from it's parent too recursively.
239  void removeEmptyParent(osg::Node* node);
240  void updateBounds();
241 
243  virtual bool getElevation(double lonRadians, double latRadians,
244  double& retElevation );
245 
246  virtual void setPerPixelLightingEnabled( bool setting );
247 
248  virtual void slot_perPixelLightingChanged( bool newVal );
249  virtual void slot_usePixelShaderForOsgEarthModelsChanged();
250  virtual void slot_postUpdate();
251  virtual void setOsgEarthMaterial( float ambient, float diffuse,
252  float specular, float shininess );
253  virtual void setOsgEarthMaterialOnNode( osg::Node& node, float ambient, float diffuse,
254  float specular, float shininess );
255  virtual void setOsgEarthMaterialOnStateSet( osg::StateSet& ss, float ambient, float diffuse,
256  float specular, float shininess );
257 
258  virtual void slot_terrainPaged();
259 
261  // demand if necessary.
262  osgEarth::ElevationQuery* getOrCreateElevationQuery();
263 
264  // Installs a data broker and feature data processing callbacks.
265  void installOsgEarthFeatureDataProcessors();
266 
267  // Sets up the osgEarth GeometryCompiler with custom defaults.
268  void configureOsgEarthFeatureGeometryCompiler();
269 
270  protected:
271 
272 
274  osg::ref_ptr<DtTerrainPatchGroup> myRoot;
275 
277  osg::ref_ptr<DtFastGroup> myTerrainGroup;
278 
279  osg::ref_ptr<osgEarth::MapNode> myMapNode;
280  osg::ref_ptr<DtFastGroup> myOsgEarthModelsNode;
281 
288  volatile bool myTerrainPagedThisFrame;
296 
297  // List of node pointers that have meta data associated with them
299  // Vector of node with .meta file info associated with them
300  // on this terrain so they can be deleted on page destruction
301  std::vector<DtVirtualBaseClass*> myTerrainAttachments;
302 
304  osgEarth::ElevationQuery* myElevationQuery;
305 
307  osg::ref_ptr<DtOsgEarthFeatureDataBroker> myOsgEarthFeatureDataBroker;
308 
312 
318 
321 
324 
326  };
327 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)