#ifndef _OcclusionCullingSceneManager_H__ #define _OcclusionCullingSceneManager_H__ #include "OgreSceneNode.h" #include "OgreSceneManager.h" #include "OgrePrerequisites.h" #include using namespace std; namespace Ogre { /** This class implements the compare operator for the priority queue. a lower distance has a higher value in the queue */ template class myless { public: //bool operator() (HierarchyNode *v1, HierarchyNode *v2) const bool operator() (T v1, T v2) const { return true;//(v1->getSquaredViewDepth(cam) > v2->getSquaredViewDepth(cam)); } }; typedef priority_queue, myless::value_type> > PriorityQueue; /** Class which implements a scene mangager which uses occlusion queries for culling occluded objects */ class OcclusionCullingSceneManager : public SceneManager { public: enum {RENDER_CULL_FRUSTUM, RENDER_STOP_AND_WAIT, RENDER_COHERENT, NUM_RENDERMODES}; OcclusionCullingSceneManager(); /** Overriden from SceneManager. */ void _renderVisibleObjects(void); protected: void walkTree(SceneNode *node); /** renders the scene with view frustum culling only */ void renderCullFrustum(); /** we use a priority queue rather than a renderstack */ PriorityQueue mDistanceQueue; int mFrameID; }; } #endif // OCCLUSIONCULLINGSCENEMANAGER_H