clray

changeset 50:d3c46803242e

- added button to stop the timing messages
author John Tsiombikas
date Tue, 31 Aug 2010 02:54:37 +0100
parents 1ae68d46cfda
children 9c0867942612
files src/clray.cc src/rt.cc
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/src/clray.cc	Tue Aug 31 01:28:20 2010 +0100
     1.2 +++ b/src/clray.cc	Tue Aug 31 02:54:37 2010 +0100
     1.3 @@ -36,11 +36,11 @@
     1.4  static bool dbg_glrender = false;
     1.5  static bool dbg_show_kdtree = false;
     1.6  static bool dbg_show_obj = true;
     1.7 +bool dbg_frame_time = true;
     1.8  
     1.9  static Scene scn;
    1.10  static unsigned int tex;
    1.11  
    1.12 -
    1.13  int main(int argc, char **argv)
    1.14  {
    1.15  	glutInitWindowSize(800, 600);
    1.16 @@ -318,6 +318,10 @@
    1.17  		capture("shot%03d.ppm");
    1.18  		break;
    1.19  
    1.20 +	case 't':
    1.21 +		dbg_frame_time = !dbg_frame_time;
    1.22 +		break;
    1.23 +
    1.24  	default:
    1.25  		break;
    1.26  	}
     2.1 --- a/src/rt.cc	Tue Aug 31 01:28:20 2010 +0100
     2.2 +++ b/src/rt.cc	Tue Aug 31 02:54:37 2010 +0100
     2.3 @@ -60,6 +60,8 @@
     2.4  static long timing_sample_sum;
     2.5  static long num_timing_samples;
     2.6  
     2.7 +extern bool dbg_frame_time;
     2.8 +
     2.9  
    2.10  bool init_renderer(int xsz, int ysz, Scene *scn, unsigned int tex)
    2.11  {
    2.12 @@ -193,7 +195,9 @@
    2.13  	timing_sample_sum += msec;
    2.14  	num_timing_samples++;
    2.15  
    2.16 -	printf("rendered in %ld msec\n", msec);
    2.17 +	if(dbg_frame_time) {
    2.18 +		printf("rendered in %ld msec\n", msec);
    2.19 +	}
    2.20  	return true;
    2.21  }
    2.22