KiCad PCB EDA Suite
Loading...
Searching...
No Matches
post_shader_ssao.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2015-2016 Mario Luzeiro <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
25
26#ifndef POST_SHADER_SSAO_H
27#define POST_SHADER_SSAO_H
28
29
30#include "post_shader.h"
31
32
34{
35public:
36 explicit POST_SHADER_SSAO( const CAMERA& aCamera );
37
38 SFVEC3F Shade(const SFVEC2I& aShaderPos ) const override;
39 SFVEC4F ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC4F& aInputColor,
40 const SFVEC3F& aShadeColor ) const override;
41
42 SFVEC3F Blur( const SFVEC2I& aShaderPos ) const;
43
44 void SetShadedBuffer( SFVEC3F* aShadedBuffer )
45 {
46 m_shadedBuffer = aShadedBuffer;
47 }
48
49 void SetShadowsEnabled( bool aIsShadowsEnabled )
50 {
51 m_isUsingShadows = aIsShadowsEnabled;
52 }
53
54private:
55 SFVEC3F posFromDepth( const SFVEC2F& coord ) const;
56
57 float ec_depth( const SFVEC2F& tc ) const;
58
59 float aoFF( const SFVEC2I& aShaderPos, const SFVEC3F& ddiff, const SFVEC3F& cnorm,
60 const float aShadowAtSamplePos, const float aShadowAtCenterPos,
61 int c1, int c2 ) const;
62
63 float giFF( const SFVEC2I& aShaderPos, const SFVEC3F& ddiff, const SFVEC3F& cnorm,
64 const float aShadow, int c1, int c2 ) const;
65
75 SFVEC3F giColorCurve( const SFVEC3F& aColor ) const;
76 SFVEC4F giColorCurve( const SFVEC4F& aColor ) const;
77 SFVEC3F giColorCurveShade( const SFVEC4F& aColor ) const;
78
80
82};
83
84
85#endif // POST_SHADER_SSAO_H
A class used to derive camera objects from.
Definition camera.h:99
float aoFF(const SFVEC2I &aShaderPos, const SFVEC3F &ddiff, const SFVEC3F &cnorm, const float aShadowAtSamplePos, const float aShadowAtCenterPos, int c1, int c2) const
SFVEC3F giColorCurveShade(const SFVEC4F &aColor) const
float giFF(const SFVEC2I &aShaderPos, const SFVEC3F &ddiff, const SFVEC3F &cnorm, const float aShadow, int c1, int c2) const
SFVEC4F ApplyShadeColor(const SFVEC2I &aShaderPos, const SFVEC4F &aInputColor, const SFVEC3F &aShadeColor) const override
Apply the final color process using a previous stage color.
float ec_depth(const SFVEC2F &tc) const
SFVEC3F posFromDepth(const SFVEC2F &coord) const
void SetShadedBuffer(SFVEC3F *aShadedBuffer)
SFVEC3F Shade(const SFVEC2I &aShaderPos) const override
POST_SHADER_SSAO(const CAMERA &aCamera)
void SetShadowsEnabled(bool aIsShadowsEnabled)
SFVEC3F giColorCurve(const SFVEC3F &aColor) const
Apply a curve transformation to the original color.
SFVEC3F Blur(const SFVEC2I &aShaderPos) const
POST_SHADER(const CAMERA &aCamera)
A base class to create post shaders.
glm::ivec2 SFVEC2I
Definition xv3d_types.h:35
glm::vec2 SFVEC2F
Definition xv3d_types.h:38
glm::vec3 SFVEC3F
Definition xv3d_types.h:40
glm::vec4 SFVEC4F
Definition xv3d_types.h:42