equal
deleted
inserted
replaced
|
1 /* |
|
2 * C++ RayTracer |
|
3 * file: raytracer.h |
|
4 * |
|
5 * Radek Brich, 2006 |
|
6 */ |
|
7 |
|
8 #ifndef RAYTRACER_H |
|
9 #define RAYTRACER_H |
|
10 |
|
11 #include <vector> |
|
12 |
|
13 #include "scene.h" |
|
14 |
|
15 using namespace std; |
|
16 |
|
17 /* axis-aligned bounding box */ |
|
18 class AABB |
|
19 { |
|
20 }; |
|
21 |
|
22 class ShapeList: public vector<Shape*> |
|
23 { |
|
24 AABB extends() { return AABB(); }; |
|
25 }; |
|
26 |
|
27 class Raytracer |
|
28 { |
|
29 ShapeList shapes; |
|
30 vector<Light*> lights; |
|
31 Colour bg_colour; |
|
32 int ao_samples; |
|
33 float ao_distance, ao_angle; |
|
34 |
|
35 Vector3 SphereDistribute(int i, int n, float extent, Vector3 &normal); |
|
36 inline Shape *nearest_intersection(const Shape *origin_shape, const Ray &ray, |
|
37 float &nearest_distance); |
|
38 Colour raytrace(Ray &ray, int depth, Shape *origin_shape); |
|
39 public: |
|
40 Raytracer(): shapes(), lights(), bg_colour(0.0, 0.0, 0.0), ao_samples(0) {}; |
|
41 ~Raytracer() {}; |
|
42 float *render(int w, int h); |
|
43 void addshape(Shape *shape); |
|
44 void addlight(Light *light); |
|
45 |
|
46 void ambientocclusion(int samples, float distance, float angle); |
|
47 }; |
|
48 |
|
49 #endif |