#include <OxygenEngine/render/framebuffer.h>
|
| Framebuffer (const glm::ivec2 &dimensions) |
|
| 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 |
|
Wrapper around framebuffer operations
Example usage:
fb.addColorAttachment(0);
fb.addDepthAttachment();
assert(fb);
fb.beginRender();
fb.clearContents(glm::vec4(glm::vec3(0.5), 1.0));
...
fb.endRender();
Definition framebuffer.h:43
◆ addColorAttachment()
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
- Parameters
-
attachment_level | the attachment level to use |
◆ addDepthAttachment()
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
- Note
- If no parameters provided, a renderbuffer will be generated instead a texture (the rbo is more optimized but you won't be able to sample it)
◆ beginRender()
void oe::render::Framebuffer::beginRender |
( |
const bool |
resize_viewport = true | ) |
|
Begin rendering operations on this framebuffer
◆ blitFrom()
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
- Parameters
-
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 |
◆ blitTo()
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
- Parameters
-
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 |
◆ blitToDefault()
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
- Parameters
-
color_attachment_src | Attachment layer to fetch |
usefilter | If bounds are not the same size, do we need to use a linear filter |
◆ clearContents()
void oe::render::Framebuffer::clearContents |
( |
const glm::vec4 & |
color = glm::vec4(0.f) , |
|
|
const int & |
target = 0 |
|
) |
| |
Clear the framebuffer contents with a color
◆ copyFrom()
void oe::render::Framebuffer::copyFrom |
( |
Framebuffer * |
source, |
|
|
const TargetBuffer & |
type = TargetBuffer::ALL |
|
) |
| |
|
inline |
Copy all contents from source
- Parameters
-
source | Source framebuffer to get blit data |
type | TargetBuffer target to copy |
◆ endRender()
void oe::render::Framebuffer::endRender |
( |
| ) |
|
End rendering operations on this framebuffer
◆ getColorAttachment()
const std::shared_ptr< Texture > & oe::render::Framebuffer::getColorAttachment |
( |
const uint32_t |
attachment_level | ) |
const |
|
inline |
Get the color attachment texture
- Parameters
-
attachment_level | the attachment level to fetch (if not multitexturing used, set it to 0) |
◆ getDepthAttachment()
const std::shared_ptr< Texture > & oe::render::Framebuffer::getDepthAttachment |
( |
| ) |
const |
|
inline |
Get the depth attachment texture
- Note
- nullptr returned if the framebuffer doesn't have depth or depth created with a renderbuffer
◆ getDimensions()
glm::ivec2 oe::render::Framebuffer::getDimensions |
( |
| ) |
const |
|
inlinenoexcept |
◆ operator bool()
oe::render::Framebuffer::operator bool |
( |
| ) |
|
Check if the framebuffer is valid
◆ setDepthAttachment()
void oe::render::Framebuffer::setDepthAttachment |
( |
std::shared_ptr< Texture > |
texture | ) |
|
Add a existing texture as the depth framebuffer
◆ setTextureAttachment()
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
- Parameters
-
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 |
The documentation for this class was generated from the following file:
- OxygenEngine/render/framebuffer.h