Changeset 1816


Ignore:
Timestamp:
11/28/06 12:50:34 (18 years ago)
Author:
mattausch
Message:

changed scenemanager: options are directly given to it

Location:
GTP/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.cpp

    r1617 r1816  
    18681868        initOverlayElement(&mThresholdInfo, ext, "Threshold", top, ": 0"); top += vert_space; 
    18691869        initOverlayElement(&mTestGeometryForVisibleLeavesInfo, ext,  
    1870                 "TestGeometryForVisibleLeaves", top, ": true"); top += vert_space; 
     1870                                           "TestGeometryForVisibleLeaves", top, ": true"); top += vert_space; 
    18711871        initOverlayElement(&mUseDepthPassInfo, ext, "UseDepthPass", top, ": false"); top += vert_space; 
    18721872        initOverlayElement(&mAssumedVisibilityInfo, ext, "AssumedVisibility", top, ": 0"); top += vert_space; 
     
    19161916        initOverlayElement(&mQueryPatchVisibilityInfo , ext, "PatchVisibility", top,    ": 0"); top += vert_space; 
    19171917 
    1918  
    1919         OverlayElement *queryPanel = OverlayManager::getSingleton(). 
    1920                 getOverlayElement("Example/Visibility/Query/QueryPanel"); 
     1918        OverlayElement *queryPanel =  
     1919                OverlayManager::getSingleton().getOverlayElement("Example/Visibility/Query/QueryPanel"); 
    19211920 
    19221921        queryPanel->setHeight(top + border_height); 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp

    r1609 r1816  
    192192        } 
    193193 
    194          
    195194        val = config.getSetting("ViewCells"); 
    196195 
     
    246245        } 
    247246 
    248         ///////////////////////// 
     247        ///////////// 
    249248        // setup scene 
    250249 
    251         //-- load the scene from specified file 
    252250        if (!LoadScene(mFilename)) 
    253251        { 
     
    380378                                                                                                const int index) 
    381379{ 
    382  
    383  
    384  
    385380        mIVReader = new IVReader(); 
    386381 
    387382        Timer *timer = PlatformManager::getSingleton().createTimer(); 
    388383        timer->reset(); 
     384 
    389385        if (1) 
    390386        { 
     
    405401                mIVReader->collapse(); 
    406402                OGRE_DELETE(mIVReader); 
    407  
    408403 
    409404                std::stringstream d;  
     
    458453void TestCullingTerrainApplication::createScene() 
    459454{ 
     455        ///////// 
    460456        //-- load scene 
    461457        loadConfig("terrainCulling.cfg"); 
     
    505501        } 
    506502         
    507  
    508         setupGui(); //-- CEGUI setup 
     503        //////  
     504        //-- CEGUI setup 
     505        setupGui(); 
    509506 
    510507        // occluder plane to test visibility 
     
    529526        mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); 
    530527 
    531         //////////////77 
     528        ////////////// 
    532529        //-- terrain content setup 
    533530 
     
    786783                { 
    787784                        // load collada files 
    788                         // load iv files 
    789785                        LoadSceneCollada(fn, mSceneMgr->getRootSceneNode(), i);          
    790786                } 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.h

    r1609 r1816  
    200200        StaticGeometry *mStaticGeometry; 
    201201     
    202  
    203202private: 
     203 
    204204        void chooseSceneManager(void); 
    205205}; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOcclusionCullingSceneManager.h

    r1616 r1816  
    104104        */ 
    105105#if 1 
    106         virtual void setWorldGeometry( DataStreamPtr& stream, const String& typeName ); 
     106        virtual void setWorldGeometry(DataStreamPtr& stream, const String& typeName); 
    107107#endif 
    108108         
     
    141141        void CreateViewCellsGeometry(); 
    142142        void VisualizeViewCells(const bool visualize); 
     143 
     144        bool LoadSceneIV(const String &filename,  
     145                                         SceneNode *root,  
     146                                         const int index); 
     147 
     148        bool LoadScene(const String &filename); 
     149 
     150        void loadConfig(DataStreamPtr& stream); 
    143151 
    144152        ////////////////////////////////////////// 
     
    231239 
    232240        bool mViewCellsGeometryLoaded; 
     241 
     242        bool mShowTerrain; 
    233243}; 
    234244 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchySceneManager.cpp

    r1595 r1816  
    13361336void BvHierarchySceneManager::applyViewCellPvs(GtpVisibilityPreprocessor::ViewCell *vc,  
    13371337                                                                                                        const bool load) 
    1338 {       // NOTE: should not happen, rather apply view cell  
    1339         // representing unbounded space then 
     1338{        
    13401339        if (!vc)  
    1341         {       // set everything visible for savety 
     1340        {        
     1341                // set everything visible for savety 
     1342 
     1343                // NOTE: should not happen, rather apply view cell  
     1344                // representing unbounded space then 
    13421345                SetObjectsVisible(true); 
    13431346                return; 
    13441347        } 
    13451348 
    1346         GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, 
    1347                 oit_end = vc->GetPvs().mEntries.end(); 
    1348  
    1349         ////////////// 
    1350         //-- PVS of view cell 
    1351         for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
    1352         { 
    1353                 if (!(*oit).first) continue; 
    1354  
    1355                 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>((*oit).first); 
    1356                 omi->GetEntity()->setVisible(load); 
    1357                 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     1349        ////////// 
     1350        //-- set PVS of view cell visible 
     1351        GtpVisibilityPreprocessor::ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
     1352 
     1353        while (pit.HasMoreEntries()) 
     1354        {                
     1355                GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 
     1356 
     1357                if (entry.mObject) 
     1358                { 
     1359                        OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry.mObject); 
     1360                        omi->GetEntity()->setVisible(load); 
     1361                } 
    13581362        } 
    13591363} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTerrainSceneManager.cpp

    r1273 r1816  
    302302        // set the page source 
    303303        selectPageSource(pageSourceName, optlist); 
    304  
    305  
    306304} 
    307305//------------------------------------------------------------------------- 
     
    514512} 
    515513//------------------------------------------------------------------------- 
    516 void KdTerrainSceneManager::setWorldGeometry(DataStreamPtr& stream, const String& typeName ) 
     514void KdTerrainSceneManager::setWorldGeometry(DataStreamPtr& stream, const String& typeName) 
    517515{ 
    518516        // Clear out any existing world resources (if not default) 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp

    r1595 r1816  
    13331333void KdTreeSceneManager::applyViewCellPvs(GtpVisibilityPreprocessor::ViewCell *vc,  
    13341334                                                                                                        const bool load) 
    1335 {       // NOTE: should not happen, rather apply view cell representing unbounded space then 
     1335{        
    13361336        if (!vc)  
    13371337        {        
    13381338                // set everything visible for savety 
     1339 
     1340                // NOTE: should not happen, rather apply view cell  
     1341                // representing unbounded space then 
    13391342                SetObjectsVisible(true); 
    1340  
    13411343                return; 
    13421344        } 
    13431345 
    1344         GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, 
    1345                 oit_end = vc->GetPvs().mEntries.end(); 
    1346  
    1347         //-- PVS of view cell 
    1348         for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
    1349         { 
    1350                 if (!(*oit).first) continue; 
    1351  
    1352                 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>((*oit).first); 
    1353                 omi->GetEntity()->setVisible(load); 
    1354                 //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     1346        ////////// 
     1347        //-- set PVS of view cell visible 
     1348        GtpVisibilityPreprocessor::ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
     1349 
     1350        while (pit.HasMoreEntries()) 
     1351        {                
     1352                GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 
     1353 
     1354                if (entry.mObject) 
     1355                { 
     1356                        OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry.mObject); 
     1357                        omi->GetEntity()->setVisible(load); 
     1358                } 
    13551359        } 
    13561360} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp

    r1676 r1816  
    2222#include <OgreManualObject.h> 
    2323#include "IntersectableWrapper.h" 
     24#include "IVReader.h" 
     25 
    2426 
    2527namespace Ogre { 
     
    5456mNormalExecution(false), 
    5557mShowViewCells(false), 
    56 mViewCellsGeometryLoaded(false) 
    57 { 
    58         Ogre::LogManager::getSingleton().logMessage("creating occlusion culling scene manager"); 
     58mViewCellsGeometryLoaded(false), 
     59mShowTerrain(false) 
     60{ 
     61        Ogre::LogManager::getSingleton(). 
     62                logMessage("creating occlusion culling scene manager"); 
    5963 
    6064        mHierarchyInterface = new OctreeHierarchyInterface(this, mDestRenderSystem); 
     
    126130//------------------------------------------------------------------------- 
    127131#if 1 
    128 void OcclusionCullingSceneManager::setWorldGeometry( DataStreamPtr& stream, const String& typeName ) 
     132void OcclusionCullingSceneManager::setWorldGeometry(DataStreamPtr& stream,  
     133                                                                                                        const String& typeName) 
    129134{ 
    130135    // Clear out any existing world resources (if not default) 
     
    141146    // Load the configuration 
    142147    loadConfig(stream); 
    143         initLevelIndexes(); 
    144  
    145     // Resize the octree, allow for 1 page for now 
    146     float max_x = mOptions.scale.x * mOptions.pageSize; 
    147     float max_y = mOptions.scale.y; 
    148     float max_z = mOptions.scale.z * mOptions.pageSize; 
    149  
    150         float maxAxis = std::max(max_x, max_y); 
    151         maxAxis = std::max(maxAxis, max_z); 
    152         resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 
     148 
     149        if (mShowTerrain) 
     150        { 
     151                initLevelIndexes(); 
     152 
     153                // Resize the octree, allow for 1 page for now 
     154                float max_x = mOptions.scale.x * mOptions.pageSize; 
     155                float max_y = mOptions.scale.y; 
     156                float max_z = mOptions.scale.z * mOptions.pageSize; 
     157 
     158                float maxAxis = std::max(max_x, max_y); 
     159                maxAxis = std::max(maxAxis, max_z); 
     160                resize( AxisAlignedBox( 0, 0, 0, maxAxis, maxAxis, maxAxis ) ); 
    153161     
    154     setupTerrainMaterial(); 
    155     setupTerrainPages(); 
    156  
     162                setupTerrainMaterial(); 
     163                setupTerrainPages(); 
     164        } 
    157165 } 
    158166#endif 
     167//------------------------------------------------------------------------- 
     168void OcclusionCullingSceneManager::loadConfig(DataStreamPtr& stream) 
     169{ 
     170        /* Set up the options */ 
     171        ConfigFile config; 
     172        String val; 
     173 
     174        config.load(stream); 
     175 
     176        std::stringstream d;  
     177        //d << "reading the config file from: " << filename; 
     178        //LogManager::getSingleton().logMessage(d.str()); 
     179 
     180        val = config.getSetting("Scene"); 
     181 
     182    if (!val.empty()) 
     183        { 
     184                 string filename = val.c_str(); 
     185                 LoadScene(filename); 
     186        } 
     187 
     188        val = config.getSetting("ViewCells"); 
     189 
     190        if (!val.empty()) 
     191        { 
     192                 string viewCellsFilename = val.c_str(); 
     193                 std::stringstream d; d << "view cells file name: " << viewCellsFilename; 
     194                 LogManager::getSingleton().logMessage(d.str()); 
     195 
     196                 mViewCellsLoaded = LoadViewCells(viewCellsFilename); 
     197        } 
     198         
     199        val = config.getSetting("OnlineCullingAlgorithm"); 
     200                 
     201        if (!val.empty()) 
     202        { 
     203                GtpVisibility::VisibilityEnvironment::CullingManagerType algorithm; 
     204 
     205                if (val == "CHC") 
     206                { 
     207                        algorithm =  
     208                                GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING; 
     209                } 
     210                else if (val == "SWC") 
     211                { 
     212                         algorithm =  
     213                                 GtpVisibility::VisibilityEnvironment::STOP_AND_WAIT_CULLING; 
     214                 } 
     215                 else if (val == "VFC") 
     216                 { 
     217                         algorithm =  
     218                                 GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING; 
     219                 } 
     220                 else // default rendering 
     221                 { 
     222                         algorithm =  
     223                                 GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS; 
     224                 } 
     225 
     226                 mVisibilityManager->SetCullingManager(algorithm); 
     227        } 
     228 
     229        if (mShowTerrain) 
     230        { 
     231                TerrainSceneManager::loadConfig(stream); 
     232        } 
     233} 
    159234//----------------------------------------------------------------------- 
    160235void OcclusionCullingSceneManager::PrepareVisualization(Camera *cam) 
     
    192267 
    193268                                MovableMap::iterator fit = mViewCellsGeometry.find(id); 
     269 
    194270                                if ((fit != mViewCellsGeometry.end()) && (*fit).second) 
    195271                                        (*fit).second->_updateRenderQueue(getRenderQueue()); 
     
    207283                } 
    208284                 
    209                 GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator  
    210                         oit, oit_end = mCurrentViewCell->GetPvs().mEntries.end(); 
    211                          
    212                 for (oit = mCurrentViewCell->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
    213                 { 
    214                         GtpVisibilityPreprocessor::Intersectable *entry = (*oit).first; 
    215  
    216                         if (entry->Type() == GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE) 
     285 
     286                ////////// 
     287                //-- set PVS of view cell visible 
     288 
     289                GtpVisibilityPreprocessor::ObjectPvsIterator pit =  
     290                        mCurrentViewCell->GetPvs().GetIterator(); 
     291 
     292                while (pit.HasMoreEntries()) 
     293                {                
     294                        GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 
     295                        GtpVisibilityPreprocessor::Intersectable *obj = entry.mObject; 
     296 
     297                        if (obj->Type() ==  
     298                                GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE) 
    217299                        { 
    218                                 ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 
    219                                  
     300                                ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(obj); 
     301 
    220302                                EntityContainer *entries = oi->GetItem(); 
    221                                  
    222303                                EntityContainer::const_iterator eit, eit_end = entries->end(); 
    223                                                  
     304 
    224305                                for (eit = entries->begin(); eit != eit_end; ++ eit) 
    225306                                { 
     
    229310                } 
    230311 
    231                 for (oit = mCurrentViewCell->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
    232                 { 
    233                         GtpVisibilityPreprocessor::Intersectable *entry = (*oit).first; 
    234                  
    235                         switch (entry->Type()) 
     312                pit = mCurrentViewCell->GetPvs().GetIterator(); 
     313 
     314                while (pit.HasMoreEntries()) 
     315                {                
     316                        GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 
     317                        GtpVisibilityPreprocessor::Intersectable *obj = entry.mObject; 
     318 
     319                        switch (obj->Type()) 
    236320                        {        
    237                                 case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 
     321                        case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 
     322                                { 
     323                                        OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(obj); 
     324                                        omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 
     325                                } 
     326                                break; 
     327 
     328                        case GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE: 
     329                                { 
     330                                        ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(obj); 
     331 
     332                                        EntityContainer *entries = oi->GetItem(); 
     333                                        EntityContainer::const_iterator eit, eit_end = entries->end(); 
     334 
     335                                        for (eit = entries->begin(); eit != eit_end; ++ eit) 
    238336                                        { 
    239                                                 OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry); 
    240                                                 omi->GetEntity()->_updateRenderQueue(getRenderQueue()); 
     337                                                //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit); 
     338                                                Entity *ent = *eit; 
     339                                                Any newAny = ent->getUserAny(); 
     340 
     341                                                int flt = any_cast<int>(newAny); 
     342                                                //std::stringstream d; d << "any: " << flt << " "; 
     343                                                //Ogre::LogManager::getSingleton().logMessage(d.str()); 
     344                                                if (any_cast<int>(newAny) == 0) 
     345                                                { 
     346                                                        ent->setUserAny(Any((int)1)); 
     347                                                        ent->_updateRenderQueue(getRenderQueue()); 
     348                                                } 
     349 
     350                                                //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
    241351                                        } 
    242                                         break; 
    243                                 case GtpVisibilityPreprocessor::Intersectable::OBJECTS_INTERSECTABLE: 
    244                                         { 
    245                                                 ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 
    246                                          
    247                                                 EntityContainer *entries = oi->GetItem(); 
    248                                                 EntityContainer::const_iterator eit, eit_end = entries->end(); 
    249                                                  
    250                                                 for (eit = entries->begin(); eit != eit_end; ++ eit) 
    251                                                 { 
    252                                                         //OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(*eit); 
    253                                                         Entity *ent = *eit; 
    254                                                         Any newAny = ent->getUserAny(); 
    255  
    256                                                         int flt = any_cast<int>(newAny); 
    257                                                         //std::stringstream d; d << "any: " << flt << " "; 
    258                                                         //Ogre::LogManager::getSingleton().logMessage(d.str()); 
    259                                                         if (any_cast<int>(newAny) == 0) 
    260                                                         { 
    261                                                                 ent->setUserAny(Any((int)1)); 
    262                                                                 ent->_updateRenderQueue(getRenderQueue()); 
    263                                                         } 
    264  
    265                                                         //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
    266                                                 } 
    267                                         } 
    268                                         break; 
    269                                 default: 
    270                                         break; 
     352                                } 
     353                                break; 
     354                        default: 
     355                                break; 
    271356                        } 
    272357                }        
    273358        } 
    274  
    275359/* 
    276360   if (mRenderNodesForViz || mRenderNodesContentForViz) 
     
    367451        } 
    368452        //else if (mIsItemBufferPass) {usedPass = mItemBufferPass;} 
    369          
    370453 
    371454        //-- set actual pass here 
    372  
    373455        const Pass *result = SceneManager::_setPass(usedPass); 
    374456 
     
    673755        if (key == "LoadViewCells") 
    674756        {  
    675                 if (!mViewCellsLoaded) 
    676                 { 
    677                         String filename(static_cast<const char *>(val)); 
    678                         mViewCellsLoaded = LoadViewCells(filename);      
    679                 } 
    680  
    681757                return mViewCellsLoaded; 
    682758        } 
     
    742818} 
    743819//----------------------------------------------------------------------- 
    744 bool OcclusionCullingSceneManager::getOption(const String & key, void *val) 
     820bool OcclusionCullingSceneManager::getOption(const String &key, void *val) 
    745821{ 
    746822        if (key == "NumHierarchyNodes") 
     
    759835                * static_cast<GtpVisibility::HierarchyInterface **>(val) =  
    760836                        (GtpVisibility::HierarchyInterface *)mHierarchyInterface; 
     837                return true; 
     838        } 
     839        if (key == "ShowTerrain") 
     840        { 
     841                * static_cast<bool *>(val) = (bool *)mShowTerrain; 
    761842                return true; 
    762843        } 
     
    9221003        } 
    9231004 
     1005        /////////// 
    9241006        //-- TRANSPARENT LOOP: must be handled differently from solids 
    9251007 
     
    12371319        } 
    12381320                 
    1239         GtpVisibilityPreprocessor::ObjectPvsMap::const_iterator oit, 
    1240                         oit_end = vc->GetPvs().mEntries.end(); 
     1321        GtpVisibilityPreprocessor::ObjectPvsIterator pit = vc->GetPvs().GetIterator(); 
    12411322 
    12421323        //////////// 
    12431324        //-- set PVS of view cell to visible 
    12441325 
    1245         for (oit = vc->GetPvs().mEntries.begin(); oit != oit_end; ++ oit) 
    1246         { 
    1247                 GtpVisibilityPreprocessor::Intersectable *entry = (*oit).first; 
     1326        while (pit.HasMoreEntries()) 
     1327        {                
     1328                GtpVisibilityPreprocessor::ObjectPvsEntry entry = pit.Next(); 
     1329                GtpVisibilityPreprocessor::Intersectable *obj = entry.mObject; 
     1330 
    12481331                // no associated geometry found 
    1249                 if (!entry) continue; 
    1250          
    1251                 switch (entry->Type()) 
     1332                if (!obj) continue; 
     1333         
     1334                switch (obj->Type()) 
    12521335                { 
    12531336                        case GtpVisibilityPreprocessor::Intersectable::OGRE_MESH_INSTANCE: 
    12541337                                { 
    1255                                         OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(entry); 
     1338                                        OgreMeshInstance *omi = dynamic_cast<OgreMeshInstance *>(obj); 
    12561339                                        omi->GetEntity()->setVisible(load); 
    12571340                                        //GtpVisibilityPreprocessor::Debug << "assigned id " << omi->GetId() << endl; 
     
    12621345                                        //GtpVisibilityPreprocessor::ObjectsIntersectable *oi =  
    12631346                                        //      dynamic_cast<GtpVisibilityPreprocessor::ObjectsIntersectable *>(entry); 
    1264                                         ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(entry); 
     1347                                        ObjectsIntersectable *oi = dynamic_cast<ObjectsIntersectable *>(obj); 
    12651348 
    12661349                                        //GtpVisibilityPreprocessor::ObjectContainer *entries = oi->GetItem(); 
    12671350                                        EntityContainer *entries = oi->GetItem(); 
    12681351 
    1269                                         EntityContainer::const_iterator eit, 
    1270                                                 eit_end = entries->end(); 
     1352                                        EntityContainer::const_iterator eit, eit_end = entries->end(); 
     1353 
    12711354                                        for (eit = entries->begin(); eit != eit_end; ++ eit) 
    12721355                                        { 
     
    14231506} 
    14241507#endif 
     1508// splits strings containing multiple file names 
     1509static int SplitFilenames(const std::string str, std::vector<std::string> &filenames) 
     1510{ 
     1511        int pos = 0; 
     1512 
     1513        while(1)  
     1514        { 
     1515                int npos = (int)str.find(';', pos); 
     1516                 
     1517                if (npos < 0 || npos - pos < 1) 
     1518                        break; 
     1519                filenames.push_back(std::string(str, pos, npos - pos)); 
     1520                pos = npos + 1; 
     1521        } 
     1522         
     1523        filenames.push_back(std::string(str, pos, str.size() - pos)); 
     1524        return (int)filenames.size(); 
     1525} 
     1526//----------------------------------------------------------------------- 
     1527bool OcclusionCullingSceneManager::LoadScene(const String &filename) 
     1528{ 
     1529        using namespace std; 
     1530        // use leaf nodes of the original spatial hierarchy as occludees 
     1531        vector<string> filenames; 
     1532        const int files = SplitFilenames(filename, filenames); 
     1533         
     1534        std::stringstream d; 
     1535        d << "number of input files: " << files << "\n"; 
     1536        LogManager::getSingleton().logMessage(d.str()); 
     1537 
     1538        bool result = false; 
     1539        vector<string>::const_iterator fit, fit_end = filenames.end(); 
     1540        int i = 0; 
     1541 
     1542        if (filename == "terrain") 
     1543        { 
     1544                // terrain hack 
     1545                mShowTerrain = true; 
     1546                LogManager::getSingleton().logMessage("creating terrain"); 
     1547                return true; 
     1548        } 
     1549 
     1550        for (fit = filenames.begin(); fit != fit_end; ++ fit, ++ i) 
     1551        { 
     1552                const string fn = *fit; 
     1553 
     1554                if (strstr(fn.c_str(), ".iv") || strstr(fn.c_str(), ".wrl")) 
     1555                { 
     1556                        // load iv files 
     1557                        if (!LoadSceneIV(fn, getRootSceneNode(), i)) 
     1558                        { 
     1559                                // terrain hack 
     1560                                LogManager::getSingleton().logMessage("error loading file"); 
     1561                        } 
     1562                } 
     1563                         
     1564                // at least one piece of geometry loaded 
     1565                result = true; 
     1566        } 
     1567         
     1568        return result; 
     1569} 
     1570//----------------------------------------------------------------------- 
     1571bool OcclusionCullingSceneManager::LoadSceneIV(const String &filename,  
     1572                                                                                           SceneNode *root,  
     1573                                                                                           const int index) 
     1574{ 
     1575        IVReader ivReader; 
     1576 
     1577        Timer *timer = PlatformManager::getSingleton().createTimer(); 
     1578        timer->reset(); 
     1579 
     1580        if (1) 
     1581        { 
     1582                std::string logFilename = "IVLog" + Ogre::StringConverter().toString(index) + ".log"; 
     1583                 
     1584                Log *log = LogManager::getSingleton().createLog(logFilename); 
     1585                ivReader.setLog(log); 
     1586        } 
     1587         
     1588        //viennaNode->translate(Vector3(-300, -300, 0)); 
     1589 
     1590        if (ivReader.loadFile(filename.c_str())) 
     1591        { 
     1592                SceneNode *node = root->createChildSceneNode("IVSceneNode" + index); 
     1593 
     1594                ivReader.buildTree(this, node); 
     1595                 
     1596                ivReader.collapse(); 
     1597 
     1598                std::stringstream d;  
     1599                d << "loaded " << filename << " in " << timer->getMilliseconds() * 1e-3 << " secs"; 
     1600                LogManager::getSingleton().logMessage(d.str()); 
     1601                 
     1602                PlatformManager::getSingleton().destroyTimer(timer); 
     1603 
     1604                //-- bake into static geometry 
     1605                /*if (USE_STATIC_GEOMETRY) 
     1606                { 
     1607                        BakeSceneIntoStaticGeometry("staticVienna", "Vienna"); 
     1608                }*/ 
     1609         
     1610                return true; 
     1611        } 
     1612 
     1613        return false; 
     1614} 
    14251615//----------------------------------------------------------------------- 
    14261616const String OcclusionCullingSceneManagerFactory::FACTORY_TYPE_NAME = "OcclusionCullingSceneManager"; 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj

    r1676 r1816  
    8989                                OptimizeForProcessor="0" 
    9090                                OptimizeForWindowsApplication="TRUE" 
    91                                 AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src" 
     91                                AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include" 
    9292                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE" 
    9393                                StringPooling="TRUE" 
     
    105105                                Name="VCLinkerTool" 
    106106                                IgnoreImportLibrary="TRUE" 
    107                                 AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib" 
     107                                AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib IVReader.lib" 
    108108                                OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll" 
    109109                                Version="0.99" 
    110110                                LinkIncremental="1" 
    111111                                SuppressStartupBanner="TRUE" 
    112                                 AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;&quot;..\..\lib\$(ConfigurationName)&quot;" 
     112                                AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\$(ConfigurationName)&quot;" 
    113113                                ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 
    114114                                GenerateDebugInformation="TRUE" 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp

    r1486 r1816  
    2929        while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 
    3030        { 
    31                 //if (mHierarchyInterface->GetQueue()->empty()) 
    32                 //      Ogre::LogManager::getSingleton().logMessage("distance queue empty!!"); 
    3331                bool resultAvailable = false; 
    3432 
     
    3836                                mHierarchyInterface->GetQueue()->empty())) 
    3937                { 
    40                  
    41                 /*while (!queryQueue.empty() &&  
    42                            ((resultAvailable = queryQueue.front().second->GetQueryResult(visiblePixels, false)) || 
    43                 mHierarchyInterface->GetQueue()->empty())) 
    44                 { 
    45                         if (!resultAvailable) visiblePixels = 0;//1e20; // render if result not available 
    46                         */ 
    47                 HierarchyNode *node = queryQueue.front().first; 
     38                HierarchyNode *node = queryQueue.front().first; 
    4839                         
    4940                        queryQueue.pop(); 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp

    r1811 r1816  
    127127        else 
    128128        { 
    129                 mStrategies.push_back(SamplingStrategy::VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    130  
    131                 // ratio 3:1 
     129                mStrategies.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
     130                //mStrategies.push_back(SamplingStrategy::VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    132131                mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    133                 mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    134                 mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
     132                //mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
     133                //mStrategies.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    135134        } 
    136135 
     
    61986197                //evalStrats.push_back(SamplingStrategy::VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    61996198                evalStrats.push_back(SamplingStrategy::OBJECT_BASED_DISTRIBUTION); 
    6200  
    6201                 // ratio 3:1 
    62026199                evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
    62036200                //evalStrats.push_back(SamplingStrategy::REVERSE_VIEWSPACE_BORDER_BASED_DISTRIBUTION); 
Note: See TracChangeset for help on using the changeset viewer.