nngn
Loading...
Searching...
No Matches
nngn::GLPost Class Reference

Post-processing operations. More...

#include <post.h>

Collaboration diagram for nngn::GLPost:

Public Member Functions

bool init ()
 Single-step, swap-chain-independent initialization.
 
bool destroy ()
 Releases all resources.
 
void resize (uvec2 size)
 Signals that the frame buffer has been resized.
 
bool set_automatic_exposure (bool b)
 
void set_exposure (float e)
 
void set_bloom_downscale (std::size_t d)
 
void set_bloom_threshold (float t)
 
void set_bloom_blur_size (float n)
 
void set_bloom_blur_passes (std::size_t n)
 
void set_bloom_amount (float a)
 
void set_blur_downscale (std::size_t d)
 
void set_blur_size (float n)
 
void set_blur_passes (std::size_t n)
 
void set_HDR_mix (float m)
 
bool update ()
 Updates resources as necessary.
 
bool bind_frame_buffer ()
 Binds the appropriate frame buffer according to the configuration.
 
bool render ()
 Renders all enabled steps.
 

Private Types

enum  Flag : u8 { AUTOMATIC_EXPOSURE = 1u << 0 , SIZE_UPDATED = 1u << 1 , BLOOM_SCALE_UPDATED = 1u << 2 , BLUR_SCALE_UPDATED = 1u << 3 }
 

Private Member Functions

bool enabled () const
 
bool HDR_enabled () const
 
bool bloom_enabled () const
 
bool blur_enabled () const
 
bool resize_frame_buffers ()
 
bool calc_avg_luminance ()
 
bool bloom () const
 
bool blur () const
 
bool HDR () const
 

Private Attributes

Flags< Flagflags = {}
 
float exposure = Graphics::DEFAULT_EXPOSURE
 
float bloom_scale
 
float bloom_threshold = Graphics::DEFAULT_BLOOM_THRESHOLD
 
float bloom_blur_size = Graphics::DEFAULT_BLOOM_BLUR_SIZE
 
std::size_t bloom_blur_passes = Graphics::DEFAULT_BLOOM_BLUR_PASSES
 
float bloom_amount = 0
 
float blur_scale
 
float blur_size = 0
 
std::size_t blur_passes = 0
 
float HDR_mix = 0
 
GLProgram luminance_prog = {}
 
GLProgram bloom_prog = {}
 
GLProgram blur_prog = {}
 
GLProgram hdr_prog = {}
 
GLTexArray color_tex = {}
 
GLTexArray depth_tex = {}
 
GLTexArray luminance_tex0 = {}
 
GLTexArray luminance_tex1 = {}
 
GLTexArray luminance_last_tex = {}
 
GLTexArray luminance_res_tex = {}
 
GLTexArray blur_tex0 = {}
 
GLTexArray blur_tex1 = {}
 
GLTexArray bloom_blur_tex0 = {}
 
GLTexArray bloom_blur_tex1 = {}
 
GLFrameBuffer color_fb = {}
 
GLFrameBuffer luminance_fb0 = {}
 
GLFrameBuffer luminance_fb1 = {}
 
GLFrameBuffer luminance_res_fb = {}
 
GLFrameBuffer blur_fb0 = {}
 
GLFrameBuffer blur_fb1 = {}
 
GLFrameBuffer bloom_blur_fb0 = {}
 
GLFrameBuffer bloom_blur_fb1 = {}
 
int bloom_threshold_loc = -1
 
int bloom_amount_loc = -1
 
int blur_dir_loc = -1
 
int exposure_scale_loc = -1
 
int HDR_mix_loc = -1
 
VAO luminance_vao = {}
 
VAO bloom_filter_vao = {}
 
VAO blur_vao = {}
 
VAO hdr_vao = {}
 
GLBuffer vbo = {}
 
GLBuffer ebo = {}
 
uvec2 size = {}
 
uvec2 half_size = {}
 
uvec2 rounded_half_size = {}
 

Detailed Description

Post-processing operations.

Member Enumeration Documentation

◆ Flag

enum nngn::GLPost::Flag : u8
private
Enumerator
AUTOMATIC_EXPOSURE 
SIZE_UPDATED 
BLOOM_SCALE_UPDATED 
BLUR_SCALE_UPDATED 

Member Function Documentation

◆ bind_frame_buffer()

bool nngn::GLPost::bind_frame_buffer ( )
inline

Binds the appropriate frame buffer according to the configuration.

May bind either the internal color/depth textures or the default frame buffer.

Here is the call graph for this function:

◆ bloom()

bool nngn::GLPost::bloom ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bloom_enabled()

bool nngn::GLPost::bloom_enabled ( ) const
inlineprivate
Here is the caller graph for this function:

◆ blur()

bool nngn::GLPost::blur ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ blur_enabled()

bool nngn::GLPost::blur_enabled ( ) const
inlineprivate
Here is the caller graph for this function:

◆ calc_avg_luminance()

bool nngn::GLPost::calc_avg_luminance ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ destroy()

bool nngn::GLPost::destroy ( )

Releases all resources.

Here is the call graph for this function:

◆ enabled()

bool nngn::GLPost::enabled ( ) const
inlineprivate
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HDR()

bool nngn::GLPost::HDR ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ HDR_enabled()

bool nngn::GLPost::HDR_enabled ( ) const
inlineprivate
Here is the caller graph for this function:

◆ init()

bool nngn::GLPost::init ( )

Single-step, swap-chain-independent initialization.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ render()

bool nngn::GLPost::render ( )

Renders all enabled steps.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize()

void nngn::GLPost::resize ( uvec2 size)
inline

Signals that the frame buffer has been resized.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resize_frame_buffers()

bool nngn::GLPost::resize_frame_buffers ( )
private

◆ set_automatic_exposure()

bool nngn::GLPost::set_automatic_exposure ( bool b)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_bloom_amount()

void nngn::GLPost::set_bloom_amount ( float a)
inline
Here is the caller graph for this function:

◆ set_bloom_blur_passes()

void nngn::GLPost::set_bloom_blur_passes ( std::size_t n)
inline
Here is the caller graph for this function:

◆ set_bloom_blur_size()

void nngn::GLPost::set_bloom_blur_size ( float n)
inline
Here is the caller graph for this function:

◆ set_bloom_downscale()

void nngn::GLPost::set_bloom_downscale ( std::size_t d)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_bloom_threshold()

void nngn::GLPost::set_bloom_threshold ( float t)
inline
Here is the caller graph for this function:

◆ set_blur_downscale()

void nngn::GLPost::set_blur_downscale ( std::size_t d)
inline
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_blur_passes()

void nngn::GLPost::set_blur_passes ( std::size_t n)
inline
Here is the caller graph for this function:

◆ set_blur_size()

void nngn::GLPost::set_blur_size ( float n)
inline
Here is the caller graph for this function:

◆ set_exposure()

void nngn::GLPost::set_exposure ( float e)
inline
Here is the caller graph for this function:

◆ set_HDR_mix()

void nngn::GLPost::set_HDR_mix ( float m)
inline
Here is the caller graph for this function:

◆ update()

bool nngn::GLPost::update ( )

Updates resources as necessary.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ bloom_amount

float nngn::GLPost::bloom_amount = 0
private

◆ bloom_amount_loc

int nngn::GLPost::bloom_amount_loc = -1
private

◆ bloom_blur_fb0

GLFrameBuffer nngn::GLPost::bloom_blur_fb0 = {}
private

◆ bloom_blur_fb1

GLFrameBuffer nngn::GLPost::bloom_blur_fb1 = {}
private

◆ bloom_blur_passes

std::size_t nngn::GLPost::bloom_blur_passes = Graphics::DEFAULT_BLOOM_BLUR_PASSES
private

◆ bloom_blur_size

float nngn::GLPost::bloom_blur_size = Graphics::DEFAULT_BLOOM_BLUR_SIZE
private

◆ bloom_blur_tex0

GLTexArray nngn::GLPost::bloom_blur_tex0 = {}
private

◆ bloom_blur_tex1

GLTexArray nngn::GLPost::bloom_blur_tex1 = {}
private

◆ bloom_filter_vao

VAO nngn::GLPost::bloom_filter_vao = {}
private

◆ bloom_prog

GLProgram nngn::GLPost::bloom_prog = {}
private

◆ bloom_scale

float nngn::GLPost::bloom_scale
private
Initial value:
=
1.0f / static_cast<float>(Graphics::DEFAULT_BLOOM_DOWNSCALE)
static constexpr std::size_t DEFAULT_BLOOM_DOWNSCALE
Definition graphics.h:273

◆ bloom_threshold

float nngn::GLPost::bloom_threshold = Graphics::DEFAULT_BLOOM_THRESHOLD
private

◆ bloom_threshold_loc

int nngn::GLPost::bloom_threshold_loc = -1
private

◆ blur_dir_loc

int nngn::GLPost::blur_dir_loc = -1
private

◆ blur_fb0

GLFrameBuffer nngn::GLPost::blur_fb0 = {}
private

◆ blur_fb1

GLFrameBuffer nngn::GLPost::blur_fb1 = {}
private

◆ blur_passes

std::size_t nngn::GLPost::blur_passes = 0
private

◆ blur_prog

GLProgram nngn::GLPost::blur_prog = {}
private

◆ blur_scale

float nngn::GLPost::blur_scale
private
Initial value:
=
1.0f / static_cast<float>(Graphics::DEFAULT_BLUR_DOWNSCALE)
static constexpr std::size_t DEFAULT_BLUR_DOWNSCALE
Definition graphics.h:274

◆ blur_size

float nngn::GLPost::blur_size = 0
private

◆ blur_tex0

GLTexArray nngn::GLPost::blur_tex0 = {}
private

◆ blur_tex1

GLTexArray nngn::GLPost::blur_tex1 = {}
private

◆ blur_vao

VAO nngn::GLPost::blur_vao = {}
private

◆ color_fb

GLFrameBuffer nngn::GLPost::color_fb = {}
private

◆ color_tex

GLTexArray nngn::GLPost::color_tex = {}
private

◆ depth_tex

GLTexArray nngn::GLPost::depth_tex = {}
private

◆ ebo

GLBuffer nngn::GLPost::ebo = {}
private

◆ exposure

float nngn::GLPost::exposure = Graphics::DEFAULT_EXPOSURE
private

◆ exposure_scale_loc

int nngn::GLPost::exposure_scale_loc = -1
private

◆ flags

Flags<Flag> nngn::GLPost::flags = {}
private

◆ half_size

uvec2 nngn::GLPost::half_size = {}
private

◆ HDR_mix

float nngn::GLPost::HDR_mix = 0
private

◆ HDR_mix_loc

int nngn::GLPost::HDR_mix_loc = -1
private

◆ hdr_prog

GLProgram nngn::GLPost::hdr_prog = {}
private

◆ hdr_vao

VAO nngn::GLPost::hdr_vao = {}
private

◆ luminance_fb0

GLFrameBuffer nngn::GLPost::luminance_fb0 = {}
private

◆ luminance_fb1

GLFrameBuffer nngn::GLPost::luminance_fb1 = {}
private

◆ luminance_last_tex

GLTexArray nngn::GLPost::luminance_last_tex = {}
private

◆ luminance_prog

GLProgram nngn::GLPost::luminance_prog = {}
private

◆ luminance_res_fb

GLFrameBuffer nngn::GLPost::luminance_res_fb = {}
private

◆ luminance_res_tex

GLTexArray nngn::GLPost::luminance_res_tex = {}
private

◆ luminance_tex0

GLTexArray nngn::GLPost::luminance_tex0 = {}
private

◆ luminance_tex1

GLTexArray nngn::GLPost::luminance_tex1 = {}
private

◆ luminance_vao

VAO nngn::GLPost::luminance_vao = {}
private

◆ rounded_half_size

uvec2 nngn::GLPost::rounded_half_size = {}
private

◆ size

uvec2 nngn::GLPost::size = {}
private

◆ vbo

GLBuffer nngn::GLPost::vbo = {}
private

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