/******************************************************************************
*	File		-	components.h
*	Author		-	Joey Pollack
*	Date		-	2022/05/24 (y/m/d)
*	Mod Date	-	2022/05/24 (y/m/d)
*	Description	-	ECS component declarations
******************************************************************************/

#ifndef LUNARIUM_COMPONENTS_H_
#define LUNARIUM_COMPONENTS_H_

#include <core/common_defs.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>

#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/quaternion.hpp>

#include <string>

namespace lunarium
{
    struct TagComponent
    {
        std::string Info;

        TagComponent()
        {
            Info.reserve(256);
        }
    };

    struct TransformComponent
    {
        glm::vec3 Position = { 0.0f, 0.0f, 0.0f };
        glm::vec3 Rotation = { 0.0f, 0.0f, 0.0f };
        glm::vec3 Scale = { 1.0f, 1.0f, 1.0f };;

        glm::mat4 GetTransform() 
        { 
            // Quaternion code taken from Hazel engine
            // https://github.com/TheCherno/Hazel/blob/dev/Hazel/src/Hazel/Scene/Components.h
            return (glm::translate(glm::mat4(1.0f), Position) * glm::toMat4(glm::quat(Rotation)) * glm::scale(glm::mat4(1.0f), Scale )); 
        }
    };
}

#endif  // LUNARIUM_COMPONENTS_H_