source: trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp @ 74

Revision 74, 4.2 KB checked in by mattausch, 20 years ago (diff)

added support for release mode

RevLine 
[59]1#include "OgreVisibilityOctreeSceneManager.h"
[74]2#include "OgreVisibilityOptionsManager.h"
[59]3#include <OgreMath.h>
4#include <OgreIteratorWrappers.h>
5#include <OgreRenderSystem.h>
6#include <OgreCamera.h>
7
8#include <windows.h>
9
10namespace Ogre {
11
12//-----------------------------------------------------------------------
13VisibilityOctreeSceneManager::VisibilityOctreeSceneManager(
14        GtpVisibility::VisibilityManager *visManager): mVisibilityManager(visManager)
15{
16        mHierarchyInterface =
17                new OctreeHierarchyInterface(this, mDestRenderSystem);
18
19        //mDisplayNodes = true;
[74]20        mShowBoundingBoxes = true;
21        mShowBoxes = true;
[59]22        //mMaxDepth = 20;
23}
24//-----------------------------------------------------------------------
25VisibilityOctreeSceneManager::~VisibilityOctreeSceneManager()
26{
27        delete mHierarchyInterface;
28}
29//-----------------------------------------------------------------------
30void VisibilityOctreeSceneManager::_renderVisibleObjects()
31{
32        //-- render background
33        clearSpecialCaseRenderQueues();
34        addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
35        addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
36
37        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
38        SceneManager::_renderVisibleObjects( );
39#ifdef GTP_VISIBILITY_MODIFIED_OGRE
40        _deleteRenderedQueueGroups();
41#endif
42
43        //-- render visible objects (i.e., all but overlay)
44        clearSpecialCaseRenderQueues();
45        addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
46        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
47
[74]48        mHierarchyInterface->InitFrame(mOctree, mCameraInProgress);
[59]49        mVisibilityManager->ApplyVisibilityCulling();
50
51#ifdef GTP_VISIBILITY_MODIFIED_OGRE
52        _deleteRenderedQueueGroups();
53#endif
54
55        //-- render rest, e.g., overlay
56        clearSpecialCaseRenderQueues();
57        SceneManager::_renderVisibleObjects();
58        //_deleteRenderedQueueGroups();
59}
60//-----------------------------------------------------------------------
61void VisibilityOctreeSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
62{
63        // must be empty because objects are found and rendered in an interleaved fashion
64        // in _renderVisibibleObjects
65}
66//-----------------------------------------------------------------------
67void VisibilityOctreeSceneManager::_updateSceneGraph(Camera* cam)
68{
69        mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface);
70        mHierarchyInterface->SetRenderSystem(mDestRenderSystem);
71
72#ifdef GTP_VISIBILITY_MODIFIED_OGRE
73    mHierarchyInterface->SetNumOctreeNodes(mNumOctreeNodes);
74#endif
75        OctreeSceneManager::_updateSceneGraph(cam);
76}
77//-----------------------------------------------------------------------
78bool VisibilityOctreeSceneManager::setOption(const String & key, const void * val)
79{
[74]80        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
81                setOption(key, val) || OctreeSceneManager::setOption(key, val);
[59]82}
83//-----------------------------------------------------------------------
84bool VisibilityOctreeSceneManager::getOption(const String & key, void *val)
85{
[74]86        if (key == "NumHierarchyNodes")
87        {
88                * static_cast<unsigned int *>(val) = (unsigned int)mNumOctreeNodes;
89                return true;
90        }
91
92        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
93                getOption(key, val) && OctreeSceneManager::getOption(key, val);
[59]94}
95//-----------------------------------------------------------------------
96bool VisibilityOctreeSceneManager::getOptionValues(const String & key, StringVector  &refValueList)
97{
98        return OctreeSceneManager::getOptionValues( key, refValueList );
99}
100//-----------------------------------------------------------------------
101bool VisibilityOctreeSceneManager::getOptionKeys(StringVector & refKeys)
102{
[74]103        return  VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface).
104                getOptionKeys ( refKeys ) || OctreeSceneManager::getOptionKeys(refKeys);
[59]105}
106//-----------------------------------------------------------------------
107void VisibilityOctreeSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager)
108{
109    mVisibilityManager = visManager;
110}
111//-----------------------------------------------------------------------
112GtpVisibility::VisibilityManager *VisibilityOctreeSceneManager::getVisibilityManager()
113{
114        return mVisibilityManager;
115}
116
117}   // namespace Ogre
Note: See TracBrowser for help on using the repository browser.