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 (C) 2016 Kicad Developers, see change_log.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, you may find one here:
18* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19* or you may search the http://www.gnu.org website for the version 2 license,
20* or you may write to the Free Software Foundation, Inc.,
21* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22*/
23
24#ifndef OPENGL_ANTIALIASING_H__
25#define OPENGL_ANTIALIASING_H__
26
27#include <memory>
28#include <gal/opengl/shader.h>
29#include <math/vector2d.h>
30
31namespace KIGFX {
32
33 class OPENGL_COMPOSITOR;
34
36 {
37 public:
39 {
40 }
41
42 virtual bool Init() = 0;
43 virtual unsigned int CreateBuffer() = 0;
44
46 virtual void OnLostBuffers() = 0;
47
48 virtual void Begin() = 0;
49 virtual void DrawBuffer( GLuint aBuffer ) = 0;
50 virtual void Present() = 0;
51 };
52
53
55 {
56 public:
58
59 bool Init() override;
60 unsigned int CreateBuffer() override;
61
63 void OnLostBuffers() override;
64
65 void Begin() override;
66 void DrawBuffer( GLuint aBuffer ) override;
67 void Present() override;
68
69 private:
71 };
72
73
75 {
76 public:
78
79 bool Init() override;
80 unsigned int CreateBuffer() override;
81
83 void OnLostBuffers() override;
84
85 void Begin() override;
86 void DrawBuffer( GLuint ) override;
87 void Present() override;
88
89 private:
91
92 unsigned int ssaaMainBuffer;
94
96 };
97
99 {
100 public:
101 ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor );
102
103 bool Init() override;
104 unsigned int CreateBuffer () override;
105
107 void OnLostBuffers() override;
108
109 void Begin() override;
110 void DrawBuffer( GLuint buffer ) override;
111 void Present() override;
112
113 private:
114 void loadShaders();
115 void updateUniforms();
116
118
119 unsigned int smaaBaseBuffer; // base + overlay temporary
120 unsigned int smaaEdgesBuffer;
121 unsigned int smaaBlendBuffer;
122
123 // smaa shader lookup textures
124 unsigned int smaaAreaTex;
125 unsigned int smaaSearchTex;
126
128
129 std::unique_ptr<SHADER> pass_1_shader;
131
132 std::unique_ptr<SHADER> pass_2_shader;
134
135 std::unique_ptr<SHADER> pass_3_shader;
137
139 };
140
141}
142
143#endif
void DrawBuffer(GLuint aBuffer) override
unsigned int CreateBuffer() override
VECTOR2I GetInternalBufferSize() override
void Present() override
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:70
void OnLostBuffers() override
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:138
unsigned int smaaEdgesBuffer
Definition: antialiasing.h:120
unsigned int smaaBaseBuffer
Definition: antialiasing.h:119
unsigned int smaaBlendBuffer
Definition: antialiasing.h:121
unsigned int smaaSearchTex
Definition: antialiasing.h:125
void DrawBuffer(GLuint buffer) override
VECTOR2I GetInternalBufferSize() override
std::unique_ptr< SHADER > pass_1_shader
Definition: antialiasing.h:129
void OnLostBuffers() override
std::unique_ptr< SHADER > pass_3_shader
Definition: antialiasing.h:135
std::unique_ptr< SHADER > pass_2_shader
Definition: antialiasing.h:132
unsigned int CreateBuffer() override
VECTOR2I GetInternalBufferSize() override
unsigned int CreateBuffer() override
void DrawBuffer(GLuint) override
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90
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: color4d.cpp:247