include/scene.h
branchpyrit
changeset 73 a5127346fbcd
parent 72 7c3f38dff082
child 78 9569e9f35374
equal deleted inserted replaced
72:7c3f38dff082 73:a5127346fbcd
    64 {
    64 {
    65 public:
    65 public:
    66 	Vector3 eye, p, u, v;
    66 	Vector3 eye, p, u, v;
    67 	Float F;
    67 	Float F;
    68 
    68 
    69 	Camera(): eye(0,0,10), p(0,0,-1), u(-1,0,0), v(0,1,0), F(0.7071) {};
    69 	Camera(): eye(0,0,10), p(0,0,-1), u(-1,0,0), v(0,1,0), F(2.*tan(M_PI/8.)) {};
    70 	Camera(const Vector3 &C, const Vector3 &ap, const Vector3 &au, const Vector3 &av):
    70 	Camera(const Vector3 &C, const Vector3 &ap, const Vector3 &au, const Vector3 &av):
    71 		eye(C), p(ap), u(au), v(av), F(0.7071) {};
    71 		eye(C), p(ap), u(au), v(av), F(2.*tan(M_PI/8.)) {};
    72 	Camera(const Vector3 &from, const Vector3 &lookat, const Vector3 &up):
    72 	Camera(const Vector3 &from, const Vector3 &lookat, const Vector3 &up):
    73 		eye(from), F(0.7071)
    73 		eye(from), F(2.*tan(M_PI/8.))
    74 	{
    74 	{
    75 		p = lookat - from; u = cross(up, p);
    75 		p = lookat - from; u = cross(up, p);
    76 		p.normalize(); u.normalize();
    76 		p.normalize(); u.normalize();
    77 		v = cross(p, u);
    77 		v = cross(p, u);
    78 	};
    78 	};
    79 	void setEye(const Vector3 &aeye) { eye = aeye; };
    79 	void setEye(const Vector3 &aeye) { eye = aeye; };
    80 	void setAngle(const Float angle) { F = sin(angle); };
    80 	void setAngle(const Float angle) { F = 2.*tan(angle/2.); };
    81 	void rotate(const Quaternion &q);
    81 	void rotate(const Quaternion &q);
    82 	void move(const Float fw, const Float left, const Float up);
    82 	void move(const Float fw, const Float left, const Float up);
    83 
    83 
    84 	Ray makeRay(Sample &samp)
    84 	Ray makeRay(Sample &samp)
    85 	{
    85 	{