#ifndef SUBTEXTURE2D_HPP
#define SUBTEXTURE2D_HPP

#include "open_engine/renderer/texture.hpp"

#include <glm/glm.hpp>

namespace OpenEngine {
    class Subtexture2D
    {
        public:
            Subtexture2D(const Ref<Texture2D>& texture, glm::vec2& min, glm::vec2& max);

            const Ref<Texture2D>& GetTexture() { return atlas; };
            const glm::vec2* GetCoords() { return coords; };

            static Ref<Subtexture2D> CreateFromCoords(const Ref<Texture2D> texture,
                    const glm::vec2& coordinates,
                    const glm::vec2& cell_size,
                    const glm::vec2& sprite_size = { 1.0f, 1.0f } );

        private:
            Ref<Texture2D> atlas;
            glm::vec2 coords[4];
    };
}

#endif // SUBTEXTURE2D_HPP
