Changeset 115 for trunk/VUT/Ogre/src
- Timestamp:
- 05/30/05 03:20:23 (19 years ago)
- Location:
- trunk/VUT/Ogre/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/Ogre/src/OgreOctreeHierarchyInterface.cpp
r113 r115 4 4 #include <OgreLogManager.h> 5 5 #include <OgreStringConverter.h> 6 #include <windows.h> 6 7 7 8 8 namespace Ogre { … … 107 107 108 108 static_cast<OctreeSceneManager *>(mSceneManager)->_renderOctant(mCamera, 109 octant, mOnlyShadowCasters );109 octant, mOnlyShadowCasters, mLeaveTransparentsInQueue); 110 110 111 111 mNumRenderedNodes ++; -
trunk/VUT/Ogre/src/OgrePlatformHierarchyInterface.cpp
r113 r115 10 10 PlatformHierarchyInterface::PlatformHierarchyInterface(SceneManager *sm, RenderSystem *rsys): 11 11 mSceneManager(sm), mRenderSystem(rsys), mSolidBoundingBox(NULL), 12 mCamera(NULL), mCullCamera(NULL), mOnlyShadowCasters(false) 13 { 14 } 15 //----------------------------------------------------------------------- 16 void PlatformHierarchyInterface::Create CulledNodeMaterials()12 mCamera(NULL), mCullCamera(NULL), mOnlyShadowCasters(false), mLeaveTransparentsInQueue(false) 13 { 14 } 15 //----------------------------------------------------------------------- 16 void PlatformHierarchyInterface::CreateNodeVizMaterials() 17 17 { 18 18 // material for frustum culled nodes … … 25 25 mat->createTechnique()->createPass(); 26 26 27 mat->getTechnique(0)->getPass(0)->setAmbient(1, 0,0);27 mat->getTechnique(0)->getPass(0)->setAmbient(1, 0, 0); 28 28 mat->getTechnique(0)->getPass(0)->setLightingEnabled(true); 29 29 //mat->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false); 30 31 30 mat->load(); 32 31 } … … 41 40 mat->createTechnique()->createPass(); 42 41 43 mat->getTechnique(0)->getPass(0)->setAmbient(0, 0,1);42 mat->getTechnique(0)->getPass(0)->setAmbient(0, 0, 1); 44 43 mat->getTechnique(0)->getPass(0)->setLightingEnabled(true); 45 44 mat->load(); 46 45 } 46 47 // material for scene nodes 48 /*mat = MaterialManager::getSingleton().getByName("SceneNodesMaterial"); 49 50 if (mat.isNull()) 51 { 52 mat = MaterialManager::getSingleton().create("SceneNodesMaterial", 53 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 54 mat->createTechnique()->createPass(); 55 56 mat->getTechnique(0)->getPass(0)->setAmbient(1, 1, 0); 57 mat->getTechnique(0)->getPass(0)->setLightingEnabled(true); 58 mat->load(); 59 }*/ 47 60 } 48 61 //----------------------------------------------------------------------- … … 71 84 mRenderSystem->_setWorldMatrix(Ogre::Matrix4::IDENTITY); 72 85 mSceneManager->useRenderableViewProjMode(solidBox); 73 //mSceneManager->setOcclusionPass(solidBox->getTechnique()->getPass(0)); 86 87 // set no depth write, no color, no lighting material 88 //mSceneManager->setPass(solidBox->getTechnique()->getPass(0)); 74 89 SetOcclusionPass(); 75 90 … … 112 127 //----------------------------------------------------------------------- 113 128 void PlatformHierarchyInterface::InitFrame(GtpVisibility::HierarchyNode *root, 114 Camera *cam, Camera *cullCam )129 Camera *cam, Camera *cullCam, bool leaveTransparentsInQueue) 115 130 { 116 131 GtpVisibility::HierarchyInterface::InitFrame(root); 117 132 mPreviousNode = NULL; 118 133 mLeaveTransparentsInQueue = leaveTransparentsInQueue; 119 134 SetCamera(cam); 120 135 … … 128 143 } 129 144 130 Create CulledNodeMaterials();145 CreateNodeVizMaterials(); 131 146 } 132 147 //----------------------------------------------------------------------- … … 151 166 } 152 167 //----------------------------------------------------------------------- 168 bool PlatformHierarchyInterface::UseOptimization() const 169 { 170 /* If camera for culling is different from camera for rendering or only solids 171 will be rendereded => cannot optimize 172 */ 173 return mUseOptimization && (mCamera == mCullCamera); 174 } 175 176 //----------------------------------------------------------------------- 153 177 GtpVisibility::OcclusionQuery *PlatformHierarchyInterface::IssueOcclusionQuery( 154 178 GtpVisibility::HierarchyNode *node, const bool wasVisible) … … 162 186 // if node is leaf and was visible => will be rendered anyway. 163 187 // In this case we can also test with the real geometry. 164 // if camera for culling is different from camera for rendering => cannot optimize 165 if (mUseOptimization && wasVisible && IsLeaf(node) && (mCamera == mCullCamera)) 188 if (UseOptimization() && wasVisible && IsLeaf(node) ) 166 189 { 167 190 //LogManager::getSingleton().logMessage("render node\n"); -
trunk/VUT/Ogre/src/OgrePlatformOcclusionQuery.cpp
r96 r115 1 1 #include "OgrePlatformOcclusionQuery.h" 2 #include <OgreLogManager.h> 2 3 3 4 namespace Ogre { -
trunk/VUT/Ogre/src/OgreSceneNodeHierarchyInterface.cpp
r112 r115 42 42 mNumRenderedNodes ++; 43 43 44 mSceneManager->_renderSceneNode(mCamera, sceneNode );44 mSceneManager->_renderSceneNode(mCamera, sceneNode, mLeaveTransparentsInQueue); 45 45 } 46 46 #endif -
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); -
trunk/VUT/Ogre/src/OgreVisibilitySceneManager.cpp
r112 r115 12 12 //----------------------------------------------------------------------- 13 13 VisibilitySceneManager::VisibilitySceneManager(GtpVisibility::VisibilityManager *visManager) 14 :mVisibilityManager(visManager), mUse VisibilityCulling(true), mShowVisualization(false)14 :mVisibilityManager(visManager), mUseDepthPass(false), mShowVisualization(false) 15 15 { 16 16 mHierarchyInterface = … … 29 29 // we interleave identification and rendering of objects 30 30 // in _renderVisibibleObjects 31 if (!mUse VisibilityCulling)31 if (!mUseDepthPass) 32 32 { 33 33 SceneManager::_findVisibleObjects(cam, onlyShadowCasters); … … 48 48 49 49 // standard terrain scenemanager rendering without hierarchical culling 50 if (!mUse VisibilityCulling|| mShowVisualization)50 if (!mUseDepthPass || mShowVisualization) 51 51 { 52 52 SceneManager::_renderVisibleObjects(); … … 68 68 69 69 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 70 _deleteRenderedQueueGroups( );70 _deleteRenderedQueueGroups(false); 71 71 #endif 72 72 … … 84 84 85 85 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 86 _deleteRenderedQueueGroups();86 //_deleteRenderedQueueGroups(); 87 87 #endif 88 88 … … 136 136 } 137 137 //----------------------------------------------------------------------- 138 GtpVisibility::VisibilityManager *VisibilitySceneManager::getVisibilityManager( void)138 GtpVisibility::VisibilityManager *VisibilitySceneManager::getVisibilityManager() 139 139 { 140 140 return mVisibilityManager; -
trunk/VUT/Ogre/src/OgreVisibilitySceneManagerDll.cpp
r104 r115 27 27 #include <OgreVisibilityOctreeSceneManager.h> 28 28 //#include <OgreVisibilityDotSceneManager.h> 29 29 30 #include <OgreHeightmapTerrainPageSource.h> 30 31 #include <OgreRoot.h> 31 32 #include <OgreLogManager.h> 32 33 #include "VisibilityManager.h" 33 #include "StopAndWaitCullingManager.h"34 34 #include "VisibilityEnvironment.h" 35 35 … … 39 39 namespace Ogre { 40 40 41 // VisibilityDotSceneManager *cullingDotPlugin;42 Visibility OctreeSceneManager *cullingOctreePlugin;43 VisibilityTerrainSceneManager *cullingTerrainPlugin;41 VisibilityOctreeSceneManager *visibilityOctreePlugin; 42 VisibilityTerrainSceneManager *visibilityTerrainPlugin; 43 //VisibilityDotSceneManager *visibilityDotPlugin; 44 44 45 45 HeightmapTerrainPageSource *heightmapTerrainPageSource; … … 48 48 extern "C" void dllStartPlugin(void) 49 49 { 50 //visEnv = new GtpVisibility::VisibilityEnvironment(); 50 51 visManager = new GtpVisibility::VisibilityManager(visEnv); 52 51 53 // Create new scene manager 54 visibilityOctreePlugin = new VisibilityOctreeSceneManager(visManager); 55 visibilityTerrainPlugin = new VisibilityTerrainSceneManager(visManager); 52 56 //occlusionDotPlugin = new VisibilityDotSceneManager(); 53 cullingOctreePlugin = new VisibilityOctreeSceneManager(visManager); 54 cullingTerrainPlugin = new VisibilityTerrainSceneManager(visManager); 57 55 58 heightmapTerrainPageSource = new HeightmapTerrainPageSource(); 59 visibilityTerrainPlugin->registerPageSource("Heightmap", heightmapTerrainPageSource); 56 60 57 cullingTerrainPlugin->registerPageSource("Heightmap", heightmapTerrainPageSource); 61 62 // Register 63 Root::getSingleton().setSceneManager(ST_GENERIC, visibilityOctreePlugin); 64 Root::getSingleton().setSceneManager(ST_EXTERIOR_CLOSE, visibilityTerrainPlugin); 65 //Root::getSingleton().setSceneManager(ST_GENERIC, occlusionDotPlugin); 58 66 59 // Register 60 //Root::getSingleton().setSceneManager( ST_GENERIC, occlusionDotPlugin ); 61 Root::getSingleton().setSceneManager( ST_GENERIC, cullingOctreePlugin ); 62 Root::getSingleton().setSceneManager( ST_EXTERIOR_CLOSE, cullingTerrainPlugin ); 67 LogManager::getSingleton().logMessage("registered akira plugins"); 63 68 } 69 //----------------------------------------------------------------------- 64 70 extern "C" void dllStopPlugin(void) 65 71 { 66 72 delete heightmapTerrainPageSource; 67 //delete occlusionDotPlugin; 68 delete cullingOctreePlugin; 69 delete cullingTerrainPlugin; 73 74 delete visibilityOctreePlugin; 75 delete visibilityTerrainPlugin; 76 //delete occlusionDotPlugin; 77 70 78 delete visManager; 79 //delete visEnv; 71 80 } 72 81 -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r114 r115 9 9 #include <OgreStringConverter.h> 10 10 11 #include <windows.h>12 11 13 12 namespace Ogre { … … 15 14 //----------------------------------------------------------------------- 16 15 VisibilityTerrainSceneManager::VisibilityTerrainSceneManager( 17 GtpVisibility::VisibilityManager *visManager) 18 : mVisibilityManager(visManager), 19 mUseVisibilityCulling(true), 16 GtpVisibility::VisibilityManager *visManager): 17 mVisibilityManager(visManager), 18 mUseDepthPass(false), 19 mIsDepthPass(false), 20 20 mShowVisualization(false), 21 21 mRenderNodesForViz(false), 22 22 mRenderNodesContentForViz(false), 23 23 mVisualizeCulledNodes(false), 24 mRenderTransparentObjects(false) 24 mSkipTransparents(false), 25 mDelayRenderTransparents(true) 25 26 { 26 27 mHierarchyInterface = … … 32 33 // TODO: set maxdepth to reasonable value 33 34 mMaxDepth = 50; 35 // create material for depth pass 36 CreateDepthPass(); 37 } 38 //----------------------------------------------------------------------- 39 void VisibilityTerrainSceneManager::CreateDepthPass() 40 { 41 MaterialPtr depthMat = MaterialManager::getSingleton().getByName("Visibility/DepthPass"); 42 43 if (depthMat.isNull()) 44 { 45 // Init 46 depthMat = MaterialManager::getSingleton().create( 47 "Visibility/DepthPass", 48 ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME); 49 mDepthPass = depthMat->getTechnique(0)->getPass(0); 50 mDepthPass->setColourWriteEnabled(false); 51 mDepthPass->setDepthWriteEnabled(true); 52 mDepthPass->setLightingEnabled(false); 53 } 54 else 55 { 56 mDepthPass = depthMat->getTechnique(0)->getPass(0); 57 } 34 58 } 35 59 //----------------------------------------------------------------------- … … 39 63 } 40 64 //----------------------------------------------------------------------- 65 Pass *VisibilityTerrainSceneManager::setPass(Pass* pass) 66 { 67 // setting vertex program is not efficient 68 //Pass *usedPass = ((mIsDepthPass && !pass->hasVertexProgram()) ? mDepthPass : pass); 69 Pass *usedPass = (mIsDepthPass ? mDepthPass : pass); 70 71 if (mIsDepthPass) 72 { 73 // set vertex program of current pass 74 if (pass->hasVertexProgram()) 75 { 76 mDepthPass->setVertexProgram(pass->getVertexProgramName()); 77 78 if (mDepthPass->hasVertexProgram()) 79 { 80 const GpuProgramPtr& prg = mDepthPass->getVertexProgram(); 81 // Load this program if not done already 82 if (!prg->isLoaded()) 83 prg->load(); 84 // Copy params 85 mDepthPass->setVertexProgramParameters(pass->getVertexProgramParameters()); 86 } 87 } 88 else if (mDepthPass->hasVertexProgram()) 89 { 90 mDepthPass->setVertexProgram(""); 91 } 92 } 93 94 TerrainSceneManager::setPass(usedPass); 95 96 return usedPass; 97 } 98 //----------------------------------------------------------------------- 99 void VisibilityTerrainSceneManager::ShowVisualization(Camera *cam) 100 { 101 // add player camera for visualization purpose 102 try { 103 Camera *c; 104 if ((c = getCamera("PlayerCam")) != NULL) 105 { 106 getRenderQueue()->addRenderable(c); 107 } 108 } 109 catch(...) 110 { 111 // ignore 112 } 113 114 if (mRenderNodesForViz || mRenderNodesContentForViz) 115 { 116 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 117 { 118 if (mRenderNodesForViz) 119 { 120 //getRenderQueue()->addRenderable(*it); 121 // addbounding boxes instead of node itself 122 (*it)->_addBoundingBoxToQueue(getRenderQueue()); 123 } 124 if (mRenderNodesContentForViz) 125 { 126 (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 127 } 128 } 129 } 130 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 131 { 132 getRenderQueue()->addRenderable(*it); 133 } 134 } 135 //----------------------------------------------------------------------- 41 136 void VisibilityTerrainSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 42 137 { 43 // only shadow casters will be rendered in shadow texture pass 44 mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 45 46 // does nothing if hierarchical culling is used => 47 // we interleave identification and rendering of objects 48 // in _renderVisibibleObjects 49 if (!mUseVisibilityCulling) 50 { 51 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 52 return; 53 } 54 55 //-- show visibile scene nodes and octree bounding boxes from last frame 138 //-- show visible scene nodes and octree bounding boxes from last frame 56 139 if (mShowVisualization) 57 140 { 58 // add player camera for visualization purpose 59 try { 60 Camera *c; 61 if ((c = getCamera("PlayerCam")) != NULL) 62 { 63 getRenderQueue()->addRenderable(c); 64 } 65 } 66 catch(...) 67 { 68 // ignore 69 } 141 ShowVisualization(cam); 142 } 143 else 144 { 145 mVisible.clear(); 146 mBoxes.clear(); 70 147 71 if (mRenderNodesForViz || mRenderNodesContentForViz) 72 { 73 // change node material so it is better suited for visualization 74 /*MaterialPtr nodeMat = MaterialManager::getSingleton().getByName("Core/NodeMaterial"); 75 nodeMat->setAmbient(1, 1, 0); 76 nodeMat->setLightingEnabled(true); 77 nodeMat->getTechnique(0)->getPass(0)->removeAllTextureUnitStates();*/ 78 79 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 80 { 81 if (mRenderNodesForViz) 82 { 83 getRenderQueue()->addRenderable(*it); 84 } 85 if (mRenderNodesContentForViz) 86 { 87 (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 88 } 89 } 90 } 91 for (BoxList::iterator it = mBoxes.begin(); it != mBoxes.end(); ++it) 92 { 93 getRenderQueue()->addRenderable(*it); 94 } 95 } 96 97 mVisible.clear(); 98 mBoxes.clear(); 148 // if there is no depth pass => 149 // we interleave identification and rendering of objects 150 // in _renderVisibibleObjects 151 152 // only shadow casters will be rendered in shadow texture pass 153 mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 154 } 99 155 } 100 156 //----------------------------------------------------------------------- 101 157 void VisibilityTerrainSceneManager::_renderVisibleObjects() 102 158 { 103 if (!mShowVisualization) 104 { 105 // two cameras (one for culling, one for rendering) 106 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 107 mCullCamera ? getCamera("CullCamera") : NULL); 108 109 // call initframe to reset culling manager stats 110 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 111 } 112 113 // standard terrain scenemanager rendering without hierarchical culling 114 if (!mUseVisibilityCulling || mShowVisualization) 159 // visualization: apply standard rendering 160 if (mShowVisualization) 115 161 { 116 162 TerrainSceneManager::_renderVisibleObjects(); 117 118 163 return; 119 } 120 164 } 165 166 121 167 //-- hierarchical culling 122 168 // the objects of different layers (e.g., background, scene, 123 169 // overlay) must be identified and rendered one after another 124 170 125 //-- render background 171 bool leaveTransparentsInQueue = mDelayRenderTransparents && !mUseDepthPass; 172 173 // possible two cameras (one for culling, one for rendering) 174 mHierarchyInterface->InitFrame(mOctree, mCameraInProgress, 175 mCullCamera ? getCamera("CullCamera") : NULL, 176 leaveTransparentsInQueue); 177 178 // call initframe to reset culling manager stats 179 mVisibilityManager->GetCullingManager()->InitFrame(mVisualizeCulledNodes); 180 181 mSkipTransparents = false; 182 183 //-- render background, in case there is one 126 184 clearSpecialCaseRenderQueues(); 127 185 addSpecialCaseRenderQueue(RENDER_QUEUE_BACKGROUND); 128 186 addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_EARLY); 129 130 187 setSpecialCaseRenderQueueMode(SceneManager::SCRQM_INCLUDE); 188 131 189 SceneManager::_renderVisibleObjects(); 132 190 191 133 192 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 134 _deleteRenderedQueueGroups( );193 _deleteRenderedQueueGroups(false); 135 194 #endif 136 195 137 //-- render visible objects (i.e., all but overlay )196 //-- render visible objects (i.e., all but overlay and skies late) 138 197 clearSpecialCaseRenderQueues(); 198 addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_LATE); 139 199 addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY); 140 200 setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 141 201 142 202 // transparents are skipped from hierarchical rendering 203 // => they need sorting, thus we render them afterwards 204 mSkipTransparents = mDelayRenderTransparents; 205 206 // set state for depth pass 207 mIsDepthPass = mUseDepthPass; 208 143 209 /** 144 * the hierarchical culling algorithm 210 * the hierarchical culling algorithm 211 * for depth pass: will just find objects and update depth buffer 212 * for delayed rendering: will render all but transparents 145 213 **/ 214 146 215 mVisibilityManager->ApplyVisibilityCulling(); 147 216 148 217 149 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 150 _deleteRenderedQueueGroups(); 151 #endif 152 153 //-- render overlay 218 // for depth pass: add visible nodes found with the visibility culling 219 if (mUseDepthPass) 220 { 221 for (NodeList::iterator it = mVisible.begin(); it != mVisible.end(); ++it) 222 { 223 (*it)->_addToRenderQueue(mCameraInProgress, getRenderQueue(), false); 224 } 225 mIsDepthPass = false; 226 } 227 mSkipTransparents = false; 228 229 //-- now we can render all remaining queue objects 230 // for depth pass: all 231 // for delayed rendering: transparents, overlay 154 232 clearSpecialCaseRenderQueues(); 155 233 SceneManager::_renderVisibleObjects(); … … 171 249 bool VisibilityTerrainSceneManager::setOption(const String & key, const void * val) 172 250 { 173 if (key == "Use VisibilityCulling")174 { 175 mUse VisibilityCulling= (*static_cast<const bool *>(val));251 if (key == "UseDepthPass") 252 { 253 mUseDepthPass = (*static_cast<const bool *>(val)); 176 254 return true; 177 255 } … … 209 287 { 210 288 mVisualizeCulledNodes = (*static_cast<const bool *>(val)); 289 return true; 290 } 291 if (key == "DelayRenderTransparents") 292 { 293 mDelayRenderTransparents = (*static_cast<const bool *>(val)); 211 294 return true; 212 295 } … … 266 349 bool doLightIteration, const LightList* manualLightList) 267 350 { 268 if ( mRenderTransparentObjects)351 if (!mSkipTransparents) 269 352 { 270 353 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList);
Note: See TracChangeset
for help on using the changeset viewer.