1 | #include <OgreVisibilityDotSceneManager.h>
|
---|
2 | #include <OgreMath.h>
|
---|
3 | #include <OgreIteratorWrappers.h>
|
---|
4 | #include <OgreRenderSystem.h>
|
---|
5 | #include <OgreCamera.h>
|
---|
6 |
|
---|
7 | //#include <windows.h>
|
---|
8 |
|
---|
9 | namespace Ogre {
|
---|
10 |
|
---|
11 | //-----------------------------------------------------------------------
|
---|
12 | VisibilityDotSceneManager::VisibilityDotSceneManager(GtpVisibility::VisibilityManager *visManager)
|
---|
13 | :mVisibilityManager(visManager)
|
---|
14 | {
|
---|
15 | mHierarchyInterface =
|
---|
16 | new SceneNodeHierarchyInterface(this, mDestRenderSystem);
|
---|
17 |
|
---|
18 | mShowBoundingBoxes = true;
|
---|
19 |
|
---|
20 | //mDisplayNodes = true;
|
---|
21 | //mShowBoxes = true;
|
---|
22 | }
|
---|
23 | //-----------------------------------------------------------------------
|
---|
24 | VisibilityDotSceneManager::~VisibilityDotSceneManager()
|
---|
25 | {
|
---|
26 | delete mHierarchyInterface;
|
---|
27 | }
|
---|
28 | //-----------------------------------------------------------------------
|
---|
29 | void VisibilityDotSceneManager::_renderVisibleObjects(void)
|
---|
30 | {
|
---|
31 | //-- render background
|
---|
32 | clearSpecialCaseRenderQueues();
|
---|
33 | addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND);
|
---|
34 | addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY);
|
---|
35 |
|
---|
36 | setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE);
|
---|
37 | DotSceneManager::_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 | DotSceneManager::_renderVisibleObjects( );
|
---|
57 |
|
---|
58 | clearSpecialCaseRenderQueues();
|
---|
59 | }
|
---|
60 | //-----------------------------------------------------------------------
|
---|
61 | void VisibilityDotSceneManager::_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 | //-----------------------------------------------------------------------
|
---|
67 | void VisibilityDotSceneManager::_updateSceneGraph(Camera* cam)
|
---|
68 | {
|
---|
69 | //mVisibilitySceneTraverser->setNumSceneNodes((int)mSceneNodes.size());
|
---|
70 | mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface);
|
---|
71 | mHierarchyInterface->SetRenderSystem(mDestRenderSystem);
|
---|
72 |
|
---|
73 | DotSceneManager::_updateSceneGraph(cam);
|
---|
74 | }
|
---|
75 | //-----------------------------------------------------------------------
|
---|
76 | bool VisibilityDotSceneManager::setOption(const String & key, const void * val)
|
---|
77 | {
|
---|
78 | return /*mVisibilitySceneTraverser->setOption( key, val) || */DotSceneManager::setOption(key, val);
|
---|
79 | }
|
---|
80 | //-----------------------------------------------------------------------
|
---|
81 | bool VisibilityDotSceneManager::getOption(const String & key, void *val)
|
---|
82 | {
|
---|
83 | return /*mVisibilitySceneTraverser->getOption( key, val) || */DotSceneManager::getOption(key, val);
|
---|
84 | }
|
---|
85 | //-----------------------------------------------------------------------
|
---|
86 | bool VisibilityDotSceneManager::getOptionValues(const String & key, StringVector &refValueList)
|
---|
87 | {
|
---|
88 | return DotSceneManager::getOptionValues(key, refValueList);
|
---|
89 | }
|
---|
90 | //-----------------------------------------------------------------------
|
---|
91 | bool VisibilityDotSceneManager::getOptionKeys(StringVector & refKeys)
|
---|
92 | {
|
---|
93 | return /*mVisibilitySceneTraverser->getOptionKeys ( refKeys ) || */DotSceneManager::getOptionKeys( refKeys );
|
---|
94 | }
|
---|
95 | //-----------------------------------------------------------------------
|
---|
96 | void VisibilityDotSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager)
|
---|
97 | {
|
---|
98 | mVisibilityManager = visManager;
|
---|
99 | }
|
---|
100 | //-----------------------------------------------------------------------
|
---|
101 | GtpVisibility::VisibilityManager *VisibilityDotSceneManager::getVisibilityManager()
|
---|
102 | {
|
---|
103 | return mVisibilityManager;
|
---|
104 | }
|
---|
105 |
|
---|
106 | //} // namespace GtpVisibility
|
---|
107 | } // namespace Ogre |
---|