diff options
| author | hachem <im@hachem.wtf> | 2025-08-22 00:22:12 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-22 00:22:12 +0200 |
| commit | 01fadbecbed89afffb18b2cf5cf3972845a7a169 (patch) | |
| tree | 1faf64e41f4a9b59e8ad6f68363c590dfc089cc4 /src/Rendering/Framebuffer.h | |
| parent | 6f72049359651155be62846e7d080d7a5e871096 (diff) | |
[add]: frame exporting
Diffstat (limited to 'src/Rendering/Framebuffer.h')
| -rw-r--r-- | src/Rendering/Framebuffer.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/Rendering/Framebuffer.h b/src/Rendering/Framebuffer.h new file mode 100644 index 0000000..e4c1481 --- /dev/null +++ b/src/Rendering/Framebuffer.h @@ -0,0 +1,65 @@ +#pragma once + +#include "Core/Memory.h" +#include "Texture.h" + +namespace Donut +{ + enum class FramebufferTextureFormat + { + None = 0, + + RGBA8, + RED_INTEGER, + + DEPTH24STENCIL8, + + Depth = DEPTH24STENCIL8 + }; + + struct FramebufferTextureSpecification + { + FramebufferTextureSpecification() = default; + FramebufferTextureSpecification(FramebufferTextureFormat format) + : TextureFormat(format) {} + + FramebufferTextureFormat TextureFormat = FramebufferTextureFormat::None; + }; + + struct FramebufferAttachmentSpecification + { + FramebufferAttachmentSpecification() = default; + FramebufferAttachmentSpecification(std::initializer_list<FramebufferTextureSpecification> attachments) + : Attachments(attachments) {} + + std::vector<FramebufferTextureSpecification> Attachments; + }; + + struct FramebufferSpecification + { + uint32_t Width = 0, Height = 0; + FramebufferAttachmentSpecification Attachments; + uint32_t Samples = 1; + + bool SwapChainTarget = false; + }; + + class Framebuffer + { + public: + virtual ~Framebuffer() = default; + + virtual void Bind() = 0; + virtual void Unbind() = 0; + + virtual void Resize(uint32_t width, uint32_t height) = 0; + virtual int ReadPixel(uint32_t attachmentIndex, int x, int y) = 0; + + virtual void ClearAttachment(uint32_t attachmentIndex, int value) = 0; + virtual uint32_t GetColorAttachmentRendererID(uint32_t index = 0) const = 0; + + virtual const FramebufferSpecification& GetSpecification() const = 0; + + static Ref<Framebuffer> Create(const FramebufferSpecification& spec); + }; +}; |
