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.
 
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 {
  AUTOMATIC_EXPOSURE = 1u << 0 , SIZE_UPDATED = 1u << 1 , BLOOM_SCALE_UPDATED = 1u << 2 , BLUR_SCALE_UPDATED = 1u << 3 ,
  AUTOMATIC_EXPOSURE = 1u << 0 , SIZE_UPDATED = 1u << 1 , BLOOM_SCALE_UPDATED = 1u << 2 , BLUR_SCALE_UPDATED = 1u << 3
}
 
enum  Flag : u8 {
  AUTOMATIC_EXPOSURE = 1u << 0 , SIZE_UPDATED = 1u << 1 , BLOOM_SCALE_UPDATED = 1u << 2 , BLUR_SCALE_UPDATED = 1u << 3 ,
  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
 
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 [1/2]

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

◆ Flag [2/2]

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

Member Function Documentation

◆ bind_frame_buffer() [1/2]

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:

◆ bind_frame_buffer() [2/2]

bool nngn::GLPost::bind_frame_buffer ( )

Binds the appropriate frame buffer according to the configuration.

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

◆ bloom() [1/2]

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

◆ bloom() [2/2]

bool nngn::GLPost::bloom ( ) const
private

◆ bloom_enabled() [1/2]

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

◆ bloom_enabled() [2/2]

bool nngn::GLPost::bloom_enabled ( ) const
private

◆ blur() [1/2]

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

◆ blur() [2/2]

bool nngn::GLPost::blur ( ) const
private

◆ blur_enabled() [1/2]

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

◆ blur_enabled() [2/2]

bool nngn::GLPost::blur_enabled ( ) const
private

◆ calc_avg_luminance() [1/2]

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

◆ calc_avg_luminance() [2/2]

bool nngn::GLPost::calc_avg_luminance ( )
private

◆ destroy() [1/2]

bool nngn::GLPost::destroy ( )

Releases all resources.

Here is the call graph for this function:

◆ destroy() [2/2]

bool nngn::GLPost::destroy ( )

Releases all resources.

◆ enabled() [1/2]

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

◆ enabled() [2/2]

bool nngn::GLPost::enabled ( ) const
private

◆ HDR() [1/2]

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

◆ HDR() [2/2]

bool nngn::GLPost::HDR ( ) const
private

◆ HDR_enabled() [1/2]

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

◆ HDR_enabled() [2/2]

bool nngn::GLPost::HDR_enabled ( ) const
private

◆ init() [1/2]

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:

◆ init() [2/2]

bool nngn::GLPost::init ( )

Single-step, swap-chain-independent initialization.

◆ render() [1/2]

bool nngn::GLPost::render ( )

Renders all enabled steps.

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

◆ render() [2/2]

bool nngn::GLPost::render ( )

Renders all enabled steps.

◆ resize() [1/2]

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() [2/2]

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

Signals that the frame buffer has been resized.

◆ resize_frame_buffers() [1/2]

bool nngn::GLPost::resize_frame_buffers ( )
private

◆ resize_frame_buffers() [2/2]

bool nngn::GLPost::resize_frame_buffers ( )
private

◆ set_automatic_exposure() [1/2]

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_automatic_exposure() [2/2]

bool nngn::GLPost::set_automatic_exposure ( bool  b)

◆ set_bloom_amount() [1/2]

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

◆ set_bloom_amount() [2/2]

void nngn::GLPost::set_bloom_amount ( float  a)
inline

◆ set_bloom_blur_passes() [1/2]

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

◆ set_bloom_blur_passes() [2/2]

void nngn::GLPost::set_bloom_blur_passes ( std::size_t  n)
inline

◆ set_bloom_blur_size() [1/2]

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

◆ set_bloom_blur_size() [2/2]

void nngn::GLPost::set_bloom_blur_size ( float  n)
inline

◆ set_bloom_downscale() [1/2]

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_downscale() [2/2]

void nngn::GLPost::set_bloom_downscale ( std::size_t  d)

◆ set_bloom_threshold() [1/2]

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

◆ set_bloom_threshold() [2/2]

void nngn::GLPost::set_bloom_threshold ( float  t)
inline

◆ set_blur_downscale() [1/2]

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_downscale() [2/2]

void nngn::GLPost::set_blur_downscale ( std::size_t  d)

◆ set_blur_passes() [1/2]

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

◆ set_blur_passes() [2/2]

void nngn::GLPost::set_blur_passes ( std::size_t  n)
inline

◆ set_blur_size() [1/2]

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

◆ set_blur_size() [2/2]

void nngn::GLPost::set_blur_size ( float  n)
inline

◆ set_exposure() [1/2]

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

◆ set_exposure() [2/2]

void nngn::GLPost::set_exposure ( float  e)
inline

◆ set_HDR_mix() [1/2]

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

◆ set_HDR_mix() [2/2]

void nngn::GLPost::set_HDR_mix ( float  m)
inline

◆ update() [1/2]

bool nngn::GLPost::update ( )

Updates resources as necessary.

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

◆ update() [2/2]

bool nngn::GLPost::update ( )

Updates resources as necessary.

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: