#ifndef KRIMI_DINNER_ENGINE_TEXTURE_H
#define KRIMI_DINNER_ENGINE_TEXTURE_H

/// @file Texture.h
/// @brief Texture object

#ifdef _WIN32
    #include "glad.h"
#else
    #include <GLES3/gl3.h>
#endif

class Renderer;

/// @brief A opengl texture
class Texture
{
public:
    Texture() : m_texture(0) {}
    Texture(unsigned int width, unsigned int height, const void* data);
    Texture(unsigned int width, unsigned int height, const void* data, GLint format);

    Texture(const Texture&) = default;
    Texture(Texture&&) = default;
    Texture& operator=(const Texture&) = default;

    /// @brief Destroys the texture
    void destroy();

    /// @brief Binds the texture to @c GL_TEXTURE_2D
    void bind() const;

    /// @brief get texture size
    /// \param w output width in pixels
    /// \param h output height in pixels
    void getTextureSize(
            unsigned int* w,
            unsigned int* h);

private:
    GLuint m_texture;

    int width_px;
    int height_px;
};

#endif
