File indexing completed on 2025-01-18 10:03:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BVH_Builder_HeaderFile
0017 #define BVH_Builder_HeaderFile
0018
0019 #include <BVH_Set.hxx>
0020 #include <BVH_BinaryTree.hxx>
0021
0022
0023
0024 class BVH_BuilderTransient : public Standard_Transient
0025 {
0026 DEFINE_STANDARD_RTTIEXT(BVH_BuilderTransient, Standard_Transient)
0027 public:
0028
0029
0030 Standard_Integer MaxTreeDepth() const { return myMaxTreeDepth; }
0031
0032
0033 Standard_Integer LeafNodeSize() const { return myLeafNodeSize; }
0034
0035
0036 inline Standard_Boolean IsParallel() const
0037 {
0038 return myIsParallel;
0039 }
0040
0041
0042 inline void SetParallel(const Standard_Boolean isParallel)
0043 {
0044 myIsParallel = isParallel;
0045 }
0046
0047 protected:
0048
0049
0050 BVH_BuilderTransient (const Standard_Integer theLeafNodeSize,
0051 const Standard_Integer theMaxTreeDepth)
0052 : myMaxTreeDepth (theMaxTreeDepth),
0053 myLeafNodeSize (theLeafNodeSize),
0054 myIsParallel (Standard_False) {}
0055
0056 protected:
0057
0058 Standard_Integer myMaxTreeDepth;
0059 Standard_Integer myLeafNodeSize;
0060 Standard_Boolean myIsParallel;
0061 };
0062
0063
0064
0065
0066
0067 template<class T, int N>
0068 class BVH_Builder : public BVH_BuilderTransient
0069 {
0070 public:
0071
0072
0073 virtual void Build (BVH_Set<T, N>* theSet,
0074 BVH_Tree<T, N>* theBVH,
0075 const BVH_Box<T, N>& theBox) const = 0;
0076
0077 protected:
0078
0079
0080 BVH_Builder (const Standard_Integer theLeafNodeSize,
0081 const Standard_Integer theMaxTreeDepth)
0082 : BVH_BuilderTransient (theLeafNodeSize, theMaxTreeDepth) {}
0083
0084
0085 void updateDepth (BVH_Tree<T, N>* theBVH,
0086 const Standard_Integer theLevel) const
0087 {
0088 if (theLevel > theBVH->myDepth)
0089 {
0090 theBVH->myDepth = theLevel;
0091 }
0092 }
0093
0094 };
0095
0096 #endif