KiCad PCB EDA Suite
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 (C) 2015-2020 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, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
30#ifndef POST_SHADER_SSAO_H
31#define POST_SHADER_SSAO_H
32
33
34#include "post_shader.h"
35
36
38{
39public:
40 explicit POST_SHADER_SSAO( const CAMERA& aCamera );
41
42 SFVEC3F Shade(const SFVEC2I& aShaderPos ) const override;
43 SFVEC3F ApplyShadeColor( const SFVEC2I& aShaderPos, const SFVEC3F& aInputColor,
44 const SFVEC3F& aShadeColor ) const override;
45
46 SFVEC3F Blur( const SFVEC2I& aShaderPos ) const;
47
48 void SetShadedBuffer( SFVEC3F* aShadedBuffer )
49 {
50 m_shadedBuffer = aShadedBuffer;
51 }
52
53 void SetShadowsEnabled( bool aIsShadowsEnabled )
54 {
55 m_isUsingShadows = aIsShadowsEnabled;
56 }
57
58private:
59 SFVEC3F posFromDepth( const SFVEC2F& coord ) const;
60
61 float ec_depth( const SFVEC2F& tc ) const;
62
63 float aoFF( const SFVEC2I& aShaderPos, const SFVEC3F& ddiff, const SFVEC3F& cnorm,
64 const float aShadowAtSamplePos, const float aShadowAtCenterPos,
65 int c1, int c2 ) const;
66
67 float giFF( const SFVEC2I& aShaderPos, const SFVEC3F& ddiff, const SFVEC3F& cnorm,
68 const float aShadow, int c1, int c2 ) const;
69
79 SFVEC3F giColorCurve( const SFVEC3F& aColor ) const;
80
82
84};
85
86
87#endif // POST_SHADER_SSAO_H
A class used to derive camera objects from.
Definition: camera.h:78
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 * m_shadedBuffer
float ec_depth(const SFVEC2F &tc) const
SFVEC3F posFromDepth(const SFVEC2F &coord) const
void SetShadedBuffer(SFVEC3F *aShadedBuffer)
SFVEC3F ApplyShadeColor(const SFVEC2I &aShaderPos, const SFVEC3F &aInputColor, const SFVEC3F &aShadeColor) const override
Apply the final color process using a previous stage color.
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
A base class to create post shaders.
glm::ivec2 SFVEC2I
Definition: xv3d_types.h:39
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44