VR-Forces 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) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
9 #pragma once
10 
13 
14 #include <osgEarthSplat/GroundCoverLayer>
15 #include <osgEarthSplat/GroundCoverFeatureGenerator>
16 
17 #include <osgEarth/Feature>
18 
19 #include <set>
20 
22 
27 {
28 public:
29 
31  DtOsgEarthGroundCoverSourcePager(DtVantageTerrainEngine* terrainEngine, osgEarth::MapNode* mapNode);
32 
34  virtual ~DtOsgEarthGroundCoverSourcePager() override;
35 
37  virtual bool init() override;
38 
41 
42  virtual DtString type() const override;
43 
45  virtual void setGroundCoverLayer(osg::ref_ptr<osgEarth::Splat::GroundCoverLayer> gclayer);
46 
48  virtual unsigned int groundCoverLod() const;
49 
53  unsigned reloadPagesWithinExtent(const osgEarth::GeoExtent & extent, bool isRemoval = false);
54 
55  virtual unsigned queuePageReloadsWithinExtent(
56  const osgEarth::GeoExtent& extent, const DtUUID& dynamicUuid, bool isRemoval = false) override;
57 
60 
61 protected:
62 
68  virtual bool reloadTile(const osgEarth::TileKey& tileKey, bool isRemoval = false, unsigned numEvents = 1) override;
69 
75  virtual std::shared_ptr<DtTileData> createTileDataFromGroundCover(
76  const osgEarth::TileKey& tilekey,
77  DtTerrainIntersectIDType intersectId,
78  bool createIfAlreadyLoaded = false) const;
79 
81  virtual bool pageInTile(const osgEarth::TileKey& tileKey, DtTerrainIntersectIDType intersectId = 0) override;
82 
84  virtual bool pageOutTile(const osgEarth::TileKey& tileKey) override;
85 
96  virtual void addTile(const osgEarth::TileKey& tilekey, const std::shared_ptr<DtTileData>& tile) override;
97 
100  //virtual void addEmptyTile(const osgEarth::TileKey& tilekey, DtTerrainIntersectIDType intersectId = 0);
101 
102  class treemodel
103  {
104  public:
105  treemodel(int id, double width, double height, double sim_trunk_height,
106  double sim_trunk_width, double sim_crown_offset, double sim_crown_height, double sim_crown_width, osg::ref_ptr<osg::Geode> geode) :
107  myId(id),
108  myWidth(width),
109  myHeight(height),
110  myTrunkHeight(sim_trunk_height),
111  myTrunkWidth(sim_trunk_width),
112  myCrownOffset(sim_crown_offset),
113  myCrownHeight(sim_crown_height),
114  myCrownWidth(sim_crown_width),
115  myGeode(geode)
116  {
117  }
118 
119  treemodel(const treemodel& tree) :
120  myId(tree.myId),
121  myWidth(tree.myWidth),
122  myHeight(tree.myHeight),
123  myTrunkHeight(tree.myTrunkHeight),
124  myTrunkWidth(tree.myTrunkWidth),
125  myCrownOffset(tree.myCrownOffset),
126  myCrownHeight(tree.myCrownHeight),
127  myCrownWidth(tree.myCrownWidth),
128  myGeode(tree.myGeode)
129  {
130  }
131 
132  int myId;
133  double myWidth;
134  double myHeight;
136  double myTrunkWidth;
139  double myCrownWidth;
141  };
142 
143  typedef std::map<int, treemodel> DtTreeMap;
146 
148  std::set<int> myErrorMessages;
149 
151  osgEarth::Splat::GroundCoverFeatureGenerator myFeatureGenerator;
152 
155 
157  mutable tbb::spin_rw_mutex myTileKeysForReloadMutex;
158 
159 };
std::map< int, treemodel > DtTreeMap
Definition: osgEarthGroundCoverSourcePager.h:143
UUID is a unique ID wrapper class.
Definition: uuid.h:59
virtual unsigned queuePageReloadsWithinExtent(const osgEarth::GeoExtent &extent, const DtUUID &dynamicUuid, bool isRemoval=false)
virtual bool pageInTile(const osgEarth::TileKey &tileKey, DtTerrainIntersectIDType intersectId=0)=0
Load a ground cover terrain patch in memory.
osgEarth::Splat::GroundCoverFeatureGenerator myFeatureGenerator
Used to extract procedural trees/shrub/ect.
Definition: osgEarthGroundCoverSourcePager.h:151
Definition: osgEarthGroundCoverSourceTracker.h:25
DtTreeMap myTreeMap
Tree Map.
Definition: osgEarthGroundCoverSourcePager.h:145
unsigned long long DtTerrainIntersectIDType
Definition: terrainInterfaceDefines.h:28
virtual DtString type() const =0
Used when a tile cannot be created by osgEarth&#39;s tileBuilder. Creates a Terrain Tile with all heights...
Definition: osgEarthGroundCoverSourcePager.h:102
double myCrownHeight
Definition: osgEarthGroundCoverSourcePager.h:138
double myTrunkHeight
Definition: osgEarthGroundCoverSourcePager.h:135
virtual DtTerrainSourceTracker * createTerrainSourceTracker(DtVantageTerrainEngine *)=0
Creates and returns a DtTerrainSourceTracker.
treemodel(const treemodel &tree)
Definition: osgEarthGroundCoverSourcePager.h:119
osg::ref_ptr< osgEarth::Splat::GroundCoverLayer > myGcLayer
ground cover of the pager
Definition: osgEarthGroundCoverSourcePager.h:154
tbb::spin_rw_mutex myTileKeysForReloadMutex
Mutex for the tile reload when dynamic terrain gets modify.
Definition: osgEarthGroundCoverSourcePager.h:157
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:137
osg::ref_ptr< osg::Geode > myGeode
Definition: osgEarthGroundCoverSourcePager.h:140
std::set< int > myErrorMessages
list of error messages
Definition: osgEarthGroundCoverSourcePager.h:148
int myId
Definition: osgEarthGroundCoverSourcePager.h:132
DtOsgEarthBaseGroundCoverSourcePager is a derived terrainSourcePager and based class for common code ...
Definition: osgEarthBaseGroundCoverSourcePager.h:29
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:105
double myCrownWidth
Definition: osgEarthGroundCoverSourcePager.h:139
double myHeight
Definition: osgEarthGroundCoverSourcePager.h:134
double myWidth
Definition: osgEarthGroundCoverSourcePager.h:133
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
virtual void addTile(const osgEarth::TileKey &tilekey, const std::shared_ptr< DtTileData > &tile)=0
Adds a configured tile data object to the terrain.
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:112
virtual bool init() override=0
Called after pager is configured.
virtual bool pageOutTile(const osgEarth::TileKey &tileKey)=0
Unload a ground cover terrain patch.
double myTrunkWidth
Definition: osgEarthGroundCoverSourcePager.h:136
virtual bool reloadTile(const osgEarth::TileKey &tileKey, bool isRemoval=false, unsigned numEvents=1)=0
Reloads a tile and keeps track of cratering events that affect the tile.
DtOsgEarthGroundCoverSourcePager is a derived terrainSourcePager that handles a streaming terrain sou...
Definition: osgEarthGroundCoverSourcePager.h:25

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)