VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
boundingVolumeTerrainSourceTracker.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
10 
12 
13 //Mak Terrain Toolkit includes
14 #include <geometry/sphere.h>
16 #include <boost/unordered_map.hpp>
17 
24 
25 //VR-Link includes
26 #include <vlutil/vlSmartPointers.h>
27 #include <matrix/coordTransform.h>
28 
29 #include <tbb/spin_rw_mutex.h>
30 
31 #include <string>
32 #include <list>
33 #include <stack>
34 
38 class DtLocalVertexList;
39 
41 
42 
48  : public DtTerrainSourceTracker
49 {
50 public:
51 
52  //Struct defining the elemnt to add to the spatial subdivision for paged-in
53  //nodes. This is a different data structure from the paged-out nodes because
54  //there is additional data.
56  {
58  : myId(id)
59  , myStatus(status)
60  {
61 
62  }
63 
64  DtNodeStatusSSELement(std::pair<DtNodeId, DtPagedNodeStatusPtr> idStatusPair)
65  : myId(idStatusPair.first)
66  , myStatus(idStatusPair.second)
67  {
68 
69  }
70 
71  DtExtent extent()
72  {
73  return myStatus->myBoundingInfo.extent();
74  }
75 
76  void expandExtent(DtExtent& extent) const
77  {
78  myStatus->myBoundingInfo.expandExtent(extent);
79  }
80 
83  };
84  typedef boost::shared_ptr<DtNodeStatusSSELement> DtNodeStatusSSElementPtr;
85 
88 
90 
92 
93  virtual void updatePagedOutInfo(const DtNodeBoundingInfoList& volumes, bool invalid = false);
94 
97  virtual void updatePagedOutInfo(
98  const DtNodeBoundingInfoList& volumes,
99  const DtNodeBoundingInfoList& removed,
100  bool invalid = false);
101 
102  virtual void updatePagedInInfo(
103  const DtNodeBoundingInfoMap& volumes,
104  DtTerrainIntersectIDType intersectId = 0);
105 
106  virtual void removePagedInInfo(DtNodeId node);
107 
108  virtual bool dataAvailable(DtPagingMetaDataPtr metaData,
109  DtTerrainPagingGeometryPtr geometry);
110 
111  virtual void pageInData(DtPagingMetaDataPtr metaData,
112  DtTerrainPagingGeometryPtr geometry);
113 
114  virtual void drawDebugInfo(btIDebugDraw* debugDrawer);
115  virtual void updateDrawer(bool force);
116 
117  virtual bool canPageOutData(DtTerrainIntersectIDType intersectId);
118 
119  virtual void pageOutOldestData(const int priority);
120 
121  virtual DtTerrainIntersectIDType findOldestPagedData(unsigned int& numTrianglesOut);
122 
123  virtual void printInfo() const;
124 
125  virtual bool getPagedOutNodes(DtTerrainPagingGeometryPtr geometry,
126  DtNodeBoundingInfoSet& nodes);
127 
128  virtual bool getPagedInNodes(DtTerrainPagingGeometryPtr geometry,
129  DtPagedNodeStatusMap& nodes);
130 
131  virtual bool setDrawMode(DtDrawMode mode);
132 
133 protected:
134 
135  virtual bool getPagedOutNodes(const DtSphere& sphere,
136  DtNodeBoundingInfoSet& nodes);
137  virtual bool getPagedOutNodes(const DtLocalVertexList& vertexList,
138  DtNodeBoundingInfoSet& nodes);
139  virtual bool getPagedOutNodes(const DtChord& chord,
140  DtNodeBoundingInfoSet& nodes);
141 
142  virtual bool getPagedInNodes(const DtSphere& sphere,
143  DtPagedNodeStatusMap& nodes);
144  virtual bool getPagedInNodes(const DtLocalVertexList& vertexList,
145  DtPagedNodeStatusMap& nodes);
146  virtual bool getPagedInNodes(const DtChord& chord,
147  DtPagedNodeStatusMap& nodes);
148 
149  virtual DtTerrainIntersectIDType findOldestPagedDataUnlocked(unsigned int& numTrianglesOut);
150 
151  virtual DtPageInGeometryCommand* createPageInGeometryCommand(
152  DtPagingMetaDataPtr metaData);
153 
154  virtual DtPageOutNodesCommand* createPageOutNodesCommand(
155  DtPagingMetaDataPtr metaData);
156 
157  virtual unsigned int getNumTriangles(DtNodeId node);
158 
159 protected:
163 
166 
168 
170  tbb::atomic<bool> myRecomputeOldestPagedObject;
171 
178 
179  std::auto_ptr<DtSharedMemoryBulletDebugDrawer> myDrawer;
180 };
181 
182 
183 

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)