#include "OgreOcclusionCullingSceneManager.h" #include "OgreMath.h" #include "OgreIteratorWrappers.h" #include namespace Ogre { //----------------------------------------------------------------------- OcclusionCullingSceneManager::OcclusionCullingSceneManager(): mFrameID(1) { } //----------------------------------------------------------------------- void OcclusionCullingSceneManager::_renderVisibleObjects(void) { SceneManager::_renderVisibleObjects(); //mDistanceQueue.push(mSceneRoot); //Preprocess(); //printf("registered my plugin!!\n"); //MessageBox( NULL, "myplugin", "this is my plugin", MB_OK | MB_ICONERROR | MB_TASKMODAL); renderCullFrustum(); //mFrameID ++; //ResetQueries(); } //----------------------------------------------------------------------- void OcclusionCullingSceneManager::renderCullFrustum() { //RenderQueue::QueueGroupIterator queueIt = getRenderQueue()->_getQueueGroupIterator(); //while (queueIt.hasMoreElements()) if(! mDistanceQueue.empty()) { SceneNode *node = mDistanceQueue.top(); mDistanceQueue.pop(); //walkTree( } /* HierarchyNode *node = mDistanceQueue.top(); mDistanceQueue.pop(); // interesting for the visualization, so rest and set node->SetVisible(false); // We don't need to know about near plane intersection // for frustum culling only, but we have to pass a parameter bool intersectsNearplane; if(InsideViewFrustum(node, intersectsNearplane)) { // update node's visited flag => needed for rendering // so set it also here node->SetLastVisited(mFrameID); node->SetVisible(true); TraverseNode(node); } }*/ } //----------------------------------------------------------------------- void OcclusionCullingSceneManager::walkTree(SceneNode *node) { if(node->numChildren() > 0) { //node->Render(); } else // internal node: add children to priority queue for further processing { Node::ChildNodeIterator it = node->getChildIterator(); while (it.hasMoreElements()) { SceneNode* sceneChild = static_cast(it.getNext()); //getRenderQueue()->addRenderable(sceneChild); mDistanceQueue.push(sceneChild); } } } }