source: trunk/VUT/OcclusionCullingSceneManager/src/OgreOcclusionCullingSceneManager.cpp @ 16

Revision 16, 2.3 KB checked in by gametools, 19 years ago (diff)
Line 
1#include "OgreOcclusionCullingSceneManager.h"
2#include "OgreMath.h"
3#include "OgreIteratorWrappers.h"
4#include <windows.h>
5
6namespace Ogre {
7       
8        //-----------------------------------------------------------------------
9        OcclusionCullingSceneManager::OcclusionCullingSceneManager():
10        mFrameID(1)
11        {               
12        }
13
14        //-----------------------------------------------------------------------
15        void OcclusionCullingSceneManager::_renderVisibleObjects(void)
16        {
17                SceneManager::_renderVisibleObjects();
18                //mDistanceQueue.push(mSceneRoot);
19                //Preprocess();
20                //printf("registered my plugin!!\n");
21                //MessageBox( NULL, "myplugin", "this is my plugin", MB_OK | MB_ICONERROR | MB_TASKMODAL);
22                renderCullFrustum();
23
24                //mFrameID ++;
25                //ResetQueries();
26        }
27
28        //-----------------------------------------------------------------------
29        void OcclusionCullingSceneManager::renderCullFrustum()
30        {
31                //RenderQueue::QueueGroupIterator queueIt = getRenderQueue()->_getQueueGroupIterator();
32
33                 //while (queueIt.hasMoreElements())
34                if(! mDistanceQueue.empty())
35                {
36                        SceneNode *node = mDistanceQueue.top();
37                        mDistanceQueue.pop();
38
39                         //walkTree(
40
41                }
42                         /*
43                        HierarchyNode *node = mDistanceQueue.top();
44                        mDistanceQueue.pop();
45       
46                        // interesting for the visualization, so rest and set
47                        node->SetVisible(false);
48                       
49                        // We don't need to know about near plane intersection
50                        // for frustum culling only, but we have to pass a parameter
51                        bool intersectsNearplane;
52                        if(InsideViewFrustum(node, intersectsNearplane))
53                        {
54                                // update node's visited flag => needed for rendering
55                                // so set it also here
56                                node->SetLastVisited(mFrameID);
57                                node->SetVisible(true);
58                                TraverseNode(node);
59                        }
60                }*/
61        }
62
63        //-----------------------------------------------------------------------
64        void OcclusionCullingSceneManager::walkTree(SceneNode *node)
65        {
66                if(node->numChildren() > 0)
67                {
68                        //node->Render();
69                }
70                else // internal node: add children to priority queue for further processing
71                {
72                        Node::ChildNodeIterator it = node->getChildIterator();
73               
74                        while (it.hasMoreElements())
75                        {
76                                SceneNode* sceneChild = static_cast<SceneNode*>(it.getNext());
77                                //getRenderQueue()->addRenderable(sceneChild);
78                mDistanceQueue.push(sceneChild);
79                        }
80                }
81        }
82}       
Note: See TracBrowser for help on using the repository browser.