Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/showplot
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/showplot	(revision 3223)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/showplot	(revision 3223)
@@ -0,0 +1,5 @@
+#!/bin/sh
+mv plot.fig $1.fig
+fig2dev -L eps $1.fig $1.eps
+#gv -scale 3 $1.eps &
+c:/programme/Ghostgum/gsview/gsview32.exe $1.eps &
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StatsWriter.h
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StatsWriter.h	(revision 3221)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/StatsWriter.h	(revision 3223)
@@ -12,9 +12,15 @@
 struct FrameStats
 {
-	FrameStats() {}
+	FrameStats():
+	mFrame(0), mFPS(0), mTime(.0f), mNodes(0), mTriangles(0), mObjects(0)
+	{}
+
+
 	FrameStats(int frame, int fps, float time, int nodes, int triangles, int objects):
 	mFrame(frame), mFPS(fps), mTime(time), mNodes(nodes), mTriangles(triangles), mObjects(objects)
 	{}
 
+
+	friend std::ostream& operator<< (std::ostream &s, const FrameStats &A);
 
 
@@ -27,7 +33,4 @@
 	int mTriangles;
 	int mObjects;
-
-
-	friend std::ostream& operator<< (std::ostream &s, const FrameStats &A);
 };
 
@@ -38,8 +41,10 @@
 	s << "#FRAME" << "\n" << A.mFrame << std::endl;
 	s << "#FPS" << "\n" << A.mFPS << std::endl;
-	s << "TIME" << "\n" << A.mTime << std::endl;
+	s << "#TIME" << "\n" << A.mTime << std::endl;
 	s << "#NODES" << "\n" << A.mNodes << std::endl;
 	s << "#TRIANGLES" << "\n" << A.mTriangles << std::endl;
 	s << "#OBJECTS" << "\n" << A.mObjects << std::endl;
+
+	return s;
 }
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3221)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp	(revision 3223)
@@ -57,4 +57,5 @@
 #include "Shape.h"
 #include "WalkThroughRecorder.h"
+#include "StatsWriter.h"
 
 
@@ -119,12 +120,14 @@
 /// replays the recorded path
 bool replayPath = false;
-
+/// frame number for replay
 int currentReplayFrame = -1;
 
 string recordedFramesSuffix("frames");
+string statsFilename("stats");
 
 /// the walkThroughRecorder
 WalkThroughRecorder *walkThroughRecorder = NULL;
 WalkThroughPlayer *walkThroughPlayer = NULL;
+StatsWriter *statsWriter = NULL;
 
 
@@ -421,4 +424,5 @@
 
 		env.GetStringParam(string("recordedFramesSuffix"), recordedFramesSuffix);
+		env.GetStringParam(string("statsFilename"), statsFilename);
 
 		//env.GetStringParam(string("modelPath"), model_path);
@@ -450,4 +454,5 @@
 		cout << "ssao full resolution: " << ssaoUseFullResolution << endl;
 		cout << "recorded frames suffix: " << recordedFramesSuffix << endl;
+		cout << "stats filename: " << statsFilename << endl;
 
 		//cout << "model path: " << model_path << endl;
@@ -1081,4 +1086,5 @@
 		++ currentReplayFrame;
 
+		// reset if end of walkthrough is reached
 		if (!walkThroughPlayer->ReadNextFrame(camera)) 
 		{
@@ -1131,6 +1137,5 @@
 		glEnable(GL_MULTISAMPLE_ARB);
 		renderState.SetRenderTechnique(FORWARD);
-		//glEnable(GL_LIGHTING);
-
+		
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 		glEnableClientState(GL_NORMAL_ARRAY);
@@ -1145,7 +1150,7 @@
 		if (!fbo) InitFBO(); 
 		fbo->Bind();
-
+		// render to single depth texture
 		glDrawBuffers(1, mrt);
-
+		// clear buffer once
 		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
@@ -1305,4 +1310,5 @@
 	elapsedTime = frameTimer.Elapsedms(restart);
 
+	// statistics
 	DisplayStats();
 
@@ -1971,4 +1977,5 @@
 	DEL_PTR(walkThroughRecorder);
 	DEL_PTR(walkThroughPlayer);
+	DEL_PTR(statsWriter);
 
 	ResourceManager::DelSingleton();
@@ -2035,4 +2042,5 @@
 	static float rTime = 1000.0f;
 
+	// the render time used up purely for the traversal algorithm using glfinish
 	if (showAlgorithmTime)
 	{
@@ -2078,4 +2086,40 @@
 
 
+	////////////////
+	//-- record stats on walkthrough
+
+	static float accTime = .0f;
+	static float averageTime = .0f;
+
+	if (currentReplayFrame > -1) 
+	{
+		accTime += frameTime;
+		averageTime = accTime / (currentReplayFrame + 1);
+
+		if (!statsWriter)
+			statsWriter = new StatsWriter(statsFilename);
+			
+		FrameStats frameStats;
+		frameStats.mFrame = currentReplayFrame;
+		frameStats.mFPS = 1e3f / (float)frameTime;
+		frameStats.mTime = frameTime;
+		frameStats.mNodes = renderedNodes;
+		frameStats.mObjects = renderedObjects;
+		frameStats.mTriangles = renderedTriangles;
+
+		statsWriter->WriteFrameStats(frameStats);
+	}
+	else if (statsWriter)
+	{
+		Debug << "average frame time " << averageTime << " for traversal algorithm " << renderMode << endl;
+
+		// reset average frame time
+		averageTime = .0f;
+		accTime = .0f;
+
+		DEL_PTR(statsWriter);
+	}
+
+
 	Begin2D();
 
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot2
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot2	(revision 3223)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot2	(revision 3223)
@@ -0,0 +1,75 @@
+#!/bin/sh
+#unalias rm
+
+rm -f *.tmpplot*
+
+PFILE=plot.fig
+FILE=tmp.plot
+echo $FILE
+rm -f $FILE
+#echo set term postscript eps monochrome dashed \"Times-Roman\" 24 > $FILE
+#echo set term postscript eps color solid > $FILE
+echo set term fig color fontsize 10 big landscape > $FILE
+echo set output \"$PFILE\" >> $FILE
+
+
+#echo set term x11 > $FILE
+#echo set grid >> $FILE 
+STYLE=$1
+echo set xlabel \"$2\" >> $FILE 
+echo set ylabel \"$3\" >> $FILE
+#echo set yrange \[0:2000\] >> $FILE
+
+# echo set boxwidth 0.4 >> $FILE
+
+#echo set logscale x >> $FILE
+echo -n plot >> $FILE
+
+
+PAR1=$2
+PAR2=$3
+NAME=A
+
+shift
+shift
+shift    
+
+pt=1
+lt=1
+
+for i in $* ; do
+    echo $i ;
+    echo $NAME
+    grep -A 1 $PAR1 $i | grep -v "\-\-" | grep -v "#" > $i.tmpplot.x ;
+    grep -A 1 $PAR2 $i | grep -v "\-\-" | grep -v "#" > $i.tmpplot.y ;
+    paste $i.tmpplot.x $i.tmpplot.y > $i.tmpplot ;
+    if test $i != $1 ; then echo -n ", ">>$FILE; fi
+#    echo -n " "\"$i.tmpplot\"  title \"$NAME\" with $STYLE" " lt $pt >>$FILE ;
+    echo -n " "\"$i.tmpplot\"  title \"$i\" with $STYLE" " lt $pt >>$FILE ;
+    YPLOT="$YPLOT $i.tmpplot.y";
+    case $NAME in
+    A) NAME=B;;
+    B) NAME=C;;
+    C) NAME=D;;
+    D) NAME=E;;
+    E) NAME=F;;
+    F) NAME=G;;
+    G) NAME=H;;
+    H) NAME=I;;
+    I) NAME=J;;
+    J) NAME=K;;
+    K) NAME=L;;
+    L) NAME=M;;
+    M) NAME=N;;
+    N) NAME=O;;
+    esac;
+    let pt=$pt+1;
+done ;
+echo >> $FILE
+paste $1.tmpplot.x $YPLOT | grep -v "#"
+
+cat $FILE
+gnuplot $FILE 
+rm -f $FILE
+rm -f *.tmpplot*
+
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot3
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot3	(revision 3223)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot3	(revision 3223)
@@ -0,0 +1,69 @@
+#!/bin/sh
+unalias rm
+
+rm -f *.tmpplot*
+
+PFILE=plot.fig
+FILE=tmp.plot
+echo $FILE
+rm -f $FILE
+#echo set term postscript eps monochrome dashed \"Times-Roman\" 24 > $FILE
+#echo set term postscript eps color solid > $FILE
+echo set term fig color fontsize 18 big  > $FILE
+echo set output \"$PFILE\" >> $FILE
+
+
+#echo set term x11 > $FILE
+#echo set grid >> $FILE 
+STYLE=$1
+echo set xlabel \"$2\" >> $FILE 
+echo set ylabel \"$3\" >> $FILE
+
+#echo set yrange \[1:1e8\] >> $FILE
+#echo set boxwidth 0.4 >> $FILE
+
+echo set logscale y >> $FILE
+echo -n plot >> $FILE
+
+#echo -n " " x*x*x*x*x*x*x*log\(x\)  title \"O\(k^2 log k\)\" with lines" , " >>$FILE
+
+PAR1=$2
+PAR2=$3
+NAME=A
+
+shift
+shift
+shift    
+
+pt=1
+lt=1
+
+for i in $* ; do
+    echo $i ;
+    echo $NAME
+    grep -A 1 $PAR1 $i | grep -v "\-\-" | grep -v "#" > $i.tmpplot.x ;
+    grep -A 1 $PAR2 $i | grep -v "\-\-" | grep -v "#" > $i.tmpplot.y ;
+    paste $i.tmpplot.x $i.tmpplot.y > $i.tmpplot ;
+    if test $i != $1 ; then echo -n ", ">>$FILE; fi
+    echo -n " "\"$i.tmpplot\"  title \"$NAME\" with $STYLE" " >>$FILE ;
+    YPLOT="$YPLOT $i.tmpplot.y";
+    case $NAME in
+    A) NAME=B;;
+    B) NAME=C;;
+    C) NAME=D;;
+    D) NAME=E;;
+    E) NAME=F;;
+    F) NAME=G;;
+    esac;
+    let pt=$pt+1;
+done ;
+#echo -n ", " 1.2*x*x*log\(x\)  title \"O\(k^2 log k\)\" with lines lt 2 " , " >>$FILE
+#echo -n " " 0.05*x*log\(x\)  title \"O\(k log k\)\" with lines lt 3 " " >>$FILE
+echo >> $FILE
+paste $1.tmpplot.x $YPLOT | grep -v "#"
+
+cat $FILE
+gnuplot $FILE 
+rm -f $FILE
+rm -f *.tmpplot*
+
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot	(revision 3223)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/ps_memory_plot	(revision 3223)
@@ -0,0 +1,59 @@
+#!/bin/sh
+#unalias rm
+
+rm -f *.tmpplot*
+
+PFILE=plot.fig
+FILE=tmp.plot
+echo $FILE
+rm -f $FILE
+#echo set term postscript eps monochrome dashed \"Times-Roman\" 24 > $FILE
+echo set term fig color fontsize 22 big landscape > $FILE
+#echo set term postscript eps color solid > $FILE
+echo set output \"$PFILE\" >> $FILE
+#echo set term x11 > $FILE
+#echo set grid >> $FILE 
+STYLE=$1
+echo set xlabel \"$2\" >> $FILE 
+echo set ylabel \"$3\" >> $FILE
+# echo set boxwidth 0.4 >> $FILE
+
+
+echo set logscale y >> $FILE
+echo -n plot >> $FILE
+
+#echo -n " " 2*x*log\(x\)  title \"O\(k log k\)\" with lines" , " >>$FILE
+
+PAR1=$2
+PAR2=$3
+NAME=A
+
+shift
+shift
+shift    
+for i in $* ; do
+    echo $i ;
+    echo $NAME
+    grep -A 1 $PAR1 $i | grep -v "\-\-" | grep -v "#" > $i.tmpplot.x ;
+    grep -A 1 $PAR2 $i | grep -v "\-\-" | grep -v "#" > $i.tmpplot.y ;
+    paste $i.tmpplot.x $i.tmpplot.y > $i.tmpplot ;
+    if test $i != $1 ; then echo -n ", ">>$FILE; fi
+    echo -n " "\"$i.tmpplot\"  title \"$NAME\" with $STYLE" " >>$FILE ;
+    YPLOT="$YPLOT $i.tmpplot.y";
+    case $NAME in
+    A) NAME=B;;
+    B) NAME=C;;
+    C) NAME=D;;
+    D) NAME=E;;
+    E) NAME=F;;
+    F) NAME=G;;
+    esac;
+done ;
+echo >> $FILE
+paste $1.tmpplot.x $YPLOT | grep -v "#"
+
+cat $FILE
+gnuplot $FILE 
+rm -f $FILE
+rm -f *.tmpplot*
+
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/plot_friendly
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/plot_friendly	(revision 3223)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/plot_friendly	(revision 3223)
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+PREFIX=vienna
+
+#COMMAND1=../cmxplot
+COMMAND1=./ps_memory_plot
+COMMAND2=./ps_memory_plot2
+COMMAND3=./ps_memory_plot3
+
+
+
+FILES="chc_f.log chc++_f-rmb.log chc++_f.log"
+
+echo $FILES
+
+STYLE=lines
+
+
+$COMMAND2 $STYLE FRAMES FPS $FILES
+./showplot $PREFIX-frames_fps
+
+$COMMAND2 $STYLE FRAMES TIME $FILES
+./showplot $PREFIX-frames_time
Index: /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env
===================================================================
--- /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3220)
+++ /GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env	(revision 3223)
@@ -8,7 +8,10 @@
 
 useLODs=1
+# shadow map size
 shadowSize=4096
 # the filenames given to recorded frames (+ number.bmp)
 recordedFramesSuffix=image
+# the filename for the statistics
+statsFilename=mystats.log
 
 
