KiCad PCB EDA Suite
Loading...
Searching...
No Matches
antialiasing.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 The KiCad Developers, see AUTHORS.txt for contributors.
5*
6* This program is free software; you can redistribute it and/or
7* modify it under the terms of the GNU General Public License
8* as published by the Free Software Foundation; either version 2
9* of the License, or (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program. If not, see <https://www.gnu.org/licenses/>.
18*/
19
20#ifndef OPENGL_ANTIALIASING_H__
21#define OPENGL_ANTIALIASING_H__
22
23#include <memory>
24#include <gal/opengl/shader.h>
25#include <math/vector2d.h>
26
27namespace KIGFX {
28
30
32{
33public:
35 {
36 }
37
38 virtual bool Init() = 0;
39 virtual unsigned int CreateBuffer() = 0;
40
42 virtual void OnLostBuffers() = 0;
43
44 virtual void Begin() = 0;
45 virtual void DrawBuffer( GLuint aBuffer ) = 0;
46 virtual void Present() = 0;
47};
48
49
51{
52public:
54
55 bool Init() override;
56 unsigned int CreateBuffer() override;
57
59 void OnLostBuffers() override;
60
61 void Begin() override;
62 void DrawBuffer( GLuint aBuffer ) override;
63 void Present() override;
64
65private:
67};
68
69
71{
72public:
74
75 bool Init() override;
76 unsigned int CreateBuffer() override;
77
79 void OnLostBuffers() override;
80
81 void Begin() override;
82 void DrawBuffer( GLuint ) override;
83 void Present() override;
84
85private:
87
88 unsigned int ssaaMainBuffer;
90
92};
93
95{
96public:
98
99 bool Init() override;
100 unsigned int CreateBuffer () override;
101
103 void OnLostBuffers() override;
104
105 void Begin() override;
106 void DrawBuffer( GLuint buffer ) override;
107 void Present() override;
108
109private:
110 void loadShaders();
111 void updateUniforms();
112
114
115 unsigned int smaaBaseBuffer; // base + overlay temporary
116 unsigned int smaaEdgesBuffer;
117 unsigned int smaaBlendBuffer;
118
119 // smaa shader lookup textures
120 unsigned int smaaAreaTex;
121 unsigned int smaaSearchTex;
122
124
125 std::unique_ptr<SHADER> pass_1_shader;
127
128 std::unique_ptr<SHADER> pass_2_shader;
130
131 std::unique_ptr<SHADER> pass_3_shader;
133
135};
136
137}
138
139#endif
void DrawBuffer(GLuint aBuffer) override
unsigned int CreateBuffer() override
VECTOR2I GetInternalBufferSize() override
ANTIALIASING_NONE(OPENGL_COMPOSITOR *aCompositor)
OPENGL_COMPOSITOR * compositor
void OnLostBuffers() override
ANTIALIASING_SMAA(OPENGL_COMPOSITOR *aCompositor)
OPENGL_COMPOSITOR * compositor
void DrawBuffer(GLuint buffer) override
VECTOR2I GetInternalBufferSize() override
std::unique_ptr< SHADER > pass_1_shader
void OnLostBuffers() override
std::unique_ptr< SHADER > pass_3_shader
std::unique_ptr< SHADER > pass_2_shader
unsigned int CreateBuffer() override
VECTOR2I GetInternalBufferSize() override
unsigned int CreateBuffer() override
ANTIALIASING_SUPERSAMPLING(OPENGL_COMPOSITOR *aCompositor)
virtual unsigned int CreateBuffer()=0
virtual void OnLostBuffers()=0
virtual VECTOR2I GetInternalBufferSize()=0
virtual bool Init()=0
virtual void Begin()=0
virtual void DrawBuffer(GLuint aBuffer)=0
virtual void Present()=0
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:683