cgv
Loading...
Searching...
No Matches
cgv::render::managed_frame_buffer Class Reference

provides a class that manages a frame buffer along with its attachments More...

#include <managed_frame_buffer.h>

Classes

struct  attachment
 

Public Member Functions

void destruct (const context &ctx)
 
ivec2 get_size ()
 
void set_size (const ivec2 &size)
 Set the size of the framebuffer attachments.
 
void add_attachment (const std::string &name, const std::string &format="uint8[R,G,B]", TextureFilter tf=TF_NEAREST, TextureWrap tw=TW_CLAMP_TO_EDGE, bool attach=true)
 
bool enable_attachment (context &ctx, const std::string &name, int tex_unit=-1)
 
bool disable_attachment (context &ctx, const std::string &name)
 
textureattachment_texture_ptr (const std::string &name)
 
bool ensure (context &ctx)
 Ensure the framebuffer is constructed with the specified size.
 
bool enable (context &ctx, bool push_viewport=true)
 
bool disable (context &ctx, bool pop_viewport=true)
 
frame_bufferref_frame_buffer ()
 

Protected Attributes

frame_buffer fb
 
unsigned index_counter = 0
 
std::unordered_map< std::string, attachmentattachments
 
ivec2 size
 

Detailed Description

provides a class that manages a frame buffer along with its attachments

Definition at line 13 of file managed_frame_buffer.h.

Constructor & Destructor Documentation

◆ managed_frame_buffer()

cgv::render::managed_frame_buffer::managed_frame_buffer ( )

Definition at line 6 of file managed_frame_buffer.cxx.

Member Function Documentation

◆ add_attachment()

void cgv::render::managed_frame_buffer::add_attachment ( const std::string &  name,
const std::string &  format = "uint8[R,G,B]",
TextureFilter  tf = TF_NEAREST,
TextureWrap  tw = TW_CLAMP_TO_EDGE,
bool  attach = true 
)

Definition at line 33 of file managed_frame_buffer.cxx.

◆ attachment_texture_ptr()

texture * cgv::render::managed_frame_buffer::attachment_texture_ptr ( const std::string &  name)

Definition at line 73 of file managed_frame_buffer.cxx.

◆ destruct()

void cgv::render::managed_frame_buffer::destruct ( const context ctx)

Definition at line 12 of file managed_frame_buffer.cxx.

◆ disable()

bool cgv::render::managed_frame_buffer::disable ( context ctx,
bool  pop_viewport = true 
)

Definition at line 110 of file managed_frame_buffer.cxx.

◆ disable_attachment()

bool cgv::render::managed_frame_buffer::disable_attachment ( context ctx,
const std::string &  name 
)

Definition at line 62 of file managed_frame_buffer.cxx.

◆ enable()

bool cgv::render::managed_frame_buffer::enable ( context ctx,
bool  push_viewport = true 
)

Definition at line 103 of file managed_frame_buffer.cxx.

◆ enable_attachment()

bool cgv::render::managed_frame_buffer::enable_attachment ( context ctx,
const std::string &  name,
int  tex_unit = -1 
)

Definition at line 51 of file managed_frame_buffer.cxx.

◆ ensure()

bool cgv::render::managed_frame_buffer::ensure ( context ctx)

Ensure the framebuffer is constructed with the specified size.

Parameters
ctxThe graphics context.
Returns
True if the framebuffer could be constructed wit the specified attachments and size, false otherwise.

Definition at line 84 of file managed_frame_buffer.cxx.

References cgv::render::frame_buffer::get_height(), cgv::render::frame_buffer::get_width(), cgv::render::render_component::is_created(), cgv::math::fvec< T, N >::x(), and cgv::math::fvec< T, N >::y().

Referenced by cgv::app::navigator::init(), cgv::app::canvas_overlay::init(), and cgv::app::navigator::init_frame().

◆ get_size()

ivec2 cgv::render::managed_frame_buffer::get_size ( )

Definition at line 23 of file managed_frame_buffer.cxx.

◆ ref_frame_buffer()

frame_buffer & cgv::render::managed_frame_buffer::ref_frame_buffer ( )
inline

Definition at line 75 of file managed_frame_buffer.h.

◆ set_size()

void cgv::render::managed_frame_buffer::set_size ( const ivec2 size)

Set the size of the framebuffer attachments.

Requires to call ensure afterwards to actually construct the framebuffer.

If the given width or height is <= 0, the attachment widths or heights will be set to the context width or height respectively.

Parameters
sizeThe requested size.

Definition at line 28 of file managed_frame_buffer.cxx.

Referenced by cgv::app::navigator::init(), cgv::app::canvas_overlay::init(), and cgv::app::navigator::init_frame().

Member Data Documentation

◆ attachments

std::unordered_map<std::string, attachment> cgv::render::managed_frame_buffer::attachments
protected

Definition at line 40 of file managed_frame_buffer.h.

◆ fb

frame_buffer cgv::render::managed_frame_buffer::fb
protected

Definition at line 38 of file managed_frame_buffer.h.

◆ index_counter

unsigned cgv::render::managed_frame_buffer::index_counter = 0
protected

Definition at line 39 of file managed_frame_buffer.h.

◆ size

ivec2 cgv::render::managed_frame_buffer::size
protected

Definition at line 41 of file managed_frame_buffer.h.


The documentation for this class was generated from the following files: