Changeset 3223


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

worked on stats

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
5 added
3 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3220 r3223  
    88 
    99useLODs=1 
     10# shadow map size 
    1011shadowSize=4096 
    1112# the filenames given to recorded frames (+ number.bmp) 
    1213recordedFramesSuffix=image 
     14# the filename for the statistics 
     15statsFilename=mystats.log 
    1316 
    1417 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StatsWriter.h

    r3221 r3223  
    1212struct FrameStats 
    1313{ 
    14         FrameStats() {} 
     14        FrameStats(): 
     15        mFrame(0), mFPS(0), mTime(.0f), mNodes(0), mTriangles(0), mObjects(0) 
     16        {} 
     17 
     18 
    1519        FrameStats(int frame, int fps, float time, int nodes, int triangles, int objects): 
    1620        mFrame(frame), mFPS(fps), mTime(time), mNodes(nodes), mTriangles(triangles), mObjects(objects) 
    1721        {} 
    1822 
     23 
     24        friend std::ostream& operator<< (std::ostream &s, const FrameStats &A); 
    1925 
    2026 
     
    2733        int mTriangles; 
    2834        int mObjects; 
    29  
    30  
    31         friend std::ostream& operator<< (std::ostream &s, const FrameStats &A); 
    3235}; 
    3336 
     
    3841        s << "#FRAME" << "\n" << A.mFrame << std::endl; 
    3942        s << "#FPS" << "\n" << A.mFPS << std::endl; 
    40         s << "TIME" << "\n" << A.mTime << std::endl; 
     43        s << "#TIME" << "\n" << A.mTime << std::endl; 
    4144        s << "#NODES" << "\n" << A.mNodes << std::endl; 
    4245        s << "#TRIANGLES" << "\n" << A.mTriangles << std::endl; 
    4346        s << "#OBJECTS" << "\n" << A.mObjects << std::endl; 
     47 
     48        return s; 
    4449} 
    4550 
  • 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.