Changeset 173 for trunk/VUT/work
- Timestamp:
- 07/13/05 18:28:40 (20 years ago)
- Location:
- trunk/VUT/work/TestCullingTerrain
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r171 r173 12 12 #include "TestCullingTerrainApplication.h" 13 13 14 15 //-- captions for overlays 16 String TerrainFrameListener::msAlgorithmCaptions[] = 17 { 18 "View Frustum Culling", 19 "Stop and Wait Culling", 20 "Coherent Hierarchical Culling" 21 }; 22 23 String TerrainFrameListener::msQueryTypeCaptions[] = 24 { 25 "from camera", 26 "from viewpoint" 27 }; 28 29 String TerrainFrameListener::msQueryRelativeVisCaptions[] = 30 { 31 "visible pixels", 32 "relative visibility" 33 }; 34 35 String TerrainFrameListener::msQueryMethodCaptions[] = 36 { 37 "occlusion queries", 38 "item buffer" 39 }; 40 41 Real TerrainFrameListener::msObjectTerrainOffsets[] = 42 { 43 0, 44 7, 45 0 46 }; 47 48 Real TerrainFrameListener::msObjectScales[] = 49 { 50 0.1, 51 0.6, 52 0.07 53 }; 54 55 String TerrainFrameListener::msObjectCaptions[] = 56 { 57 "robot", 58 "athene", 59 //"tree2", 60 //"HongKong_Tower", 61 "ninja" 62 //"ogrehead" 63 }; 64 14 65 // output file for frame info 15 66 const char* frames_out_filename = "frame.out"; … … 17 68 const char* objects_out_filename = "objects.out"; 18 69 19 20 // --- captions for overlays21 22 String currentAlgorithmCaptions[GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS] =23 {24 "View Frustum Culling",25 "Stop and Wait Culling",26 "Coherent Hierarchical Culling"27 };28 29 String queryTypeCaptions[] =30 {31 "from camera",32 "from viewpoint"33 };34 35 String queryRelativeVisCaptions[] =36 {37 "visible pixels",38 "relative visibility"39 };40 41 String queryMethodCaptions[] =42 {43 "occlusion queries",44 "item buffer"45 };46 47 Real currentObjectTerrainOffsets[] =48 {49 0,50 7,51 052 };53 Real currentObjectScales[] =54 {55 0.1,56 0.1,57 0.0758 };59 70 60 71 //----------------------------------------------------------------------- … … 210 221 mCurrentObject = mTerrainContentGenerator->GenerateSceneObject( 211 222 mouseRay.getOrigin()/*queryResult*/, Vector3(val, 0, 0), 212 m Application->getCurrentObjectCaption(mCurrentObjectType));223 msObjectCaptions[mCurrentObjectType]); 213 224 214 225 mLMouseDown = true; … … 281 292 { 282 293 // apply offset so object is ON terrain 283 queryResult.y += currentObjectTerrainOffsets[mCurrentObjectType];294 queryResult.y += msObjectTerrainOffsets[mCurrentObjectType]; 284 295 mCurrentObject->setPosition(queryResult); 285 296 } … … 414 425 415 426 mQueryManager = new OcclusionQueriesQueryManager(sm->GetHierarchyInterface(), 416 mWindow->getViewport(0), false, useItemBuffer);427 mWindow->getViewport(0), true, useItemBuffer); 417 428 //mQueryManager = new PlatformQueryManager(sm->GetHierarchyInterface(), mWindow->getViewport(0), false); 418 429 … … 437 448 438 449 std::stringstream d; 439 d << queryTypeCaptions[fromPoint ? 1 : 0].c_str() << " "440 << queryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str() << " "441 << queryMethodCaptions[useItemBuffer ? 1 : 0].c_str();450 d << msQueryTypeCaptions[fromPoint ? 1 : 0].c_str() << " " 451 << msQueryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str() << " " 452 << msQueryMethodCaptions[useItemBuffer ? 1 : 0].c_str(); 442 453 LogManager::getSingleton().logMessage(d.str()); 443 454 … … 515 526 516 527 sprintf(str, ": %s, %s, %s", 517 queryTypeCaptions[fromPoint ? 1 : 0].c_str(),518 queryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str(),519 queryMethodCaptions[useItemBuffer ? 1 : 0].c_str());528 msQueryTypeCaptions[fromPoint ? 1 : 0].c_str(), 529 msQueryRelativeVisCaptions[relativeVisibility ? 1 : 0].c_str(), 530 msQueryMethodCaptions[useItemBuffer ? 1 : 0].c_str()); 520 531 521 532 mQueryTypeInfo->setCaption(str); … … 635 646 //-- write out stats for recorded walkthrough 636 647 std::stringstream d; 637 d << "Algorithm: " << currentAlgorithmCaptions[mCurrentAlgorithm] << "\n"648 d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n" 638 649 //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n" 639 650 << "avg. FPS: " << avgFps << "\n" … … 737 748 738 749 // parameters for new object 739 mTerrainContentGenerator->SetOffset( currentObjectTerrainOffsets[mCurrentObjectType]);740 Real scale = currentObjectScales[mCurrentObjectType];750 mTerrainContentGenerator->SetOffset(msObjectTerrainOffsets[mCurrentObjectType]); 751 Real scale = msObjectScales[mCurrentObjectType]; 741 752 mTerrainContentGenerator->SetScale(Vector3(scale, scale, scale)); 742 753 743 mCurrentObjectTypeInfo->setCaption(": " + 744 mApplication->getCurrentObjectCaption(mCurrentObjectType)); 754 mCurrentObjectTypeInfo->setCaption(": " + msObjectCaptions[mCurrentObjectType]); 745 755 } 746 756 //----------------------------------------------------------------------- 747 757 void TerrainFrameListener::setAlgorithm(int algorithm) 748 758 { 749 mAlgorithmInfo->setCaption(": " + currentAlgorithmCaptions[mCurrentAlgorithm]);759 mAlgorithmInfo->setCaption(": " + msAlgorithmCaptions[mCurrentAlgorithm]); 750 760 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); 751 761 } … … 1370 1380 1371 1381 initOverlayElement(&mAlgorithmInfo, ext, "Algorithm", top, 1372 ": " + currentAlgorithmCaptions[mCurrentAlgorithm]); top += vert_space;1382 ": " + msAlgorithmCaptions[mCurrentAlgorithm]); top += vert_space; 1373 1383 1374 1384 initOverlayElement(&mThresholdInfo, ext, "Threshold", top, ": 0"); top += vert_space; -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r164 r173 13 13 #include "OgrePlatformQueryManager.h" 14 14 15 15 16 class TestCullingTerrainApplication; 16 17 … … 18 19 using namespace Ogre; 19 20 20 // z order index of visualizaion viewport21 #define VIZ_VIEWPORT_Z_ORDER 1022 21 23 22 /** Frame listener specialised for terrains. … … 84 83 //enum {NODEVIZ_NONE, NODEVIZ_RENDER_GEOMETRY, NODEVIZ_MODES_NUM}; 85 84 86 void zoomVizCamera(int zoom);85 void zoomVizCamera(int zoom); 87 86 88 87 void addFrameInfo(SceneNode *camNode, Real timeElapsed); … … 141 140 void setObjectType(int objectType); 142 141 142 static String msAlgorithmCaptions[]; 143 static String msQueryTypeCaptions[]; 144 static String msQueryRelativeVisCaptions[]; 145 static String msQueryMethodCaptions[]; 146 static Real msObjectTerrainOffsets[]; 147 static Real msObjectScales[]; 148 static String msObjectCaptions[]; 149 143 150 protected: 144 151 145 152 void initHelpOverlayElement(String name, int top); 146 void initOverlayElement(OverlayElement **elInfo, String ext, String name, int top, String caption); 153 void initOverlayElement(OverlayElement **elInfo, String ext, String name, 154 int top, String caption); 147 155 148 156 //-- initialise overlays -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.cpp
r164 r173 11 11 //#include "OgreRefAppWorld.h" 12 12 #include "TestCullingTerrainApplication.h" 13 13 #include "TerrainFrameListener.h" 14 14 15 15 #define WIN32_LEAN_AND_MEAN 16 16 #include <windows.h> 17 17 18 String currentObjectCaptions[] = 19 { 20 "robot", 21 "athene", 22 "ninja" 23 //"ogrehead" 24 }; 25 26 const float walk_duration = 10.0f; 27 const float wait_duration = 2.0f; 28 const float rotate_factor = 0.7f; 29 const float move_factor = 0.03; 30 31 /***************************************/ 32 /* EntityState implementation */ 33 /***************************************/ 18 19 /**********************************************/ 20 /* EntityState implementation */ 21 /**********************************************/ 22 23 34 24 Vector3 EntityState::msMinPos = Vector3::ZERO; 35 25 Vector3 EntityState::msMaxPos = Vector3::ZERO; … … 250 240 mSunLight->setCastShadows(true); 251 241 252 // set light angle not too s harp, otherwise shadows textures will be broken242 // set light angle not too small over the surface, otherwise shadows textures will be broken 253 243 Vector3 dir(0.5, 1, 0.5); 254 244 dir.normalise(); … … 288 278 mSceneMgr->getRootSceneNode()->createChildSceneNode()->attachObject(pPlaneEnt); */ 289 279 290 mSceneMgr->setShadowTextureSettings(1024, 2); 280 // Use 512x512 texture in GL since we can't go higher than the window res 281 mSceneMgr->setShadowTextureSettings(512, 2); 282 291 283 mSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5)); 292 284 … … 326 318 void TestCullingTerrainApplication::generateScene(int num, int objectType) 327 319 { 328 mTerrainContentGenerator->GenerateScene(num, currentObjectCaptions[objectType]); 320 Vector3 scale(TerrainFrameListener::msObjectScales[objectType], 321 TerrainFrameListener::msObjectScales[objectType], 322 TerrainFrameListener::msObjectScales[objectType]); 323 324 mTerrainContentGenerator->SetScale(scale); 325 mTerrainContentGenerator->SetOffset(TerrainFrameListener::msObjectTerrainOffsets[objectType]); 326 mTerrainContentGenerator->GenerateScene(num, TerrainFrameListener::msObjectCaptions[objectType]); 329 327 330 328 if (objectType != 0) // from our objects, only robot has animation phases … … 384 382 } 385 383 //----------------------------------------------------------------------- 386 String TestCullingTerrainApplication::getCurrentObjectCaption(int id)387 {388 return currentObjectCaptions[id];389 }390 //-----------------------------------------------------------------------391 384 void TestCullingTerrainApplication::chooseSceneManager() 392 385 { -
trunk/VUT/work/TestCullingTerrain/TestCullingTerrainApplication.h
r164 r173 11 11 #include <OgreEntity.h> 12 12 13 // z order index of visualizaion viewport 14 #define VIZ_VIEWPORT_Z_ORDER 10 15 16 17 //-- constants for animation 18 const float walk_duration = 10.0f; 19 const float wait_duration = 2.0f; 20 const float rotate_factor = 0.7f; 21 const float move_factor = 0.03; 22 23 24 /** Rendertarget listener which shows a visualization. 25 */ 13 26 class VisualizationRenderTargetListener: public RenderTargetListener 14 27 {
Note: See TracChangeset
for help on using the changeset viewer.