VR-Forces 4.7 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 
65  void updateLastUsed(DtTerrainIntersectIDType lastUsed)
66  {
67  tbb::spin_mutex::scoped_lock lock(myMutex);
68  if (lastUsed > myLastUsed)
69  {
70  myLastUsed = lastUsed;
71  }
72  }
73 
74  DtTerrainIntersectIDType lastUsed() const
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 

Document ID: Generated on Fri Apr 26 21:53:14 EDT 2019 from SVN revision 197883
Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)