diff options
| author | hachem <im@hachem.wtf> | 2025-08-22 12:24:05 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-22 12:24:05 +0200 |
| commit | 2c8002d30f291cba832a5750212009d48238c308 (patch) | |
| tree | 4aafc468441b3e32c267040830b8e0b5af859faf /src/platform/opengl/opengl_texture.h | |
| parent | b9de06951631d9969c52c6ed95de17a6d8aad121 (diff) | |
feat: add HDRI
Diffstat (limited to 'src/platform/opengl/opengl_texture.h')
| -rw-r--r-- | src/platform/opengl/opengl_texture.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/platform/opengl/opengl_texture.h b/src/platform/opengl/opengl_texture.h index 705d770..5e5f6b2 100644 --- a/src/platform/opengl/opengl_texture.h +++ b/src/platform/opengl/opengl_texture.h @@ -34,4 +34,35 @@ namespace Donut uint32_t m_renderer_id; GLenum m_internal_format, m_data_format; }; + + class OpenGLCubemapTexture + : public CubemapTexture + { + public: + OpenGLCubemapTexture(uint32_t width, uint32_t height); + OpenGLCubemapTexture(const std::string& path); + virtual ~OpenGLCubemapTexture(); + + virtual uint32_t get_width() const override { return m_width; } + virtual uint32_t get_height() const override { return m_height; } + virtual uint32_t get_renderer_id() const override { return m_renderer_id; } + + virtual void set_data(void* data, uint32_t size) override; + virtual void bind(uint32_t slot = 0) const override; + virtual void bind_as_image(uint32_t slot = 0, bool read_only = false) const override; + + virtual bool operator==(const Texture& other) const override + { + return m_renderer_id == other.get_renderer_id(); + } + + private: + void load_hdri(const std::string& path); + void convert_equirectangular_to_cubemap(float* hdr_data, int width, int height); + + std::string m_path; + uint32_t m_width, m_height; + uint32_t m_renderer_id; + GLenum m_internal_format, m_data_format; + }; } |
