1#ifndef OE_RENDER_FRAMEBUFFER_H
2#define OE_RENDER_FRAMEBUFFER_H
12 enum TargetBuffer :
int
14 COLOR_BUFFER = 0x4000,
15 DEPTH_BUFFER = 0x0100,
16 STENCIL_BUFFER = 0x0400,
47 Framebuffer(
const uint32_t width,
const uint32_t height);
54 std::shared_ptr<Texture>
addColorAttachment(
const uint32_t attachment_level = 0,
const uint32_t internal_format = 0,
const uint32_t format = 0,
const uint32_t type = 0,
55 const uint32_t filter = 0,
const uint8_t max_mips = 1
62 void addDepthAttachment(
const uint32_t format = 0,
const uint32_t type = 0,
const uint32_t filter = 0);
75 void setTextureAttachment(
const uint32_t attachment_level, std::shared_ptr<Texture> texture,
const int32_t mip_level = 0);
80 void clearContents(
const glm::vec4& color = glm::vec4(0.f),
const int& target = 0);
103 return _color_attachments.at(attachment_level);
112 return _depth_attachment;
127 const glm::ivec4& src_bounds = glm::ivec4(0),
128 const glm::ivec4& target_bounds = glm::ivec4(0),
129 const TargetBuffer& type = TargetBuffer::ALL,
130 const uint8_t color_attachment_src = 0,
131 const uint8_t color_attachment_dest = 0,
132 const bool usefilter =
false
147 const glm::ivec4& src_bounds = glm::ivec4(0),
148 const glm::ivec4& target_bounds = glm::ivec4(0),
149 const TargetBuffer& type = TargetBuffer::ALL,
150 const uint8_t color_attachment_src = 0,
151 const uint8_t color_attachment_dest = 0,
152 const bool usefilter =
false
170 void blitToDefault(
const uint8_t color_attachment_src = 0,
const bool& usefilter =
false)
const;
183 return {_width, _height};
187 void _update_color_attachments();
188 void _clear_all_color_attachments(
const glm::vec4& color);
193 const glm::ivec4& src_bounds,
194 const glm::ivec4& target_bounds,
195 const TargetBuffer& type,
196 const uint8_t color_attachment_src,
197 const uint8_t color_attachment_dest,
201 std::map<unsigned int, std::shared_ptr<Texture>> _color_attachments;
202 std::shared_ptr<Texture> _depth_attachment = {};
204 unsigned int _width = 0;
205 unsigned int _height = 0;
206 unsigned int _fbo = 0;
207 unsigned int _rbo = 0;
Definition framebuffer.h:43
void blitTo(Framebuffer *target, const glm::ivec4 &src_bounds=glm::ivec4(0), const glm::ivec4 &target_bounds=glm::ivec4(0), const TargetBuffer &type=TargetBuffer::ALL, const uint8_t color_attachment_src=0, const uint8_t color_attachment_dest=0, const bool usefilter=false) const
void addDepthAttachment(const uint32_t format=0, const uint32_t type=0, const uint32_t filter=0)
void blitToDefault(const uint8_t color_attachment_src=0, const bool &usefilter=false) const
void blitFrom(const Framebuffer *src, const glm::ivec4 &src_bounds=glm::ivec4(0), const glm::ivec4 &target_bounds=glm::ivec4(0), const TargetBuffer &type=TargetBuffer::ALL, const uint8_t color_attachment_src=0, const uint8_t color_attachment_dest=0, const bool usefilter=false)
const std::shared_ptr< Texture > & getDepthAttachment() const
Definition framebuffer.h:110
const std::shared_ptr< Texture > & getColorAttachment(const uint32_t attachment_level) const
Definition framebuffer.h:101
void clearContents(const glm::vec4 &color=glm::vec4(0.f), const int &target=0)
void setDepthAttachment(std::shared_ptr< Texture > texture)
void setTextureAttachment(const uint32_t attachment_level, std::shared_ptr< Texture > texture, const int32_t mip_level=0)
void beginRender(const bool resize_viewport=true)
std::shared_ptr< Texture > addColorAttachment(const uint32_t attachment_level=0, const uint32_t internal_format=0, const uint32_t format=0, const uint32_t type=0, const uint32_t filter=0, const uint8_t max_mips=1)
glm::ivec2 getDimensions() const noexcept
Definition framebuffer.h:181
void copyFrom(Framebuffer *source, const TargetBuffer &type=TargetBuffer::ALL)
Definition framebuffer.h:160
Render related abstractions (Shader, Framebuffer, Cubemaps, Textures)
Definition opengl.h:10