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

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

completely changed file structure plus software design

Line 
1#include "OgreVisibilityTerrainSceneManager.h"
2#include "OgreOctreeHierarchyInterface.h"
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//namespace GtpVisibility {
12//-----------------------------------------------------------------------
13VisibilityTerrainSceneManager::VisibilityTerrainSceneManager(GtpVisibility::VisibilityManager *visManager)
14:mVisibilityManager(visManager)
15{
16        mHierarchyInterface =
17                new OctreeHierarchyInterface(this, mDestRenderSystem);
18
19        setVisibilityManager(visManager);
20        //mShowBoxes = true;
21        //mDisplayNodes = true;
22        //mShowBoundingBoxes = true;
23        mMaxDepth = 20;
24}
25//-----------------------------------------------------------------------
26VisibilityTerrainSceneManager::~VisibilityTerrainSceneManager()
27{
28        delete mHierarchyInterface;
29}
30//-----------------------------------------------------------------------
31void VisibilityTerrainSceneManager::_renderVisibleObjects()
32{
33        //-- render background
34        clearSpecialCaseRenderQueues();
35        addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
36        addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
37
38        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
39        SceneManager::_renderVisibleObjects();
40#ifdef GTP_VISIBILITY_MODIFIED_OGRE
41        _deleteRenderedQueueGroups();
42#endif
43
44        //-- render visible objects (i.e., all but overlay)
45        clearSpecialCaseRenderQueues();
46        addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
47        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
48
49        mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress);
50
51        mVisibilityManager->ApplyVisibilityCulling();
52#ifdef GTP_VISIBILITY_MODIFIED_OGRE
53        _deleteRenderedQueueGroups();
54#endif
55
56        //-- render overlay
57        clearSpecialCaseRenderQueues();
58        SceneManager::_renderVisibleObjects( );
59}
60//-----------------------------------------------------------------------
61void VisibilityTerrainSceneManager::_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 VisibilityTerrainSceneManager::_updateSceneGraph(Camera* cam)
68{
69        //mHierarchyInterface->setNumSceneNodes((int)mSceneNodes.size());
70        mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface);
71        mHierarchyInterface->SetRenderSystem(mDestRenderSystem);
72#ifdef GTP_VISIBILITY_MODIFIED_OGRE
73    mHierarchyInterface->SetNumOctreeNodes(mNumOctreeNodes);
74#endif
75        TerrainSceneManager::_updateSceneGraph(cam);
76}
77//-----------------------------------------------------------------------
78bool VisibilityTerrainSceneManager::setOption(const String & key, const void * val)
79{
80        return /*mOcclusionOctreeHierarchyInterface->setOption( key, val) || */TerrainSceneManager::setOption( key, val );
81}
82//-----------------------------------------------------------------------
83bool VisibilityTerrainSceneManager::getOption(const String & key, void *val)
84{
85        return /*mOcclusionOctreeHierarchyInterface->getOption( key, val) || */TerrainSceneManager::getOption( key, val ) ;
86}
87//-----------------------------------------------------------------------
88bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector  &refValueList)
89{
90        return TerrainSceneManager::getOptionValues( key, refValueList );
91}
92//-----------------------------------------------------------------------
93bool VisibilityTerrainSceneManager::getOptionKeys(StringVector & refKeys)
94{
95        return /*mOcclusionOctreeHierarchyInterface->getOptionKeys ( refKeys ) ||*/ TerrainSceneManager::getOptionKeys( refKeys );
96}
97//-----------------------------------------------------------------------
98void VisibilityTerrainSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager)
99{
100        mVisibilityManager = visManager;
101}
102//-----------------------------------------------------------------------
103GtpVisibility::VisibilityManager *VisibilityTerrainSceneManager::getVisibilityManager( void )
104{
105        return mVisibilityManager;
106}
107//} // namespace GtpVisibility
108} // namespace Ogre
Note: See TracBrowser for help on using the repository browser.