//
// Created by sfd on 25-5-24.
//

#ifndef SUBTEXTURE2D_H
#define SUBTEXTURE2D_H
#include <Hazel/Core/Core.h>

#include "Texture.h"
#include "glm/vec2.hpp"


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

        const Ref<Texture2D>& GetTexture() const { return m_Texture; }
        const glm::vec2* GetTexCoords() const { return m_TexCoords; }

        static Ref<SubTexture2D> CreateFromCoords(const Ref<Texture2D>& texture, const glm::vec2& coords, const glm::vec2& cellSize, const glm::vec2& spriteSize = {1.0f,1.0f});
    private:
        Ref<Texture2D> m_Texture;
        glm::vec2 m_TexCoords[4];
    };
}


#endif //SUBTEXTURE2D_H
