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 |
|
---|
10 | namespace Ogre {
|
---|
11 | //namespace GtpVisibility {
|
---|
12 | //-----------------------------------------------------------------------
|
---|
13 | VisibilitySceneManager::VisibilitySceneManager(GtpVisibility::VisibilityManager *visManager)
|
---|
14 | :mVisibilityManager(visManager)
|
---|
15 | {
|
---|
16 | mHierarchyInterface = new SceneNodeHierarchyInterface(this, mDestRenderSystem);
|
---|
17 | }
|
---|
18 | //-----------------------------------------------------------------------
|
---|
19 | VisibilitySceneManager::~VisibilitySceneManager()
|
---|
20 | {
|
---|
21 | delete mHierarchyInterface;
|
---|
22 | }
|
---|
23 | //-----------------------------------------------------------------------
|
---|
24 | void VisibilitySceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
|
---|
25 | {
|
---|
26 | // empty because we have to find objects in _renderVisibleObjects
|
---|
27 | }
|
---|
28 | //-----------------------------------------------------------------------
|
---|
29 | void 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 | //-----------------------------------------------------------------------
|
---|
61 | void 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 | //-----------------------------------------------------------------------
|
---|
72 | bool VisibilitySceneManager::setOption(const String & key, const void * val)
|
---|
73 | {
|
---|
74 | //mVisibilitySceneTraverser->setOption(key, val);
|
---|
75 | return SceneManager::setOption(key, val);
|
---|
76 | }
|
---|
77 | //-----------------------------------------------------------------------
|
---|
78 | bool VisibilitySceneManager::getOption(const String & key, void *val)
|
---|
79 | {
|
---|
80 | //mVisibilitySceneTraverser->getOption(key, val);
|
---|
81 |
|
---|
82 | return SceneManager::getOption(key, val);
|
---|
83 | }
|
---|
84 | //-----------------------------------------------------------------------
|
---|
85 | bool VisibilitySceneManager::getOptionValues(const String & key, StringVector &refValueList)
|
---|
86 | {
|
---|
87 | return SceneManager::getOptionValues(key, refValueList);
|
---|
88 | }
|
---|
89 | //-----------------------------------------------------------------------
|
---|
90 | bool VisibilitySceneManager::getOptionKeys(StringVector & refKeys)
|
---|
91 | {
|
---|
92 | SceneManager::getOptionKeys(refKeys);
|
---|
93 | //mVisibilitySceneTraverser->getOptionKeys( refKeys );
|
---|
94 |
|
---|
95 | return true;
|
---|
96 | }
|
---|
97 | //-----------------------------------------------------------------------
|
---|
98 | void VisibilitySceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager)
|
---|
99 | {
|
---|
100 | mVisibilityManager = visManager;
|
---|
101 | }
|
---|
102 | //-----------------------------------------------------------------------
|
---|
103 | GtpVisibility::VisibilityManager *VisibilitySceneManager::getVisibilityManager( void )
|
---|
104 | {
|
---|
105 | return mVisibilityManager;
|
---|
106 | }
|
---|
107 |
|
---|
108 | //} // namespace GtpVisibility
|
---|
109 | } // namespace Ogre |
---|