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,
50 Framebuffer(
const uint32_t width,
const uint32_t height);
57 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,
58 const uint32_t filter = 0,
const uint8_t max_mips = 1
65 void addDepthAttachment(
const uint32_t format = 0,
const uint32_t type = 0,
const uint32_t filter = 0);
78 void setTextureAttachment(
const uint32_t attachment_level, std::shared_ptr<Texture> texture,
const int32_t mip_level = 0);
83 void clearContents(
const glm::vec4& color = glm::vec4(0.f),
const int& target = 0);
106 return _color_attachments.at(attachment_level);
115 return _depth_attachment;
130 const glm::ivec4& src_bounds = glm::ivec4(0),
131 const glm::ivec4& target_bounds = glm::ivec4(0),
132 const TargetBuffer& type = TargetBuffer::ALL,
133 const uint8_t color_attachment_src = 0,
134 const uint8_t color_attachment_dest = 0,
135 const bool usefilter =
false
150 const glm::ivec4& src_bounds = glm::ivec4(0),
151 const glm::ivec4& target_bounds = glm::ivec4(0),
152 const TargetBuffer& type = TargetBuffer::ALL,
153 const uint8_t color_attachment_src = 0,
154 const uint8_t color_attachment_dest = 0,
155 const bool usefilter =
false
173 void blitToDefault(
const uint8_t color_attachment_src = 0,
const bool& usefilter =
false)
const;
186 return {_width, _height};
189 #ifdef OXYGEN_ENGINE_DEBUG_VALIDATE_ORDERED_OPERATIONS
190 bool is_between_begin_end =
false;
194 void _update_color_attachments();
195 void _clear_all_color_attachments(
const glm::vec4& color);
200 const glm::ivec4& src_bounds,
201 const glm::ivec4& target_bounds,
202 const TargetBuffer& type,
203 const uint8_t color_attachment_src,
204 const uint8_t color_attachment_dest,
208 std::map<unsigned int, std::shared_ptr<Texture>> _color_attachments;
209 std::shared_ptr<Texture> _depth_attachment = {};
211 unsigned int _width = 0;
212 unsigned int _height = 0;
213 unsigned int _fbo = 0;
214 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:113
const std::shared_ptr< Texture > & getColorAttachment(const uint32_t attachment_level) const
Definition framebuffer.h:104
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:184
void copyFrom(Framebuffer *source, const TargetBuffer &type=TargetBuffer::ALL)
Definition framebuffer.h:163
Prevent class to be copied.
Definition non_copyable.h:12
Render related abstractions (Shader, Framebuffer, Cubemaps, Textures)
Definition opengl.h:10