[2555] | 1 | #ifndef _CoherentHierarchicalCullingPlusPlusManager_H__
|
---|
| 2 | #define _CoherentHierarchicalCullingPlusPlusManager_H__
|
---|
[373] | 3 |
|
---|
[2555] | 4 | #include "CullingManager.h"
|
---|
[373] | 5 | #include "HierarchyInterface.h"
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | namespace GtpVisibility
|
---|
| 9 | {
|
---|
| 10 |
|
---|
| 11 | /** Renders the scene with the coherent hierarchical culling algorithm.
|
---|
| 12 | */
|
---|
[2555] | 13 | class CoherentHierarchicalCullingPlusPlusManager: public CullingManager
|
---|
[373] | 14 | {
|
---|
| 15 | public:
|
---|
[2555] | 16 | CoherentHierarchicalCullingPlusPlusManager();
|
---|
[373] | 17 | /** Constructor taking the assumed visibility into account, i.e., the estimation
|
---|
| 18 | for how many frames the current visibility is considered to be valid
|
---|
| 19 | */
|
---|
[2555] | 20 | CoherentHierarchicalCullingPlusPlusManager(const unsigned int assumedVisibility);
|
---|
[373] | 21 |
|
---|
| 22 | void RenderScene();
|
---|
| 23 |
|
---|
[2555] | 24 | /** Sets assumed visibility (i.e., an estimation for
|
---|
| 25 | how many frames the visibility is considered to be valid).
|
---|
| 26 | @param assumedVisibility indicates for how many frames the
|
---|
| 27 | same visibility is be assumed.
|
---|
| 28 | if 0, the visibility is tested deterministically for each frame.
|
---|
| 29 | */
|
---|
| 30 | void SetAssumedVisibility(const unsigned int assumedVisibility);
|
---|
| 31 | /** This is an optimization when issuing the occlusion test.
|
---|
| 32 | The test is done with actual geometry rather than the bounding
|
---|
| 33 | box of leave nodes previously marked as visible.
|
---|
[373] | 34 |
|
---|
[2555] | 35 | @param testGeometry if this optimization should be used
|
---|
| 36 | @remark this option is only useful for the coherent hierarchical culling algorithm
|
---|
| 37 | */
|
---|
| 38 | void SetTestGeometryForVisibleLeaves(const bool testGeometry);
|
---|
| 39 | /** See TestGeometryForVisibleLeaves
|
---|
| 40 | */
|
---|
| 41 | bool GetTestGeometryForVisibleLeaves();
|
---|
| 42 |
|
---|
| 43 |
|
---|
[373] | 44 | protected:
|
---|
| 45 |
|
---|
[2555] | 46 | /** Decides if node is considered to be visible depeding on the
|
---|
| 47 | assumed visibility factor.
|
---|
| 48 | @returns if node is considered to be visible
|
---|
| 49 | */
|
---|
| 50 | bool DecideVisible(HierarchyNode *node) const;
|
---|
[373] | 51 |
|
---|
[2555] | 52 | /** Skip query for this node.
|
---|
[373] | 53 | */
|
---|
[2555] | 54 | void SkipQuery(HierarchyNode *node) const;
|
---|
| 55 |
|
---|
| 56 | /** If this node is still valid for traversal in this frame.
|
---|
| 57 | It is possible that the parent was tested invisible before
|
---|
| 58 | so this node can be skipped.
|
---|
| 59 | */
|
---|
| 60 | bool NodeInvalid(HierarchyNode *node) const;
|
---|
| 61 |
|
---|
| 62 | void AssignAssumedVisibility(GtpVisibility::HierarchyNode *node);
|
---|
| 63 | |
---|
| 64 | void IssueBatchedQuery(HierarchyNodeContainer &nodes); |
---|
| 65 |
|
---|
| 66 | inline void IssueQuery(HierarchyNode *node, const bool testGeometry);
|
---|
| 67 |
|
---|
[2557] | 68 | //void IssueOptimalBatches(QueryHeap &nodes);
|
---|
[2555] | 69 |
|
---|
[2557] | 70 |
|
---|
[2555] | 71 | //////////////////////
|
---|
| 72 |
|
---|
| 73 | /** number of steps the visibility is assumed to be valid.
|
---|
| 74 | */
|
---|
| 75 | unsigned int mAssumedVisibility;
|
---|
| 76 |
|
---|
| 77 | bool mTestGeometryForVisibleLeaves;
|
---|
| 78 |
|
---|
| 79 | QueryQueue mQueryQueue;
|
---|
| 80 |
|
---|
| 81 | std::queue<HierarchyNode *> mVisibleNodes;
|
---|
| 82 | HierarchyNodeContainer mInvisibleNodes;
|
---|
| 83 |
|
---|
| 84 | int mMaxInvisibleNodesSize;
|
---|
[373] | 85 | };
|
---|
| 86 |
|
---|
| 87 | } // namespace GtpVisibility
|
---|
| 88 |
|
---|
[2555] | 89 | #endif // CoherentHierarchicalCullingPlusPlusManager_H
|
---|