Changeset 3223 for GTP/trunk/App
- Timestamp:
- 12/11/08 02:32:29 (16 years ago)
- 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 8 8 9 9 useLODs=1 10 # shadow map size 10 11 shadowSize=4096 11 12 # the filenames given to recorded frames (+ number.bmp) 12 13 recordedFramesSuffix=image 14 # the filename for the statistics 15 statsFilename=mystats.log 13 16 14 17 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StatsWriter.h
r3221 r3223 12 12 struct FrameStats 13 13 { 14 FrameStats() {} 14 FrameStats(): 15 mFrame(0), mFPS(0), mTime(.0f), mNodes(0), mTriangles(0), mObjects(0) 16 {} 17 18 15 19 FrameStats(int frame, int fps, float time, int nodes, int triangles, int objects): 16 20 mFrame(frame), mFPS(fps), mTime(time), mNodes(nodes), mTriangles(triangles), mObjects(objects) 17 21 {} 18 22 23 24 friend std::ostream& operator<< (std::ostream &s, const FrameStats &A); 19 25 20 26 … … 27 33 int mTriangles; 28 34 int mObjects; 29 30 31 friend std::ostream& operator<< (std::ostream &s, const FrameStats &A);32 35 }; 33 36 … … 38 41 s << "#FRAME" << "\n" << A.mFrame << std::endl; 39 42 s << "#FPS" << "\n" << A.mFPS << std::endl; 40 s << " TIME" << "\n" << A.mTime << std::endl;43 s << "#TIME" << "\n" << A.mTime << std::endl; 41 44 s << "#NODES" << "\n" << A.mNodes << std::endl; 42 45 s << "#TRIANGLES" << "\n" << A.mTriangles << std::endl; 43 46 s << "#OBJECTS" << "\n" << A.mObjects << std::endl; 47 48 return s; 44 49 } 45 50 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3221 r3223 57 57 #include "Shape.h" 58 58 #include "WalkThroughRecorder.h" 59 #include "StatsWriter.h" 59 60 60 61 … … 119 120 /// replays the recorded path 120 121 bool replayPath = false; 121 122 /// frame number for replay 122 123 int currentReplayFrame = -1; 123 124 124 125 string recordedFramesSuffix("frames"); 126 string statsFilename("stats"); 125 127 126 128 /// the walkThroughRecorder 127 129 WalkThroughRecorder *walkThroughRecorder = NULL; 128 130 WalkThroughPlayer *walkThroughPlayer = NULL; 131 StatsWriter *statsWriter = NULL; 129 132 130 133 … … 421 424 422 425 env.GetStringParam(string("recordedFramesSuffix"), recordedFramesSuffix); 426 env.GetStringParam(string("statsFilename"), statsFilename); 423 427 424 428 //env.GetStringParam(string("modelPath"), model_path); … … 450 454 cout << "ssao full resolution: " << ssaoUseFullResolution << endl; 451 455 cout << "recorded frames suffix: " << recordedFramesSuffix << endl; 456 cout << "stats filename: " << statsFilename << endl; 452 457 453 458 //cout << "model path: " << model_path << endl; … … 1081 1086 ++ currentReplayFrame; 1082 1087 1088 // reset if end of walkthrough is reached 1083 1089 if (!walkThroughPlayer->ReadNextFrame(camera)) 1084 1090 { … … 1131 1137 glEnable(GL_MULTISAMPLE_ARB); 1132 1138 renderState.SetRenderTechnique(FORWARD); 1133 //glEnable(GL_LIGHTING); 1134 1139 1135 1140 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1136 1141 glEnableClientState(GL_NORMAL_ARRAY); … … 1145 1150 if (!fbo) InitFBO(); 1146 1151 fbo->Bind(); 1147 1152 // render to single depth texture 1148 1153 glDrawBuffers(1, mrt); 1149 1154 // clear buffer once 1150 1155 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 1151 1156 … … 1305 1310 elapsedTime = frameTimer.Elapsedms(restart); 1306 1311 1312 // statistics 1307 1313 DisplayStats(); 1308 1314 … … 1971 1977 DEL_PTR(walkThroughRecorder); 1972 1978 DEL_PTR(walkThroughPlayer); 1979 DEL_PTR(statsWriter); 1973 1980 1974 1981 ResourceManager::DelSingleton(); … … 2035 2042 static float rTime = 1000.0f; 2036 2043 2044 // the render time used up purely for the traversal algorithm using glfinish 2037 2045 if (showAlgorithmTime) 2038 2046 { … … 2078 2086 2079 2087 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 2080 2124 Begin2D(); 2081 2125
Note: See TracChangeset
for help on using the changeset viewer.