--- a/ccdemos/realtime.cc Fri Nov 30 00:44:51 2007 +0100
+++ b/ccdemos/realtime.cc Mon Dec 03 01:49:23 2007 +0100
@@ -4,7 +4,7 @@
int w = 480;
int h = 288;
-float *render_buffer;
+Float *render_buffer;
Raytracer rt;
Camera cam;
@@ -19,7 +19,7 @@
Uint32 *bufp = (Uint32 *)screen->pixels;
unsigned char c[3];
- for (float *fd = render_buffer; fd != render_buffer + w*h*3; fd += 3)
+ for (Float *fd = render_buffer; fd != render_buffer + w*h*3; fd += 3)
{
for (int i = 0; i < 3; i++)
{
@@ -60,10 +60,10 @@
}
/* initialize raytracer and prepare scene */
- render_buffer = (float *) malloc(w*h*3*sizeof(float));
+ render_buffer = (Float *) malloc(w*h*3*sizeof(Float));
rt.setThreads(2);
- rt.setMaxDepth(1);
+ rt.setMaxDepth(3);
KdTree top;
rt.setTop(&top);
@@ -79,7 +79,7 @@
Material mat_sph(Colour(1.0, 1.0, 1.0));
for (int y=0; y<10; y++)
for (int x=0; x<10; x++)
- rt.addshape(new Sphere(Vector3(x*2-10, (float)random()/RAND_MAX*5.0, y*2-10), 0.45, &mat_sph));
+ rt.addshape(new Sphere(Vector3(x*2-10, (Float)random()/RAND_MAX*5.0, y*2-10), 0.45, &mat_sph));
rt.setCamera(&cam);
cam.setEye(Vector3(0,0,10));
@@ -91,7 +91,7 @@
/* loop... */
SDL_Event event;
bool quit = false;
- float roty = 0.0, rotx = 0.0, move = 0.0;
+ Float roty = 0.0, rotx = 0.0, move = 0.0;
while (!quit)
{
while (SDL_PollEvent(&event))
@@ -100,7 +100,7 @@
case SDL_VIDEORESIZE:
w = event.resize.w;
h = event.resize.h;
- render_buffer = (float *) realloc(render_buffer, w*h*3*sizeof(float));
+ render_buffer = (Float *) realloc(render_buffer, w*h*3*sizeof(Float));
screen = SDL_SetVideoMode(w, h, 32, SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_RESIZABLE);
break;
case SDL_KEYDOWN: