KiCad PCB EDA Suite
Loading...
Searching...
No Matches
POST_SHADER_SSAO Class Reference

#include <post_shader_ssao.h>

Inheritance diagram for POST_SHADER_SSAO:
POST_SHADER

Public Member Functions

 POST_SHADER_SSAO (const CAMERA &aCamera)
 
SFVEC3F Shade (const SFVEC2I &aShaderPos) const override
 
SFVEC4F ApplyShadeColor (const SFVEC2I &aShaderPos, const SFVEC4F &aInputColor, const SFVEC3F &aShadeColor) const override
 Apply the final color process using a previous stage color.
 
SFVEC3F Blur (const SFVEC2I &aShaderPos) const
 
void SetShadedBuffer (SFVEC3F *aShadedBuffer)
 
void SetShadowsEnabled (bool aIsShadowsEnabled)
 
void UpdateSize (const SFVEC2UI &aSize)
 
void UpdateSize (unsigned int xSize, unsigned int ySize)
 
void InitFrame ()
 
void SetPixelData (unsigned int x, unsigned int y, const SFVEC3F &aNormal, const SFVEC4F &aColor, const SFVEC3F &aHitPosition, float aDepth, float aShadowAttFactor)
 
const SFVEC4FGetColorAtNotProtected (const SFVEC2I &aPos) const
 
void DebugBuffersOutputAsImages () const
 
unsigned int GetIndex (const SFVEC2F &aPos) const
 
unsigned int GetIndex (const SFVEC2I &aPos) const
 

Protected Member Functions

const SFVEC3FGetNormalAt (const SFVEC2F &aPos) const
 
const SFVEC3FGetNormalAt (const SFVEC2I &aPos) const
 
const SFVEC4FGetColorAt (const SFVEC2F &aPos) const
 
const SFVEC4FGetColorAt (const SFVEC2I &aPos) const
 
const SFVEC3FGetPositionAt (const SFVEC2F &aPos) const
 
const SFVEC3FGetPositionAt (const SFVEC2I &aPos) const
 
float GetDepthAt (const SFVEC2F &aPos) const
 
float GetDepthAt (const SFVEC2I &aPos) const
 
const float & GetShadowFactorAt (const SFVEC2I &aPos) const
 
float GetDepthNormalizedAt (const SFVEC2I &aPos) const
 
float GetMaxDepth () const
 

Protected Attributes

const CAMERAm_camera
 
SFVEC2UI m_size
 
SFVEC3Fm_normals
 
SFVEC4Fm_color
 
SFVEC3Fm_wc_hitposition
 
float * m_depth
 
float * m_shadow_att_factor
 
float m_tmin
 
float m_tmax
 

Private Member Functions

SFVEC3F posFromDepth (const SFVEC2F &coord) const
 
float ec_depth (const SFVEC2F &tc) const
 
float aoFF (const SFVEC2I &aShaderPos, const SFVEC3F &ddiff, const SFVEC3F &cnorm, const float aShadowAtSamplePos, const float aShadowAtCenterPos, int c1, int c2) const
 
float giFF (const SFVEC2I &aShaderPos, const SFVEC3F &ddiff, const SFVEC3F &cnorm, const float aShadow, int c1, int c2) const
 
SFVEC3F giColorCurve (const SFVEC3F &aColor) const
 Apply a curve transformation to the original color.
 
SFVEC4F giColorCurve (const SFVEC4F &aColor) const
 
SFVEC3F giColorCurveShade (const SFVEC4F &aColor) const
 
void destroy_buffers ()
 

Private Attributes

SFVEC3Fm_shadedBuffer
 
bool m_isUsingShadows
 

Detailed Description

Definition at line 37 of file post_shader_ssao.h.

Constructor & Destructor Documentation

◆ POST_SHADER_SSAO()

POST_SHADER_SSAO::POST_SHADER_SSAO ( const CAMERA & aCamera)
explicit

Definition at line 34 of file post_shader_ssao.cpp.

References m_isUsingShadows, m_shadedBuffer, and POST_SHADER::POST_SHADER().

Member Function Documentation

◆ aoFF()

float POST_SHADER_SSAO::aoFF ( const SFVEC2I & aShaderPos,
const SFVEC3F & ddiff,
const SFVEC3F & cnorm,
const float aShadowAtSamplePos,
const float aShadowAtCenterPos,
int c1,
int c2 ) const
private

Definition at line 47 of file post_shader_ssao.cpp.

References POST_SHADER::GetNormalAt().

Referenced by Shade().

◆ ApplyShadeColor()

SFVEC4F POST_SHADER_SSAO::ApplyShadeColor ( const SFVEC2I & aShaderPos,
const SFVEC4F & aInputColor,
const SFVEC3F & aShadeColor ) const
overridevirtual

Apply the final color process using a previous stage color.

Parameters
aShadeColorThe result of the shader.
Returns
the result of the shade process

Implements POST_SHADER.

Definition at line 230 of file post_shader_ssao.cpp.

◆ Blur()

SFVEC3F POST_SHADER_SSAO::Blur ( const SFVEC2I & aShaderPos) const

◆ DebugBuffersOutputAsImages()

void POST_SHADER::DebugBuffersOutputAsImages ( ) const
inherited

◆ destroy_buffers()

void POST_SHADER::destroy_buffers ( )
privateinherited

Definition at line 107 of file post_shader.cpp.

References m_color, m_depth, m_normals, m_shadow_att_factor, and m_wc_hitposition.

Referenced by UpdateSize(), and ~POST_SHADER().

◆ ec_depth()

float POST_SHADER_SSAO::ec_depth ( const SFVEC2F & tc) const
private

◆ GetColorAt() [1/2]

const SFVEC4F & POST_SHADER::GetColorAt ( const SFVEC2F & aPos) const
protectedinherited

Definition at line 128 of file post_shader.cpp.

References GetIndex(), and m_color.

Referenced by POST_SHADER_SSAO::Shade().

◆ GetColorAt() [2/2]

const SFVEC4F & POST_SHADER::GetColorAt ( const SFVEC2I & aPos) const
protectedinherited

Definition at line 152 of file post_shader.cpp.

References GetIndex(), and m_color.

◆ GetColorAtNotProtected()

const SFVEC4F & POST_SHADER::GetColorAtNotProtected ( const SFVEC2I & aPos) const
inherited

Definition at line 158 of file post_shader.cpp.

References m_color, and m_size.

◆ GetDepthAt() [1/2]

float POST_SHADER::GetDepthAt ( const SFVEC2F & aPos) const
protectedinherited

Definition at line 134 of file post_shader.cpp.

References GetIndex(), and m_depth.

Referenced by POST_SHADER_SSAO::Blur(), and POST_SHADER_SSAO::Shade().

◆ GetDepthAt() [2/2]

float POST_SHADER::GetDepthAt ( const SFVEC2I & aPos) const
protectedinherited

Definition at line 164 of file post_shader.cpp.

References GetIndex(), and m_depth.

◆ GetDepthNormalizedAt()

float POST_SHADER::GetDepthNormalizedAt ( const SFVEC2I & aPos) const
protectedinherited

Definition at line 170 of file post_shader.cpp.

References GetIndex(), m_depth, m_tmax, and m_tmin.

Referenced by DebugBuffersOutputAsImages().

◆ GetIndex() [1/2]

unsigned int POST_SHADER::GetIndex ( const SFVEC2F & aPos) const
inlineinherited

◆ GetIndex() [2/2]

unsigned int POST_SHADER::GetIndex ( const SFVEC2I & aPos) const
inlineinherited

Definition at line 80 of file post_shader.h.

References m_size.

◆ GetMaxDepth()

float POST_SHADER::GetMaxDepth ( ) const
inlineprotectedinherited

Definition at line 102 of file post_shader.h.

References m_tmax.

◆ GetNormalAt() [1/2]

const SFVEC3F & POST_SHADER::GetNormalAt ( const SFVEC2F & aPos) const
protectedinherited

Definition at line 122 of file post_shader.cpp.

References GetIndex(), and m_normals.

Referenced by POST_SHADER_SSAO::aoFF(), POST_SHADER_SSAO::giFF(), and POST_SHADER_SSAO::Shade().

◆ GetNormalAt() [2/2]

const SFVEC3F & POST_SHADER::GetNormalAt ( const SFVEC2I & aPos) const
protectedinherited

Definition at line 146 of file post_shader.cpp.

References GetIndex(), and m_normals.

◆ GetPositionAt() [1/2]

const SFVEC3F & POST_SHADER::GetPositionAt ( const SFVEC2F & aPos) const
protectedinherited

Definition at line 140 of file post_shader.cpp.

References GetIndex(), and m_wc_hitposition.

Referenced by POST_SHADER_SSAO::Shade().

◆ GetPositionAt() [2/2]

const SFVEC3F & POST_SHADER::GetPositionAt ( const SFVEC2I & aPos) const
protectedinherited

Definition at line 181 of file post_shader.cpp.

References GetIndex(), and m_wc_hitposition.

◆ GetShadowFactorAt()

const float & POST_SHADER::GetShadowFactorAt ( const SFVEC2I & aPos) const
protectedinherited

Definition at line 187 of file post_shader.cpp.

References GetIndex(), and m_shadow_att_factor.

Referenced by POST_SHADER_SSAO::Shade().

◆ giColorCurve() [1/2]

SFVEC3F POST_SHADER_SSAO::giColorCurve ( const SFVEC3F & aColor) const
private

Apply a curve transformation to the original color.

It will attenuate the bright colors (works as a gamma function): http://fooplot.com/#W3sidHlwZSI6MCwiZXEiOiIxLjAtKDEvKHgqMS4wKzEuMCkpK3gqMC4zMCIsImNvbG9yIjoiIzAwMDAwMCJ9LHsidHlwZSI6MTAwMCwid2luZG93IjpbIi0wLjA2MjE4NDYxNTM4NDYxNTUwNSIsIjEuMTQyOTg0NjE1Mzg0NjE0NiIsIi0wLjEyNzA5OTk5OTk5OTk5OTc3IiwiMS4xMzI2Il19XQ&ndash;

Parameters
aColorinput color.
Returns
transformed color.

Definition at line 249 of file post_shader_ssao.cpp.

Referenced by giColorCurve(), and giColorCurveShade().

◆ giColorCurve() [2/2]

SFVEC4F POST_SHADER_SSAO::giColorCurve ( const SFVEC4F & aColor) const
private

Definition at line 261 of file post_shader_ssao.cpp.

References giColorCurve().

◆ giColorCurveShade()

SFVEC3F POST_SHADER_SSAO::giColorCurveShade ( const SFVEC4F & aColor) const
private

Definition at line 267 of file post_shader_ssao.cpp.

References giColorCurve().

Referenced by Shade().

◆ giFF()

float POST_SHADER_SSAO::giFF ( const SFVEC2I & aShaderPos,
const SFVEC3F & ddiff,
const SFVEC3F & cnorm,
const float aShadow,
int c1,
int c2 ) const
private

Definition at line 113 of file post_shader_ssao.cpp.

References POST_SHADER::GetNormalAt().

Referenced by Shade().

◆ InitFrame()

void POST_SHADER::InitFrame ( )
inlineinherited

Definition at line 56 of file post_shader.h.

References m_tmax, and m_tmin.

◆ posFromDepth()

SFVEC3F POST_SHADER_SSAO::posFromDepth ( const SFVEC2F & coord) const
private

◆ SetPixelData()

void POST_SHADER::SetPixelData ( unsigned int x,
unsigned int y,
const SFVEC3F & aNormal,
const SFVEC4F & aColor,
const SFVEC3F & aHitPosition,
float aDepth,
float aShadowAttFactor )
inherited

Definition at line 79 of file post_shader.cpp.

References m_color, m_depth, m_normals, m_shadow_att_factor, m_size, m_tmax, m_tmin, and m_wc_hitposition.

◆ SetShadedBuffer()

void POST_SHADER_SSAO::SetShadedBuffer ( SFVEC3F * aShadedBuffer)
inline

Definition at line 48 of file post_shader_ssao.h.

References m_shadedBuffer.

◆ SetShadowsEnabled()

void POST_SHADER_SSAO::SetShadowsEnabled ( bool aIsShadowsEnabled)
inline

Definition at line 53 of file post_shader_ssao.h.

References m_isUsingShadows.

◆ Shade()

◆ UpdateSize() [1/2]

void POST_SHADER::UpdateSize ( const SFVEC2UI & aSize)
inherited

Definition at line 73 of file post_shader.cpp.

References UpdateSize().

Referenced by UpdateSize().

◆ UpdateSize() [2/2]

void POST_SHADER::UpdateSize ( unsigned int xSize,
unsigned int ySize )
inherited

Member Data Documentation

◆ m_camera

const CAMERA& POST_SHADER::m_camera
protectedinherited

Definition at line 108 of file post_shader.h.

Referenced by POST_SHADER().

◆ m_color

SFVEC4F* POST_SHADER::m_color
protectedinherited

◆ m_depth

float* POST_SHADER::m_depth
protectedinherited

◆ m_isUsingShadows

bool POST_SHADER_SSAO::m_isUsingShadows
private

Definition at line 85 of file post_shader_ssao.h.

Referenced by POST_SHADER_SSAO(), SetShadowsEnabled(), and Shade().

◆ m_normals

SFVEC3F* POST_SHADER::m_normals
protectedinherited

◆ m_shadedBuffer

SFVEC3F* POST_SHADER_SSAO::m_shadedBuffer
private

Definition at line 83 of file post_shader_ssao.h.

Referenced by Blur(), POST_SHADER_SSAO(), and SetShadedBuffer().

◆ m_shadow_att_factor

float* POST_SHADER::m_shadow_att_factor
protectedinherited

◆ m_size

SFVEC2UI POST_SHADER::m_size
protectedinherited

◆ m_tmax

float POST_SHADER::m_tmax
protectedinherited

◆ m_tmin

float POST_SHADER::m_tmin
protectedinherited

Definition at line 116 of file post_shader.h.

Referenced by GetDepthNormalizedAt(), InitFrame(), POST_SHADER(), and SetPixelData().

◆ m_wc_hitposition

SFVEC3F* POST_SHADER::m_wc_hitposition
protectedinherited

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