blob: e4c14819160bfdf450391d97f9a6a1c7bfc873f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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);
};
};
|