KiCad PCB EDA Suite
KIGFX::ANTIALIASING_SUPERSAMPLING Class Reference

#include <antialiasing.h>

Inheritance diagram for KIGFX::ANTIALIASING_SUPERSAMPLING:
KIGFX::OPENGL_PRESENTOR

Public Member Functions

 ANTIALIASING_SUPERSAMPLING (OPENGL_COMPOSITOR *aCompositor)
 
bool Init () override
 
unsigned int CreateBuffer () override
 
VECTOR2U GetInternalBufferSize () override
 
void OnLostBuffers () override
 
void Begin () override
 
void DrawBuffer (GLuint) override
 
void Present () override
 

Private Attributes

OPENGL_COMPOSITORcompositor
 
unsigned int ssaaMainBuffer
 
bool areBuffersCreated
 
bool areShadersCreated
 

Detailed Description

Definition at line 74 of file antialiasing.h.

Constructor & Destructor Documentation

◆ ANTIALIASING_SUPERSAMPLING()

ANTIALIASING_SUPERSAMPLING::ANTIALIASING_SUPERSAMPLING ( OPENGL_COMPOSITOR aCompositor)

Definition at line 130 of file antialiasing.cpp.

130  :
131  compositor( aCompositor ),
132  ssaaMainBuffer( 0 ), areBuffersCreated( false ), areShadersCreated( false )
133 {
134 }
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90

Member Function Documentation

◆ Begin()

void ANTIALIASING_SUPERSAMPLING::Begin ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 160 of file antialiasing.cpp.

161 {
164 }
static const COLOR4D BLACK
Definition: color4d.h:381
virtual void ClearBuffer(const COLOR4D &aColor) override
Clear the selected buffer (set by the SetBuffer() function).
virtual void SetBuffer(unsigned int aBufferHandle) override
Set the selected buffer as the rendering target.
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90

References KIGFX::COLOR4D::BLACK, KIGFX::OPENGL_COMPOSITOR::ClearBuffer(), compositor, KIGFX::OPENGL_COMPOSITOR::SetBuffer(), and ssaaMainBuffer.

◆ CreateBuffer()

unsigned int ANTIALIASING_SUPERSAMPLING::CreateBuffer ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 191 of file antialiasing.cpp.

192 {
194 }
VECTOR2U GetInternalBufferSize() override
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90
virtual unsigned int CreateBuffer() override
Prepare a new buffer that may be used as a rendering target.

References compositor, KIGFX::OPENGL_COMPOSITOR::CreateBuffer(), and GetInternalBufferSize().

◆ DrawBuffer()

void ANTIALIASING_SUPERSAMPLING::DrawBuffer ( GLuint  aBuffer)
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 167 of file antialiasing.cpp.

168 {
169  compositor->DrawBuffer( aBuffer, ssaaMainBuffer );
170 }
virtual void DrawBuffer(unsigned int aBufferHandle) override
Draw the selected buffer to the output buffer.
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90

References compositor, KIGFX::OPENGL_COMPOSITOR::DrawBuffer(), and ssaaMainBuffer.

◆ GetInternalBufferSize()

VECTOR2U ANTIALIASING_SUPERSAMPLING::GetInternalBufferSize ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 154 of file antialiasing.cpp.

155 {
156  return compositor->GetScreenSize() * 2;
157 }
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90

References compositor, and KIGFX::OPENGL_COMPOSITOR::GetScreenSize().

Referenced by CreateBuffer().

◆ Init()

bool ANTIALIASING_SUPERSAMPLING::Init ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 137 of file antialiasing.cpp.

138 {
139  areShadersCreated = false;
140 
141  if( !areBuffersCreated )
142  {
144  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
145  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
146 
147  areBuffersCreated = true;
148  }
149 
150  return true;
151 }
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90
virtual unsigned int CreateBuffer() override
Prepare a new buffer that may be used as a rendering target.

References areBuffersCreated, areShadersCreated, compositor, KIGFX::OPENGL_COMPOSITOR::CreateBuffer(), and ssaaMainBuffer.

◆ OnLostBuffers()

void ANTIALIASING_SUPERSAMPLING::OnLostBuffers ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 185 of file antialiasing.cpp.

186 {
187  areBuffersCreated = false;
188 }

References areBuffersCreated.

◆ Present()

void ANTIALIASING_SUPERSAMPLING::Present ( )
overridevirtual

Implements KIGFX::OPENGL_PRESENTOR.

Definition at line 173 of file antialiasing.cpp.

174 {
175  glDisable( GL_BLEND );
176  glDisable( GL_DEPTH_TEST );
177  glActiveTexture( GL_TEXTURE0 );
178  glBindTexture( GL_TEXTURE_2D, compositor->GetBufferTexture( ssaaMainBuffer ) );
180 
181  draw_fullscreen_primitive();
182 }
static const unsigned int DIRECT_RENDERING
virtual void SetBuffer(unsigned int aBufferHandle) override
Set the selected buffer as the rendering target.
OPENGL_COMPOSITOR * compositor
Definition: antialiasing.h:90
GLenum GetBufferTexture(unsigned int aBufferHandle)

References compositor, KIGFX::OPENGL_COMPOSITOR::DIRECT_RENDERING, KIGFX::OPENGL_COMPOSITOR::GetBufferTexture(), KIGFX::OPENGL_COMPOSITOR::SetBuffer(), and ssaaMainBuffer.

Member Data Documentation

◆ areBuffersCreated

bool KIGFX::ANTIALIASING_SUPERSAMPLING::areBuffersCreated
private

Definition at line 93 of file antialiasing.h.

Referenced by Init(), and OnLostBuffers().

◆ areShadersCreated

bool KIGFX::ANTIALIASING_SUPERSAMPLING::areShadersCreated
private

Definition at line 95 of file antialiasing.h.

Referenced by Init().

◆ compositor

OPENGL_COMPOSITOR* KIGFX::ANTIALIASING_SUPERSAMPLING::compositor
private

Definition at line 90 of file antialiasing.h.

Referenced by Begin(), CreateBuffer(), DrawBuffer(), GetInternalBufferSize(), Init(), and Present().

◆ ssaaMainBuffer

unsigned int KIGFX::ANTIALIASING_SUPERSAMPLING::ssaaMainBuffer
private

Definition at line 92 of file antialiasing.h.

Referenced by Begin(), DrawBuffer(), Init(), and Present().


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