// Author : Chris Tolley
// Date   : 7/13/2004
// Object.h contains the class declaration for an abstract base class
// to use as the base for all game objects

#include "Object.h"
#include "logger.h"

// Declara the static variable
unsigned int Object::m_iIdGenerator = 0;

// Constructor
Object::Object() : m_iID( m_iIdGenerator++ )
{
	// Set the local coordinate system to the identity matrix
	m_mLocal.LoadIdentity();
}// End Object::Constructor


// Destructor
Object::~Object()
{}


// Performs a translation in this objects local coordinate system
void Object::Translate( const float x, const float y, const float z )
{
	m_mLocal.Translate( x, y, z );
}// End Object::Translate


// Performs a translation in this objects local coordinate system
void Object::Translate( const float* tran )
{
	m_mLocal.Translate( tran[0], tran[1], tran[2] );
}// End Object::Translate


// Performs a rotation in this object's local coordinate system
void Object::Rotate( const float x, const float y, const float z )
{
	m_mLocal.Rotate( x, y, z );
}// End Object::Rotate


// Performs a rotation in this object's local coordinate system
void Object::Rotate( const float* rot )
{
	m_mLocal.Rotate( rot[0], rot[1], rot[2] );
}// End Object::Rotate


// Performs a Scale on this object's local coordinate system
void Object::Scale( const float x, const float y, const float z )
{
	m_mLocal.Scale( x, y, z );
}// End Object::Scale


// Performs a Scale on this object's local coordinate system
void Object::Scale( const float* sca )
{
	m_mLocal.Scale( sca[0], sca[1], sca[2] );
}// End Object::Scale


// Returns this object's position and store's it in x,y,z
void Object::GetPos( float& x, float& y, float& z )
{
	// Set x, y, and z to zero and then transform them based on the 
	// local coordinate system
	x = 0;
	y = 0;
	z = 0;
	m_mLocal.Transform( x, y, z );
}// End Object::GetPos