#include <object.hpp>

gb::Object::Object(
        const mesh_list_t& meshes,
        const glm::vec3& pos,
        const glm::vec3& scale,
        const glm::vec3& rotate_axis,
        float rotate_angle
        )
    : m_meshes(meshes),
      m_pos(pos),
      m_scale(scale),
      m_rotate_axis(rotate_axis),
      m_rotate_angle(rotate_angle)
{
    calc_model_mat();
}

gb::Object::Object(
        mesh_list_t&& meshes,
        const glm::vec3& pos,
        const glm::vec3& scale,
        const glm::vec3& rotate_axis,
        float rotate_angle
        )
    : m_meshes(std::move(meshes)),
      m_pos(pos),
      m_scale(scale),
      m_rotate_axis(rotate_axis),
      m_rotate_angle(rotate_angle)
{
    calc_model_mat();
}

void gb::Object::calc_model_mat(void)
{
    m_model_mat = glm::translate(glm::vec3(m_pos))
                * glm::rotate(m_rotate_angle, m_rotate_axis)
                * glm::scale(m_scale);
}
