[59] | 1 | #ifndef _CoherentHierarchicalCullingManager_H__
|
---|
| 2 | #define _CoherentHierarchicalCullingManager_H__
|
---|
| 3 |
|
---|
| 4 | #include "CullingManager.h"
|
---|
| 5 | #include "HierarchyInterface.h"
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | namespace GtpVisibility
|
---|
| 9 | {
|
---|
| 10 |
|
---|
| 11 | /** Renders the scene with the coherent hierarchical culling algorithm.
|
---|
| 12 | */
|
---|
| 13 | class CoherentHierarchicalCullingManager : public CullingManager
|
---|
| 14 | {
|
---|
| 15 | public:
|
---|
[142] | 16 | CoherentHierarchicalCullingManager();
|
---|
[155] | 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 | */
|
---|
| 20 | CoherentHierarchicalCullingManager(const unsigned int assumedVisibility);
|
---|
| 21 |
|
---|
[59] | 22 | void RenderScene();
|
---|
[2455] | 23 |
|
---|
[155] | 24 | /** Sets assumed visibility (i.e., an estimation for
|
---|
| 25 | how many frames the visibility is considered to be valid).
|
---|
[146] | 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.
|
---|
[142] | 29 | */
|
---|
[2455] | 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.
|
---|
[146] | 34 |
|
---|
[2455] | 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 |
|
---|
[142] | 44 | protected:
|
---|
[2332] | 45 |
|
---|
[147] | 46 | /** Decides if node is considered to be visible depeding on the
|
---|
[142] | 47 | assumed visibility factor.
|
---|
[147] | 48 | @returns if node is considered to be visible
|
---|
[142] | 49 | */
|
---|
[147] | 50 | bool DecideVisible(HierarchyNode *node) const;
|
---|
[146] | 51 |
|
---|
[155] | 52 | /** Skip query for this node.
|
---|
| 53 | */
|
---|
[345] | 54 | void SkipQuery(HierarchyNode *node) const;
|
---|
[155] | 55 |
|
---|
[2332] | 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;
|
---|
[2455] | 61 | |
---|
| 62 | void AssignAssumedVisibility(GtpVisibility::HierarchyNode *node); |
---|
[2332] | 63 |
|
---|
[2455] | 64 |
|
---|
| 65 | //////////////////////
|
---|
| 66 |
|
---|
[1492] | 67 | /** number of steps the visibility is assumed to be valid.
|
---|
| 68 | */
|
---|
| 69 | unsigned int mAssumedVisibility;
|
---|
[155] | 70 |
|
---|
[2455] | 71 | bool mTestGeometryForVisibleLeaves;
|
---|
[2555] | 72 |
|
---|
| 73 | QueryQueue mQueryQueue;
|
---|
[59] | 74 | };
|
---|
| 75 |
|
---|
| 76 | } // namespace GtpVisibility
|
---|
| 77 |
|
---|
| 78 | #endif // CoherentHierarchicalCullingManager_H
|
---|