#ifndef _CoherentHierarchicalCullingPlusPlusManager_H__ #define _CoherentHierarchicalCullingPlusPlusManager_H__ #include "CullingManager.h" #include "HierarchyInterface.h" namespace GtpVisibility { /** Renders the scene with the coherent hierarchical culling algorithm. */ class CoherentHierarchicalCullingPlusPlusManager: public CullingManager { public: CoherentHierarchicalCullingPlusPlusManager(); /** Constructor taking the assumed visibility into account, i.e., the estimation for how many frames the current visibility is considered to be valid */ CoherentHierarchicalCullingPlusPlusManager(const unsigned int assumedVisibility); void RenderScene(); /** Sets assumed visibility (i.e., an estimation for how many frames the visibility is considered to be valid). @param assumedVisibility indicates for how many frames the same visibility is be assumed. if 0, the visibility is tested deterministically for each frame. */ void SetAssumedVisibility(const unsigned int assumedVisibility); /** This is an optimization when issuing the occlusion test. The test is done with actual geometry rather than the bounding box of leave nodes previously marked as visible. @param testGeometry if this optimization should be used @remark this option is only useful for the coherent hierarchical culling algorithm */ void SetTestGeometryForVisibleLeaves(const bool testGeometry); /** See TestGeometryForVisibleLeaves */ bool GetTestGeometryForVisibleLeaves(); protected: /** Decides if node is considered to be visible depeding on the assumed visibility factor. @returns if node is considered to be visible */ bool DecideVisible(HierarchyNode *node) const; /** Skip query for this node. */ void SkipQuery(HierarchyNode *node) const; /** If this node is still valid for traversal in this frame. It is possible that the parent was tested invisible before so this node can be skipped. */ bool NodeInvalid(HierarchyNode *node) const; void AssignAssumedVisibility(GtpVisibility::HierarchyNode *node); void IssueBatchedQuery(HierarchyNodeContainer &nodes); inline void IssueQuery(HierarchyNode *node, const bool testGeometry); ////////////////////// /** number of steps the visibility is assumed to be valid. */ unsigned int mAssumedVisibility; bool mTestGeometryForVisibleLeaves; QueryQueue mQueryQueue; std::queue mVisibleNodes; HierarchyNodeContainer mInvisibleNodes; int mMaxInvisibleNodesSize; }; } // namespace GtpVisibility #endif // CoherentHierarchicalCullingPlusPlusManager_H