#include "camera.h"

Camera::Camera()
{
	// Set initial values.
	Position = D3DXVECTOR3(0.0f,0.0f,0.0f);
	LookAt = D3DXVECTOR3(0.0f,0.0f,0.0f);
	Rotation = 0.0f;
}

Camera::~Camera() { }

VOID Camera::SetMatrices()
{
	// Set the view and projection matrices.
	SetViewMatrix();
	SetProjectionMatrix();
}

VOID Camera::SetViewMatrix()
{
	// Set the view matrix of the camera.
	D3DXVECTOR3 vEyePt(Position);
	D3DXVECTOR3 vLookatPt(LookAt);
	D3DXVECTOR3 vUpVec(0.0f, 1.0f, 0.0f);

	D3DXMatrixLookAtLH(&View, &vEyePt, &vLookatPt, &vUpVec);
}

VOID Camera::SetProjectionMatrix()
{
	// Set the perspective matrix of the camera.
	D3DXMatrixPerspectiveFovLH(&Projection, D3DX_PI/4, 1.0f, 1.0f, 10000.0f);
}

D3DXMATRIX Camera::GetViewMatrix()
{
	// Get the view matrix.
	return View;
}

D3DXMATRIX Camera::GetProjectionMatrix()
{
	// Get the projection matrix.
	return Projection;
}
