#include "EPSG/Transform.h"

/* System Includes */
#ifdef WIN32
	#include <Windows.h>
#endif

/* OpenGL Includes */
#include <GL/GL.h>
#include <GL/GLU.h>

EPSG::Transform::Transform()
{

}

bool EPSG::Transform::setupCamera()
{
	bool n = Group::setupCamera();
	if( n )
		glMultMatrixf( _tMatrix->invert().getAsArray() );

	return n;
}

int EPSG::Transform::setupLights()
{
	glPushMatrix();
	glMultMatrixf( _tMatrix->getAsArray() );
	int n = Group::setupLights();
	glPopMatrix();
	return n;
}

void EPSG::Transform::render()
{
	glPushMatrix();
	glMultMatrixf( _tMatrix->getAsArray() );
	Group::render();
	glPopMatrix();
}

void EPSG::Transform::translate( float x, float y, float z )
{
	glPushMatrix();
	glLoadMatrixf( _tMatrix->getAsArray() );
	glTranslatef( x, y, z );
	glGetFloatv( GL_MODELVIEW, _tMatrix->getAsArray() );
	glPopMatrix();
}