#include "Camera.h"

void Camera::Move(const vec4f& move)
{
	pos += mrot*move;
}

void Camera::LookAt(const vec4f& pos, const vec4f& lookAt)
{

}

void Camera::SetRotation(const vec4f& in_rot)
{
  rot = in_rot;
}


Matrix4x4f Camera::CalcMatrix()
{
  vec3f r;
	Matrix4x4f mt,mx,my,mz;

	r.x() = MGML_MATH::DEG_TO_RAD(rot.x());
	r.y() = MGML_MATH::DEG_TO_RAD(rot.y());
	r.z() = MGML_MATH::DEG_TO_RAD(rot.z());
	mx.setRotationX(r.x());
	my.setRotationY(r.y());
	mz.setRotationZ(r.z());
	mrot = mz*my*mx;
 

  vec4f pos2 = this->pos;
	pos2 *= (-1); 
	pos2.w() = 1;
	mt.setTranslate(pos2); mt.Transpose();
	return world_matrix = mt*mrot;
}