#include "ientity.h"

#include <glm/gtx/quaternion.hpp>

IEntityBase::IEntityBase() :
	m_worldTM(1.0f),
	m_position(0.0f),
	m_rotation(0.0f),
	m_scale(1.0f),
	m_classname(nullptr)
{
}

IEntityBase::~IEntityBase()
{
}

void IEntityBase::Update(float dt)
{
}

void IEntityBase::Render()
{
}

const glm::mat4& IEntityBase::GetWorldTransform()
{
	return m_worldTM;
}

void IEntityBase::UpdateTransform()
{
	glm::vec3 radiansRotation = glm::vec3(glm::radians(m_rotation.x), glm::radians(m_rotation.y), glm::radians(m_rotation.z));
	glm::mat4 rotation = glm::toMat4(glm::quat(radiansRotation));

	m_worldTM = glm::mat4(1.0f);
	m_worldTM = glm::translate(m_worldTM, m_position) * rotation * glm::scale(m_worldTM, m_scale);
}
