Ignore:
Timestamp:
12/11/08 02:32:29 (16 years ago)
Author:
mattausch
Message:

worked on stats

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3221 r3223  
    5757#include "Shape.h" 
    5858#include "WalkThroughRecorder.h" 
     59#include "StatsWriter.h" 
    5960 
    6061 
     
    119120/// replays the recorded path 
    120121bool replayPath = false; 
    121  
     122/// frame number for replay 
    122123int currentReplayFrame = -1; 
    123124 
    124125string recordedFramesSuffix("frames"); 
     126string statsFilename("stats"); 
    125127 
    126128/// the walkThroughRecorder 
    127129WalkThroughRecorder *walkThroughRecorder = NULL; 
    128130WalkThroughPlayer *walkThroughPlayer = NULL; 
     131StatsWriter *statsWriter = NULL; 
    129132 
    130133 
     
    421424 
    422425                env.GetStringParam(string("recordedFramesSuffix"), recordedFramesSuffix); 
     426                env.GetStringParam(string("statsFilename"), statsFilename); 
    423427 
    424428                //env.GetStringParam(string("modelPath"), model_path); 
     
    450454                cout << "ssao full resolution: " << ssaoUseFullResolution << endl; 
    451455                cout << "recorded frames suffix: " << recordedFramesSuffix << endl; 
     456                cout << "stats filename: " << statsFilename << endl; 
    452457 
    453458                //cout << "model path: " << model_path << endl; 
     
    10811086                ++ currentReplayFrame; 
    10821087 
     1088                // reset if end of walkthrough is reached 
    10831089                if (!walkThroughPlayer->ReadNextFrame(camera))  
    10841090                { 
     
    11311137                glEnable(GL_MULTISAMPLE_ARB); 
    11321138                renderState.SetRenderTechnique(FORWARD); 
    1133                 //glEnable(GL_LIGHTING); 
    1134  
     1139                 
    11351140                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    11361141                glEnableClientState(GL_NORMAL_ARRAY); 
     
    11451150                if (!fbo) InitFBO();  
    11461151                fbo->Bind(); 
    1147  
     1152                // render to single depth texture 
    11481153                glDrawBuffers(1, mrt); 
    1149  
     1154                // clear buffer once 
    11501155                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    11511156 
     
    13051310        elapsedTime = frameTimer.Elapsedms(restart); 
    13061311 
     1312        // statistics 
    13071313        DisplayStats(); 
    13081314 
     
    19711977        DEL_PTR(walkThroughRecorder); 
    19721978        DEL_PTR(walkThroughPlayer); 
     1979        DEL_PTR(statsWriter); 
    19731980 
    19741981        ResourceManager::DelSingleton(); 
     
    20352042        static float rTime = 1000.0f; 
    20362043 
     2044        // the render time used up purely for the traversal algorithm using glfinish 
    20372045        if (showAlgorithmTime) 
    20382046        { 
     
    20782086 
    20792087 
     2088        //////////////// 
     2089        //-- record stats on walkthrough 
     2090 
     2091        static float accTime = .0f; 
     2092        static float averageTime = .0f; 
     2093 
     2094        if (currentReplayFrame > -1)  
     2095        { 
     2096                accTime += frameTime; 
     2097                averageTime = accTime / (currentReplayFrame + 1); 
     2098 
     2099                if (!statsWriter) 
     2100                        statsWriter = new StatsWriter(statsFilename); 
     2101                         
     2102                FrameStats frameStats; 
     2103                frameStats.mFrame = currentReplayFrame; 
     2104                frameStats.mFPS = 1e3f / (float)frameTime; 
     2105                frameStats.mTime = frameTime; 
     2106                frameStats.mNodes = renderedNodes; 
     2107                frameStats.mObjects = renderedObjects; 
     2108                frameStats.mTriangles = renderedTriangles; 
     2109 
     2110                statsWriter->WriteFrameStats(frameStats); 
     2111        } 
     2112        else if (statsWriter) 
     2113        { 
     2114                Debug << "average frame time " << averageTime << " for traversal algorithm " << renderMode << endl; 
     2115 
     2116                // reset average frame time 
     2117                averageTime = .0f; 
     2118                accTime = .0f; 
     2119 
     2120                DEL_PTR(statsWriter); 
     2121        } 
     2122 
     2123 
    20802124        Begin2D(); 
    20812125 
Note: See TracChangeset for help on using the changeset viewer.