Ignore:
Timestamp:
08/21/06 17:05:45 (18 years ago)
Author:
szydlowski
Message:

implemented enhanced vis with early abort
also own frame & time counter in demo mode
fixed dependencies in solution file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp

    r1220 r1250  
    131131mTimeUntilNextToggle(0.0f), 
    132132// stuff for walkthrough recording/playback 
    133 mTimeUntilNextLogWrite(0.0f), 
     133mTimeUntilNextLogWrite(options.mDemoInterval), 
    134134mTimeRemaining(0.0f), 
    135135mWaitBeforeDemoStart(0.0f), 
     
    10631063                mTimeRemaining -= evt.timeSinceLastFrame; 
    10641064 
     1065                // update stats 
     1066                ++ mDemoStats.mNumFrames; 
     1067                ++ mDemoStats.mTotalNumFrames; 
     1068                mDemoStats.mEllapsedTime += evt.timeSinceLastFrame; 
     1069                mDemoStats.mTotalEllapsedTime += evt.timeSinceLastFrame; 
     1070 
    10651071                // store fps when in demo mode 
    10661072                if (mOptions.mDemoMode) 
     
    10701076                        if (mTimeUntilNextLogWrite <= 0.0) 
    10711077                        { 
    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; 
    10751084                        } 
    10761085                } 
     
    12561265                mCurrFrame = mFrameList.begin(); 
    12571266                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; 
    12581273        } 
    12591274        // stop playback 
     
    14521467        // stats 
    14531468        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); 
    14551472         
    14561473        // check if logfile exists 
     
    14581475        if (logread.is_open()) 
    14591476        { 
    1460                 // read first item, it's the name of the demo 
     1477                // read first line, shuold start with the name of the demo 
    14611478                // 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) 
    14641482                { 
    14651483                        LogManager::getSingleton().logMessage( 
    14661484                                "##Error##: Saved demo stats do not match the current demo: " + 
    1467                                 demofile + " != " + mOptions.mDemoInfileName); 
     1485                                storedname + " != " + demoname); 
    14681486                        logread.close(); 
    14691487                        return; 
     
    14771495                { 
    14781496                        // demo title 
    1479                         logheader << mOptions.mDemoInfileName << fs; 
     1497                        logheader << demoname << fs; 
    14801498                        // seconds 
    14811499                        for (size_t i = 0; i < mDemoFPS.size(); i ++) 
     
    14841502                        } 
    14851503                        // 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; 
    14871506                        logheader.close(); 
    14881507                } 
     
    15021521        { 
    15031522                // demo settings 
    1504                 logwrite << SCENEMANAGER[mOptions.mSceneManager]; 
     1523                logwrite << "\"" << SCENEMANAGER[mOptions.mSceneManager]; 
    15051524                if (mOptions.mSceneManager == SM_KDT) 
    15061525                { 
     
    15121531                        logwrite << ds << RENDERMETHOD[(mOptions.mRenderMethod+3)%3]; 
    15131532                } 
    1514                 logwrite << fs; 
     1533                logwrite << "\"" << fs; 
    15151534                // per second stats 
    15161535                for (std::list<Real>::iterator it = mDemoFPS.begin(); it != mDemoFPS.end(); it ++) 
     
    15221541                                maxFPS = *it; 
    15231542 
    1524                         avgFPS += *it; 
     1543                        //avgFPS += *it; 
    15251544 
    15261545                        logwrite << (int)(*it) << fs; 
    15271546 
    15281547                } 
    1529                 avgFPS /= mDemoFPS.size(); 
     1548                //avgFPS /= mDemoFPS.size(); 
     1549                avgFPS = mDemoStats.mTotalNumFrames / mDemoStats.mTotalEllapsedTime; 
    15301550                // 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; 
    15321554                logwrite.close(); 
    15331555        } 
Note: See TracChangeset for help on using the changeset viewer.