#ifndef _CAMERA_H_
#define _CAMERA_H_

#include <math.h>
//#include <GL/gl.h>
#include <GL/glut.h>

class Point3{
public:
	float x, y, z;
	void set(float dx, float dy, float dz)
		{ x = dx; y = dy; z = dz;}
	void set(Point3& p)
		{ x = p.x; y = p.y; z = p.z;}
	Point3(float xx, float yy, float zz)
		{ x = xx; y = yy; z = zz;}
	Point3()
		{ x = y = z = 0.0;}
	void build4tuple(float v[])
	{
		// load 4-tuple witht this color: v[3] = 1 for homogeneous
		v[0] = x; v[1] = y; v[2] = z; v[3] = 1.0f;
	}
}; // end of class Point3()

class Vector3{
public:
	float x, y, z;
	void set(float dx, float dy, float dz)
		{ x = dx; y = dy; z = dz;}
	void set(Vector3& p)
		{ x = p.x; y = p.y; z = p.z;}
	void flip(){x = -x; y = -y; z = -z;} // reverse this vector
	void setDiff(Point3& a, Point3& b) // set to differance a - b
		{ x = a.x - b.x; y = a.y - b.y; z = a.z - b.z;}
	void normalize(); // adjust this vector to unit length
	Vector3(float xx, float yy, float zz)
		{ x = xx; y = yy; z = zz;}
	Vector3(Vector3& v)
		{ x = v.x; y = v.y; z = v.z;}
	Vector3() { x = y = z = 0.0;} // this is the default constructor
	Vector3 cross(Vector3 b); // returns this cross b
	float dot(Vector3 b); // return this dotted with b

}; // end of class Vector3

class Camera{
public:
	Camera();  // default constructor
	void set(Point3 Eye, Point3 look, Vector3 up); // like gluLookAt()
	void roll(float angle); // roll it
	void pitch(float angle); // increase the pitch
	void yaw(float angle); // increas the yaw
	void slide(float delU, float delV, float delN); // slide it
	void setShape(float vAng, float asp, float nearD, float farD);

private:
	Point3 eye;
	Vector3 u, v, n;
	double viewAngle, aspect, nearDist, farDist; // view volume shape
	void setModelViewMatrix(); // tell openGL where the camera is

}; // end of class Camera

#endif



