From 01fadbecbed89afffb18b2cf5cf3972845a7a169 Mon Sep 17 00:00:00 2001 From: hachem Date: Fri, 22 Aug 2025 00:22:12 +0200 Subject: [add]: frame exporting --- src/Platform/OpenGL/OpenGLFramebuffer.h | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/Platform/OpenGL/OpenGLFramebuffer.h (limited to 'src/Platform/OpenGL/OpenGLFramebuffer.h') diff --git a/src/Platform/OpenGL/OpenGLFramebuffer.h b/src/Platform/OpenGL/OpenGLFramebuffer.h new file mode 100644 index 0000000..8cd376c --- /dev/null +++ b/src/Platform/OpenGL/OpenGLFramebuffer.h @@ -0,0 +1,35 @@ +#pragma once + +#include "Rendering/Framebuffer.h" + +namespace Donut +{ + class OpenGLFramebuffer : public Framebuffer + { + public: + OpenGLFramebuffer(const FramebufferSpecification& spec); + virtual ~OpenGLFramebuffer(); + + void Invalidate(); + + virtual void Bind() override; + virtual void Unbind() override; + + virtual void Resize(uint32_t width, uint32_t height) override; + virtual int ReadPixel(uint32_t attachmentIndex, int x, int y) override; + + virtual void ClearAttachment(uint32_t attachmentIndex, int value) override; + virtual uint32_t GetColorAttachmentRendererID(uint32_t index = 0) const override { return m_ColorAttachments[index]; } + + virtual const FramebufferSpecification& GetSpecification() const override { return m_Specification; } + private: + uint32_t m_RendererID = 0; + FramebufferSpecification m_Specification; + + std::vector m_ColorAttachmentSpecifications; + FramebufferTextureSpecification m_DepthAttachmentSpecification = FramebufferTextureFormat::None; + + std::vector m_ColorAttachments; + uint32_t m_DepthAttachment = 0; + }; +}; -- cgit v1.3