Changeset 147 for trunk/VUT/work
- Timestamp:
- 06/22/05 18:35:55 (20 years ago)
- Location:
- trunk/VUT/work/TestCullingTerrain
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r146 r147 170 170 dynamic_cast<PlatformQueryManager *>(mVisibilityManager->GetQueryManager())-> 171 171 SetViewport(mWindow->getViewport(0)); 172 173 // reset statistics 174 resetStats(); 172 175 } 173 176 //----------------------------------------------------------------------- … … 528 531 writeFrames(); 529 532 533 float avgFps = (float)mAvgFps / (float)mFrameCount; 534 530 535 //-- write out stats for recorded walkthrough 531 536 std::stringstream d; 532 537 d << "Algorithm: " << currentAlgorithmCaptions[mCurrentAlgorithm] << "\n" 533 << "avg. FPS: " << mWindow->getAverageFPS() << "\n" 538 //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n" 539 << "avg. FPS: " << avgFps << "\n" 534 540 << "best FPS: " << mWindow->getBestFPS() << "\n" 535 541 << "worst FPS: " << mWindow->getWorstFPS() << "\n" … … 564 570 mWindow->setDebugText("Replay"); 565 571 566 // reset, because we measure fps stats during walkthrough 572 // reset, because we measure fps stats during walkthrough (warning: average fps broken) 567 573 mWindow->resetStatistics(); 574 resetStats(); 568 575 569 576 //-- initialise frame data … … 630 637 } 631 638 //----------------------------------------------------------------------- 639 void TerrainFrameListener::resetStats() 640 { 641 mAvgFps = 0; 642 mFrameCount = 0; 643 } 644 //----------------------------------------------------------------------- 632 645 void TerrainFrameListener::updateStats() 633 646 { … … 635 648 char str[100]; 636 649 637 static String currFps = "Current FPS: "; 638 static String avgFps = "Average FPS: "; 639 static String bestFps = "Best FPS: "; 640 static String worstFps = "Worst FPS: "; 641 static String tris = "Triangle Count: "; 642 650 static String currFpsString = "Current FPS: "; 651 static String avgFpsString = "Average FPS: "; 652 static String bestFpsString = "Best FPS: "; 653 static String worstFpsString = "Worst FPS: "; 654 static String trisString = "Triangle Count: "; 655 656 mAvgFps += mWindow->getStatistics().lastFPS; 657 ++ mFrameCount; 658 659 float avgFps = (float)mAvgFps / (float)mFrameCount; 660 643 661 // update stats when necessary 644 662 try … … 651 669 const RenderTarget::FrameStats& stats = mWindow->getStatistics(); 652 670 653 guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)); 654 guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS)); 655 guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS) 671 //guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS)); 672 guiAvg->setCaption(avgFpsString + StringConverter::toString(avgFps)); 673 guiCurr->setCaption(currFpsString + StringConverter::toString(stats.lastFPS)); 674 guiBest->setCaption(bestFpsString + StringConverter::toString(stats.bestFPS) 656 675 +" "+StringConverter::toString(stats.bestFrameTime)+" ms"); 657 guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)676 guiWorst->setCaption(worstFpsString + StringConverter::toString(stats.worstFPS) 658 677 +" "+StringConverter::toString(stats.worstFrameTime)+" ms"); 659 678 660 679 OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); 661 guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));680 guiTris->setCaption(trisString + StringConverter::toString(stats.triangleCount)); 662 681 663 682 OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r146 r147 126 126 protected: 127 127 128 void resetStats(); 129 128 130 /** Clamp camera to terrain. 129 131 */ … … 228 230 bool mShowQueryStats; 229 231 232 unsigned long mAvgFps; 233 unsigned long mFrameCount; 230 234 //bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn; 231 235 };
Note: See TracChangeset
for help on using the changeset viewer.