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 |
|
---|
10 | namespace Ogre {
|
---|
11 | //namespace GtpVisibility {
|
---|
12 | //-----------------------------------------------------------------------
|
---|
13 | VisibilityTerrainSceneManager::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 | //-----------------------------------------------------------------------
|
---|
26 | VisibilityTerrainSceneManager::~VisibilityTerrainSceneManager()
|
---|
27 | {
|
---|
28 | delete mHierarchyInterface;
|
---|
29 | }
|
---|
30 | //-----------------------------------------------------------------------
|
---|
31 | void 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 | //-----------------------------------------------------------------------
|
---|
61 | void 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 | //-----------------------------------------------------------------------
|
---|
67 | void 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 | //-----------------------------------------------------------------------
|
---|
78 | bool VisibilityTerrainSceneManager::setOption(const String & key, const void * val)
|
---|
79 | {
|
---|
80 | return /*mOcclusionOctreeHierarchyInterface->setOption( key, val) || */TerrainSceneManager::setOption( key, val );
|
---|
81 | }
|
---|
82 | //-----------------------------------------------------------------------
|
---|
83 | bool VisibilityTerrainSceneManager::getOption(const String & key, void *val)
|
---|
84 | {
|
---|
85 | return /*mOcclusionOctreeHierarchyInterface->getOption( key, val) || */TerrainSceneManager::getOption( key, val ) ;
|
---|
86 | }
|
---|
87 | //-----------------------------------------------------------------------
|
---|
88 | bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector &refValueList)
|
---|
89 | {
|
---|
90 | return TerrainSceneManager::getOptionValues( key, refValueList );
|
---|
91 | }
|
---|
92 | //-----------------------------------------------------------------------
|
---|
93 | bool VisibilityTerrainSceneManager::getOptionKeys(StringVector & refKeys)
|
---|
94 | {
|
---|
95 | return /*mOcclusionOctreeHierarchyInterface->getOptionKeys ( refKeys ) ||*/ TerrainSceneManager::getOptionKeys( refKeys );
|
---|
96 | }
|
---|
97 | //-----------------------------------------------------------------------
|
---|
98 | void VisibilityTerrainSceneManager::setVisibilityManager(GtpVisibility::VisibilityManager *visManager)
|
---|
99 | {
|
---|
100 | mVisibilityManager = visManager;
|
---|
101 | }
|
---|
102 | //-----------------------------------------------------------------------
|
---|
103 | GtpVisibility::VisibilityManager *VisibilityTerrainSceneManager::getVisibilityManager( void )
|
---|
104 | {
|
---|
105 | return mVisibilityManager;
|
---|
106 | }
|
---|
107 | //} // namespace GtpVisibility
|
---|
108 | } // namespace Ogre
|
---|