Changeset 1250 for GTP/trunk/App/Demos
- Timestamp:
- 08/21/06 17:05:45 (18 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/include/TestKdTreeAppListener.h
r1220 r1250 114 114 mBuildMethod(KdTree::KDBM_PRIORITYQUEUE), 115 115 mDemoMode(false), 116 mEnhancedVisibility(false) 116 mEnhancedVisibility(false), 117 mDemoInterval(1.0f) 117 118 { 118 119 … … 134 135 bool mDemoMode; 135 136 bool mEnhancedVisibility; 136 }; 137 Real mDemoInterval; 138 }; 139 140 struct DemoStats 141 { 142 unsigned int mTotalNumFrames; 143 unsigned int mNumFrames; 144 Real mTotalEllapsedTime; 145 Real mEllapsedTime; 146 } mDemoStats; 137 147 138 148 // Constructor takes a RenderWindow because it uses that to determine input context -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp
r1220 r1250 37 37 .addOpt("s","scenemgr", ARGUMENT_REQUIRED) 38 38 .addOpt("","comment", ARGUMENT_REQUIRED) 39 .addOpt("e","enhancevis", ARGUMENT_NONE); 39 .addOpt("e","enhancevis", ARGUMENT_NONE) 40 .addOpt("","logint",ARGUMENT_REQUIRED); 40 41 41 42 … … 87 88 s << tmp; 88 89 s >> options.mKI; 90 s.clear(); 91 } 92 93 if (cmdparser.getOpt("logint", tmp)) 94 { 95 s << tmp; 96 s >> options.mDemoInterval; 89 97 s.clear(); 90 98 } … … 417 425 KdTreeAppListener::SCENEMANAGERNAME[mOptions.mSceneManager], 418 426 "MySceneManager"); 419 // set params depending onscene manager427 // set params for kdtree scene manager 420 428 if (mOptions.mSceneManager == KdTreeAppListener::SM_KDT) 421 429 { … … 426 434 mSceneMgr->setOption("RenderMethod", &mOptions.mRenderMethod); 427 435 mSceneMgr->setOption("EnhancedVisibility", &mOptions.mEnhancedVisibility); 436 // fix 437 bool depthpass = false; 438 mSceneMgr->setOption("UseDepthPass", &depthpass); 428 439 } 429 440 // set algorithm when scene manager is OCM - numbering is different though 430 if (mOptions.mSceneManager == KdTreeAppListener::SM_OCM)441 else if (mOptions.mSceneManager == KdTreeAppListener::SM_OCM) 431 442 { 432 443 int alg = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod); -
GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp
r1220 r1250 131 131 mTimeUntilNextToggle(0.0f), 132 132 // stuff for walkthrough recording/playback 133 mTimeUntilNextLogWrite( 0.0f),133 mTimeUntilNextLogWrite(options.mDemoInterval), 134 134 mTimeRemaining(0.0f), 135 135 mWaitBeforeDemoStart(0.0f), … … 1063 1063 mTimeRemaining -= evt.timeSinceLastFrame; 1064 1064 1065 // update stats 1066 ++ mDemoStats.mNumFrames; 1067 ++ mDemoStats.mTotalNumFrames; 1068 mDemoStats.mEllapsedTime += evt.timeSinceLastFrame; 1069 mDemoStats.mTotalEllapsedTime += evt.timeSinceLastFrame; 1070 1065 1071 // store fps when in demo mode 1066 1072 if (mOptions.mDemoMode) … … 1070 1076 if (mTimeUntilNextLogWrite <= 0.0) 1071 1077 { 1072 const RenderTarget::FrameStats& stats = mWindow->getStatistics(); 1073 mTimeUntilNextLogWrite += 1.0; 1074 mDemoFPS.push_back(stats.lastFPS); 1078 mTimeUntilNextLogWrite += mOptions.mDemoInterval; 1079 //const RenderTarget::FrameStats& stats = mWindow->getStatistics(); 1080 //mDemoFPS.push_back(stats.lastFPS); 1081 mDemoFPS.push_back(mDemoStats.mNumFrames / mDemoStats.mEllapsedTime); 1082 mDemoStats.mNumFrames = 0; 1083 mDemoStats.mEllapsedTime = 0.0f; 1075 1084 } 1076 1085 } … … 1256 1265 mCurrFrame = mFrameList.begin(); 1257 1266 mTimeRemaining = mCurrFrame->mElapsedTime; 1267 1268 // reset stats 1269 mDemoStats.mNumFrames = 0; 1270 mDemoStats.mTotalNumFrames = 0; 1271 mDemoStats.mEllapsedTime = 0.0f; 1272 mDemoStats.mTotalEllapsedTime = 0.0f; 1258 1273 } 1259 1274 // stop playback … … 1452 1467 // stats 1453 1468 Real minFPS = Math::POS_INFINITY, maxFPS = 0.0, avgFPS = 0.0; 1454 String demofile; 1469 String line, storedname; 1470 String demopath, demoname; 1471 StringUtil::splitFilename(mOptions.mDemoInfileName, demoname, demopath); 1455 1472 1456 1473 // check if logfile exists … … 1458 1475 if (logread.is_open()) 1459 1476 { 1460 // read first item, it'sthe name of the demo1477 // read first line, shuold start with the name of the demo 1461 1478 // if matches, OK, otherwise do something 1462 logread >> demofile; 1463 if (!StringUtil::startsWith(demofile, mOptions.mDemoInfileName)) 1479 logread >> line; 1480 storedname = line.substr(0,line.find_first_of(',')); 1481 if (storedname != demoname) 1464 1482 { 1465 1483 LogManager::getSingleton().logMessage( 1466 1484 "##Error##: Saved demo stats do not match the current demo: " + 1467 demofile + " != " + mOptions.mDemoInfileName);1485 storedname + " != " + demoname); 1468 1486 logread.close(); 1469 1487 return; … … 1477 1495 { 1478 1496 // demo title 1479 logheader << mOptions.mDemoInfileName << fs;1497 logheader << demoname << fs; 1480 1498 // seconds 1481 1499 for (size_t i = 0; i < mDemoFPS.size(); i ++) … … 1484 1502 } 1485 1503 // minFPS, avgFPS, maxFPS, comment, record separator 1486 logheader << "min FPS" << fs << "avg FPS" << fs << "max FPS" << fs << "Comment" << rs; 1504 logheader << "\"min FPS\"" << fs << "\"avg FPS\"" << fs << "\"max FPS\"" << fs 1505 << "\"# Frames \"" << fs << "\"Total Time\"" << fs << "\"Comment\"" << rs; 1487 1506 logheader.close(); 1488 1507 } … … 1502 1521 { 1503 1522 // demo settings 1504 logwrite << SCENEMANAGER[mOptions.mSceneManager];1523 logwrite << "\"" << SCENEMANAGER[mOptions.mSceneManager]; 1505 1524 if (mOptions.mSceneManager == SM_KDT) 1506 1525 { … … 1512 1531 logwrite << ds << RENDERMETHOD[(mOptions.mRenderMethod+3)%3]; 1513 1532 } 1514 logwrite << fs;1533 logwrite << "\"" << fs; 1515 1534 // per second stats 1516 1535 for (std::list<Real>::iterator it = mDemoFPS.begin(); it != mDemoFPS.end(); it ++) … … 1522 1541 maxFPS = *it; 1523 1542 1524 avgFPS += *it;1543 //avgFPS += *it; 1525 1544 1526 1545 logwrite << (int)(*it) << fs; 1527 1546 1528 1547 } 1529 avgFPS /= mDemoFPS.size(); 1548 //avgFPS /= mDemoFPS.size(); 1549 avgFPS = mDemoStats.mTotalNumFrames / mDemoStats.mTotalEllapsedTime; 1530 1550 // minFPS, avgFPS, maxFPS, comment, record separator 1531 logwrite << (int)minFPS << fs << (int)avgFPS << fs << (int)maxFPS << fs << mOptions.mComment << rs; 1551 logwrite << (int)minFPS << fs << (int)avgFPS << fs << (int)maxFPS << fs 1552 << mDemoStats.mTotalNumFrames << fs << mDemoStats.mTotalEllapsedTime << fs 1553 << "\"" << mOptions.mComment << "\"" << rs; 1532 1554 logwrite.close(); 1533 1555 }
Note: See TracChangeset
for help on using the changeset viewer.