//
// Created by sebastian on 30.07.26.
//

#ifndef COLORRACE_TEXTURE2D_H
#define COLORRACE_TEXTURE2D_H
#include "glad/glad.h"


namespace engine {
    class Texture2D {
    public:
        Texture2D() = default;
        ~Texture2D();

        Texture2D(const Texture2D&) = delete;
        Texture2D& operator=(const Texture2D&) = delete;

        Texture2D(Texture2D&& other) noexcept;
        Texture2D& operator=(Texture2D&& other) noexcept;

        void bind(unsigned int unit = 0) const;
        void unbind(unsigned int unit = 0) const;

    private:
        GLuint m_id = 0;
        int m_width = 0;
        int m_height = 0;
        int m_channels = 0;

        void release();

        friend class TextureUploader;
        Texture2D(GLuint id, int width, int height, int channels) : m_id(id), m_width(width), m_height(height), m_channels(channels) {};
    };
}

#endif //COLORRACE_TEXTURE2D_H
