VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
boundingNodeInfo.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
11 
13 #include <geometry/sphere.h>
14 
16 #include <boost/unordered_map.hpp>
17 #include <boost/unordered_set.hpp>
18 
19 #include <osg/Matrix>
20 
21 #include <tbb/spin_mutex.h>
22 
24 #include <vector>
25 
26 
27 //Stores information about a paged out bounding volume.
29 {
30  DtNodeBoundingInfo(DtSphere boundingSphere, std::string filename, bool known=false)
31  : myBoundingSphere(boundingSphere)
32  , myOriginalBoundingSphere(boundingSphere)
33  , myFilename(filename)
34  {
35  }
36 
37  virtual void expandExtent(DtExtent& ext) const
38  {
39  ext.expandToInclude(extent());
40  }
41 
42  virtual DtExtent extent() const
43  {
44  return extentOfSphere(myBoundingSphere);
45  }
46 
47  virtual std::string filename() const
48  {
49  return myFilename;
50  }
51 
54  const std::string myFilename;
55 };
56 
59 {
61  DtNodeBoundingInfo boundingInfo,
62  unsigned int numTriangles,
63  DtTerrainIntersectIDType lastUsed = 0)
64  : myBoundingInfo(boundingInfo)
65  , myLastUsed(lastUsed)
66  , myNumTriangles(numTriangles)
67  , myPendingRemoval(false)
68  {
69  }
70 
72  const unsigned int myNumTriangles;
73 
75 
77  {
78  if (lastUsed > myLastUsed)
79  {
80  myLastUsed = lastUsed;
81  }
82  }
83 
85  {
86  return myLastUsed;
87  }
88 
89 protected:
90 
91  std::atomic <DtTerrainIntersectIDType> myLastUsed;
92 };
93 
94 typedef std::shared_ptr<DtNodeBoundingInfo> DtNodeBoundingInfoPtr;
95 typedef std::shared_ptr<DtPagedNodeStatus> DtPagedNodeStatusPtr;
96 
98 inline std::size_t hash_value(const DtNodeBoundingInfoPtr& p)
99 {
100  boost::hash<DtNodeBoundingInfo*> hasher;
101  return hasher(p.get());
102 }
103 
105 {
106  DtPagedInExtendInfo(const DtNodeBoundingInfoPtr& nodeBoundingInfoPtr, const osg::Matrix& matrix):
107  myNodeBoundingInfoPtr(nodeBoundingInfoPtr),
108  myMatrix(matrix)
109  {
110  }
112  myNodeBoundingInfoPtr(rh.myNodeBoundingInfoPtr),
113  myMatrix(rh.myMatrix)
114  {
115  for (size_t i = 0; i < rh.myAssociatedDrawable.size(); i++)
116  {
117  myAssociatedDrawable.push_back(rh.myAssociatedDrawable[i]);
118  }
119  for (size_t i = 0; i < rh.myNbTriangles.size(); i++)
120  {
121  myNbTriangles.push_back(rh.myNbTriangles[i]);
122  }
123  }
125  {
126  }
127 
128 public:
130  osg::Matrix myMatrix;
131  std::vector<DtNodeId> myAssociatedDrawable;
132  std::vector<size_t> myAssociatedDrawableId;
134  std::vector<size_t> myNbTriangles;
135 };
136 
137 typedef std::list<DtNodeBoundingInfoPtr> DtNodeBoundingInfoList;
138 typedef boost::unordered_set<DtNodeBoundingInfoPtr> DtNodeBoundingInfoSet;
139 typedef boost::unordered_map<DtNodeId, DtNodeBoundingInfoPtr> DtNodeBoundingInfoMap;
140 typedef boost::unordered_map<DtNodeId, DtPagedInExtendInfo> DtNodeBoundingExtendedInfoMap;
141 typedef boost::unordered_map<DtNodeId, DtPagedNodeStatusPtr> DtPagedNodeStatusMap;
142 
boost::unordered_map< DtNodeId, DtPagedInExtendInfo > DtNodeBoundingExtendedInfoMap
Definition: boundingNodeInfo.h:140
DtNodeBoundingInfo(DtSphere boundingSphere, std::string filename, bool known=false)
Definition: boundingNodeInfo.h:30
DtTerrainIntersectIDType lastUsed() const
Definition: boundingNodeInfo.h:84
boost::unordered_map< DtNodeId, DtNodeBoundingInfoPtr > DtNodeBoundingInfoMap
Definition: boundingNodeInfo.h:139
Definition: sphere.h:22
DtPagedNodeStatus(DtNodeBoundingInfo boundingInfo, unsigned int numTriangles, DtTerrainIntersectIDType lastUsed=0)
Definition: boundingNodeInfo.h:60
Definition: boundingNodeInfo.h:104
const DtSphere myOriginalBoundingSphere
Definition: boundingNodeInfo.h:53
boost::unordered_map< DtNodeId, DtPagedNodeStatusPtr > DtPagedNodeStatusMap
Definition: boundingNodeInfo.h:141
unsigned long long DtTerrainIntersectIDType
Definition: terrainInterfaceDefines.h:28
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
std::list< DtNodeBoundingInfoPtr > DtNodeBoundingInfoList
Definition: boundingNodeInfo.h:137
virtual void expandToInclude(const DtExtent &otherExtent)
Expand extent, if necessary, to include input extent.
bool myPendingRemoval
Definition: boundingNodeInfo.h:74
virtual DtExtent extent() const
Definition: boundingNodeInfo.h:42
std::vector< size_t > myNbTriangles
triangles by drawable
Definition: boundingNodeInfo.h:134
DtSphere myBoundingSphere
Definition: boundingNodeInfo.h:52
const unsigned int myNumTriangles
Definition: boundingNodeInfo.h:72
DT_DLL_geometry DtExtent extentOfSphere(const DtSphere &sphere)
const std::string myFilename
Definition: boundingNodeInfo.h:54
std::vector< size_t > myAssociatedDrawableId
Definition: boundingNodeInfo.h:132
DtNodeBoundingInfoPtr myNodeBoundingInfoPtr
Definition: boundingNodeInfo.h:129
Stores the status of a paged in bounding volume.
Definition: boundingNodeInfo.h:58
std::shared_ptr< DtNodeBoundingInfo > DtNodeBoundingInfoPtr
Definition: boundingNodeInfo.h:94
void updateLastUsed(DtTerrainIntersectIDType lastUsed)
Definition: boundingNodeInfo.h:76
DtPagedInExtendInfo(const DtPagedInExtendInfo &rh)
Definition: boundingNodeInfo.h:111
std::shared_ptr< DtPagedNodeStatus > DtPagedNodeStatusPtr
Definition: boundingNodeInfo.h:95
vrf includes
Definition: boundingNodeInfo.h:28
std::size_t hash_value(const DtNodeBoundingInfoPtr &p)
needed for boost::unordered
Definition: boundingNodeInfo.h:98
std::vector< DtNodeId > myAssociatedDrawable
Definition: boundingNodeInfo.h:131
osg::Matrix myMatrix
Definition: boundingNodeInfo.h:130
DtPagedInExtendInfo(const DtNodeBoundingInfoPtr &nodeBoundingInfoPtr, const osg::Matrix &matrix)
Definition: boundingNodeInfo.h:106
virtual std::string filename() const
Definition: boundingNodeInfo.h:47
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
std::atomic< DtTerrainIntersectIDType > myLastUsed
Definition: boundingNodeInfo.h:91
virtual void expandExtent(DtExtent &ext) const
Definition: boundingNodeInfo.h:37
DtPagedInExtendInfo()
Definition: boundingNodeInfo.h:124
boost::unordered_set< DtNodeBoundingInfoPtr > DtNodeBoundingInfoSet
Definition: boundingNodeInfo.h:138
const DtNodeBoundingInfo myBoundingInfo
Definition: boundingNodeInfo.h:71

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)