#ifndef _PIPELINE_H_
#define _PIPELINE_H_

#include "singleton.h"
#include "ps2matrix4x4.h"
#include "ps2vector4.h"


#define Pipeline CPipeline::GetSingleton()

class CPipeline : public CSingleton<CPipeline>
{
public:
	CPipeline();
	~CPipeline(){};
	
	inline const Matrix4x4 & GetProjection(void) const;
	inline const Matrix4x4 & GetCamera(void) const;
	inline const Matrix4x4 & GetViewProjection(void) const;
	inline const Matrix4x4 & GetLightDirs(void) const;
	inline const Matrix4x4 & GetLightCols(void) const;
	inline const Vector4 & GetScaleVector(void) const;
	
	void SetLight1(const Vector4 & Direction, const Vector4 & Colour);
	void SetLight2(const Vector4 & Direction, const Vector4 & Colour);
	void SetLight3(const Vector4 & Direction, const Vector4 & Colour);
	void SetAmbient(const Vector4 & Colour);
	
	void Update(float Strafe, float Advance, float UpDown, float XRot, float YRot);
	void PositionCamera(const Vector4 & Position, const float XRot, const float YRot);
	void Initialise(void);

protected:	

	float m_near;		// Near plane
	float m_far;		// Far plane
	float m_FOV;		// Field of View
	float m_Aspect;		// Aspect Ratio
	float m_ScreenW;	// Screen Width
	float m_ScreenH;	// Screen height;
	
	Matrix4x4 m_Projection;
	Matrix4x4 m_Camera;
	Matrix4x4 m_ViewProjection;
	Matrix4x4 m_LightDirs;
	Matrix4x4 m_LightCols;
	
	Vector4 m_Scale;
		
	Vector4 m_CamPos;
	float m_XRot, m_YRot;
	
	void CalcProjection(void);	
};

inline const Matrix4x4 & CPipeline::GetProjection(void) const
	{return (m_Projection);}

inline const Matrix4x4 & CPipeline::GetCamera(void) const
	{return (m_Camera);}

inline const Matrix4x4 & CPipeline::GetViewProjection(void) const
	{return (m_ViewProjection);}
	
inline const Matrix4x4 & CPipeline::GetLightDirs(void) const
	{return (m_LightDirs);}
	
inline const Matrix4x4 & CPipeline::GetLightCols(void) const
	{return (m_LightCols);}
	
inline const Vector4 & CPipeline::GetScaleVector(void) const
	{return (m_Scale);}
	

#endif