34 vector<Light*> lights; |
31 vector<Light*> lights; |
35 Colour bg_colour; |
32 Colour bg_colour; |
36 int ao_samples; |
33 int ao_samples; |
37 float ao_distance, ao_angle; |
34 float ao_distance, ao_angle; |
38 int num_threads; |
35 int num_threads; |
|
36 int subsample; |
|
37 int max_depth; |
39 |
38 |
40 Vector3 SphereDistribute(int i, int n, float extent, Vector3 &normal); |
39 Vector3 SphereDistribute(int i, int n, float extent, Vector3 &normal); |
41 public: |
40 public: |
42 Raytracer(): top(NULL), camera(NULL), lights(), bg_colour(0.0, 0.0, 0.0), |
41 Raytracer(): top(NULL), camera(NULL), lights(), bg_colour(0.0, 0.0, 0.0), |
43 ao_samples(0), num_threads(4) {}; |
42 ao_samples(0), num_threads(4), subsample(8), max_depth(4) {}; |
44 void render(int w, int h, float *buffer); |
43 void render(int w, int h, float *buffer); |
45 Colour raytrace(Ray &ray, int depth, Shape *origin_shape); |
44 Colour raytrace(Ray &ray, int depth, Shape *origin_shape); |
46 void addshape(Shape *shape) { top->addShape(shape); }; |
45 void addshape(Shape *shape) { top->addShape(shape); }; |
47 void addlight(Light *light); |
46 void addlight(Light *light); |
48 void setCamera(Camera *cam) { camera = cam; }; |
47 void setCamera(Camera *cam) { camera = cam; }; |
49 void setTop(Container *atop) { top = atop; }; |
48 void setTop(Container *atop) { top = atop; }; |
50 Container *getTop() { return top; }; |
49 Container *getTop() { return top; }; |
|
50 int getSubsample() { return subsample; }; |
|
51 void setMaxDepth(int newdepth) { max_depth = newdepth; }; |
51 |
52 |
52 void ambientocclusion(int samples, float distance, float angle); |
53 void ambientocclusion(int samples, float distance, float angle); |
53 void setThreads(int num) { num_threads = num; }; |
54 void setThreads(int num) { num_threads = num; }; |
54 }; |
55 }; |
55 |
56 |