Changeset 1602


Ignore:
Timestamp:
10/10/06 16:42:41 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r1593 r1602  
    140140        */ 
    141141        void CreateViewCellsGeometry(); 
    142  
     142        void VisualizeViewCells(const bool visualize); 
    143143 
    144144        ////////////////////////////////////////// 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r1597 r1602  
    147147     
    148148    setupTerrainMaterial(); 
    149  
    150149    setupTerrainPages(); 
    151150 
     
    179178    if (mCurrentViewCell && mCurrentViewCell->GetMesh()) 
    180179        { 
    181                 const int id = mCurrentViewCell->GetId(); 
    182                 mViewCellsGeometry[id]->_updateRenderQueue(getRenderQueue()); 
    183         } 
    184  
     180                const bool showSingleViewCell = true; 
     181                if (showSingleViewCell) 
     182                { 
     183                        const int id = mCurrentViewCell->GetId(); 
     184                        mViewCellsGeometry[id]->_updateRenderQueue(getRenderQueue()); 
     185 
     186                        GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, oit_end = mCurrentViewCell->GetPvs().mEntries.end(); 
     187                         
     188                        for (oit = mCurrentViewCell->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
     189                        { 
     190                                OgreMeshInstance *obj = static_cast<OgreMeshInstance *>((*oit).first); 
     191                obj->GetEntity()->_updateRenderQueue(getRenderQueue()); 
     192                        }        
     193                } 
     194                else 
     195                { 
     196                        MovableObjectsMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 
     197                         
     198                        for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 
     199                        { 
     200                                (*mit).second->_updateRenderQueue(getRenderQueue()); 
     201                        }        
     202                } 
     203        } 
     204/* 
    185205    if (mRenderNodesForViz || mRenderNodesContentForViz) 
    186206        { 
     
    206226 
    207227                                // add bounding boxes instead of node itself 
    208                                 //(*it)->_addBoundingBoxToQueue(getRenderQueue()); 
     228                                if (0) 
     229                                        (*it)->_addBoundingBoxToQueue(getRenderQueue()); 
    209230                        } 
    210231 
    211232                        // add renderables itself 
    212                         if (0 && mRenderNodesContentForViz)  
     233                        if (mRenderNodesContentForViz)  
    213234                        { 
    214235                                (*it)->_addToRenderQueue(cam, getRenderQueue(), false); 
    215236                        } 
    216237                } 
    217         }        
     238        }*/ 
    218239} 
    219240//----------------------------------------------------------------------- 
     
    297318                                                                                                                bool onlyShadowCasters) 
    298319{ 
    299         /////////// 
    300         //-- set visibility according to pvs of current view cell 
    301  
    302         UpdatePvs(cam); 
    303  
    304         if (mNormalExecution) 
    305         { 
    306                 OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
    307                 return; 
    308         } 
    309  
    310320        if (mShowVisualization) 
    311321    { 
    312322                ////////////// 
    313323                //-- show visible scene nodes and octree bounding boxes from last frame 
    314  
    315324                PrepareVisualization(cam); 
    316325        } 
     
    330339                // only shadow casters will be rendered in shadow texture pass 
    331340                if (0) mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters); 
     341 
     342                /////////// 
     343                //-- set visibility according to pvs of current view cell 
     344 
     345                UpdatePvs(cam); 
     346 
     347                if (mNormalExecution) 
     348                { 
     349                        OctreeSceneManager::_findVisibleObjects(cam, onlyShadowCasters); 
     350                        //return; 
     351                } 
    332352        } 
    333353                 
     
    339359void OcclusionCullingSceneManager::_renderVisibleObjects() 
    340360{ 
     361         
    341362        if (mNormalExecution) 
    342363        { 
    343364                // the standard octree rendering mode 
    344                 OctreeSceneManager::_renderVisibleObjects(); 
     365                TerrainSceneManager::_renderVisibleObjects(); 
    345366                return; 
    346367        } 
     
    455476                        } 
    456477                } 
    457                 /*const bool mVisualizeViewCells = true; 
    458                 if (mVisualizeViewCells) 
    459                 { 
    460                         MovableObjectsMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 
    461                          
    462                         for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 
    463                         { 
    464                                 (*mit).second->_updateRenderQueue(getRenderQueue()); 
    465                         }        
    466                 }*/ 
    467  
     478                 
    468479                ///////////// 
    469480                //-- now we can render all remaining queue objects 
     
    600611        if (key == "UseViewCells") 
    601612        {  
     613                // only use this option if view cells are available 
    602614                if (mViewCellsLoaded) 
    603615                { 
     
    611623                                mCurrentViewCell = mViewCellsManager->GenerateViewCell(); 
    612624                        } 
    613  
     625                        // view cell corresponding to leaf in the view cell hierarchy 
    614626                        mElementaryViewCell = NULL; 
    615627 
    616                         // if we use view cells, all objects are set to false initially 
     628                        // if we decide use view cells 
     629                        // all objects are set to invisible per default 
    617630                        SetObjectsVisible(!mUseViewCells); 
     631                } 
     632 
     633                return true; 
     634        } 
     635        if (key == "ShowViewCells") 
     636        {  
     637                // only use this option if view cells are available 
     638                if (mViewCellsLoaded) 
     639                { 
     640                        bool showViewCells = *static_cast<const bool *>(val); 
     641                        // if we decide use view cells 
     642                        // all objects are set to invisible per default 
     643                        VisualizeViewCells(showViewCells); 
    618644                } 
    619645 
     
    11921218                getRootSceneNode()->createChildSceneNode()->attachObject(manual); 
    11931219                manual->setQueryFlags(0); // returned by no query 
     1220         
    11941221                // initialy set to invisible 
    1195                 //manual->setVisible(false); 
    1196         } 
    1197 } 
    1198  
     1222                manual->setVisible(false); 
     1223        } 
     1224} 
     1225//------------------------------------------------------------------------- 
     1226void OcclusionCullingSceneManager::VisualizeViewCells(const bool visualize) 
     1227{ 
     1228        MovableObjectsMap::const_iterator mit, mit_end = mViewCellsGeometry.end(); 
     1229                         
     1230        for (mit = mViewCellsGeometry.begin(); mit != mit_end; ++ mit) 
     1231        { 
     1232                (*mit).second->setVisible(visualize); 
     1233        }        
     1234} 
    11991235#if 0 
    12001236//------------------------------------------------------------------------- 
     
    12031239        // first test for scene node, then for octant (part of the hierarchy) 
    12041240        if (!node->mVisibleChildren) 
     1241        { 
    12051242                node->setVisible(false); 
     1243        } 
    12061244 
    12071245        node->getOctant()->mVisibleChildren --; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionQueriesQueryManager.cpp

    r931 r1602  
    3333        bool overlayEnabled = mViewport->getOverlaysEnabled(); 
    3434 
     35        /////////// 
    3536        //-- render scene with item buffer (i.e., objects with their id as color codes) 
    3637//mItemBufferMode = 0; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreTypeConverter.cpp

    r1593 r1602  
    5454                const GtpVisibilityPreprocessor::Vector3 vtx = *vit; 
    5555                manual->position(vtx.x, vtx.y, vtx.z); 
     56                manual->colour(1.0f, 0.0f, 0.0f); 
    5657        } 
    5758 
Note: See TracChangeset for help on using the changeset viewer.