[1239] | 1 | #ifndef SUBDIVISIONCANDIDATE_H
|
---|
| 2 | #define SUBDIVISIONCANDIDATE_H
|
---|
[1237] | 3 |
|
---|
[1239] | 4 |
|
---|
[1237] | 5 | #include "FlexibleHeap.h"
|
---|
| 6 |
|
---|
| 7 | using namespace std;
|
---|
| 8 |
|
---|
| 9 | namespace GtpVisibilityPreprocessor {
|
---|
| 10 |
|
---|
| 11 | /** Candidate for a view space / object space split.
|
---|
| 12 | */
|
---|
| 13 | class SubdivisionCandidate: public Heapable
|
---|
| 14 | {
|
---|
| 15 | public:
|
---|
| 16 |
|
---|
| 17 | enum {OBJECT_SPACE, VIEW_SPACE};
|
---|
| 18 |
|
---|
| 19 | SubdivisionCandidate(): mRenderCostDecrease(0) {};
|
---|
| 20 |
|
---|
[1305] | 21 | virtual ~SubdivisionCandidate() {};
|
---|
[1237] | 22 | virtual void EvalPriority() = 0;
|
---|
| 23 | virtual int Type() const = 0;
|
---|
| 24 | virtual bool GlobalTerminationCriteriaMet() const = 0;
|
---|
| 25 |
|
---|
| 26 | /** Set render cost decrease achieved through this split.
|
---|
| 27 | */
|
---|
[1473] | 28 | inline void SetRenderCostDecrease(const float renderCostDecr)
|
---|
[1237] | 29 | {
|
---|
| 30 | mRenderCostDecrease = renderCostDecr;
|
---|
| 31 | }
|
---|
| 32 |
|
---|
[1473] | 33 | inline float GetRenderCostDecrease() const
|
---|
[1237] | 34 | {
|
---|
| 35 | return mRenderCostDecrease;
|
---|
| 36 | }
|
---|
| 37 |
|
---|
[1297] | 38 | /** Position in queue.
|
---|
| 39 | */
|
---|
[1576] | 40 | inline int GetPosition() const
|
---|
[1297] | 41 | {
|
---|
| 42 | return mPosition;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
[1576] | 45 | inline void SetSplitAxis(const int splitAxis)
|
---|
| 46 | {
|
---|
| 47 | mSplitAxis = splitAxis;
|
---|
| 48 | }
|
---|
| 49 | inline void SetMaxCostMisses(const int misses)
|
---|
| 50 | {
|
---|
| 51 | mMaxCostMisses = misses;
|
---|
| 52 | }
|
---|
| 53 | inline void SetPvsEntriesIncr(const int pvsEntriesIncr)
|
---|
| 54 | {
|
---|
| 55 | mPvsEntriesIncr = pvsEntriesIncr;
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | inline int GetSplitAxis() const
|
---|
| 59 | {
|
---|
| 60 | return mSplitAxis;
|
---|
| 61 | }
|
---|
| 62 | inline int GetMaxCostMisses() const
|
---|
| 63 | {
|
---|
| 64 | return mMaxCostMisses;
|
---|
| 65 | }
|
---|
| 66 | inline int GetPvsEntriesIncr() const
|
---|
| 67 | {
|
---|
| 68 | return mPvsEntriesIncr;
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | protected:
|
---|
| 72 |
|
---|
[1473] | 73 | /// split axis of this plane (0, 1, 2, or 3 if non-axis-aligned)
|
---|
| 74 | int mSplitAxis;
|
---|
| 75 | /// the number of misses of max cost ratio until this split
|
---|
| 76 | int mMaxCostMisses;
|
---|
[1237] | 77 | /// render cost decrease achieved through this split
|
---|
| 78 | float mRenderCostDecrease;
|
---|
[1576] | 79 | /// the decrease of the number of pvs entries
|
---|
| 80 | int mPvsEntriesIncr;
|
---|
[1237] | 81 | };
|
---|
| 82 |
|
---|
| 83 | typedef FlexibleHeap<SubdivisionCandidate *> SplitQueue;
|
---|
[1259] | 84 | typedef vector<SubdivisionCandidate *> SubdivisionCandidateContainer;
|
---|
[1313] | 85 |
|
---|
[1237] | 86 | }
|
---|
| 87 |
|
---|
| 88 | // FLEXIBLEHEAP_H
|
---|
| 89 | #endif
|
---|