#ifndef PW_VISUAL_TEXTURE_HPP
#define PW_VISUAL_TEXTURE_HPP

#include <pw/core/debug.hpp>
#include <pw/core/globals.hpp>
#include <pw/core/image.hpp>

namespace pw {

class texture {
  public:
    enum class data_type { color, normal };

    enum class data_layout { shape_1d, shape_2d, shape_3d };

    enum texture_dimension { dimension_r, dimension_s, dimension_t };

    enum wrap_mode {
        wrap_repeat,
        wrap_clamp,
        wrap_clamp_to_edge,
        wrap_clamp_to_repeat
    };

    texture();
    texture(const image& i, data_layout s);
    ~texture();

    void set_shape(data_layout s);
    data_layout shape() const { return _shape; }

    void set_wrap(wrap_mode w);
    wrap_mode wrap() const { return _wrap; }

    uint32_t native_handle() const;

    bool create(const image& i);
    void update(const image& i);

    void bind();
    void unbind();

    bool valid() const;

  protected:
    data_layout _shape = data_layout::shape_2d;
    wrap_mode _wrap    = wrap_mode::wrap_clamp_to_edge;

    struct impl;
    unique_ptr<impl> _impl;
};

} // namespace pw

#endif
