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 | 0d819f2b9a71e862bce8799c6b0c1304e62219b3 (patch) | |
| tree | a3011c8f5b04c98de5a8a24bc2b4ded312de958e /src/Platform/OpenGL/OpenGLTexture.h | |
| parent | c20a400e620154f0c334fe0a37d547625b6ee65b (diff) | |
[add]: add HDRI
Diffstat (limited to 'src/Platform/OpenGL/OpenGLTexture.h')
| -rw-r--r-- | src/Platform/OpenGL/OpenGLTexture.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/Platform/OpenGL/OpenGLTexture.h b/src/Platform/OpenGL/OpenGLTexture.h index 1c3cb05..220df09 100644 --- a/src/Platform/OpenGL/OpenGLTexture.h +++ b/src/Platform/OpenGL/OpenGLTexture.h @@ -34,4 +34,35 @@ namespace Donut uint32_t m_RendererID; GLenum m_InternalFormat, m_DataFormat; }; + + class OpenGLCubemapTexture + : public CubemapTexture + { + public: + OpenGLCubemapTexture(uint32_t width, uint32_t height); + OpenGLCubemapTexture(const std::string& path); + virtual ~OpenGLCubemapTexture(); + + virtual uint32_t GetWidth() const override { return m_Width; } + virtual uint32_t GetHeight() const override { return m_Height; } + virtual uint32_t GetRendererID() const override { return m_RendererID; } + + virtual void SetData(void* data, uint32_t size) override; + virtual void Bind(uint32_t slot = 0) const override; + virtual void BindAsImage(uint32_t slot = 0, bool readOnly = false) const override; + + virtual bool operator==(const Texture& other) const override + { + return m_RendererID == other.GetRendererID(); + } + + private: + void LoadHDRI(const std::string& path); + void ConvertEquirectangularToCubemap(float* hdrData, int width, int height); + + std::string m_Path; + uint32_t m_Width, m_Height; + uint32_t m_RendererID; + GLenum m_InternalFormat, m_DataFormat; + }; } |
