Browse Source
Refactor COMPOSITOR/OPENGL_COMPOSITOR to enable customization of scene rendering and presentation
pull/3/merge
Refactor COMPOSITOR/OPENGL_COMPOSITOR to enable customization of scene rendering and presentation
pull/3/merge
committed by
Maciej Suminski
10 changed files with 216 additions and 34 deletions
-
1common/CMakeLists.txt
-
6common/gal/cairo/cairo_compositor.cpp
-
56common/gal/opengl/antialiasing.cpp
-
46common/gal/opengl/antialiasing.h
-
85common/gal/opengl/opengl_compositor.cpp
-
14common/gal/opengl/opengl_gal.cpp
-
6include/gal/cairo/cairo_compositor.h
-
14include/gal/compositor.h
-
17include/gal/opengl/opengl_compositor.h
-
5include/math/vector2d.h
@ -0,0 +1,56 @@ |
|||
#include <gal/opengl/antialiasing.h>
|
|||
#include <gal/opengl/opengl_compositor.h>
|
|||
#include <gal/opengl/utils.h>
|
|||
|
|||
#include <tuple>
|
|||
|
|||
#include "gl_builtin_shaders.h"
|
|||
|
|||
namespace KIGFX { |
|||
|
|||
// =========================
|
|||
// ANTIALIASING_NONE
|
|||
// =========================
|
|||
|
|||
ANTIALIASING_NONE::ANTIALIASING_NONE( OPENGL_COMPOSITOR* aCompositor ) |
|||
: compositor(aCompositor) |
|||
{ |
|||
} |
|||
|
|||
bool ANTIALIASING_NONE::Init() |
|||
{ |
|||
// Nothing to initialize
|
|||
return true; |
|||
} |
|||
|
|||
VECTOR2U ANTIALIASING_NONE::GetInternalBufferSize() |
|||
{ |
|||
return compositor->GetScreenSize(); |
|||
} |
|||
|
|||
void ANTIALIASING_NONE::DrawBuffer( GLuint buffer ) |
|||
{ |
|||
compositor->DrawBuffer( buffer, OPENGL_COMPOSITOR::DIRECT_RENDERING ); |
|||
} |
|||
|
|||
void ANTIALIASING_NONE::Present() |
|||
{ |
|||
// Nothing to present, draw_buffer already drew to the screen
|
|||
} |
|||
|
|||
void ANTIALIASING_NONE::OnLostBuffers() |
|||
{ |
|||
// Nothing to do
|
|||
} |
|||
|
|||
void ANTIALIASING_NONE::Begin() |
|||
{ |
|||
// Nothing to do
|
|||
} |
|||
|
|||
unsigned int ANTIALIASING_NONE::CreateBuffer() |
|||
{ |
|||
return compositor->CreateBuffer( compositor->GetScreenSize() ); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
#ifndef OPENGL_ANTIALIASING_H__ |
|||
#define OPENGL_ANTIALIASING_H__ |
|||
|
|||
#include <memory> |
|||
#include <gal/opengl/shader.h> |
|||
#include <math/vector2d.h> |
|||
|
|||
namespace KIGFX { |
|||
|
|||
class OPENGL_COMPOSITOR; |
|||
|
|||
class OPENGL_PRESENTOR |
|||
{ |
|||
public: |
|||
virtual bool Init() = 0; |
|||
virtual unsigned int CreateBuffer() = 0; |
|||
|
|||
virtual VECTOR2U GetInternalBufferSize() = 0; |
|||
virtual void OnLostBuffers() = 0; |
|||
|
|||
virtual void Begin() = 0; |
|||
virtual void DrawBuffer(GLuint buffer) = 0; |
|||
virtual void Present() = 0; |
|||
}; |
|||
|
|||
class ANTIALIASING_NONE : public OPENGL_PRESENTOR { |
|||
public: |
|||
ANTIALIASING_NONE( OPENGL_COMPOSITOR* aCompositor ); |
|||
|
|||
bool Init() override; |
|||
unsigned int CreateBuffer() override; |
|||
|
|||
VECTOR2U GetInternalBufferSize() override; |
|||
void OnLostBuffers() override; |
|||
|
|||
void Begin() override; |
|||
void DrawBuffer( GLuint buffer ) override; |
|||
void Present() override; |
|||
|
|||
private: |
|||
OPENGL_COMPOSITOR* compositor; |
|||
}; |
|||
|
|||
} |
|||
|
|||
#endif |
Write
Preview
Loading…
Cancel
Save
Reference in new issue