- Timestamp:
- 09/06/05 18:18:47 (19 years ago)
- Location:
- trunk/VUT
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r254 r259 25 25 unsigned int visiblePixels = 0; 26 26 bool isAvailable = false; 27 Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling");27 //Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling"); 28 28 29 29 //-- PART 1: process finished occlusion queries -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r254 r259 7 7 void FrustumCullingManager::RenderScene() 8 8 { 9 Ogre::LogManager::getSingleton().logMessage("Frustum Culling");9 //Ogre::LogManager::getSingleton().logMessage("Frustum Culling"); 10 10 while (!mHierarchyInterface->GetQueue()->empty()) 11 11 { … … 27 27 } 28 28 else 29 { 29 { 30 30 mHierarchyInterface->SetNodeVisible(node, true); 31 31 mHierarchyInterface->TraverseNode(node); -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r254 r259 7 7 void StopAndWaitCullingManager::RenderScene() 8 8 { 9 Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling");9 //Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling"); 10 10 while (!mHierarchyInterface->GetQueue()->empty()) 11 11 { -
trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp
r254 r259 436 436 if (key == "NumHierarchyNodes") 437 437 { 438 * static_cast<unsigned int *>(val) = (unsigned int)mNumOct reeNodes;438 * static_cast<unsigned int *>(val) = (unsigned int)mNumOctants; 439 439 return true; 440 440 } … … 473 473 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 474 474 << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << "\n" 475 << "Hierarchy nodes: " << mNumOct reeNodes << ", "475 << "Hierarchy nodes: " << mNumOctants << ", " 476 476 << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 477 477 << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " -
trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp
r254 r259 239 239 void VisibilityTerrainSceneManager::_renderVisibleObjects() 240 240 { 241 241 242 InitDepthPass(); // create material for depth pass 242 243 InitItemBufferPass(); // create material for item buffer pass … … 282 283 283 284 TerrainSceneManager::_renderVisibleObjects(); 284 285 285 286 286 #ifdef GTP_VISIBILITY_MODIFIED_OGRE … … 293 293 addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_LATE); 294 294 addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY); 295 296 // exclude this queues from hierarchical rendering 295 297 setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 296 297 298 298 299 // set all necessary parameters for … … 333 334 // used for depth pass, transparents, overlay 334 335 clearSpecialCaseRenderQueues(); 336 335 337 TerrainSceneManager::_renderVisibleObjects(); 336 338 } 337 339 338 // set the new render level index 340 // HACK: set the new render level index, important to avoid cracks 341 // in terrain caused by LOD 339 342 TerrainRenderable::NextRenderLevelIndex(); 340 343 … … 345 348 OGRE_DELETE(mRenderQueue); // HACK: should be cleared before... 346 349 //WriteLog(); // write out stats 350 347 351 } 348 352 … … 438 442 if (key == "NumHierarchyNodes") 439 443 { 440 * static_cast<unsigned int *>(val) = (unsigned int)mNumOct reeNodes;444 * static_cast<unsigned int *>(val) = (unsigned int)mNumOctants; 441 445 return true; 442 446 } … … 477 481 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 478 482 << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 479 << "Hierarchy nodes: " << mNumOct reeNodes << ", "483 << "Hierarchy nodes: " << mNumOctants << ", " 480 484 << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 481 485 << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r254 r259 190 190 191 191 // reset statistics 192 resetStats();192 mWalkthroughStats.Reset(); 193 193 } 194 194 //----------------------------------------------------------------------- … … 403 403 /// set the current camera data to loaded frame information 404 404 setCurrentFrameInfo(evt.timeSinceLastFrame); 405 // HACK to producedemo406 addFrameInfo(mSavedFrameInfo, mCamNode, evt.timeSinceLastFrame);405 // HACK for demo 406 //addFrameInfo(mSavedFrameInfo, mCamNode, evt.timeSinceLastFrame); 407 407 break; 408 408 case WALKTHROUGH: … … 701 701 mSavedFrameInfo.clear(); 702 702 703 float avgFps = (float)mAvgFps / (float)mFrameCount;704 705 //-- write out stats for recorded walkthrough706 703 std::stringstream d; 707 d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n" 708 //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n" 709 << "avg. FPS: " << avgFps << "\n" 710 << "best FPS: " << mWindow->getBestFPS() << "\n" 711 << "worst FPS: " << mWindow->getWorstFPS() << "\n" 712 << "best frame time: " << mWindow->getBestFrameTime() << "\n" 713 << "worst frame time: " << mWindow->getWorstFrameTime(); 704 mWalkthroughStats.Print(d, msAlgorithmCaptions[mCurrentAlgorithm]); 714 705 715 706 LogManager::getSingleton().logMessage(d.str()); … … 739 730 // reset, because we measure fps stats during walkthrough (warning: average fps broken) 740 731 mWindow->resetStatistics(); 741 resetStats();732 mWalkthroughStats.Reset(); 742 733 743 734 //-- initialise frame data … … 827 818 mAlgorithmInfo->setCaption(": " + msAlgorithmCaptions[mCurrentAlgorithm]); 828 819 mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); 829 }830 //-----------------------------------------------------------------------831 void TerrainFrameListener::resetStats()832 {833 mAvgFps = 0;834 mFrameCount = 0;835 820 } 836 821 //----------------------------------------------------------------------- … … 848 833 int currentFps = mWindow->getStatistics().lastFPS; 849 834 835 // HACK for demo: use precomputed FPS 850 836 if (mUseDemoFps) 851 837 currentFps = mDemoFps; … … 863 849 #endif 864 850 851 unsigned int nodeInfo[3]; 852 mSceneMgr->getOption("NumRenderedNodes", nodeInfo); 853 mSceneMgr->getOption("NumQueryCulledNodes", nodeInfo+1); 854 mSceneMgr->getOption("NumFrustumCulledNodes", nodeInfo+2); 855 856 857 mWalkthroughStats.UpdateFrame(currentFps, mWindow->getBestFPS(), mWindow->getWorstFPS(), 858 (int)mWindow->getTriangleCount(), nodeInfo[0], nodeInfo[1], nodeInfo[2]); 859 865 860 // HACK: compute average fps ourselfs, because ogre avg. fps is wrong 866 861 // TODO: update only once per second 867 mAvgFps += currentFps;868 float avgFps = (float)mAvgFps / (float)(mFrameCount++);869 862 float avgFps = (float)mWalkthroughStats.mAccFps / (float)(mWalkthroughStats.mFrameCount); 863 864 870 865 // update stats when necessary 871 866 try … … 895 890 OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); 896 891 guiTris->setCaption(trisString + StringConverter::toString(stats.triangleCount)); 892 893 //LogManager::getSingleton().logMessage(StringConverter::toString(stats.triangleCount)); 897 894 898 895 OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); 899 896 guiDbg->setCaption(mWindow->getDebugText()); 897 900 898 901 899 //-- culling stats -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r254 r259 19 19 using namespace Ogre; 20 20 21 21 /** Struct storing walktrough statistics 22 */ 23 struct WalkthroughStats 24 { 25 public: 26 27 unsigned long mAccFps; 28 unsigned long mBestFps; 29 unsigned long mWorstFps; 30 unsigned long mAccTris; 31 unsigned long mAccQueryCulledNodes; 32 unsigned long mAccFrustumCulledNodes; 33 unsigned long mFrameCount; 34 unsigned long mAccRenderedNodes; 35 36 WalkthroughStats(): 37 mAccFps(0), mBestFps(0), mWorstFps(0), mAccTris(0), 38 mAccQueryCulledNodes(0), mAccFrustumCulledNodes(0), 39 mFrameCount(0), mAccRenderedNodes(0) 40 {} 41 42 void Reset() 43 { 44 mAccFps = mBestFps = mWorstFps = mAccTris = mAccQueryCulledNodes = mAccFrustumCulledNodes = mFrameCount = mAccRenderedNodes = 0; 45 } 46 47 void UpdateFrame(int currentFps, int bestFps, int worstFps, int renderedTris, int renderedNodes, int queryCulledNodes, int frustumCulledNodes) 48 { 49 mAccFps += currentFps; 50 mBestFps = bestFps; 51 mWorstFps = worstFps; 52 53 // accumulated #triangles (M) 54 mAccTris += renderedTris / 1000; 55 mAccRenderedNodes += renderedNodes; 56 mAccQueryCulledNodes += queryCulledNodes; 57 mAccFrustumCulledNodes += frustumCulledNodes; 58 59 ++ mFrameCount; 60 } 61 62 void Print(std::ostream &d, const std::string &algorithmName) const 63 { 64 // compuate average fps and triangle count 65 float avgFps = (float)mAccFps / (float)mFrameCount; 66 float avgTris = (float)mAccTris / (float)mFrameCount; 67 float avgFrustumCulledNodes = 0; 68 float avgRenderedNodes = 0; 69 float avgQueryCulledNodes = 0; 70 71 if (mFrameCount != 0) 72 { 73 avgFrustumCulledNodes = (float)mAccFrustumCulledNodes / (float)mFrameCount; 74 avgQueryCulledNodes = (float)mAccQueryCulledNodes / (float)mFrameCount; 75 avgRenderedNodes = (float)mAccRenderedNodes / (float) mFrameCount; 76 } 77 78 //-- write out stats for recorded walkthrough 79 d << "Algorithm: " << algorithmName << "\n" 80 << "avg. FPS: " << avgFps << "\n" 81 << "best FPS: " << mBestFps << "\n" 82 << "worst FPS: " << mWorstFps << "\n" 83 << "avg. #triangles: " << avgTris << " M\n" 84 << "#frames: " << mFrameCount << "\n" 85 << "avg. #query culled nodes: " << avgFrustumCulledNodes << "\n" 86 << "avg. #frustum culled nodes: " << avgQueryCulledNodes << "\n" 87 << "avg. #rendered nodes: " << avgRenderedNodes << "\n"; 88 } 89 90 }; 22 91 23 92 /** Frame listener specialised for terrains. … … 39 108 40 109 ~TerrainFrameListener(); 41 42 110 43 111 bool frameStarted(const FrameEvent& evt); … … 184 252 void initVisStatsOverlay(); 185 253 void initQueryOverlay(); 186 187 void resetStats();188 254 189 255 SceneManager *mSceneMgr; // A pointer to the scene manager … … 206 272 /// the newly created object 207 273 SceneNode *mCurrentObject; 208 /// HACK 209 float mDemoFps; 210 bool mUseDemoFps; 274 275 WalkthroughStats mWalkthroughStats; 276 277 /// HACK for demo 278 float mDemoFps; 279 bool mUseDemoFps; 280 211 281 OverlayElement *mAlgorithmInfo; 212 282 OverlayElement *mThresholdInfo; … … 301 371 bool mShiftPressed; 302 372 bool mShowQueryStats; 303 304 unsigned long mAvgFps; 305 unsigned long mFrameCount; 306 373 307 374 //bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn; 308 375 PlatformQueryManager *mQueryManager; -
trunk/VUT/work/iv/IVFrameListener.cpp
r254 r259 78 78 mDelayedTraversedNodes(0.0), 79 79 mApplication(app), 80 mMoveSpeed(15) 80 mMoveSpeed(15), 81 mAccumulatedTris(0), 82 mAccumulatedFps(0) 81 83 { 82 84 mRaySceneQuery = mSceneMgr->createRayQuery( … … 420 422 writeFrames(); 421 423 422 float avgFps = (float)mAvgFps / (float)mFrameCount; 424 float avgFps = (float)mAccumulatedFps / (float)mFrameCount; 425 float avgTris = (float)mAccumulatedTris / (float)mFrameCount; 423 426 424 427 //-- write out stats for recorded walkthrough 425 428 std::stringstream d; 429 426 430 d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n" 427 431 //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n" … … 430 434 << "worst FPS: " << mWindow->getWorstFPS() << "\n" 431 435 << "best frame time: " << mWindow->getBestFrameTime() << "\n" 432 << "worst frame time: " << mWindow->getWorstFrameTime(); 433 436 << "worst frame time: " << mWindow->getWorstFrameTime() << "\n" 437 << "avg. #triangles: " << avgTris << " M\n" 438 << "#frames: " << mFrameCount < "\n"; 439 434 440 LogManager::getSingleton().logMessage(d.str()); 435 441 } … … 515 521 { 516 522 mCurrentAlgorithm = (mCurrentAlgorithm + 1) % 517 (GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS - 1);523 GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS; 518 524 setAlgorithm(mCurrentAlgorithm); 519 525 } … … 527 533 void IVFrameListener::resetStats() 528 534 { 529 mAvgFps = 0; 535 mAccumulatedFps = 0; 536 mAccumulatedTris = 0; 530 537 mFrameCount = 0; 531 538 } … … 544 551 // HACK: compute average fps ourselfs, because ogre avg. fps is wrong 545 552 // TODO: update only once per second 546 mA vgFps += mWindow->getStatistics().lastFPS;553 mAccumulatedFps += mWindow->getStatistics().lastFPS; 547 554 ++ mFrameCount; 548 555 549 float avgFps = (float)mA vgFps / (float)mFrameCount;556 float avgFps = (float)mAccumulatedFps / (float)mFrameCount; 550 557 551 558 // update stats when necessary -
trunk/VUT/work/iv/IVFrameListener.h
r254 r259 237 237 bool mShowQueryStats; 238 238 239 unsigned long mAvgFps; 239 unsigned long mAccumulatedFps; 240 unsigned long mAccumulatedTris; 240 241 unsigned long mFrameCount; 241 242 -
trunk/VUT/work/iv/TestCullingIVApplication.cpp
r193 r259 92 92 mSceneMgr->setOption("NodeVizScale", &scale); 93 93 // HACK: change this to relative path 94 String path = "D:/ gametools/trunk/VUT/Ogre/resources/";94 String path = "D:/svn/gtp/trunk/VUT/Ogre/resources/"; 95 95 96 96 SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node1");
Note: See TracChangeset
for help on using the changeset viewer.