1 | #ifndef _CullingManager_H__
|
---|
2 | #define _CullingManager_H__
|
---|
3 |
|
---|
4 | #include <iostream>
|
---|
5 | #include <fstream>
|
---|
6 | #include "HierarchyInterface.h"
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 | namespace GtpVisibility {
|
---|
11 |
|
---|
12 | /** This abstract class implements an interface for a specific culling
|
---|
13 | algorithm. The algorithm is either used to render a scene or to make a visibility query.
|
---|
14 | */
|
---|
15 | class CullingManager
|
---|
16 | {
|
---|
17 | public:
|
---|
18 | /** Default constructor.
|
---|
19 | @remark an appropriate hierarchy interface must be provided for the algorithms to
|
---|
20 | work on specific hierarchy
|
---|
21 | */
|
---|
22 | CullingManager();
|
---|
23 | /** Renders the scene using a specific occlusion culling algorithm, e.g., coherent
|
---|
24 | hierarchical culling or stop and wait.
|
---|
25 | */
|
---|
26 | virtual void RenderScene() = 0;
|
---|
27 | /** Sets the hierarchy interface.
|
---|
28 | @param hierarchyInterface
|
---|
29 | @remark the hierarchy interface encapsulates the hierarchy we are working on
|
---|
30 | */
|
---|
31 | void SetHierarchyInterface(HierarchyInterface *hierarchyInterface);
|
---|
32 | /** Sets the threshold for the visibiliy culling algorithm.
|
---|
33 | @param visibilityThreshold number of visible pixels where an object
|
---|
34 | is still considered invisible.
|
---|
35 | */
|
---|
36 | void SetVisibilityThreshold(unsigned int visibilityThreshold);
|
---|
37 |
|
---|
38 | /** Returns number of frustum culled nodes.
|
---|
39 | */
|
---|
40 | unsigned int GetNumFrustumCulledNodes();
|
---|
41 | /** Returns number of occlusion query culled nodes.
|
---|
42 | */
|
---|
43 | unsigned int GetNumQueryCulledNodes();
|
---|
44 | /** Returns number of issued occlusion queries.
|
---|
45 | */
|
---|
46 | unsigned int GetNumQueriesIssued();
|
---|
47 | /** basic initializations on beginning of each frame, e.g.,
|
---|
48 | resets statistics.
|
---|
49 | */
|
---|
50 | void InitFrame(bool visualizeCulledNodes);
|
---|
51 |
|
---|
52 | /** Some visualization of culled nodes are shown, depending
|
---|
53 | on the type of hierarchy.
|
---|
54 | @param visualizeCulledNodes if true, culled nodes are visualized
|
---|
55 | */
|
---|
56 | void SetVisualizeCulledNodes(bool visualizeCulledNodes);
|
---|
57 |
|
---|
58 |
|
---|
59 | protected:
|
---|
60 |
|
---|
61 | unsigned int mNumQueryCulledNodes;
|
---|
62 | unsigned int mNumFrustumCulledNodes;
|
---|
63 | unsigned int mVisibilityThreshold;
|
---|
64 | unsigned int mNumQueriesIssued;
|
---|
65 |
|
---|
66 | HierarchyInterface *mHierarchyInterface;
|
---|
67 | bool mVisualizeCulledNodes;
|
---|
68 |
|
---|
69 | };
|
---|
70 |
|
---|
71 | } // namespace GtpVisibility
|
---|
72 | #endif // CullingManager |
---|