diff -r 83d0200d4c09 -r 28f6e8b9d5d1 include/scene.h --- a/include/scene.h Sun Dec 09 15:01:51 2007 +0100 +++ b/include/scene.h Sun Dec 09 23:10:58 2007 +0100 @@ -1,8 +1,8 @@ /* - * C++ RayTracer + * Pyrit Ray Tracer * file: scene.h * - * Radek Brich, 2006 + * Radek Brich, 2006-2007 */ #ifndef SCENE_H @@ -13,6 +13,7 @@ #include "noise.h" #include "vector.h" +#include "quaternion.h" /* triangle intersection alghoritm @@ -35,40 +36,6 @@ o(ao), dir(adir) {}; }; -class Quaternion -{ -public: - Float a,b,c,d; - Quaternion(): a(0), b(0), c(0), d(0) {}; - Quaternion(const Float aa, const Float ab, const Float ac, const Float ad): - a(aa), b(ab), c(ac), d(ad) {}; - Quaternion(const Vector3& v): a(1), b(v.x), c(v.y), d(v.z) {}; - - Vector3 toVector() { return Vector3(b/a, c/a, d/a); }; - - Quaternion normalize() - { - Float f = 1.0f / sqrtf(a * a + b * b + c * c + d * d); - a *= f; - b *= f; - c *= f; - d *= f; - return *this; - }; - friend Quaternion operator*(const Quaternion &q1, const Quaternion &q2) - { - return Quaternion( - q1.a*q2.a - q1.b*q2.b - q1.c*q2.c - q1.d*q2.d, - q1.a*q2.b + q1.b*q2.a + q1.c*q2.d - q1.d*q2.c, - q1.a*q2.c + q1.c*q2.a + q1.d*q2.b - q1.b*q2.d, - q1.a*q2.d + q1.d*q2.a + q1.b*q2.c - q1.c*q2.b); - }; - friend Quaternion conjugate(const Quaternion &q) - { - return Quaternion(q.a, -q.b, -q.c, -q.d); - } -}; - class Camera { public: