1 | #ifndef _CoherentHierarchicalCullingPlusPlusManager_H__
|
---|
2 | #define _CoherentHierarchicalCullingPlusPlusManager_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 CoherentHierarchicalCullingPlusPlusManager: public CullingManager
|
---|
14 | {
|
---|
15 | public:
|
---|
16 | CoherentHierarchicalCullingPlusPlusManager();
|
---|
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 | CoherentHierarchicalCullingPlusPlusManager(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 | void IssueBatchedQuery(HierarchyNodeContainer &nodes); |
---|
65 |
|
---|
66 | inline void IssueQuery(HierarchyNode *node, const bool testGeometry);
|
---|
67 |
|
---|
68 |
|
---|
69 | //////////////////////
|
---|
70 |
|
---|
71 | /** number of steps the visibility is assumed to be valid.
|
---|
72 | */
|
---|
73 | unsigned int mAssumedVisibility;
|
---|
74 |
|
---|
75 | bool mTestGeometryForVisibleLeaves;
|
---|
76 |
|
---|
77 | QueryQueue mQueryQueue;
|
---|
78 |
|
---|
79 | std::queue<HierarchyNode *> mVisibleNodes;
|
---|
80 | HierarchyNodeContainer mInvisibleNodes;
|
---|
81 |
|
---|
82 | int mMaxInvisibleNodesSize;
|
---|
83 | };
|
---|
84 |
|
---|
85 | } // namespace GtpVisibility
|
---|
86 |
|
---|
87 | #endif // CoherentHierarchicalCullingPlusPlusManager_H
|
---|