Changeset 259 for trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
- Timestamp:
- 09/06/05 18:18:47 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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;
Note: See TracChangeset
for help on using the changeset viewer.