--- a/include/scene.h Sat Apr 19 18:00:27 2008 +0200
+++ b/include/scene.h Sun Apr 20 16:48:24 2008 +0200
@@ -64,19 +64,26 @@
{
public:
Vector3 eye, p, u, v;
- Float f,F;
+ Float F;
- Camera(): eye(0,0,10), p(0,0,-1), u(-1,0,0), v(0,1,0), f(3.14/4.0), F(0.5/f) {};
+ Camera(): eye(0,0,10), p(0,0,-1), u(-1,0,0), v(0,1,0), F(0.7071) {};
Camera(const Vector3 &C, const Vector3 &ap, const Vector3 &au, const Vector3 &av):
- eye(C), p(ap), u(au), v(av), f(3.14/4.0), F(0.5/f) {};
+ eye(C), p(ap), u(au), v(av), F(0.7071) {};
+ Camera(const Vector3 &from, const Vector3 &lookat, const Vector3 &up):
+ eye(from), F(0.7071)
+ {
+ p = lookat - from; u = cross(up, p);
+ p.normalize(); u.normalize();
+ v = cross(p, u);
+ };
void setEye(const Vector3 &aeye) { eye = aeye; };
- void setFocalLength(const Float af) { f = af; F = 0.5/f; };
+ void setAngle(const Float angle) { F = sin(angle); };
void rotate(const Quaternion &q);
void move(const Float fw, const Float left, const Float up);
Ray makeRay(Sample &samp)
{
- Vector3 dir = p + (u*samp.x - v*samp.y)*F;
+ Vector3 dir = p - (u*samp.x + v*samp.y)*F;
dir.normalize();
return Ray(eye, dir);
};