14 rt.setMaxDepth(3); |
14 rt.setMaxDepth(3); |
15 rt.setTop(&top); |
15 rt.setTop(&top); |
16 |
16 |
17 Light light1(Vector3(2.0, -5.0, -5.0), Colour(0.7, 0.3, 0.6)); |
17 Light light1(Vector3(2.0, -5.0, -5.0), Colour(0.7, 0.3, 0.6)); |
18 light1.castShadows(false); |
18 light1.castShadows(false); |
19 rt.addlight(&light1); |
19 rt.addLight(&light1); |
20 |
20 |
21 Light light2(Vector3(-2.0, 10.0, 2.0), Colour(0.4, 0.6, 0.3)); |
21 Light light2(Vector3(-2.0, 10.0, 2.0), Colour(0.4, 0.6, 0.3)); |
22 light2.castShadows(false); |
22 light2.castShadows(false); |
23 rt.addlight(&light2); |
23 rt.addLight(&light2); |
24 |
24 |
25 Material mat_sph(Colour(1.0, 1.0, 1.0)); |
25 Material mat_sph(Colour(1.0, 1.0, 1.0)); |
26 for (int y=0; y<10; y++) |
26 for (int y=0; y<10; y++) |
27 for (int x=0; x<10; x++) |
27 for (int x=0; x<10; x++) |
28 rt.addshape(new Sphere(Vector3(x*2-10, (Float)rand()/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)); |
29 |
29 |
30 rt.setCamera(&cam); |
30 rt.setCamera(&cam); |
31 cam.setEye(Vector3(0,0,10)); |
31 cam.setEye(Vector3(0,0,10)); |
32 |
32 |
33 top.optimize(); |
33 top.optimize(); |