src/raytracer.cc
branchpyrit
changeset 30 33f95441790e
parent 25 b8232edee786
child 31 b4e09433934a
--- a/src/raytracer.cc	Sat Dec 08 14:07:42 2007 +0100
+++ b/src/raytracer.cc	Sat Dec 08 16:02:37 2007 +0100
@@ -13,6 +13,8 @@
 #include <malloc.h>
 #include "raytracer.h"
 
+int pyrit_verbosity = 2;
+
 // Hammersley spherical point distribution
 // http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoints.html
 Vector3 Raytracer::SphereDistribute(int i, int n, Float extent, Vector3 &normal)
@@ -319,7 +321,7 @@
 	Vector3 dy = camera->v * (-S/camera->f);
 
 #ifdef PTHREADS
-	infomsg("* pthreads enabled, using %d threads\n", num_threads);
+	dbgmsg(1, "* pthreads enabled, using %d threads\n", num_threads);
 	pthread_t threads[num_threads];
 	for (int t = 0; t < num_threads; t++)
 		threads[t] = pthread_self();
@@ -327,7 +329,8 @@
 #endif
 
 	/* for each pixel... */
-	infomsg("* rendering row   0 (  0%% done)");
+	dbgmsg(1, "* raytracing...\n");
+	dbgmsg(2, "- row   0 (  0%% done)");
 	for (int y = 0; y < h; y += subsample)
 	{
 		d = (RenderrowData*) malloc(sizeof(RenderrowData));
@@ -342,7 +345,7 @@
 		/* create new thread and increase 't' */
 		int rc = pthread_create(&threads[t++], NULL, renderrow, (void *)d);
 		if (rc) {
-			infomsg("\nERROR: return code from pthread_create() is %d\n", rc);
+			dbgmsg(0, "\nE pthread_create unsuccessful, return code was %d\n", rc);
 			exit(1);
 		}
 		/* when 't' owerflows, reset it */
@@ -358,12 +361,12 @@
 		free(d);
 #endif
 		dfix += dy*subsample;
-		infomsg("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b%4d (%2d%% done)", y, y*100/(h-1));
+		dbgmsg(2, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b%4d (%2d%% done)", y, y*100/(h-1));
 	}
-	infomsg("\n");
+	dbgmsg(2, "\n");
 
 #ifdef PTHREADS
-	infomsg("* waiting for threads to finish\n");
+	dbgmsg(2, "- waiting for threads to finish\n");
 	for (t = 0; t < num_threads; t++)
 		if (pthread_join(threads[t], (void**)&d) == 0)
 			free(d);