File indexing completed on 2026-09-21 09:16:42
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 int MaxTreeDepth() const { return myMaxTreeDepth; }
0030
0031
0032 int LeafNodeSize() const { return myLeafNodeSize; }
0033
0034
0035 inline bool IsParallel() const { return myIsParallel; }
0036
0037
0038 inline void SetParallel(const bool isParallel) { myIsParallel = isParallel; }
0039
0040 protected:
0041
0042 BVH_BuilderTransient(const int theLeafNodeSize, const int theMaxTreeDepth)
0043 : myMaxTreeDepth(theMaxTreeDepth),
0044 myLeafNodeSize(theLeafNodeSize),
0045 myIsParallel(false)
0046 {
0047 }
0048
0049 protected:
0050 int myMaxTreeDepth;
0051 int myLeafNodeSize;
0052 bool myIsParallel;
0053 };
0054
0055
0056
0057
0058
0059 template <class T, int N>
0060 class BVH_Builder : public BVH_BuilderTransient
0061 {
0062 public:
0063
0064 virtual void Build(BVH_Set<T, N>* theSet,
0065 BVH_Tree<T, N>* theBVH,
0066 const BVH_Box<T, N>& theBox) const = 0;
0067
0068 protected:
0069
0070 BVH_Builder(const int theLeafNodeSize, const int theMaxTreeDepth)
0071 : BVH_BuilderTransient(theLeafNodeSize, theMaxTreeDepth)
0072 {
0073 }
0074
0075
0076 void updateDepth(BVH_Tree<T, N>* theBVH, const int theLevel) const
0077 {
0078 if (theLevel > theBVH->myDepth)
0079 {
0080 theBVH->myDepth = theLevel;
0081 }
0082 }
0083 };
0084
0085 #endif