source: trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h @ 19

Revision 19, 1.6 KB checked in by gametools, 20 years ago (diff)

doing some basic traversal

Line 
1#ifndef _OcclusionCullingSceneManager_H__
2#define _OcclusionCullingSceneManager_H__
3
4#include "OgreSceneNode.h"
5#include "OgreSceneManager.h"
6#include "OgrePrerequisites.h"
7#include <queue>
8
9using namespace std;
10
11namespace Ogre {
12        /**
13                This class implements the compare operator for the priority queue.
14                a lower distance has a higher value in the queue
15        */
16        template <typename T> class myless
17        {
18        public:
19                myless(Camera *cam) { mCamera = cam; }
20                //bool operator() (HierarchyNode *v1, HierarchyNode *v2) const
21                bool operator() (T v1, T v2) const
22                {
23                        return v1->getSquaredViewDepth(mCamera) > v2->getSquaredViewDepth(mCamera);
24                }
25        private:
26                Camera *mCamera;
27        };
28
29        typedef priority_queue<SceneNode *, vector<SceneNode *>, myless<vector<SceneNode *>::value_type> > PriorityQueue;
30
31        /**
32                Class which implements a scene mangager which uses occlusion queries for culling occluded objects
33        */
34        class OcclusionCullingSceneManager : public SceneManager
35        {
36        public:
37                enum {RENDER_CULL_FRUSTUM, RENDER_STOP_AND_WAIT, RENDER_COHERENT, NUM_RENDERMODES};
38
39                OcclusionCullingSceneManager();
40       
41                /** Overriden from SceneManager. */
42                void _renderVisibleObjects(void);
43                void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
44       
45        protected:
46
47                void renderZPass();
48                void traverseNode(SceneNode *node);
49                void renderSceneNode(SceneNode *node);
50                /** renders the scene with view frustum culling only */
51                void renderCullFrustum();
52
53                /** we use a priority queue rather than a renderstack */
54                PriorityQueue *mDistanceQueue;
55                // RenderQueue* mDistanceQueue;
56
57                int mFrameID;   
58        };
59
60}
61#endif // OCCLUSIONCULLINGSCENEMANAGER_H
Note: See TracBrowser for help on using the repository browser.