#include "Transform.h"

Transform::Transform()
: Group()
{
    _scaling.identity();
    _rotation.identity();
    _translation.identity();
    _world.identity();
}

Transform::~Transform()
{
}

void Transform::setPosition(Vector3& position)
{
    _translation.translate(position.x, position.y, position.z);
    _world = _scaling * _rotation * _translation;
}

void Transform::setOrientation(Quaternion& orientation)
{
    _rotation = orientation.toMatrix4();
    _world = _scaling * _rotation * _translation;
}

void Transform::setScale(Vector3& scale)
{
    _scaling.scale(scale.x, scale.y, scale.z);
    _world = _scaling * _rotation * _translation;
}

Matrix4& Transform::getWorldMatrix()
{
    return _world;
}