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

Revision 12, 2.1 KB checked in by gametools, 19 years ago (diff)

added occlusionscenemanager

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