VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
osgEarthGroundCoverSourcePager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
15 
16 #include <osgEarthSplat/GroundCoverLayer>
17 #include <osgEarthSplat/GroundCoverFeatureGenerator>
18 
19 #include <osgEarth/Feature>
20 
21 #include <tbb/spin_rw_mutex.h>
22 #include <tbb/task_arena.h>
23 
24 #include <set>
25 
27 
32 {
33 public:
34 
36  DtOsgEarthGroundCoverSourcePager(DtVantageTerrainEngine* terrainEngine, osgEarth::MapNode* mapNode);
37 
40 
42  virtual bool init();
43 
47  virtual void tick();
48 
51  unsigned reloadQueuedPages();
52 
58  virtual bool pageInTiles(DtTileKeyList& tileIds,
59  DtTerrainIntersectIDType intersectId = 0);
60 
66  virtual bool pageOutTiles(const DtTileKeyList& tilesToRemove);
67 
70 
72  virtual void updatePageTracker(DtTerrainIntersectIDType intersectId = 0);
73 
75  virtual void setGroundCoverLayer(osg::ref_ptr<osgEarth::Splat::GroundCoverLayer> gclayer);
76 
78  virtual unsigned int groundCoverLod() const;
79 
81  virtual void findMissingTiles(const DtTerrainPagingGeometryPtr& geometry, DtTileKeyList& tiles) const;
82 
86  unsigned reloadPagesWithinExtent(const osgEarth::GeoExtent & extent, bool isRemoval = false);
87 
88  virtual unsigned queuePageReloadsWithinExtent(const osgEarth::GeoExtent & extent, const DtUUID& dynamicUuid, bool isRemoval = false);
89 
92 
93 protected:
94 
100  virtual bool reloadTile(const osgEarth::TileKey & tileKey, bool isRemoval = false, unsigned numEvents = 1);
101 
107  virtual boost::shared_ptr<DtTileData> createTileDataFromGroundCover(
108  const osgEarth::TileKey& tilekey,
109  DtTerrainIntersectIDType intersectId,
110  bool createIfAlreadyLoaded = false) const;
111 
113  virtual bool pageInTile(const osgEarth::TileKey& tileKey,
114  DtTerrainIntersectIDType intersectId = 0);
115 
117  virtual bool pageOutTile(const osgEarth::TileKey& tileKey);
118 
129  virtual void addTile(const osgEarth::TileKey& tilekey, const boost::shared_ptr<DtTileData>& tile);
130 
133  virtual void addEmptyTile(const osgEarth::TileKey& tilekey, DtTerrainIntersectIDType intersectId = 0);
134 
135  class treemodel
136  {
137  public:
138  treemodel(int id, double width, double height, double sim_trunk_height,
139  double sim_trunk_width, double sim_crown_offset, double sim_crown_height, double sim_crown_width, osg::ref_ptr<osg::Geode> geode) :
140  myId(id),
141  myWidth(width),
142  myHeight(height),
143  myTrunkHeight(sim_trunk_height),
144  myTrunkWidth(sim_trunk_width),
145  myCrownOffset(sim_crown_offset),
146  myCrownHeight(sim_crown_height),
147  myCrownWidth(sim_crown_width),
148  myGeode(geode)
149  {
150  }
151 
152  treemodel(const treemodel& tree) :
153  myId(tree.myId),
154  myWidth(tree.myWidth),
155  myHeight(tree.myHeight),
156  myTrunkHeight(tree.myTrunkHeight),
157  myTrunkWidth(tree.myTrunkWidth),
158  myCrownOffset(tree.myCrownOffset),
159  myCrownHeight(tree.myCrownHeight),
160  myCrownWidth(tree.myCrownWidth),
161  myGeode(tree.myGeode)
162  {
163  }
164 
165  int myId;
166  double myWidth;
167  double myHeight;
169  double myTrunkWidth;
172  double myCrownWidth;
174  };
175 
176  typedef std::map<int, treemodel> DtTreeMap;
179 
181  osgEarth::Splat::GroundCoverFeatureGenerator myFeatureGenerator;
182 
185 
188 
190  mutable tbb::spin_rw_mutex myTileKeysForReloadMutex;
191 
193  tbb::spin_rw_mutex myCreateTreeMutex;
194 
196  tbb::task_arena myArena;
197 
199  std::set<int> myErrorMessages;
200 };
std::map< int, treemodel > DtTreeMap
Definition: osgEarthGroundCoverSourcePager.h:176
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
virtual unsigned queuePageReloadsWithinExtent(const osgEarth::GeoExtent &extent, const DtUUID &dynamicUuid, bool isRemoval=false)
std::list< osgEarth::TileKey > DtTileKeyList
Definition: tileSpatialIndex.h:32
DtBoost::shared_ptr< DtTerrainPagingGeometry > DtTerrainPagingGeometryPtr
Definition: terrainPagingGeometry.h:46
virtual bool init()
Called after pager is configured.
DtTerrainSourcePager is the base class for terrain pagers. There will be one terrainSourcePager per t...
Definition: terrainSourcePager.h:58
osgEarth::Splat::GroundCoverFeatureGenerator myFeatureGenerator
Used to extract procedural trees/shrub/ect.
Definition: osgEarthGroundCoverSourcePager.h:181
Definition: osgEarthGroundCoverSourceTracker.h:25
DtTreeMap myTreeMap
Tree Map.
Definition: osgEarthGroundCoverSourcePager.h:178
Definition: osgEarthGroundCoverSourcePager.h:135
double myCrownHeight
Definition: osgEarthGroundCoverSourcePager.h:171
double myTrunkHeight
Definition: osgEarthGroundCoverSourcePager.h:168
virtual DtTerrainSourceTracker * createTerrainSourceTracker(DtVantageTerrainEngine *)=0
Creates and returns a DtTerrainSourceTracker.
treemodel(const treemodel &tree)
Definition: osgEarthGroundCoverSourcePager.h:152
tbb::task_arena myArena
Tbb arena to limit number of threads.
Definition: osgEarthGroundCoverSourcePager.h:196
DtOsgEarthGroundCoverSourceTracker * myOsgTracker
Associated Tracker.
Definition: osgEarthGroundCoverSourcePager.h:187
osg::ref_ptr< osgEarth::Splat::GroundCoverLayer > myGcLayer
ground cover of the pager
Definition: osgEarthGroundCoverSourcePager.h:184
tbb::spin_rw_mutex myTileKeysForReloadMutex
Mutex for the tile reload when dynamic terrain gets modify.
Definition: osgEarthGroundCoverSourcePager.h:190
Base class for Terrain Source trackers. Determines if the necessary data To perform an intersection i...
Definition: terrainSourceTracker.h:75
double myCrownOffset
Definition: osgEarthGroundCoverSourcePager.h:170
osg::ref_ptr< osg::Geode > myGeode
Definition: osgEarthGroundCoverSourcePager.h:173
std::set< int > myErrorMessages
list of error messages
Definition: osgEarthGroundCoverSourcePager.h:199
int myId
Definition: osgEarthGroundCoverSourcePager.h:165
treemodel(int id, double width, double height, double sim_trunk_height, double sim_trunk_width, double sim_crown_offset, double sim_crown_height, double sim_crown_width, osg::ref_ptr< osg::Geode > geode)
Definition: osgEarthGroundCoverSourcePager.h:138
double myCrownWidth
Definition: osgEarthGroundCoverSourcePager.h:172
tbb::spin_rw_mutex myCreateTreeMutex
Mutex for creating tree geometry.
Definition: osgEarthGroundCoverSourcePager.h:193
double myHeight
Definition: osgEarthGroundCoverSourcePager.h:167
double myWidth
Definition: osgEarthGroundCoverSourcePager.h:166
virtual void updatePageTracker(DtTerrainIntersectIDType intersectId=0)=0
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
virtual void tick()
Processes commands from the priority-sorted command map. Executes the first command and returns...
This class wraps the VR-Vantage Display Engine, and uses as a terrain loader and intersector. This is the terrain engine that powers the DtVantageTerrainImplementation. The DtVantageTerrainEngine runs the DtDe it its own thread, and processes commands thought the command queue.
Definition: vantageTerrainEngine.h:99
double myTrunkWidth
Definition: osgEarthGroundCoverSourcePager.h:169
DtOsgEarthGroundCoverSourcePager is a derived terrainSourcePager that handles a streaming terrain sou...
Definition: osgEarthGroundCoverSourcePager.h:30

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)