From 778cb9d024c997cd3e012882db76a6dea6925219 Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Wed, 25 Oct 2017 01:47:43 -0500 Subject: [PATCH] Rename CopyFramebufferShader to ApplyPaletteShader --- OpenRCT2.xcodeproj/project.pbxproj | 12 ++++++------ ...{copyframebuffer.frag => applypalette.frag} | 0 ...{copyframebuffer.vert => applypalette.vert} | 0 ...bufferShader.cpp => ApplyPaletteShader.cpp} | 14 +++++++------- ...ramebufferShader.h => ApplyPaletteShader.h} | 6 +++--- .../engines/opengl/OpenGLDrawingEngine.cpp | 18 +++++++++--------- .../drawing/engines/opengl/SwapFramebuffer.cpp | 1 - 7 files changed, 25 insertions(+), 26 deletions(-) rename data/shaders/{copyframebuffer.frag => applypalette.frag} (100%) rename data/shaders/{copyframebuffer.vert => applypalette.vert} (100%) rename src/openrct2-ui/drawing/engines/opengl/{CopyFramebufferShader.cpp => ApplyPaletteShader.cpp} (85%) rename src/openrct2-ui/drawing/engines/opengl/{CopyFramebufferShader.h => ApplyPaletteShader.h} (89%) diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index 97c67e30f1..4f0761e56b 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -471,7 +471,7 @@ F76C887C1EC5324E00FA49E2 /* MemoryAudioSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85881EC4E82600FA49E2 /* MemoryAudioSource.cpp */; }; F76C887D1EC5324E00FA49E2 /* CursorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C858A1EC4E82600FA49E2 /* CursorData.cpp */; }; F76C887E1EC5324E00FA49E2 /* CursorRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C858B1EC4E82600FA49E2 /* CursorRepository.cpp */; }; - F76C887F1EC5324E00FA49E2 /* CopyFramebufferShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85911EC4E82600FA49E2 /* CopyFramebufferShader.cpp */; }; + F76C887F1EC5324E00FA49E2 /* ApplyPaletteShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85911EC4E82600FA49E2 /* ApplyPaletteShader.cpp */; }; F76C88801EC5324E00FA49E2 /* DrawRectShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85941EC4E82600FA49E2 /* DrawRectShader.cpp */; }; F76C88811EC5324E00FA49E2 /* DrawLineShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85961EC4E82600FA49E2 /* DrawLineShader.cpp */; }; F76C88831EC5324E00FA49E2 /* OpenGLAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C859B1EC4E82600FA49E2 /* OpenGLAPI.cpp */; }; @@ -1394,8 +1394,8 @@ F76C858B1EC4E82600FA49E2 /* CursorRepository.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CursorRepository.cpp; sourceTree = ""; }; F76C858C1EC4E82600FA49E2 /* CursorRepository.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CursorRepository.h; sourceTree = ""; }; F76C858F1EC4E82600FA49E2 /* DrawingEngines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawingEngines.h; sourceTree = ""; }; - F76C85911EC4E82600FA49E2 /* CopyFramebufferShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CopyFramebufferShader.cpp; sourceTree = ""; }; - F76C85921EC4E82600FA49E2 /* CopyFramebufferShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CopyFramebufferShader.h; sourceTree = ""; }; + F76C85911EC4E82600FA49E2 /* ApplyPaletteShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ApplyPaletteShader.cpp; sourceTree = ""; }; + F76C85921EC4E82600FA49E2 /* ApplyPaletteShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplyPaletteShader.h; sourceTree = ""; }; F76C85931EC4E82600FA49E2 /* DrawCommands.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawCommands.h; sourceTree = ""; }; F76C85941EC4E82600FA49E2 /* DrawRectShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DrawRectShader.cpp; sourceTree = ""; }; F76C85951EC4E82600FA49E2 /* DrawRectShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawRectShader.h; sourceTree = ""; }; @@ -2669,10 +2669,10 @@ F76C85901EC4E82600FA49E2 /* opengl */ = { isa = PBXGroup; children = ( + F76C85911EC4E82600FA49E2 /* ApplyPaletteShader.cpp */, + F76C85921EC4E82600FA49E2 /* ApplyPaletteShader.h */, D45E09161F99CF2F00854B2B /* ApplyTransparencyShader.cpp */, D45E09151F99CF2F00854B2B /* ApplyTransparencyShader.h */, - F76C85911EC4E82600FA49E2 /* CopyFramebufferShader.cpp */, - F76C85921EC4E82600FA49E2 /* CopyFramebufferShader.h */, F76C85931EC4E82600FA49E2 /* DrawCommands.h */, F76C85961EC4E82600FA49E2 /* DrawLineShader.cpp */, F76C85971EC4E82600FA49E2 /* DrawLineShader.h */, @@ -3231,7 +3231,7 @@ F775F5341EE35A6B001F00E7 /* DummyUiContext.cpp in Sources */, C654DF401F69C18C0040F43D /* Intent.cpp in Sources */, C666ED761F33DBB20061AA04 /* ShortcutKeyChange.cpp in Sources */, - F76C887F1EC5324E00FA49E2 /* CopyFramebufferShader.cpp in Sources */, + F76C887F1EC5324E00FA49E2 /* ApplyPaletteShader.cpp in Sources */, C685E51C1F8907850090598F /* Map.cpp in Sources */, F7CB864A1EEDA1330030C877 /* KeyboardShortcuts.cpp in Sources */, 4C8667821EEFDCDF0024AAB8 /* RideGroupManager.cpp in Sources */, diff --git a/data/shaders/copyframebuffer.frag b/data/shaders/applypalette.frag similarity index 100% rename from data/shaders/copyframebuffer.frag rename to data/shaders/applypalette.frag diff --git a/data/shaders/copyframebuffer.vert b/data/shaders/applypalette.vert similarity index 100% rename from data/shaders/copyframebuffer.vert rename to data/shaders/applypalette.vert diff --git a/src/openrct2-ui/drawing/engines/opengl/CopyFramebufferShader.cpp b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp similarity index 85% rename from src/openrct2-ui/drawing/engines/opengl/CopyFramebufferShader.cpp rename to src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp index 34bea525ef..bb3ff794e2 100644 --- a/src/openrct2-ui/drawing/engines/opengl/CopyFramebufferShader.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.cpp @@ -16,7 +16,7 @@ #ifndef DISABLE_OPENGL -#include "CopyFramebufferShader.h" +#include "ApplyPaletteShader.h" struct VDStruct { @@ -32,7 +32,7 @@ constexpr VDStruct VertexData[4] = { 1.0f, 1.0f, 1.0f, 1.0f }, }; -CopyFramebufferShader::CopyFramebufferShader() : OpenGLShaderProgram("copyframebuffer") +ApplyPaletteShader::ApplyPaletteShader() : OpenGLShaderProgram("applypalette") { GetLocations(); @@ -53,13 +53,13 @@ CopyFramebufferShader::CopyFramebufferShader() : OpenGLShaderProgram("copyframeb glUniform1i(uTexture, 0); } -CopyFramebufferShader::~CopyFramebufferShader() +ApplyPaletteShader::~ApplyPaletteShader() { glDeleteBuffers(1, &_vbo); glDeleteVertexArrays(1, &_vao); } -void CopyFramebufferShader::GetLocations() +void ApplyPaletteShader::GetLocations() { uTexture = GetUniformLocation("uTexture"); uPalette = GetUniformLocation("uPalette"); @@ -68,17 +68,17 @@ void CopyFramebufferShader::GetLocations() vTextureCoordinate = GetAttributeLocation("vTextureCoordinate"); } -void CopyFramebufferShader::SetTexture(GLuint texture) +void ApplyPaletteShader::SetTexture(GLuint texture) { OpenGLAPI::SetTexture(0, GL_TEXTURE_2D, texture); } -void CopyFramebufferShader::SetPalette(const vec4 * glPalette) +void ApplyPaletteShader::SetPalette(const vec4 * glPalette) { glUniform4fv(uPalette, 256, (const GLfloat *)glPalette); } -void CopyFramebufferShader::Draw() +void ApplyPaletteShader::Draw() { glBindVertexArray(_vao); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); diff --git a/src/openrct2-ui/drawing/engines/opengl/CopyFramebufferShader.h b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.h similarity index 89% rename from src/openrct2-ui/drawing/engines/opengl/CopyFramebufferShader.h rename to src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.h index 2b4dc2f8fc..6675470e17 100644 --- a/src/openrct2-ui/drawing/engines/opengl/CopyFramebufferShader.h +++ b/src/openrct2-ui/drawing/engines/opengl/ApplyPaletteShader.h @@ -19,7 +19,7 @@ #include "GLSLTypes.h" #include "OpenGLShaderProgram.h" -class CopyFramebufferShader final : public OpenGLShaderProgram +class ApplyPaletteShader final : public OpenGLShaderProgram { private: GLuint uTexture; @@ -32,8 +32,8 @@ private: GLuint _vao; public: - CopyFramebufferShader(); - ~CopyFramebufferShader() override; + ApplyPaletteShader(); + ~ApplyPaletteShader() override; void SetTexture(GLuint texture); void SetPalette(const vec4 * glPalette); diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp index d4327e30ac..c72cb56da1 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLDrawingEngine.cpp @@ -39,7 +39,7 @@ #include "GLSLTypes.h" #include "OpenGLAPI.h" #include "OpenGLFramebuffer.h" -#include "CopyFramebufferShader.h" +#include "ApplyPaletteShader.h" #include "DrawCommands.h" #include "DrawLineShader.h" #include "DrawRectShader.h" @@ -139,7 +139,7 @@ private: OpenGLDrawingContext * _drawingContext; - CopyFramebufferShader * _copyFramebufferShader = nullptr; + ApplyPaletteShader * _applyPaletteShader = nullptr; OpenGLFramebuffer * _screenFramebuffer = nullptr; OpenGLFramebuffer * _scaleFramebuffer = nullptr; @@ -159,7 +159,7 @@ public: ~OpenGLDrawingEngine() override { - delete _copyFramebufferShader; + delete _applyPaletteShader; delete _screenFramebuffer; delete _drawingContext; @@ -191,7 +191,7 @@ public: _drawingContext->Initialise(); - _copyFramebufferShader = new CopyFramebufferShader(); + _applyPaletteShader = new ApplyPaletteShader(); } void Resize(uint32 width, uint32 height) override @@ -218,8 +218,8 @@ public: colour.a / 255.0f }; } - _copyFramebufferShader->Use(); - _copyFramebufferShader->SetPalette(GLPalette); + _applyPaletteShader->Use(); + _applyPaletteShader->SetPalette(GLPalette); _drawingContext->ResetPalette(); } @@ -254,9 +254,9 @@ public: _screenFramebuffer->Bind(); } - _copyFramebufferShader->Use(); - _copyFramebufferShader->SetTexture(_drawingContext->GetFinalFramebuffer().GetTexture()); - _copyFramebufferShader->Draw(); + _applyPaletteShader->Use(); + _applyPaletteShader->SetTexture(_drawingContext->GetFinalFramebuffer().GetTexture()); + _applyPaletteShader->Draw(); if (_scaleFramebuffer != nullptr) { diff --git a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp index 39a82302bb..5d41e57b74 100644 --- a/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/SwapFramebuffer.cpp @@ -16,7 +16,6 @@ #ifndef DISABLE_OPENGL -#include "CopyFramebufferShader.h" #include "OpenGLFramebuffer.h" #include "SwapFramebuffer.h"