aboutsummaryrefslogtreecommitdiff
path: root/src/Rendering/Framebuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Rendering/Framebuffer.h')
-rw-r--r--src/Rendering/Framebuffer.h65
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);
+ };
+};