VR-Forces 4.10 Class Documentation
 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) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
10 #include <geometry/sphere.h>
11 #include <boost/shared_ptr.hpp>
12 #include <boost/unordered_map.hpp>
13 #include <boost/unordered_set.hpp>
14 #include <tbb/spin_mutex.h>
15 
16 //Stores information about a paged out bounding volume.
18 {
19  DtNodeBoundingInfo(DtSphere boundingSphere, std::string filename, bool known=false)
20  : myBoundingSphere(boundingSphere)
21  , myOriginalBoundingSphere(boundingSphere)
22  , myFilename(filename)
23  {
24  }
25 
26  virtual void expandExtent(DtExtent& ext) const
27  {
28  ext.expandToInclude(extent());
29  }
30 
31  virtual DtExtent extent() const
32  {
33  return extentOfSphere(myBoundingSphere);
34  }
35 
36  virtual std::string filename() const
37  {
38  return myFilename;
39  }
40 
43  const std::string myFilename;
44 };
45 
48 {
50  DtNodeBoundingInfo boundingInfo,
51  unsigned int numTriangles,
52  DtTerrainIntersectIDType lastUsed = 0)
53  : myBoundingInfo(boundingInfo)
54  , myLastUsed(lastUsed)
55  , myNumTriangles(numTriangles)
56  , myPendingRemoval(false)
57  {
58  }
59 
61  const unsigned int myNumTriangles;
62 
64 
66  {
67  tbb::spin_mutex::scoped_lock lock(myMutex);
68  if (lastUsed > myLastUsed)
69  {
70  myLastUsed = lastUsed;
71  }
72  }
73 
75  {
76  tbb::spin_mutex::scoped_lock lock(myMutex);
77  return myLastUsed;
78  }
79 
80 protected:
81  mutable tbb::spin_mutex myMutex;
83 };
84 
85 typedef DtBoost::shared_ptr<DtNodeBoundingInfo> DtNodeBoundingInfoPtr;
86 typedef DtBoost::shared_ptr<DtPagedNodeStatus> DtPagedNodeStatusPtr;
87 
89 inline std::size_t hash_value(const DtNodeBoundingInfoPtr& p)
90 {
91  boost::hash<DtNodeBoundingInfo*> hasher;
92  return hasher(p.get());
93 }
94 
95 typedef std::list<DtNodeBoundingInfoPtr> DtNodeBoundingInfoList;
96 typedef boost::unordered_set<DtNodeBoundingInfoPtr> DtNodeBoundingInfoSet;
97 typedef boost::unordered_map<DtNodeId, DtNodeBoundingInfoPtr> DtNodeBoundingInfoMap;
98 typedef boost::unordered_map<DtNodeId, DtPagedNodeStatusPtr> DtPagedNodeStatusMap;
99 
DtBoost::shared_ptr< DtNodeBoundingInfo > DtNodeBoundingInfoPtr
Definition: boundingNodeInfo.h:85
DtNodeBoundingInfo(DtSphere boundingSphere, std::string filename, bool known=false)
Definition: boundingNodeInfo.h:19
DtTerrainIntersectIDType lastUsed() const
Definition: boundingNodeInfo.h:74
DtBoost::shared_ptr< DtPagedNodeStatus > DtPagedNodeStatusPtr
Definition: boundingNodeInfo.h:86
boost::unordered_map< DtNodeId, DtNodeBoundingInfoPtr > DtNodeBoundingInfoMap
Definition: boundingNodeInfo.h:97
Definition: sphere.h:22
DtPagedNodeStatus(DtNodeBoundingInfo boundingInfo, unsigned int numTriangles, DtTerrainIntersectIDType lastUsed=0)
Definition: boundingNodeInfo.h:49
const DtSphere myOriginalBoundingSphere
Definition: boundingNodeInfo.h:42
boost::unordered_map< DtNodeId, DtPagedNodeStatusPtr > DtPagedNodeStatusMap
Definition: boundingNodeInfo.h:98
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:95
virtual void expandToInclude(const DtExtent &otherExtent)
Expand extent, if necessary, to include input extent.
bool myPendingRemoval
Definition: boundingNodeInfo.h:63
virtual DtExtent extent() const
Definition: boundingNodeInfo.h:31
DtSphere myBoundingSphere
Definition: boundingNodeInfo.h:41
const unsigned int myNumTriangles
Definition: boundingNodeInfo.h:61
DT_DLL_geometry DtExtent extentOfSphere(const DtSphere &sphere)
const std::string myFilename
Definition: boundingNodeInfo.h:43
DtTerrainIntersectIDType myLastUsed
Definition: boundingNodeInfo.h:82
Stores the status of a paged in bounding volume.
Definition: boundingNodeInfo.h:47
void updateLastUsed(DtTerrainIntersectIDType lastUsed)
Definition: boundingNodeInfo.h:65
Definition: boundingNodeInfo.h:17
std::size_t hash_value(const DtNodeBoundingInfoPtr &p)
needed for boost::unordered
Definition: boundingNodeInfo.h:89
virtual std::string filename() const
Definition: boundingNodeInfo.h:36
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
tbb::spin_mutex myMutex
Definition: boundingNodeInfo.h:81
virtual void expandExtent(DtExtent &ext) const
Definition: boundingNodeInfo.h:26
boost::unordered_set< DtNodeBoundingInfoPtr > DtNodeBoundingInfoSet
Definition: boundingNodeInfo.h:96
const DtNodeBoundingInfo myBoundingInfo
Definition: boundingNodeInfo.h:60

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)