equal
deleted
inserted
replaced
1 #include <SDL.h> |
1 #include <SDL.h> |
2 |
2 |
3 #include "raytracer.h" |
3 #include "raytracer.h" |
|
4 #include "octree.h" |
4 #include <iostream> |
5 #include <iostream> |
5 #include <fstream> |
6 #include <fstream> |
6 #include <iomanip> |
7 #include <iomanip> |
7 |
8 |
8 int w = 320; |
9 int w = 320; |
142 } |
143 } |
143 |
144 |
144 /* initialize raytracer and prepare scene */ |
145 /* initialize raytracer and prepare scene */ |
145 render_buffer = (Float *) malloc(w*h*3*sizeof(Float)); |
146 render_buffer = (Float *) malloc(w*h*3*sizeof(Float)); |
146 |
147 |
147 rt.setThreads(1); |
148 rt.setThreads(2); |
148 rt.setMaxDepth(3); |
149 rt.setMaxDepth(3); |
149 |
150 |
150 KdTree top; |
151 Octree top; |
151 rt.setTop(&top); |
152 rt.setTop(&top); |
152 |
153 |
153 Light light1(Vector3(-5.0, 2.0, 8.0), Colour(0.9, 0.3, 0.6)); |
154 Light light1(Vector3(-5.0, 2.0, 8.0), Colour(0.9, 0.3, 0.6)); |
154 light1.castShadows(false); |
155 light1.castShadows(false); |
155 rt.addlight(&light1); |
156 rt.addlight(&light1); |
163 |
164 |
164 rt.setCamera(&cam); |
165 rt.setCamera(&cam); |
165 cam.setEye(Vector3(0,0,10)); |
166 cam.setEye(Vector3(0,0,10)); |
166 |
167 |
167 /* build kd-tree */ |
168 /* build kd-tree */ |
168 top.setMaxDepth(100); |
169 top.setMaxDepth(3); |
169 top.optimize(); |
170 top.optimize(); |
170 |
171 |
171 /* loop... */ |
172 /* loop... */ |
172 SDL_Event event; |
173 SDL_Event event; |
173 bool quit = false; |
174 bool quit = false; |