BucketSizeMaxLevelSubdivisionTreeStrategy.h
Go to the documentation of this file.
1#ifndef GfxTL__BUCKETSIZEMAXLEVELSUBDIVISIONTREESTRATEGY_HEADER__
2#define GfxTL__BUCKETSIZEMAXLEVELSUBDIVISIONTREESTRATEGY_HEADER__
3
4namespace GfxTL
5{
6 template <class InheritedStrategyT>
8 {
9 typedef typename InheritedStrategyT::value_type value_type;
10
11 struct CellData : public InheritedStrategyT::CellData
12 {
13 };
14
15 template <class BaseT>
16 class StrategyBase : public InheritedStrategyT::template StrategyBase<BaseT>
17 {
18 public:
19 typedef typename InheritedStrategyT::template StrategyBase<BaseT> BaseType;
20 typedef typename BaseType::CellType CellType;
21
22 StrategyBase() : m_maxBucketSize(10), m_maxLevel(20)
23 {
24 }
25
26 unsigned int&
28 {
29 return m_maxBucketSize;
30 }
31
32 const unsigned int
34 {
35 return m_maxBucketSize;
36 }
37
38 unsigned int&
40 {
41 return m_maxLevel;
42 }
43
44 const unsigned int
46 {
47 return m_maxLevel;
48 }
49
50 protected:
51 template <class BuildInformationT>
52 bool
53 ShouldSubdivide(const CellType& cell, const BuildInformationT& bi) const
54 {
55 return cell.Size() > m_maxBucketSize && bi.Level() < m_maxLevel;
56 }
57
58 private:
59 unsigned int m_maxBucketSize;
60 unsigned int m_maxLevel;
61 };
62 };
63}; // namespace GfxTL
64
65#endif
bool ShouldSubdivide(const CellType &cell, const BuildInformationT &bi) const
Definition AABox.h:10