source: branches/VUT/DummyModules/Ogre/src/OgreVisibilityOctreeSceneManager.cpp @ 59

Revision 59, 4.0 KB checked in by mattausch, 20 years ago (diff)

completely changed file structure plus software design

Line 
1#include "OgreVisibilityOctreeSceneManager.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//-----------------------------------------------------------------------
12VisibilityOctreeSceneManager::VisibilityOctreeSceneManager(
13        GtpVisibility::VisibilityManager *visManager): mVisibilityManager(visManager)
14{
15        mHierarchyInterface =
16                new OctreeHierarchyInterface(this, mDestRenderSystem);
17
18        //mDisplayNodes = true;
19        //mShowBoundingBoxes = true;
20        //mShowBoxes = true;
21        //mMaxDepth = 20;
22}
23//-----------------------------------------------------------------------
24VisibilityOctreeSceneManager::~VisibilityOctreeSceneManager()
25{
26        delete mHierarchyInterface;
27}
28//-----------------------------------------------------------------------
29void VisibilityOctreeSceneManager::_renderVisibleObjects()
30{
31        //-- render background
32        clearSpecialCaseRenderQueues();
33        addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
34        addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
35
36        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
37        SceneManager::_renderVisibleObjects( );
38#ifdef GTP_VISIBILITY_MODIFIED_OGRE
39        _deleteRenderedQueueGroups();
40#endif
41
42        //-- render visible objects (i.e., all but overlay)
43        clearSpecialCaseRenderQueues();
44        addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
45        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
46
47        mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress);
48        mVisibilityManager->ApplyVisibilityCulling();
49
50#ifdef GTP_VISIBILITY_MODIFIED_OGRE
51        _deleteRenderedQueueGroups();
52#endif
53
54        //-- render rest, e.g., overlay
55        clearSpecialCaseRenderQueues();
56        SceneManager::_renderVisibleObjects();
57        //_deleteRenderedQueueGroups();
58}
59//-----------------------------------------------------------------------
60void VisibilityOctreeSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
61{
62        // must be empty because objects are found and rendered in an interleaved fashion
63        // in _renderVisibibleObjects
64}
65//-----------------------------------------------------------------------
66void VisibilityOctreeSceneManager::_updateSceneGraph(Camera* cam)
67{
68        //mOcclusionOctreeHierarchyInterface->setNumSceneNodes((int)mSceneNodes.size());
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{
80        return /*mVisibilitySceneTraverser->setOption( key, val) || */OctreeSceneManager::setOption( key, val );
81}
82//-----------------------------------------------------------------------
83bool VisibilityOctreeSceneManager::getOption(const String & key, void *val)
84{
85        return /*mVisibilitySceneTraverser->getOption( key, val) || */OctreeSceneManager::getOption(key, val);
86}
87//-----------------------------------------------------------------------
88bool VisibilityOctreeSceneManager::getOptionValues(const String & key, StringVector  &refValueList)
89{
90        return OctreeSceneManager::getOptionValues( key, refValueList );
91}
92//-----------------------------------------------------------------------
93bool VisibilityOctreeSceneManager::getOptionKeys(StringVector & refKeys)
94{
95        return /*mVisibilitySceneTraverser->getOptionKeys ( refKeys ) || */OctreeSceneManager::getOptionKeys(refKeys);
96}
97//-----------------------------------------------------------------------
98void VisibilityOctreeSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager)
99{
100    mVisibilityManager = visManager;
101}
102//-----------------------------------------------------------------------
103GtpVisibility::VisibilityManager *VisibilityOctreeSceneManager::getVisibilityManager()
104{
105        return mVisibilityManager;
106}
107
108}   // namespace Ogre
Note: See TracBrowser for help on using the repository browser.