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.

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

◆ 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 POST_SHADER::GetIndex(), and POST_SHADER::m_color.

Referenced by Shade().

◆ GetColorAt() [2/2]

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

Definition at line 152 of file post_shader.cpp.

References POST_SHADER::GetIndex(), and POST_SHADER::m_color.

◆ GetColorAtNotProtected()

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

Definition at line 158 of file post_shader.cpp.

References POST_SHADER::m_color, and POST_SHADER::m_size.

◆ GetDepthAt() [1/2]

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

Definition at line 134 of file post_shader.cpp.

References POST_SHADER::GetIndex(), and POST_SHADER::m_depth.

Referenced by Blur(), and Shade().

◆ GetDepthAt() [2/2]

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

Definition at line 164 of file post_shader.cpp.

References POST_SHADER::GetIndex(), and POST_SHADER::m_depth.

◆ GetDepthNormalizedAt()

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

◆ 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 POST_SHADER::m_size.

◆ GetMaxDepth()

float POST_SHADER::GetMaxDepth ( ) const
inlineprotectedinherited

Definition at line 102 of file post_shader.h.

References POST_SHADER::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 POST_SHADER::GetIndex(), and POST_SHADER::m_normals.

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

◆ GetNormalAt() [2/2]

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

Definition at line 146 of file post_shader.cpp.

References POST_SHADER::GetIndex(), and POST_SHADER::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 POST_SHADER::GetIndex(), and POST_SHADER::m_wc_hitposition.

Referenced by Shade().

◆ GetPositionAt() [2/2]

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

Definition at line 181 of file post_shader.cpp.

References POST_SHADER::GetIndex(), and POST_SHADER::m_wc_hitposition.

◆ GetShadowFactorAt()

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

Definition at line 187 of file post_shader.cpp.

References POST_SHADER::GetIndex(), and POST_SHADER::m_shadow_att_factor.

Referenced by 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 POST_SHADER::m_tmax, and POST_SHADER::m_tmin.

Referenced by RENDER_3D_RAYTRACE_BASE::restartRenderState().

◆ 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

◆ SetShadedBuffer()

void POST_SHADER_SSAO::SetShadedBuffer ( SFVEC3F aShadedBuffer)
inline

Definition at line 48 of file post_shader_ssao.h.

References m_shadedBuffer.

Referenced by RENDER_3D_RAYTRACE_BASE::postProcessShading().

◆ SetShadowsEnabled()

void POST_SHADER_SSAO::SetShadowsEnabled ( bool  aIsShadowsEnabled)
inline

Definition at line 53 of file post_shader_ssao.h.

References m_isUsingShadows.

Referenced by RENDER_3D_RAYTRACE_BASE::postProcessShading().

◆ Shade()

◆ UpdateSize() [1/2]

void POST_SHADER::UpdateSize ( const SFVEC2UI aSize)
inherited

◆ 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.

◆ m_color

◆ m_depth

◆ m_isUsingShadows

bool POST_SHADER_SSAO::m_isUsingShadows
private

Definition at line 85 of file post_shader_ssao.h.

Referenced by SetShadowsEnabled(), and Shade().

◆ m_normals

◆ m_shadedBuffer

SFVEC3F* POST_SHADER_SSAO::m_shadedBuffer
private

Definition at line 83 of file post_shader_ssao.h.

Referenced by Blur(), and SetShadedBuffer().

◆ m_shadow_att_factor

◆ m_size

◆ m_tmax

float POST_SHADER::m_tmax
protectedinherited

◆ m_tmin

float POST_SHADER::m_tmin
protectedinherited

◆ m_wc_hitposition

SFVEC3F* POST_SHADER::m_wc_hitposition
protectedinherited

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