[59] | 1 | #ifndef _CullingManager_H__
|
---|
| 2 | #define _CullingManager_H__
|
---|
| 3 |
|
---|
[2280] | 4 | #include <iostream>
|
---|
| 5 | #include <fstream>
|
---|
[59] | 6 | #include "HierarchyInterface.h"
|
---|
| 7 |
|
---|
[2278] | 8 |
|
---|
[2280] | 9 |
|
---|
[59] | 10 | namespace GtpVisibility {
|
---|
| 11 |
|
---|
| 12 | /** This abstract class implements an interface for a specific culling
|
---|
[2280] | 13 | algorithm. The algorithm is either used to render a scene or to make a visibility query.
|
---|
[59] | 14 | */
|
---|
| 15 | class CullingManager
|
---|
| 16 | {
|
---|
| 17 | public:
|
---|
[74] | 18 | /** Default constructor.
|
---|
| 19 | @remark an appropriate hierarchy interface must be provided for the algorithms to
|
---|
| 20 | work on specific hierarchy
|
---|
[59] | 21 | */
|
---|
[74] | 22 | CullingManager();
|
---|
[59] | 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);
|
---|
[74] | 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);
|
---|
[59] | 37 |
|
---|
[74] | 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();
|
---|
[87] | 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 | */
|
---|
[112] | 50 | void InitFrame(bool visualizeCulledNodes);
|
---|
[74] | 51 |
|
---|
[112] | 52 | /** Some visualization of culled nodes are shown, depending
|
---|
[897] | 53 | on the type of hierarchy.
|
---|
| 54 | @param visualizeCulledNodes if true, culled nodes are visualized
|
---|
[112] | 55 | */
|
---|
| 56 | void SetVisualizeCulledNodes(bool visualizeCulledNodes);
|
---|
| 57 |
|
---|
[2280] | 58 |
|
---|
[59] | 59 | protected:
|
---|
[87] | 60 |
|
---|
[59] | 61 | unsigned int mNumQueryCulledNodes;
|
---|
| 62 | unsigned int mNumFrustumCulledNodes;
|
---|
[74] | 63 | unsigned int mVisibilityThreshold;
|
---|
[87] | 64 | unsigned int mNumQueriesIssued;
|
---|
[59] | 65 |
|
---|
| 66 | HierarchyInterface *mHierarchyInterface;
|
---|
[112] | 67 | bool mVisualizeCulledNodes;
|
---|
[2280] | 68 |
|
---|
[59] | 69 | };
|
---|
[2280] | 70 |
|
---|
[59] | 71 | } // namespace GtpVisibility
|
---|
| 72 | #endif // CullingManager |
---|