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:
|
---|
16 | CoherentHierarchicalCullingManager();
|
---|
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 |
|
---|
22 | void RenderScene();
|
---|
23 |
|
---|
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.
|
---|
34 |
|
---|
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 |
|
---|
44 | protected:
|
---|
45 |
|
---|
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;
|
---|
51 |
|
---|
52 | /** Skip query for this node.
|
---|
53 | */
|
---|
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 |
|
---|
65 | //////////////////////
|
---|
66 |
|
---|
67 | /** number of steps the visibility is assumed to be valid.
|
---|
68 | */
|
---|
69 | unsigned int mAssumedVisibility;
|
---|
70 |
|
---|
71 | bool mTestGeometryForVisibleLeaves;
|
---|
72 |
|
---|
73 | QueryQueue mQueryQueue;
|
---|
74 | };
|
---|
75 |
|
---|
76 | } // namespace GtpVisibility
|
---|
77 |
|
---|
78 | #endif // CoherentHierarchicalCullingManager_H
|
---|