equal
deleted
inserted
replaced
1 #include <SDL.h> |
1 #include <SDL.h> |
2 |
2 |
3 #include "raytracer.h" |
3 #include "raytracer.h" |
|
4 #include "kdtree.h" |
4 #include <iostream> |
5 #include <iostream> |
5 #include <fstream> |
6 #include <fstream> |
6 |
7 |
7 int w = 320; |
8 int w = 320; |
8 int h = 200; |
9 int h = 200; |
140 render_buffer = (Float *) malloc(w*h*3*sizeof(Float)); |
141 render_buffer = (Float *) malloc(w*h*3*sizeof(Float)); |
141 |
142 |
142 rt.setThreads(1); |
143 rt.setThreads(1); |
143 rt.setMaxDepth(3); |
144 rt.setMaxDepth(3); |
144 |
145 |
145 KdTree top; |
146 Kdtree top; |
146 rt.setTop(&top); |
147 rt.setTop(&top); |
147 |
148 |
148 Light light1(Vector3(-5.0, 2.0, 8.0), Colour(0.9, 0.3, 0.6)); |
149 Light light1(Vector3(-5.0, 2.0, 8.0), Colour(0.9, 0.3, 0.6)); |
149 light1.castShadows(false); |
150 light1.castShadows(false); |
150 rt.addlight(&light1); |
151 rt.addlight(&light1); |
158 |
159 |
159 rt.setCamera(&cam); |
160 rt.setCamera(&cam); |
160 cam.setEye(Vector3(0,0,10)); |
161 cam.setEye(Vector3(0,0,10)); |
161 |
162 |
162 /* build kd-tree */ |
163 /* build kd-tree */ |
163 top.setMaxDepth(100); |
164 top.setMaxDepth(30); |
164 top.optimize(); |
165 top.optimize(); |
165 |
166 |
166 /* loop... */ |
167 /* loop... */ |
167 SDL_Event event; |
168 SDL_Event event; |
168 bool quit = false; |
169 bool quit = false; |