Loading...
Searching...
No Matches
hellfire::Framebuffer Class Reference

#include <Framebuffer.h>

Collaboration diagram for hellfire::Framebuffer:

Public Member Functions

 Framebuffer ()
 
 ~Framebuffer ()
 
void attach_color_texture (const FrameBufferAttachmentSettings &settings={})
 
void attach_texture_by_id (uint32_t texture_id, GLenum attachment, GLenum target)
 
void attach_depth_texture (const FrameBufferAttachmentSettings &settings={})
 
void attach_stencil_texture (const FrameBufferAttachmentSettings &settings={})
 
 Framebuffer (const Framebuffer &)=delete
 
Framebufferoperator= (const Framebuffer &)=delete
 
void bind () const
 
void unbind ()
 
void resize (uint32_t width, uint32_t height)
 
uint32_t read_pixel_from_texture (uint32_t texture_id, int x, int y)
 Reads a pixel from an external texture using this framebuffer.
 
const std::vector< uint32_t > & get_color_attachments () const
 
uint32_t get_color_attachment (const size_t index=0) const
 
size_t get_color_attachment_count () const
 
uint32_t get_depth_attachment () const
 
bool is_complete () const
 
uint32_t get_width () const
 
uint32_t get_height () const
 

Private Member Functions

void create_framebuffer ()
 
void cleanup ()
 

Private Attributes

uint32_t framebuffer_id_
 
std::vector< uint32_t > color_attachments_
 
uint32_t depth_attachment_
 
uint32_t stencil_attachment_
 
std::vector< FrameBufferAttachmentSettingscolor_settings_
 
FrameBufferAttachmentSettings depth_settings_
 
FrameBufferAttachmentSettings stencil_settings_
 
bool has_depth_ = false
 
bool has_stencil_ = false
 

Detailed Description

Definition at line 29 of file Framebuffer.h.

Constructor & Destructor Documentation

◆ Framebuffer() [1/2]

hellfire::Framebuffer::Framebuffer ( )

Definition at line 10 of file Framebuffer.cpp.

◆ ~Framebuffer()

hellfire::Framebuffer::~Framebuffer ( )

Definition at line 14 of file Framebuffer.cpp.

◆ Framebuffer() [2/2]

hellfire::Framebuffer::Framebuffer ( const Framebuffer )
delete

Member Function Documentation

◆ attach_color_texture()

void hellfire::Framebuffer::attach_color_texture ( const FrameBufferAttachmentSettings settings = {})

Definition at line 18 of file Framebuffer.cpp.

◆ attach_depth_texture()

void hellfire::Framebuffer::attach_depth_texture ( const FrameBufferAttachmentSettings settings = {})

Definition at line 60 of file Framebuffer.cpp.

◆ attach_stencil_texture()

void hellfire::Framebuffer::attach_stencil_texture ( const FrameBufferAttachmentSettings settings = {})

Definition at line 100 of file Framebuffer.cpp.

◆ attach_texture_by_id()

void hellfire::Framebuffer::attach_texture_by_id ( uint32_t  texture_id,
GLenum  attachment = GL_COLOR_ATTACHMENT0,
GLenum  target = GL_FRAMEBUFFER 
)

Definition at line 54 of file Framebuffer.cpp.

◆ bind()

void hellfire::Framebuffer::bind ( ) const

Definition at line 135 of file Framebuffer.cpp.

◆ cleanup()

void hellfire::Framebuffer::cleanup ( )
private

Definition at line 254 of file Framebuffer.cpp.

◆ create_framebuffer()

void hellfire::Framebuffer::create_framebuffer ( )
private

Definition at line 250 of file Framebuffer.cpp.

◆ get_color_attachment()

uint32_t hellfire::Framebuffer::get_color_attachment ( const size_t  index = 0) const
inline

Definition at line 65 of file Framebuffer.h.

◆ get_color_attachment_count()

size_t hellfire::Framebuffer::get_color_attachment_count ( ) const
inline

Definition at line 69 of file Framebuffer.h.

◆ get_color_attachments()

const std::vector< uint32_t > & hellfire::Framebuffer::get_color_attachments ( ) const
inline

Definition at line 63 of file Framebuffer.h.

◆ get_depth_attachment()

uint32_t hellfire::Framebuffer::get_depth_attachment ( ) const
inline

Definition at line 70 of file Framebuffer.h.

◆ get_height()

uint32_t hellfire::Framebuffer::get_height ( ) const

Definition at line 246 of file Framebuffer.cpp.

◆ get_width()

uint32_t hellfire::Framebuffer::get_width ( ) const

Definition at line 242 of file Framebuffer.cpp.

◆ is_complete()

bool hellfire::Framebuffer::is_complete ( ) const

Definition at line 209 of file Framebuffer.cpp.

◆ operator=()

Framebuffer & hellfire::Framebuffer::operator= ( const Framebuffer )
delete

◆ read_pixel_from_texture()

uint32_t hellfire::Framebuffer::read_pixel_from_texture ( uint32_t  texture_id,
int  x,
int  y 
)

Reads a pixel from an external texture using this framebuffer.

Parameters
texture_idTexture to read from
xX coordinate
yY coordinate
Returns
Pixel value as uint32_t

Definition at line 187 of file Framebuffer.cpp.

◆ resize()

void hellfire::Framebuffer::resize ( uint32_t  width,
uint32_t  height 
)

Definition at line 148 of file Framebuffer.cpp.

◆ unbind()

void hellfire::Framebuffer::unbind ( )

Definition at line 144 of file Framebuffer.cpp.

Member Data Documentation

◆ color_attachments_

std::vector<uint32_t> hellfire::Framebuffer::color_attachments_
private

Definition at line 84 of file Framebuffer.h.

◆ color_settings_

std::vector<FrameBufferAttachmentSettings> hellfire::Framebuffer::color_settings_
private

Definition at line 87 of file Framebuffer.h.

◆ depth_attachment_

uint32_t hellfire::Framebuffer::depth_attachment_
private

Definition at line 85 of file Framebuffer.h.

◆ depth_settings_

FrameBufferAttachmentSettings hellfire::Framebuffer::depth_settings_
private

Definition at line 88 of file Framebuffer.h.

◆ framebuffer_id_

uint32_t hellfire::Framebuffer::framebuffer_id_
private

Definition at line 83 of file Framebuffer.h.

◆ has_depth_

bool hellfire::Framebuffer::has_depth_ = false
private

Definition at line 90 of file Framebuffer.h.

◆ has_stencil_

bool hellfire::Framebuffer::has_stencil_ = false
private

Definition at line 91 of file Framebuffer.h.

◆ stencil_attachment_

uint32_t hellfire::Framebuffer::stencil_attachment_
private

Definition at line 86 of file Framebuffer.h.

◆ stencil_settings_

FrameBufferAttachmentSettings hellfire::Framebuffer::stencil_settings_
private

Definition at line 89 of file Framebuffer.h.


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