source: trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp @ 59

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

completely changed file structure plus software design

Line 
1#include <OgreMath.h>
2#include <OgreIteratorWrappers.h>
3#include <OgreRenderSystem.h>
4#include <OgreCamera.h>
5#include "OgreVisibilitySceneManager.h"
6#include "OgreSceneNodeHierarchyInterface.h"
7
8//#include <windows.h>
9
10namespace Ogre {
11//namespace GtpVisibility {
12//-----------------------------------------------------------------------
13VisibilitySceneManager::VisibilitySceneManager(GtpVisibility::VisibilityManager *visManager)
14:mVisibilityManager(visManager)
15{
16        mHierarchyInterface = new SceneNodeHierarchyInterface(this, mDestRenderSystem);
17}
18//-----------------------------------------------------------------------
19VisibilitySceneManager::~VisibilitySceneManager()
20{
21        delete mHierarchyInterface;
22}
23//-----------------------------------------------------------------------
24void VisibilitySceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
25{
26        // empty because we have to find objects in _renderVisibleObjects
27}
28//-----------------------------------------------------------------------
29void VisibilitySceneManager::_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        //-- render visible objects (i.e., all but overlay)
42        clearSpecialCaseRenderQueues();
43        addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
44        setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
45
46        mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress);
47
48        mVisibilityManager->ApplyVisibilityCulling();
49
50#ifdef GTP_VISIBILITY_MODIFIED_OGRE
51        _deleteRenderedQueueGroups();
52#endif
53
54        //-- render overlay
55        clearSpecialCaseRenderQueues();
56        SceneManager::_renderVisibleObjects( );
57
58        clearSpecialCaseRenderQueues();
59}
60//-----------------------------------------------------------------------
61void VisibilitySceneManager::_updateSceneGraph(Camera* cam)
62{
63        //mVisibilitySceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
64        mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface);
65        mHierarchyInterface->SetRenderSystem(mDestRenderSystem);
66       
67        //mVisibilitySceneTraverser->setNumQueries((int)mSceneNodes.size());
68       
69        SceneManager::_updateSceneGraph(cam);
70}
71//-----------------------------------------------------------------------
72bool VisibilitySceneManager::setOption(const String & key, const void * val)
73{
74        //mVisibilitySceneTraverser->setOption(key, val);       
75        return SceneManager::setOption(key, val);
76}
77//-----------------------------------------------------------------------
78bool VisibilitySceneManager::getOption(const String & key, void *val)
79{
80        //mVisibilitySceneTraverser->getOption(key, val);
81       
82        return SceneManager::getOption(key, val);
83}
84//-----------------------------------------------------------------------
85bool VisibilitySceneManager::getOptionValues(const String & key, StringVector  &refValueList)
86{
87        return SceneManager::getOptionValues(key, refValueList);
88}
89//-----------------------------------------------------------------------
90bool VisibilitySceneManager::getOptionKeys(StringVector & refKeys)
91{
92        SceneManager::getOptionKeys(refKeys);
93        //mVisibilitySceneTraverser->getOptionKeys( refKeys );
94
95        return true;
96}
97//-----------------------------------------------------------------------
98void VisibilitySceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager)
99{
100        mVisibilityManager = visManager;
101}
102//-----------------------------------------------------------------------
103GtpVisibility::VisibilityManager *VisibilitySceneManager::getVisibilityManager( void )
104{
105        return mVisibilityManager;
106}
107
108//} // namespace GtpVisibility
109} // namespace Ogre
Note: See TracBrowser for help on using the repository browser.