|
Oxygen Engine
Modern C++ 3D Engine using OpenGL
|
#include <OxygenEngine/render/framebuffer.h>
Inheritance diagram for oe::render::Framebuffer:
Collaboration diagram for oe::render::Framebuffer:Public Member Functions | |
| Framebuffer (const glm::ivec2 &dimensions) | |
| Framebuffer (Framebuffer &&)=default | |
| Framebuffer & | operator= (Framebuffer &&)=default |
| Framebuffer (const uint32_t width, const uint32_t height) | |
| 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) |
| void | addDepthAttachment (const uint32_t format=0, const uint32_t type=0, const uint32_t filter=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 | clearContents (const glm::vec4 &color=glm::vec4(0.f), const int &target=0) |
| void | beginRender (const bool resize_viewport=true) |
| void | endRender () |
| operator bool () | |
| const std::shared_ptr< Texture > & | getColorAttachment (const uint32_t attachment_level) const |
| const std::shared_ptr< Texture > & | getDepthAttachment () 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) |
| 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 | copyFrom (Framebuffer *source, const TargetBuffer &type=TargetBuffer::ALL) |
| void | blitToDefault (const uint8_t color_attachment_src=0, const bool &usefilter=false) const |
| glm::ivec2 | getDimensions () const noexcept |
Additional Inherited Members | |
Protected Member Functions inherited from oe::util::NonCopyable | |
| NonCopyable (NonCopyable &&)=default | |
| NonCopyable & | operator= (NonCopyable &&)=default |
Wrapper around framebuffer operations
Example usage:
| std::shared_ptr< Texture > oe::render::Framebuffer::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 |
||
| ) |
Generate a color texture to the framebuffer
| attachment_level | the attachment level to use |
| void oe::render::Framebuffer::addDepthAttachment | ( | const uint32_t | format = 0, |
| const uint32_t | type = 0, |
||
| const uint32_t | filter = 0 |
||
| ) |
Generate a depth attachment to the framebuffer
| void oe::render::Framebuffer::beginRender | ( | const bool | resize_viewport = true | ) |
Begin rendering operations on this framebuffer
| void oe::render::Framebuffer::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 |
||
| ) |
Copy a portion of a framebuffer to this one
| src | source framebuffer to get blit data |
| src_bounds | blit source bounds (from src) |
| target_bounds | blit target bounds (on this one) |
| type | a TargetBuffer target to copy |
| color_attachment_src | If type contains the color buffer, src attachment layer to fetch |
| color_attachment_dest | If type contains the color buffer, this framebuffer attachment layer to write |
| usefilter | If bounds are not the same size, do we need to use a linear filter |
| void oe::render::Framebuffer::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 |
Copy a portion of this framebuffer to another one
| target | target framebuffer to blit data |
| src_bounds | blit source bounds (from this one) |
| target_bounds | blit target bounds (on target) |
| type | TargetBuffer target to copy |
| color_attachment_src | If type contains the color buffer, this attachment layer to fetch |
| color_attachment_dest | If type contains the color buffer, target framebuffer attachment layer to write |
| usefilter | If bounds are not the same size, do we need to use a linear filter |
| void oe::render::Framebuffer::blitToDefault | ( | const uint8_t | color_attachment_src = 0, |
| const bool & | usefilter = false |
||
| ) | const |
Handy function to copy this framebuffer to default framebuffer
| color_attachment_src | Attachment layer to fetch |
| usefilter | If bounds are not the same size, do we need to use a linear filter |
| void oe::render::Framebuffer::clearContents | ( | const glm::vec4 & | color = glm::vec4(0.f), |
| const int & | target = 0 |
||
| ) |
Clear the framebuffer contents with a color
|
inline |
Copy all contents from source
| source | Source framebuffer to get blit data |
| type | TargetBuffer target to copy |
| void oe::render::Framebuffer::endRender | ( | ) |
End rendering operations on this framebuffer
|
inline |
Get the color attachment texture
| attachment_level | the attachment level to fetch (if not multitexturing used, set it to 0) |
|
inline |
Get the depth attachment texture
|
inlinenoexcept |
Get Framebuffer dimensions
| oe::render::Framebuffer::operator bool | ( | ) |
Check if the framebuffer is valid
| void oe::render::Framebuffer::setDepthAttachment | ( | std::shared_ptr< Texture > | texture | ) |
Add a existing texture as the depth framebuffer
| void oe::render::Framebuffer::setTextureAttachment | ( | const uint32_t | attachment_level, |
| std::shared_ptr< Texture > | texture, | ||
| const int32_t | mip_level = 0 |
||
| ) |
Add a existing texture to the framebuffer
| attachment_level | the attachment level to use (if not multitexturing used, set it to 0) |
| texture | the texture to use |
| mip_level | MIP MAP level of texture |