Changeset 937 for GTP/trunk/App
- Timestamp:
- 05/10/06 08:00:38 (19 years ago)
- Location:
- GTP/trunk/App/Demos/Vis
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.cpp
r932 r937 7 7 #include "TerrainFrameListener.h" 8 8 #include "OgrePlatformQueryManager.h" 9 #include "OgreVisibilityTerrainSceneManager.h"10 9 #include "VisibilityInfo.h" 11 10 #include "OgreOcclusionQueriesQueryManager.h" … … 68 67 "robot", 69 68 "athene", 70 //"natFX_Tree1_LOD2",69 "natFX_Tree1_LOD2", 71 70 //"tree2", 72 71 //"HongKong_Tower", … … 161 160 mVizScale(25), 162 161 mUseViewCells(false), 162 mViewCellsLoaded(false), 163 163 mUseVisibilityFilter(false) 164 164 { … … 1164 1164 void TerrainFrameListener::toggleUseViewCells() 1165 1165 { 1166 // HACK: no view cells for hilly terrain 1167 if (mApplication->msShowHillyTerrain) 1168 return; 1169 1166 1170 mUseViewCells = !mUseViewCells; 1171 1172 // load on demand 1173 if (mUseViewCells && !mViewCellsLoaded) 1174 { 1175 mViewCellsLoaded = mApplication->LoadViewCells(mApplication->mViewCellsFilename); 1176 } 1177 1167 1178 mSceneMgr->setOption("UseViewCells", &mUseViewCells); 1168 1179 } … … 1372 1383 break; 1373 1384 case KC_8: 1374 changeAssumedVisibility(-1); 1385 // changeAssumedVisibility(-5); 1386 changeAssumedVisibility(-500); 1375 1387 break; 1376 1388 case KC_9: 1377 changeAssumedVisibility(1); 1389 changeAssumedVisibility(500); 1390 //changeAssumedVisibility(5); 1378 1391 break; 1379 1392 case KC_LSHIFT: -
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TerrainFrameListener.h
r915 r937 430 430 431 431 bool mUseViewCells; 432 432 bool mViewCellsLoaded; 433 433 bool mUseVisibilityFilter; 434 434 }; -
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrain.vcproj
r866 r937 85 85 <Tool 86 86 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" 88 88 OutputFile="$(OGRE_PATH)/Samples/Common/bin/Release/TestCullingTerrain.exe" 89 89 LinkIncremental="1" -
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.cpp
r932 r937 7 7 #include <OgreIteratorWrappers.h> 8 8 #include <Ogre.h> 9 #include <direct.h> // for getcwd10 //#include "OgreReferenceAppLayer.h"11 //#include "OgreRefAppWorld.h"12 9 #include "TestCullingTerrainApplication.h" 13 10 #include "TerrainFrameListener.h" 14 //#include "OgreOcclusionCullingSceneManager.h"15 11 16 12 #include "IVReader.h" … … 161 157 mTerrainContentGenerator(NULL), 162 158 mRayQueryExecutor(NULL), 163 mIVReader(NULL) 159 mIVReader(NULL), 160 mFilename("terrain"), 161 mEnvironmentFilename("simple.env") 164 162 { 165 163 } … … 174 172 config.load(filename); 175 173 176 std::stringstream d; d << "reading configfrom: " << filename;174 std::stringstream d; d << "reading the config file from: " << filename; 177 175 LogManager::getSingleton().logMessage(d.str()); 178 176 … … 182 180 { 183 181 mFilename = val.c_str(); 184 185 std::stringstream d; d << "filename: " << mFilename; 182 d << "\nloading scene from file: " << mFilename; 186 183 LogManager::getSingleton().logMessage(d.str()); 187 184 } 188 185 189 /* val = config.getSetting("ViewCells"); 186 187 #if 0 188 val = config.getSetting("ViewCells"); 190 189 191 190 if (!val.empty()) 192 191 { 193 192 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 } 195 204 196 205 Vector3 v = Vector3::UNIT_SCALE; … … 211 220 v.z = atof( val.c_str()); 212 221 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 } 213 256 // set camera position accordingly 214 257 mCamNode->setPosition(v); … … 358 401 { 359 402 //-- 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 369 405 ///////////////////////////////////// 370 406 … … 455 491 { 456 492 // the objects are generated randomly distributed over the terrain 457 if (1) generateScene( 500, 0); // create robots493 if (1) generateScene(1500, 0); // create robots 458 494 if (0) generateScene(100, 1); // create trees 459 495 if (0) generateScene(100, 2); // create ninjas 460 496 } 461 462 463 464 //-- HACK: load the view cells from the disc465 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 here471 if (0) mSceneMgr->setOption("LoadViewCells", filename.c_str());472 497 } 473 498 //----------------------------------------------------------------------- … … 658 683 659 684 //----------------------------------------------------------------------- 660 bool TestCullingTerrainApplication::LoadScene(const std::stringfilename)685 bool TestCullingTerrainApplication::LoadScene(const String &filename) 661 686 { 662 687 using namespace std; … … 716 741 } 717 742 //----------------------------------------------------------------------- 718 bool TestCullingTerrainApplication::LoadViewCells(const std::string filename) 719 { 720 721 return true; 743 bool 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; 722 754 } 723 755 -
GTP/trunk/App/Demos/Vis/HillyTerrain/OGRE/TestCullingTerrainApplication.h
r932 r937 128 128 bool LoadSceneIV(const String &filename, SceneNode *root, const int index); 129 129 130 bool LoadScene(const std::stringfilename);130 bool LoadScene(const String &filename); 131 131 132 bool LoadViewCells(const std::stringfilename);132 bool LoadViewCells(const String &filename); 133 133 134 134 /** Loads configuration from disc. … … 138 138 /// if hilly terrain should be loaded 139 139 static bool msShowHillyTerrain; 140 141 142 String mFilename; 143 String mViewCellsFilename; 144 // name of the visibility environment file 145 String mEnvironmentFilename; 140 146 141 147 protected: … … 185 191 StaticGeometry *mStaticGeometry; 186 192 187 String mFilename; 188 //String mViewCellsFilename; 193 189 194 190 195 private: -
GTP/trunk/App/Demos/Vis/Teapots/RenderTraverser.cpp
r724 r937 141 141 142 142 //-- 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())) 147 147 { 148 148 HierarchyNode *node = queryQueue.front(); … … 164 164 165 165 //-- PART 2: hierarchical traversal 166 if (!mDistanceQueue.empty())166 if (!mDistanceQueue.empty()) 167 167 { 168 168 HierarchyNode *node = mDistanceQueue.top(); … … 174 174 bool intersects; 175 175 176 if (InsideViewFrustum(node, intersects))176 if (InsideViewFrustum(node, intersects)) 177 177 { 178 178 // for near plane intersecting bounding box possible
Note: See TracChangeset
for help on using the changeset viewer.