Ignore:
Timestamp:
05/04/06 18:26:23 (18 years ago)
Author:
mattausch
Message:

updated to ogre 1.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r868 r897  
    1010#include <OgreEntity.h> 
    1111#include <OgreSubEntity.h> 
     12#include <OgreMaterialManager.h> 
    1213#include <OgreIteratorWrappers.h> 
    1314#include "VspBspTree.h" 
     
    2223 
    2324//----------------------------------------------------------------------- 
    24 OcclusionCullingSceneManager::OcclusionCullingSceneManager( 
    25                                                         GtpVisibility::VisibilityManager *visManager):  
    26 TerrainSceneManager(), 
     25OcclusionCullingSceneManager::OcclusionCullingSceneManager(const String& name,  
     26                                                        GtpVisibility::VisibilityManager *visManager): 
     27TerrainSceneManager(name), 
    2728mVisibilityManager(visManager),  
    2829mShowVisualization(false), 
     
    3536mIsDepthPassPhase(false), 
    3637mUseItemBuffer(false), 
     38//mUseItemBuffer(true), 
    3739mIsItemBufferPhase(false), 
    3840mCurrentEntityId(1), 
     
    105107        //mItemBufferPass->setAmbient(1, 1, 0); 
    106108} 
     109//------------------------------------------------------------------------- 
     110void OcclusionCullingSceneManager::setWorldGeometry( DataStreamPtr& stream, const String& typeName ) 
     111{ 
     112    // Clear out any existing world resources (if not default) 
     113    if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() !=  
     114        ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) 
     115    { 
     116        ResourceGroupManager::getSingleton().clearResourceGroup( 
     117            ResourceGroupManager::getSingleton().getWorldResourceGroupName()); 
     118    } 
     119        destroyLevelIndexes(); 
     120    mTerrainPages.clear(); 
     121    // Load the configuration 
     122    loadConfig( stream ); 
     123        initLevelIndexes(); 
     124 
     125    // Resize the octree, allow for 1 page for now 
     126    float max_x = mOptions.scale.x * mOptions.pageSize; 
     127    float max_y = mOptions.scale.y; 
     128    float max_z = mOptions.scale.z * mOptions.pageSize; 
     129 
     130        float maxAxis = std::max(max_x, max_y); 
     131        maxAxis = std::max(maxAxis, max_z); 
     132        resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 
     133     
     134    setupTerrainMaterial(); 
     135 
     136    setupTerrainPages(); 
     137 
     138 } 
     139 
    107140//----------------------------------------------------------------------- 
    108141void OcclusionCullingSceneManager::PrepareVisualization(Camera *cam) 
     
    157190} 
    158191//----------------------------------------------------------------------- 
    159 Pass *OcclusionCullingSceneManager::setPass(Pass* pass) 
     192const Pass *OcclusionCullingSceneManager::_setPass(Pass* pass) 
    160193{ 
    161194        if (NORMAL_RENDER_HACK) 
    162195        { 
    163                 return SceneManager::setPass(pass); 
     196                return SceneManager::_setPass(pass); 
    164197        } 
    165198 
     
    217250 
    218251        //-- set actual pass here 
    219         Pass *result = SceneManager::setPass(usedPass); 
     252        const Pass *result = SceneManager::_setPass(usedPass); 
    220253 
    221254 
     
    232265} 
    233266//----------------------------------------------------------------------- 
    234 void OcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, bool onlyShadowCasters) 
     267void OcclusionCullingSceneManager::_findVisibleObjects(Camera* cam, 
     268                                                                                                                bool onlyShadowCasters) 
    235269{ 
    236270        if (NORMAL_RENDER_HACK) 
     
    335369                addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_LATE); 
    336370                addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY); 
    337                          
     371         
    338372                // exclude this queues from hierarchical rendering 
    339373                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
     
    343377                InitVisibilityCulling(mCameraInProgress); 
    344378 
    345          
     379 
    346380                /**  
    347381                * the hierarchical culling algorithm 
     
    366400                 
    367401                mLeavePassesInQueue = 0; 
    368  
     402                 
    369403#if 1    
    370404                // add visible nodes found by the visibility culling algorithm 
     
    495529                if (useArbQueries) 
    496530                { 
    497                         mHierarchyInterface->DeleteQueries(); 
     531                        mHierarchyInterface->ResetQueries(); 
    498532                        mDestRenderSystem->setConfigOption("ArbQueries", "Yes"); 
    499533                } 
    500534                else 
    501535                { 
    502                         mHierarchyInterface->DeleteQueries(); 
     536                        mHierarchyInterface->ResetQueries(); 
    503537                        mDestRenderSystem->setConfigOption("ArbQueries", "No"); 
    504538                } 
    505539        } 
    506  
    507540        return VisibilityOptionsManager(mVisibilityManager, mHierarchyInterface). 
    508541                setOption(key, val) || TerrainSceneManager::setOption(key, val); 
     
    564597//----------------------------------------------------------------------- 
    565598void OcclusionCullingSceneManager::renderObjects( 
    566         const RenderPriorityGroup::TransparentRenderablePassList& objs,  
     599        const QueuedRenderableCollection& objs, 
     600        QueuedRenderableCollection::OrganisationMode om, 
    567601    bool doLightIteration, const LightList* manualLightList) 
    568602{ 
     
    571605        if (NORMAL_RENDER_HACK || !mSkipTransparents) 
    572606        { 
    573                 OctreeSceneManager::renderObjects(objs, doLightIteration, manualLightList); 
     607                OctreeSceneManager::renderObjects(objs, om, doLightIteration, manualLightList); 
    574608        } 
    575609} 
     
    596630} 
    597631//----------------------------------------------------------------------- 
    598 void OcclusionCullingSceneManager::renderQueueGroupObjects(RenderQueueGroup* pGroup) 
     632void OcclusionCullingSceneManager::_renderQueueGroupObjects(RenderQueueGroup* pGroup, 
     633                                                                                                                        QueuedRenderableCollection::OrganisationMode om) 
    599634{ 
    600635        if (NORMAL_RENDER_HACK || !mIsItemBufferPhase) 
    601636        { 
    602                 TerrainSceneManager::renderQueueGroupObjects(pGroup); 
     637                TerrainSceneManager::_renderQueueGroupObjects(pGroup, om); 
    603638                return; 
    604639        } 
    605  
     640#ifdef  ITEM_BUFFER 
     641        //-- item buffer 
    606642        //-- item buffer: render objects using false colors 
    607643 
     
    613649                RenderItemBuffer(groupIt.getNext()); 
    614650        } 
    615 } 
     651#endif // ITEM_BUFFER 
     652} 
     653#ifdef ITEM_BUFFER 
    616654//----------------------------------------------------------------------- 
    617655void OcclusionCullingSceneManager::RenderItemBuffer(RenderPriorityGroup* pGroup) 
    618656{ 
    619657        // Do solids 
    620         RenderPriorityGroup::SolidRenderablePassMap solidObjs = pGroup->_getSolidPasses(); 
     658        QueuedRenderableCollection solidObjs = pGroup->getSolidsBasic();//msz 
    621659 
    622660        // ----- SOLIDS LOOP ----- 
     
    658696        if (mRenderTransparentsForItemBuffer) 
    659697        { 
    660                 RenderPriorityGroup::TransparentRenderablePassList transpObjs =  
    661                         pGroup->_getTransparentPasses(); 
     698                QueuedRenderableCollection transpObjs = pGroup->getTransparents(); //msz 
    662699                RenderPriorityGroup::TransparentRenderablePassList::const_iterator  
    663700                        itrans, itransend; 
     
    713750        } 
    714751 
    715         Pass *usedPass = setPass(mItemBufferPass);  
     752        const Pass *usedPass = _setPass(mItemBufferPass);  
    716753 
    717754 
     
    719756        renderSingleObject(rend, usedPass, false, &nullLightList); 
    720757} 
     758#endif // ITEM_BUFFER 
    721759//----------------------------------------------------------------------- 
    722760GtpVisibility::VisibilityManager *OcclusionCullingSceneManager::GetVisibilityManager() 
     
    749787        mLeavePassesInQueue = 0; 
    750788 
    751         if (!mUseDepthPass && !mUseItemBuffer) 
     789        // if we have the depth pass or use an item buffer, no passes are left in the queue 
     790        if (1 && !mUseDepthPass && !mUseItemBuffer) 
    752791        { 
    753792                if (mShadowTechnique == SHADOWTYPE_STENCIL_ADDITIVE) 
     
    761800 
    762801                        // just render ambient stuff 
    763                         mIlluminationStage = IRS_AMBIENT; 
    764                         getRenderQueue()->setSplitPassesByLightingType(true); 
     802                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     803                        // mIlluminationStage = IRS_AMBIENT;  
    765804                } 
    766805         
     
    820859} 
    821860//----------------------------------------------------------------------- 
    822 void OcclusionCullingSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 
     861void OcclusionCullingSceneManager::renderAdditiveStencilShadowedQueueGroupObjects( 
     862        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    823863{ 
    824864        // only render solid passes during hierarchical culling 
     
    839879 
    840880                        // Render all the ambient passes first, no light iteration, no lights 
    841                         mIlluminationStage = IRS_AMBIENT; 
    842  
    843                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), false, &lightList); 
     881                        /*** msz: no more IRS_AMBIENT, see OgreSceneManager.h ***/ 
     882                        // mIlluminationStage = IRS_AMBIENT; 
     883 
     884                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, false, &lightList); 
    844885                        // Also render any objects which have receive shadows disabled 
    845                         OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPassesNoShadow(), true); 
     886                        OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsNoShadowReceive(), om, true); 
    846887                } 
    847888        } 
    848889        else 
    849890        { 
    850                 OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup); 
    851         } 
    852 } 
    853 //----------------------------------------------------------------------- 
    854 void OcclusionCullingSceneManager::renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* pGroup) 
     891                OctreeSceneManager::renderAdditiveStencilShadowedQueueGroupObjects(pGroup, om); 
     892        } 
     893} 
     894//----------------------------------------------------------------------- 
     895void OcclusionCullingSceneManager::renderModulativeStencilShadowedQueueGroupObjects( 
     896        RenderQueueGroup* pGroup, QueuedRenderableCollection::OrganisationMode om) 
    855897{ 
    856898   if (mIsHierarchicalCulling) 
     
    867909 
    868910                   // Do (shadowable) solids 
    869                    OctreeSceneManager::renderObjects(pPriorityGrp->_getSolidPasses(), true); 
     911                   OctreeSceneManager::renderObjects(pPriorityGrp->getSolidsBasic(), om, true); 
    870912           } 
    871913   } 
    872914   else 
    873915   { 
    874            SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup); 
     916           SceneManager::renderModulativeStencilShadowedQueueGroupObjects(pGroup, om); 
    875917   } 
    876 } 
    877 //------------------------------------------------------------------------- 
    878 void OcclusionCullingSceneManager::setWorldGeometry( const String& filename ) 
    879 { 
    880     // Clear out any existing world resources (if not default) 
    881     if (ResourceGroupManager::getSingleton().getWorldResourceGroupName() !=  
    882         ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) 
    883     { 
    884         ResourceGroupManager::getSingleton().clearResourceGroup( 
    885             ResourceGroupManager::getSingleton().getWorldResourceGroupName()); 
    886     } 
    887     mTerrainPages.clear(); 
    888     // Load the configuration 
    889     loadConfig(filename); 
    890  
    891     // Resize the octree, allow for 1 page for now 
    892     float max_x = mOptions.scale.x * mOptions.pageSize; 
    893     float max_y = mOptions.scale.y; 
    894     float max_z = mOptions.scale.z * mOptions.pageSize; 
    895  
    896         float maxAxis = std::max(max_x, max_y); 
    897         maxAxis = std::max(maxAxis, max_z); 
    898         resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 
    899      
    900     setupTerrainMaterial(); 
    901     setupTerrainPages(); 
    902918} 
    903919 
Note: See TracChangeset for help on using the changeset viewer.