/******************************************************************************
*	File		-	texture.h
*	Author		-	Joey Pollack
*	Date		-	2022/07/14 (y/m/d)
*	Mod Date	-	2022/07/14 (y/m/d)
*	Description	-	OpenGL texture 2D
******************************************************************************/

#ifndef LUNARIUM_TEXTURE_H_
#define LUNARIUM_TEXTURE_H_

#include <core/common_defs.h>

namespace lunarium
{
    enum class TextureFormat
    {
        RED,
        RGB,
        RGBA,
    };

    class Texture
    {
    public:
        static Texture* Create(u8* data = nullptr, u32 width = 1, u32 height = 1, TextureFormat format = TextureFormat::RGBA, bool clamp = false);
        static void Destroy(Texture** ppTex);
        static i32 GetMaxSize();

        void Bind(u32 slot = 0) const;
        void Unbind() const;

        void FlipVertically();

        u32 GetGLID() const;
        u64 GetGLID64() const;
        TextureFormat GetFormat() const;
        u32 GetWidth() const;
        u32 GetHeight() const;

        u8* GetPixels() const;
        i32 NumComponents() const;

    private:
        TextureFormat mFormat;
        u32 mWidth;
        u32 mHeight;
        u32 mGLID;

    private:
        Texture();
    };
}

#endif	// LUNARIUM_TEXTURE_H_