source: trunk/VUT/obsolete/OcclusionCullingSceneManager/src/OgreOcclusionCullingOctreeSceneManager.cpp @ 52

Revision 52, 3.6 KB checked in by mattausch, 20 years ago (diff)
Line 
1#include "OgreOcclusionCullingOctreeSceneManager.h"
2#include "OgreMath.h"
3#include "OgreIteratorWrappers.h"
4#include "OgreRenderSystem.h"
5#include "OgreCamera.h"
6
7#include <windows.h>
8
9namespace Ogre {
10        //-----------------------------------------------------------------------
11        OcclusionCullingOctreeSceneManager::OcclusionCullingOctreeSceneManager()
12        {
13                mOcclusionCullingOctreeSceneTraverser =
14                        new OcclusionCullingOctreeSceneTraverser(this, mDestRenderSystem);
15
16                //mDisplayNodes = true;
17                //mShowBoundingBoxes = true;
18                //mShowBoxes = true;
19                //mMaxDepth = 20;
20        }
21        //-----------------------------------------------------------------------
22        OcclusionCullingOctreeSceneManager::~OcclusionCullingOctreeSceneManager()
23        {
24                delete mOcclusionCullingOctreeSceneTraverser;
25        }
26        //-----------------------------------------------------------------------
27        void OcclusionCullingOctreeSceneManager::_renderVisibleObjects(void)
28        {
29                //-- render background
30                clearSpecialCaseRenderQueues();
31                addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
32                addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
33       
34                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
35                SceneManager::_renderVisibleObjects( );
36                _deleteRenderedQueueGroups();
37
38                //-- render visible objects (i.e., all but overlay)
39                clearSpecialCaseRenderQueues();
40                addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
41                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
42
43                mOcclusionCullingOctreeSceneTraverser->setSceneRoot(mOctree);
44                mOcclusionCullingOctreeSceneTraverser->renderScene(mCameraInProgress);
45
46                _deleteRenderedQueueGroups();
47
48                //-- render rest, e.g., overlay
49                clearSpecialCaseRenderQueues();
50                SceneManager::_renderVisibleObjects();
51                //_deleteRenderedQueueGroups();
52        }
53        //-----------------------------------------------------------------------
54        void OcclusionCullingOctreeSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
55        {
56                // must be empty because objects are found and rendered in an interleaved fashion
57                // in _renderVisibibleObjects
58        }
59        //-----------------------------------------------------------------------
60        void OcclusionCullingOctreeSceneManager::_updateSceneGraph(Camera* cam)
61        {
62                mOcclusionCullingOctreeSceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
63                mOcclusionCullingOctreeSceneTraverser->setRenderSystem(mDestRenderSystem);
64       
65                mOcclusionCullingOctreeSceneTraverser->setNumOctreeNodes(mNumOctreeNodes);
66
67                OctreeSceneManager::_updateSceneGraph(cam);
68        }
69        //-----------------------------------------------------------------------
70        bool OcclusionCullingOctreeSceneManager::setOption( const String & key, const void * val )
71        {
72                return mOcclusionCullingOctreeSceneTraverser->setOption( key, val) || OctreeSceneManager::setOption( key, val );
73        }
74        //-----------------------------------------------------------------------
75        bool OcclusionCullingOctreeSceneManager::getOption( const String & key, void *val )
76        {
77                return mOcclusionCullingOctreeSceneTraverser->getOption( key, val) || OctreeSceneManager::getOption( key, val ) ;
78        }
79        //-----------------------------------------------------------------------
80        bool OcclusionCullingOctreeSceneManager::getOptionValues( const String & key, StringVector  &refValueList )
81        {
82                return OctreeSceneManager::getOptionValues( key, refValueList );
83        }
84        //-----------------------------------------------------------------------
85        bool OcclusionCullingOctreeSceneManager::getOptionKeys( StringVector & refKeys )
86        {
87                return mOcclusionCullingOctreeSceneTraverser->getOptionKeys ( refKeys ) || OctreeSceneManager::getOptionKeys( refKeys );
88        }
89}       
Note: See TracBrowser for help on using the repository browser.