ccdemos/realtime.cc
branchpyrit
changeset 40 929aad02c5f2
parent 39 7079dcc3bd74
child 72 7c3f38dff082
equal deleted inserted replaced
39:7079dcc3bd74 40:929aad02c5f2
       
     1 #include <stdlib.h>
       
     2 
     1 #include "raytracer.h"
     3 #include "raytracer.h"
     2 #include "octree.h"
     4 #include "octree.h"
     3 
     5 
     4 #include "common_sdl.h"
     6 #include "common_sdl.h"
     5 
     7 
     6 int main()
     8 int main(int argc, char **argv)
     7 {
     9 {
     8 	Raytracer rt;
    10 	Raytracer rt;
     9 	Octree top;
    11 	Octree top;
    10 	Camera cam;
    12 	Camera cam;
    11 
    13 
    21 	rt.addlight(&light2);
    23 	rt.addlight(&light2);
    22 
    24 
    23 	Material mat_sph(Colour(1.0, 1.0, 1.0));
    25 	Material mat_sph(Colour(1.0, 1.0, 1.0));
    24 	for (int y=0; y<10; y++)
    26 	for (int y=0; y<10; y++)
    25 		for (int x=0; x<10; x++)
    27 		for (int x=0; x<10; x++)
    26 			rt.addshape(new Sphere(Vector3(x*2-10, (Float)random()/RAND_MAX*5.0, y*2-10), 0.45, &mat_sph));
    28 			rt.addshape(new Sphere(Vector3(x*2-10, (Float)rand()/RAND_MAX*5.0, y*2-10), 0.45, &mat_sph));
    27 
    29 
    28 	rt.setCamera(&cam);
    30 	rt.setCamera(&cam);
    29 	cam.setEye(Vector3(0,0,10));
    31 	cam.setEye(Vector3(0,0,10));
    30 
    32 
    31 	top.optimize();
    33 	top.optimize();