[59] | 1 | #include "OgreVisibilityBspSceneManager.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 | VisibilityBspSceneManager::VisibilityBspSceneManager(
|
---|
| 13 | GtpVisibility::Manager *visManager): mVisibilityManager(visManager)
|
---|
| 14 | {
|
---|
| 15 | mHierarchyInterface =
|
---|
| 16 | new BspHierarchyInterface(this, mDestRenderSystem);
|
---|
| 17 |
|
---|
| 18 | //mDisplayNodes = true;
|
---|
| 19 | //mShowBoundingBoxes = true;
|
---|
| 20 | //mShowBoxes = true;
|
---|
| 21 | //mMaxDepth = 20;
|
---|
| 22 | }
|
---|
| 23 | //-----------------------------------------------------------------------
|
---|
| 24 | VisibilityBspSceneManager::~VisibilityBspSceneManager()
|
---|
| 25 | {
|
---|
| 26 | delete mHierarchyInterface;
|
---|
| 27 | }
|
---|
| 28 | //-----------------------------------------------------------------------
|
---|
| 29 | void VisibilityBspSceneManager::_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 |
|
---|
| 42 | //-- render visible objects (i.e., all but overlay)
|
---|
| 43 | clearSpecialCaseRenderQueues();
|
---|
| 44 | addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY);
|
---|
| 45 | setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE);
|
---|
| 46 |
|
---|
| 47 | mHierarchyInterface->InitFrame(mSceneRoot, mCameraInProgress);
|
---|
| 48 | mVisibilityManager->ApplyVisibilityCulling();
|
---|
| 49 |
|
---|
| 50 | #ifdef GTP_VISIBILITY_MODIFIED_OGRE
|
---|
| 51 | _deleteRenderedQueueGroups();
|
---|
| 52 | #endif
|
---|
| 53 |
|
---|
| 54 | //-- render rest, e.g., overlay
|
---|
| 55 | clearSpecialCaseRenderQueues();
|
---|
| 56 | SceneManager::_renderVisibleObjects();
|
---|
| 57 | //_deleteRenderedQueueGroups();
|
---|
| 58 | }
|
---|
| 59 | //-----------------------------------------------------------------------
|
---|
| 60 | void VisibilityBspSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)
|
---|
| 61 | {
|
---|
| 62 | // must be empty because objects are found and rendered in an interleaved fashion
|
---|
| 63 | // in _renderVisibibleObjects
|
---|
| 64 | }
|
---|
| 65 | //-----------------------------------------------------------------------
|
---|
| 66 | void VisibilityBspSceneManager::_updateSceneGraph(Camera* cam)
|
---|
| 67 | {
|
---|
| 68 | //mOcclusionBspHierarchyInterface->setNumSceneNodes((int)mSceneNodes.size());
|
---|
| 69 | mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface);
|
---|
| 70 | mHierarchyInterface->SetRenderSystem(mDestRenderSystem);
|
---|
| 71 |
|
---|
| 72 | #ifdef GTP_VISIBILITY_MODIFIED_OGRE
|
---|
| 73 | mHierarchyInterface->SetNumOctreeNodes(mNumOctreeNodes);
|
---|
| 74 | #endif
|
---|
| 75 | BspSceneManager::_updateSceneGraph(cam);
|
---|
| 76 | }
|
---|
| 77 | //-----------------------------------------------------------------------
|
---|
| 78 | bool VisibilityBspSceneManager::setOption(const String & key, const void * val)
|
---|
| 79 | {
|
---|
| 80 | return /*mVisibilitySceneTraverser->setOption( key, val) || */BspSceneManager::setOption( key, val );
|
---|
| 81 | }
|
---|
| 82 | //-----------------------------------------------------------------------
|
---|
| 83 | bool VisibilityBspSceneManager::getOption(const String & key, void *val)
|
---|
| 84 | {
|
---|
| 85 | return /*mVisibilitySceneTraverser->getOption( key, val) || */BspSceneManager::getOption(key, val);
|
---|
| 86 | }
|
---|
| 87 | //-----------------------------------------------------------------------
|
---|
| 88 | bool VisibilityBspSceneManager::getOptionValues(const String & key, StringVector &refValueList)
|
---|
| 89 | {
|
---|
| 90 | return BspSceneManager::getOptionValues( key, refValueList );
|
---|
| 91 | }
|
---|
| 92 | //-----------------------------------------------------------------------
|
---|
| 93 | bool VisibilityBspSceneManager::getOptionKeys(StringVector & refKeys)
|
---|
| 94 | {
|
---|
| 95 | return /*mVisibilitySceneTraverser->getOptionKeys ( refKeys ) || */BspSceneManager::getOptionKeys(refKeys);
|
---|
| 96 | }
|
---|
| 97 | //-----------------------------------------------------------------------
|
---|
| 98 | void VisibilityBspSceneManager::setVisibilityManager(GtpVisibility::Manager *visManager)
|
---|
| 99 | {
|
---|
| 100 | mVisibilityManager = visManager;
|
---|
| 101 | }
|
---|
| 102 | //-----------------------------------------------------------------------
|
---|
| 103 | GtpVisibility::Manager *VisibilityBspSceneManager::getVisibilityManager()
|
---|
| 104 | {
|
---|
| 105 | return mVisibilityManager;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | } // namespace Ogre |
---|