Changeset 103 for trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
- Timestamp:
- 05/18/05 02:06:32 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r101 r103 16 16 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( 17 17 GtpVisibility::VisibilityManager *visManager) 18 : mVisibilityManager(visManager), mUseVisibilityCulling(true), 19 mShowVisualization(false) 18 : mVisibilityManager(visManager), 19 mUseVisibilityCulling(true), 20 mShowVisualization(false), 21 mRenderNodesForViz(false) 20 22 { 21 23 mHierarchyInterface = … … 24 26 //mDisplayNodes = true; 25 27 //mShowBoundingBoxes = true; 28 29 // TODO: set maxdepth to reasonable value 26 30 mMaxDepth = 50; 27 31 } … … 32 36 } 33 37 //----------------------------------------------------------------------- 38 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 39 { 40 mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 41 // does nothing if hierarchical culling is used => 42 // we interleave identification and rendering of objects 43 // in _renderVisibibleObjects 44 if (!mUseVisibilityCulling) 45 { 46 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 47 return; 48 } 49 50 //-- show visibile scene nodes and octree bounding boxes from last frame 51 if (mShowVisualization) 52 { 53 // add player camera for visualization purpose 54 Camera *c; 55 if ((c = getCamera("PlayerCam")) != NULL) 56 { 57 getRenderQueue()->addRenderable(c); 58 } 59 60 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 61 { 62 getRenderQueue()->addRenderable(*it); 63 64 if (mRenderNodesForViz) 65 { 66 (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 67 } 68 } 69 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 70 { 71 getRenderQueue()->addRenderable(*it); 72 } 73 } 74 75 mVisible.clear(); 76 mBoxes.clear(); 77 } 78 //----------------------------------------------------------------------- 34 79 void VisibilityTerrainSceneManager::_renderVisibleObjects() 35 80 { 36 // two cameras (one for culling, one for rendering) 37 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 38 mCullCamera ? getCamera("CullCamera") : NULL); 39 //mVisibilityManager->GetCullingManager()->InitFrame(); 40 81 if (!mShowVisualization) 82 { 83 // two cameras (one for culling, one for rendering) 84 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 85 mCullCamera ? getCamera("CullCamera") : NULL); 86 87 // call initframe to reset culling manager stats 88 mVisibilityManager->GetCullingManager()->InitFrame(); 89 } 90 41 91 // standard terrain scenemanager rendering without hierarchical culling 42 if (!mUseVisibilityCulling || mShowVisualization)92 if (!mUseVisibilityCulling || mShowVisualization) 43 93 { 44 94 TerrainSceneManager::_renderVisibleObjects(); … … 85 135 } 86 136 //----------------------------------------------------------------------- 87 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters)88 {89 // does nothing if hierarchical culling is used =>90 // we interleave identification and rendering of objects91 // in _renderVisibibleObjects92 getRenderQueue()->clear();93 94 if (!mUseVisibilityCulling)95 {96 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters);97 return;98 }99 100 //-- show visibile scene nodes and octree bounding boxes from last frame101 if (mShowVisualization)102 {103 // add cull camera for visualization purpose104 if (mCullCamera)105 {106 Camera *c;107 if ((c = getCamera("CullCamera")) != NULL)108 {109 getRenderQueue()->addRenderable(c);110 }111 }112 113 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it)114 {115 getRenderQueue()->addRenderable(*it);116 }117 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it)118 {119 getRenderQueue()->addRenderable(*it);120 }121 }122 123 mVisible.clear();124 mBoxes.clear();125 }126 //-----------------------------------------------------------------------127 137 void VisibilityTerrainSceneManager::_updateSceneGraph(Camera* cam) 128 138 { 129 // mHierarchyInterface->setNumSceneNodes((int)mSceneNodes.size());130 139 mVisibilityManager->GetCullingManager()->SetHierarchyInterface(mHierarchyInterface); 131 140 mHierarchyInterface->SetRenderSystem(mDestRenderSystem); … … 149 158 return true; 150 159 } 160 if (key == "RenderNodesForViz") 161 { 162 mRenderNodesForViz = (*static_cast<const bool *>(val)); 163 return true; 164 } 151 165 if (key == "SkyBoxEnabled") 152 166 { … … 180 194 } 181 195 //----------------------------------------------------------------------- 182 bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector 196 bool VisibilityTerrainSceneManager::getOptionValues(const String & key, StringVector &refValueList) 183 197 { 184 198 return TerrainSceneManager::getOptionValues( key, refValueList); … … 200 214 return mVisibilityManager; 201 215 } 202 //----------------------------------------------------------------------- 203 void VisibilityTerrainSceneManager::SetShowVisualization(bool showViz) 204 { 205 mShowVisualization = showViz; 206 } 207 /* 208 //----------------------------------------------------------------------- 209 void SetSkyBoxEnabled(bool enabled) 210 { 211 mSkyBoxEnabled = enabled; 212 } 213 //----------------------------------------------------------------------- 214 void SetSkyPlaneEnabled(bool enabled) 215 { 216 mSkyPlaneEnabled = enabled; 217 } 218 //----------------------------------------------------------------------- 219 void SetSkyDomeEnabled(bool enabled) 220 { 221 mSkyDomeEnabled = enabled; 222 } */ 216 223 217 //----------------------------------------------------------------------- 224 218 void VisibilityTerrainSceneManager::WriteLog() … … 236 230 LogManager::getSingleton().logMessage(d.str()); 237 231 } 232 233 238 234 } // namespace Ogre
Note: See TracChangeset
for help on using the changeset viewer.