34 #include "sampler.h" |
35 #include "sampler.h" |
35 #include "vector.h" |
36 #include "vector.h" |
36 #include "quaternion.h" |
37 #include "quaternion.h" |
37 |
38 |
38 /** |
39 /** |
39 * ray |
40 * A ray |
40 */ |
41 */ |
41 class Ray |
42 class Ray |
42 { |
43 { |
43 public: |
44 public: |
44 Vector o, dir; |
45 Vector o; ///< Origin |
|
46 Vector dir; ///< Normalized direction |
45 |
47 |
46 Ray(): o(), dir() {}; |
48 Ray(): o(), dir() {}; |
47 Ray(const Vector &ao, const Vector &adir): |
49 Ray(const Vector &ao, const Vector &adir): |
48 o(ao), dir(adir) {}; |
50 o(ao), dir(adir) {}; |
49 }; |
51 }; |
50 |
52 |
51 #ifndef NO_SIMD |
53 #ifndef NO_SIMD |
52 /** |
54 /** |
53 * packet of 4 rays |
55 * Packet of four rays for SIMD accelerated packet tracing. |
54 */ |
56 */ |
55 class RayPacket |
57 class RayPacket |
56 { |
58 { |
57 public: |
59 public: |
58 VectorPacket o, dir, invdir; |
60 VectorPacket o; ///< Packet of four origins |
|
61 VectorPacket dir; ///< Directions |
|
62 VectorPacket invdir; ///< Inverted directions (1/dir) |
59 |
63 |
60 RayPacket(): o(), dir() {}; |
64 RayPacket(): o(), dir() {}; |
61 RayPacket(const VectorPacket &ao, const VectorPacket &adir): |
65 RayPacket(const VectorPacket &ao, const VectorPacket &adir): |
62 o(ao), dir(adir), invdir(mOne/adir) {}; |
66 o(ao), dir(adir), invdir(mOne/adir) {}; |
63 |
67 |
64 // index operator - get a ray |
68 /** Index operator: get ray 'i' */ |
65 Ray operator[](int i) const |
69 Ray operator[](int i) const |
66 { |
70 { |
67 return Ray( |
71 return Ray( |
68 Vector(o.x[i], o.y[i], o.z[i]), |
72 Vector(o.x[i], o.y[i], o.z[i]), |
69 Vector(dir.x[i], dir.y[i], dir.z[i])); |
73 Vector(dir.x[i], dir.y[i], dir.z[i])); |
70 }; |
74 }; |
71 }; |
75 }; |
72 #endif |
76 #endif |
73 |
77 |
74 /** |
78 /** |
75 * a camera |
79 * General camera |
76 */ |
80 */ |
77 class Camera |
81 class Camera |
78 { |
82 { |
79 Vector eye, p, u, v; |
83 Vector eye, p, u, v; |
80 Float F; |
84 Float F; |