Changeset 937


Ignore:
Timestamp:
05/10/06 08:00:38 (18 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis
Files:
6 edited

Legend:

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

    r932 r937  
    77#include "TerrainFrameListener.h" 
    88#include "OgrePlatformQueryManager.h" 
    9 #include "OgreVisibilityTerrainSceneManager.h" 
    109#include "VisibilityInfo.h" 
    1110#include "OgreOcclusionQueriesQueryManager.h" 
     
    6867        "robot", 
    6968        "athene", 
    70         //"natFX_Tree1_LOD2", 
     69        "natFX_Tree1_LOD2", 
    7170        //"tree2", 
    7271        //"HongKong_Tower", 
     
    161160mVizScale(25), 
    162161mUseViewCells(false), 
     162mViewCellsLoaded(false), 
    163163mUseVisibilityFilter(false) 
    164164{ 
     
    11641164void TerrainFrameListener::toggleUseViewCells() 
    11651165{ 
     1166        // HACK: no view cells for hilly terrain 
     1167        if (mApplication->msShowHillyTerrain) 
     1168                return; 
     1169 
    11661170        mUseViewCells = !mUseViewCells; 
     1171 
     1172        // load on demand 
     1173        if (mUseViewCells && !mViewCellsLoaded) 
     1174        { 
     1175                mViewCellsLoaded = mApplication->LoadViewCells(mApplication->mViewCellsFilename); 
     1176        } 
     1177 
    11671178        mSceneMgr->setOption("UseViewCells", &mUseViewCells); 
    11681179} 
     
    13721383                break; 
    13731384        case KC_8: 
    1374                 changeAssumedVisibility(-1); 
     1385        //      changeAssumedVisibility(-5); 
     1386                changeAssumedVisibility(-500); 
    13751387                break; 
    13761388        case KC_9: 
    1377                 changeAssumedVisibility(1); 
     1389                changeAssumedVisibility(500); 
     1390                //changeAssumedVisibility(5); 
    13781391                break; 
    13791392        case KC_LSHIFT: 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h

    r915 r937  
    430430         
    431431        bool mUseViewCells; 
    432  
     432        bool mViewCellsLoaded; 
    433433        bool mUseVisibilityFilter; 
    434434}; 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrain.vcproj

    r866 r937  
    8585                        <Tool 
    8686                                Name="VCLinkerTool" 
    87                                 AdditionalDependencies="OGREMain.LIB CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib Plugin_VisibilitySceneManager.lib IVReader.lib" 
     87                                AdditionalDependencies="OGREMain.LIB CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib Plugin_VisibilitySceneManager.lib IVReader.lib zdll.lib zziplib.lib" 
    8888                                OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCullingTerrain.exe" 
    8989                                LinkIncremental="1" 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp

    r932 r937  
    77#include <OgreIteratorWrappers.h> 
    88#include <Ogre.h> 
    9 #include <direct.h> // for getcwd 
    10 //#include "OgreReferenceAppLayer.h" 
    11 //#include "OgreRefAppWorld.h" 
    129#include "TestCullingTerrainApplication.h" 
    1310#include "TerrainFrameListener.h" 
    14 //#include "OgreOcclusionCullingSceneManager.h" 
    1511 
    1612#include "IVReader.h" 
     
    161157mTerrainContentGenerator(NULL),  
    162158mRayQueryExecutor(NULL), 
    163 mIVReader(NULL) 
     159mIVReader(NULL), 
     160mFilename("terrain"), 
     161mEnvironmentFilename("simple.env") 
    164162{ 
    165163} 
     
    174172        config.load(filename); 
    175173 
    176         std::stringstream d; d << "reading config from: " << filename; 
     174        std::stringstream d; d << "reading the config file from: " << filename; 
    177175        LogManager::getSingleton().logMessage(d.str()); 
    178176 
     
    182180        { 
    183181                 mFilename = val.c_str(); 
    184  
    185                  std::stringstream d; d << "filename: " << mFilename; 
     182                 d << "\nloading scene from file: " << mFilename; 
    186183                 LogManager::getSingleton().logMessage(d.str()); 
    187184        } 
    188185 
    189 /*      val = config.getSetting("ViewCells"); 
     186         
     187#if 0 
     188        val = config.getSetting("ViewCells"); 
    190189 
    191190        if (!val.empty()) 
    192191        { 
    193192                 mViewCellsFilename = val.c_str(); 
    194         }*/ 
     193        } 
     194#endif 
     195 
     196        val = config.getSetting("VisibilityEnvironment"); 
     197 
     198        if (!val.empty()) 
     199        { 
     200                 mEnvironmentFilename = val.c_str(); 
     201                 std::stringstream d; d << "loading environment from from file: " << mEnvironmentFilename; 
     202                 LogManager::getSingleton().logMessage(d.str()); 
     203        } 
    195204 
    196205        Vector3 v = Vector3::UNIT_SCALE; 
     
    211220                v.z = atof( val.c_str()); 
    212221 
     222 
     223        ///////////////////////// 
     224        // setup scene 
     225 
     226        //-- load the scene from specified file 
     227        if (!LoadScene(mFilename)) 
     228                LogManager::getSingleton().logMessage("error loading scene"); 
     229 
     230 
     231        GtpVisibility::VisibilityManager *mVisManager = NULL; 
     232 
     233        //-- load the environment from file 
     234        if (mSceneMgr->getOption("VisibilityManager", &mVisManager)) 
     235        { 
     236                GtpVisibility::VisibilityEnvironment *visEnv = mVisManager->GetVisibilityEnvironment(); 
     237                 
     238                if (!visEnv->LoadEnvironment(mEnvironmentFilename)) 
     239                { 
     240                        std::stringstream d; d << "failed loading environment from " << mEnvironmentFilename; 
     241                        LogManager::getSingleton().logMessage(d.str()); 
     242                } 
     243                else //-- load environment options 
     244                { 
     245                        //-- get view cells name. load only on demand 
     246                        mViewCellsFilename = visEnv->getViewCellsFileName(); 
     247 
     248                        std::stringstream d; d << "view cells file name: " << mViewCellsFilename; 
     249                        LogManager::getSingleton().logMessage(d.str()); 
     250                } 
     251        } 
     252        else 
     253        { 
     254                LogManager::getSingleton().logMessage("error! no visibility scenemanager available"); 
     255        } 
    213256        // set camera position accordingly 
    214257        mCamNode->setPosition(v); 
     
    358401{ 
    359402        //-- load scene 
    360  
    361         //GtpVisibility::VisibilityManager *mVisManager; 
    362         //if (!mSceneMgr->getOption("VisibilityManager", mVisManager))  return; 
    363         //const std::string filename = visEnv->getSceneFilename(); 
    364         loadConfig("test.cfg"); 
    365         LoadScene(mFilename); 
    366  
    367  
    368  
     403        loadConfig("terrainCulling.cfg"); 
     404         
    369405        ///////////////////////////////////// 
    370406 
     
    455491        { 
    456492                // the objects are generated randomly distributed over the terrain 
    457                 if (1) generateScene(500, 0); // create robots 
     493                if (1) generateScene(1500, 0); // create robots 
    458494                if (0) generateScene(100, 1); // create trees 
    459495                if (0) generateScene(100, 2); // create ninjas 
    460496        } 
    461  
    462  
    463  
    464         //-- HACK: load the view cells from the disc 
    465          
    466         //std::string filename = "vienna_simple-21-04-avs2-viewCells.xml"; 
    467         //std::string filename = "vienna_simple-21-04-kdcasm-viewCells.xml"; 
    468         std::string filename = "vienna_simple-21-04-avs-viewCells.xml"; 
    469  
    470         //-- the actual loading happens here 
    471         if (0) mSceneMgr->setOption("LoadViewCells", filename.c_str()); 
    472497} 
    473498//----------------------------------------------------------------------- 
     
    658683 
    659684//----------------------------------------------------------------------- 
    660 bool TestCullingTerrainApplication::LoadScene(const std::string filename) 
     685bool TestCullingTerrainApplication::LoadScene(const String &filename) 
    661686{ 
    662687        using namespace std; 
     
    716741} 
    717742//----------------------------------------------------------------------- 
    718 bool TestCullingTerrainApplication::LoadViewCells(const std::string filename) 
    719 { 
    720  
    721         return true; 
     743bool TestCullingTerrainApplication::LoadViewCells(const String &filename) 
     744{ 
     745        LogManager::getSingleton().logMessage("loading view cells"); 
     746 
     747        //-- the actual loading happens here 
     748        if (mSceneMgr->setOption("LoadViewCells", filename.c_str())) 
     749        return true; 
     750 
     751        LogManager::getSingleton().logMessage("error loading view cells!!"); 
     752 
     753        return false; 
    722754} 
    723755 
  • GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.h

    r932 r937  
    128128        bool LoadSceneIV(const String &filename, SceneNode *root, const int index); 
    129129 
    130         bool LoadScene(const std::string filename); 
     130        bool LoadScene(const String &filename); 
    131131 
    132         bool LoadViewCells(const std::string filename); 
     132        bool LoadViewCells(const String &filename); 
    133133 
    134134        /** Loads configuration from disc. 
     
    138138        /// if hilly terrain should be loaded 
    139139        static bool msShowHillyTerrain; 
     140 
     141 
     142        String mFilename; 
     143        String mViewCellsFilename; 
     144        // name of the visibility environment file 
     145        String mEnvironmentFilename; 
    140146 
    141147protected: 
     
    185191        StaticGeometry *mStaticGeometry; 
    186192 
    187         String mFilename; 
    188         //String mViewCellsFilename; 
     193         
    189194 
    190195private: 
  • GTP/trunk/App/Demos/Vis/Teapots/RenderTraverser.cpp

    r724 r937  
    141141 
    142142        //-- PART 1: process finished occlusion queries 
    143         while(!mDistanceQueue.empty() || !queryQueue.empty()) 
    144         { 
    145                 while(!queryQueue.empty() &&  
    146                           (ResultAvailable(queryQueue.front()) || mDistanceQueue.empty())) 
     143        while (!mDistanceQueue.empty() || !queryQueue.empty()) 
     144        { 
     145                while (!queryQueue.empty() &&  
     146                           (ResultAvailable(queryQueue.front()) || mDistanceQueue.empty())) 
    147147                { 
    148148                        HierarchyNode *node = queryQueue.front(); 
     
    164164 
    165165                //-- PART 2: hierarchical traversal 
    166                 if(! mDistanceQueue.empty()) 
     166                if (!mDistanceQueue.empty()) 
    167167                { 
    168168                        HierarchyNode *node = mDistanceQueue.top(); 
     
    174174                        bool intersects; 
    175175                         
    176                         if(InsideViewFrustum(node, intersects)) 
     176                        if (InsideViewFrustum(node, intersects)) 
    177177                        { 
    178178                                // for near plane intersecting bounding box possible  
Note: See TracChangeset for help on using the changeset viewer.