
#include "ssMatrix.hpp"

using namespace SS;


Matrix4x4 MatrixFactory::rotateX	(float angle)
{
	float s = (float)::sin(angle);
	float c = (float)::cos(angle);
	float o = 1.f;
	float z = 0.f;

	Matrix4x4	m;	//calls ident()
	m.setColumn(0,Vector4(o, z, z, 0));
	m.setColumn(1,Vector4(z, c,-s, 0));
	m.setColumn(2,Vector4(z, s, c ,0));

	return m;
}


Matrix4x4 MatrixFactory::rotateY	(float angle)
{
	float s = (float)::sin(angle);
	float c = (float)::cos(angle);
	float o = 1.f;
	float z = 0.f;

	Matrix4x4	m;	//calls ident()
	m.setColumn(0,Vector4(c, z, s, 0));
	m.setColumn(1,Vector4(z, o, z, 0));
	m.setColumn(2,Vector4(-s,z, c ,0));

	return m;
}


Matrix4x4 MatrixFactory::rotateZ	(float angle)
{
	float s = (float)::sin(angle);
	float c = (float)::cos(angle);
	float o = 1.f;
	float z = 0.f;

	Matrix4x4	m;	//calls ident()
	m.setColumn(0,Vector4(c,-s, z, 0));
	m.setColumn(1,Vector4(s, c, z, 0));
	m.setColumn(2,Vector4(z, z, o, 0));

	return m;
}
