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

Revision 18, 2.3 KB checked in by gametools, 20 years ago (diff)

added mouse functionality

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