Changeset 115 for trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
- Timestamp:
- 05/30/05 03:20:23 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r114 r115 14 14 : 15 15 mVisibilityManager(visManager), 16 mUse VisibilityCulling(true),16 mUseDepthPass(false), 17 17 mShowVisualization(false), 18 18 mRenderNodesForViz(false), 19 19 mVisualizeCulledNodes(false), 20 mRenderTransparentObjects(false) 20 mSkipTransparents(false), 21 mDelayRenderTransparents(true) 21 22 { 22 23 mHierarchyInterface = … … 29 30 // TODO: find reasonable value for max depth 30 31 mMaxDepth = 50; 32 33 CreateDepthPass(); 34 } 35 //----------------------------------------------------------------------- 36 void VisibilityOctreeSceneManager::CreateDepthPass() 37 { 38 MaterialPtr depthMat = MaterialManager::getSingleton().getByName("Visibility/DepthPass"); 39 40 if (depthMat.isNull()) 41 { 42 // Init 43 depthMat = MaterialManager::getSingleton().create( 44 "Visibility/DepthPass", 45 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 46 47 depthMat->createTechnique()->createPass(); 48 mDepthPass = depthMat->getTechnique(0)->getPass(0); 49 mDepthPass->setColourWriteEnabled(false); 50 mDepthPass->setDepthWriteEnabled(true); 51 mDepthPass->setLightingEnabled(false); 52 } 53 else 54 { 55 mDepthPass = depthMat->getTechnique(0)->getPass(0); 56 } 31 57 } 32 58 //----------------------------------------------------------------------- … … 38 64 void VisibilityOctreeSceneManager::_renderVisibleObjects() 39 65 { 40 // two cameras (one for culling, one for rendering) 41 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 42 mCullCamera ? getCamera("CullCamera") : NULL); 43 44 if (!mShowVisualization) 66 if (!mShowVisualization) 45 67 { 46 68 // two cameras (one for culling, one for rendering) 47 69 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 48 mCullCamera ? getCamera("CullCamera") : NULL );70 mCullCamera ? getCamera("CullCamera") : NULL, mDelayRenderTransparents); 49 71 50 72 // call initframe to reset culling manager stats 51 73 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 52 74 } 75 76 // standard terrain scenemanager rendering without hierarchical culling 77 if (!mUseDepthPass || mShowVisualization) 78 { 79 OctreeSceneManager::_renderVisibleObjects(); 80 81 return; 82 } 53 83 54 84 //-- hierarchical culling 55 85 // the objects of different layers (e.g., background, scene, 56 86 // overlay) must be identified and rendered one after another 87 88 mSkipTransparents = false; 57 89 58 90 //-- render background … … 65 97 66 98 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 67 _deleteRenderedQueueGroups( );99 _deleteRenderedQueueGroups(false); 68 100 #endif 69 101 … … 72 104 addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY); 73 105 setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 74 106 107 // render only solids in hierarchical algorithm. 108 // Transparents need sorting, thus we render them afterwards 109 mSkipTransparents = mDelayRenderTransparents; 75 110 76 111 /** 77 112 * the hierarchical culling algorithm 78 113 **/ 114 79 115 mVisibilityManager->ApplyVisibilityCulling(); 80 81 82 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 83 _deleteRenderedQueueGroups(); 84 #endif 85 86 //-- render overlay 116 117 //-- now we can savely render all remaining objects, e.g., transparents, overlay 118 mSkipTransparents = false; 119 87 120 clearSpecialCaseRenderQueues(); 88 121 SceneManager::_renderVisibleObjects(); … … 99 132 // we interleave identification and rendering of objects 100 133 // in _renderVisibibleObjects 101 if (!mUse VisibilityCulling)134 if (!mUseDepthPass) 102 135 { 103 136 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); … … 123 156 if (mRenderNodesForViz || mRenderNodesContentForViz) 124 157 { 125 // change node material so it is better suited for visualization126 /*MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial");158 /* // change node material so it is better suited for visualization 159 MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 127 160 nodeMat->setAmbient(1, 1, 0); 128 161 nodeMat->setLightingEnabled(true); … … 164 197 bool VisibilityOctreeSceneManager::setOption(const String & key, const void * val) 165 198 { 166 if (key == "Use VisibilityCulling")167 { 168 mUse VisibilityCulling= (*static_cast<const bool *>(val));199 if (key == "UseDepthPass") 200 { 201 mUseDepthPass = (*static_cast<const bool *>(val)); 169 202 return true; 170 203 } … … 199 232 return true; 200 233 } 201 234 if (key == "DelayRenderTransparents") 235 { 236 mDelayRenderTransparents = (*static_cast<const bool *>(val)); 237 return true; 238 } 202 239 return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 203 240 setOption(key, val) || OctreeSceneManager::setOption(key, val); … … 240 277 bool doLightIteration, const LightList* manualLightList) 241 278 { 242 if ( mRenderTransparentObjects)279 if (!mSkipTransparents) 243 280 { 244 281 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList);
Note: See TracChangeset
for help on using the changeset viewer.