mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 17:42:29 +01:00
Rename CopyFramebufferShader to ApplyPaletteShader
This commit is contained in:
committed by
Michał Janiszewski
parent
50600f6195
commit
778cb9d024
@@ -471,7 +471,7 @@
|
|||||||
F76C887C1EC5324E00FA49E2 /* MemoryAudioSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85881EC4E82600FA49E2 /* MemoryAudioSource.cpp */; };
|
F76C887C1EC5324E00FA49E2 /* MemoryAudioSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85881EC4E82600FA49E2 /* MemoryAudioSource.cpp */; };
|
||||||
F76C887D1EC5324E00FA49E2 /* CursorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C858A1EC4E82600FA49E2 /* CursorData.cpp */; };
|
F76C887D1EC5324E00FA49E2 /* CursorData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C858A1EC4E82600FA49E2 /* CursorData.cpp */; };
|
||||||
F76C887E1EC5324E00FA49E2 /* CursorRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C858B1EC4E82600FA49E2 /* CursorRepository.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 */; };
|
F76C88801EC5324E00FA49E2 /* DrawRectShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85941EC4E82600FA49E2 /* DrawRectShader.cpp */; };
|
||||||
F76C88811EC5324E00FA49E2 /* DrawLineShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85961EC4E82600FA49E2 /* DrawLineShader.cpp */; };
|
F76C88811EC5324E00FA49E2 /* DrawLineShader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C85961EC4E82600FA49E2 /* DrawLineShader.cpp */; };
|
||||||
F76C88831EC5324E00FA49E2 /* OpenGLAPI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F76C859B1EC4E82600FA49E2 /* OpenGLAPI.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 = "<group>"; };
|
F76C858B1EC4E82600FA49E2 /* CursorRepository.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CursorRepository.cpp; sourceTree = "<group>"; };
|
||||||
F76C858C1EC4E82600FA49E2 /* CursorRepository.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CursorRepository.h; sourceTree = "<group>"; };
|
F76C858C1EC4E82600FA49E2 /* CursorRepository.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CursorRepository.h; sourceTree = "<group>"; };
|
||||||
F76C858F1EC4E82600FA49E2 /* DrawingEngines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawingEngines.h; sourceTree = "<group>"; };
|
F76C858F1EC4E82600FA49E2 /* DrawingEngines.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawingEngines.h; sourceTree = "<group>"; };
|
||||||
F76C85911EC4E82600FA49E2 /* CopyFramebufferShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CopyFramebufferShader.cpp; sourceTree = "<group>"; };
|
F76C85911EC4E82600FA49E2 /* ApplyPaletteShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ApplyPaletteShader.cpp; sourceTree = "<group>"; };
|
||||||
F76C85921EC4E82600FA49E2 /* CopyFramebufferShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CopyFramebufferShader.h; sourceTree = "<group>"; };
|
F76C85921EC4E82600FA49E2 /* ApplyPaletteShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApplyPaletteShader.h; sourceTree = "<group>"; };
|
||||||
F76C85931EC4E82600FA49E2 /* DrawCommands.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawCommands.h; sourceTree = "<group>"; };
|
F76C85931EC4E82600FA49E2 /* DrawCommands.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawCommands.h; sourceTree = "<group>"; };
|
||||||
F76C85941EC4E82600FA49E2 /* DrawRectShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DrawRectShader.cpp; sourceTree = "<group>"; };
|
F76C85941EC4E82600FA49E2 /* DrawRectShader.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DrawRectShader.cpp; sourceTree = "<group>"; };
|
||||||
F76C85951EC4E82600FA49E2 /* DrawRectShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawRectShader.h; sourceTree = "<group>"; };
|
F76C85951EC4E82600FA49E2 /* DrawRectShader.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DrawRectShader.h; sourceTree = "<group>"; };
|
||||||
@@ -2669,10 +2669,10 @@
|
|||||||
F76C85901EC4E82600FA49E2 /* opengl */ = {
|
F76C85901EC4E82600FA49E2 /* opengl */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
F76C85911EC4E82600FA49E2 /* ApplyPaletteShader.cpp */,
|
||||||
|
F76C85921EC4E82600FA49E2 /* ApplyPaletteShader.h */,
|
||||||
D45E09161F99CF2F00854B2B /* ApplyTransparencyShader.cpp */,
|
D45E09161F99CF2F00854B2B /* ApplyTransparencyShader.cpp */,
|
||||||
D45E09151F99CF2F00854B2B /* ApplyTransparencyShader.h */,
|
D45E09151F99CF2F00854B2B /* ApplyTransparencyShader.h */,
|
||||||
F76C85911EC4E82600FA49E2 /* CopyFramebufferShader.cpp */,
|
|
||||||
F76C85921EC4E82600FA49E2 /* CopyFramebufferShader.h */,
|
|
||||||
F76C85931EC4E82600FA49E2 /* DrawCommands.h */,
|
F76C85931EC4E82600FA49E2 /* DrawCommands.h */,
|
||||||
F76C85961EC4E82600FA49E2 /* DrawLineShader.cpp */,
|
F76C85961EC4E82600FA49E2 /* DrawLineShader.cpp */,
|
||||||
F76C85971EC4E82600FA49E2 /* DrawLineShader.h */,
|
F76C85971EC4E82600FA49E2 /* DrawLineShader.h */,
|
||||||
@@ -3231,7 +3231,7 @@
|
|||||||
F775F5341EE35A6B001F00E7 /* DummyUiContext.cpp in Sources */,
|
F775F5341EE35A6B001F00E7 /* DummyUiContext.cpp in Sources */,
|
||||||
C654DF401F69C18C0040F43D /* Intent.cpp in Sources */,
|
C654DF401F69C18C0040F43D /* Intent.cpp in Sources */,
|
||||||
C666ED761F33DBB20061AA04 /* ShortcutKeyChange.cpp in Sources */,
|
C666ED761F33DBB20061AA04 /* ShortcutKeyChange.cpp in Sources */,
|
||||||
F76C887F1EC5324E00FA49E2 /* CopyFramebufferShader.cpp in Sources */,
|
F76C887F1EC5324E00FA49E2 /* ApplyPaletteShader.cpp in Sources */,
|
||||||
C685E51C1F8907850090598F /* Map.cpp in Sources */,
|
C685E51C1F8907850090598F /* Map.cpp in Sources */,
|
||||||
F7CB864A1EEDA1330030C877 /* KeyboardShortcuts.cpp in Sources */,
|
F7CB864A1EEDA1330030C877 /* KeyboardShortcuts.cpp in Sources */,
|
||||||
4C8667821EEFDCDF0024AAB8 /* RideGroupManager.cpp in Sources */,
|
4C8667821EEFDCDF0024AAB8 /* RideGroupManager.cpp in Sources */,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#ifndef DISABLE_OPENGL
|
#ifndef DISABLE_OPENGL
|
||||||
|
|
||||||
#include "CopyFramebufferShader.h"
|
#include "ApplyPaletteShader.h"
|
||||||
|
|
||||||
struct VDStruct
|
struct VDStruct
|
||||||
{
|
{
|
||||||
@@ -32,7 +32,7 @@ constexpr VDStruct VertexData[4] =
|
|||||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||||
};
|
};
|
||||||
|
|
||||||
CopyFramebufferShader::CopyFramebufferShader() : OpenGLShaderProgram("copyframebuffer")
|
ApplyPaletteShader::ApplyPaletteShader() : OpenGLShaderProgram("applypalette")
|
||||||
{
|
{
|
||||||
GetLocations();
|
GetLocations();
|
||||||
|
|
||||||
@@ -53,13 +53,13 @@ CopyFramebufferShader::CopyFramebufferShader() : OpenGLShaderProgram("copyframeb
|
|||||||
glUniform1i(uTexture, 0);
|
glUniform1i(uTexture, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyFramebufferShader::~CopyFramebufferShader()
|
ApplyPaletteShader::~ApplyPaletteShader()
|
||||||
{
|
{
|
||||||
glDeleteBuffers(1, &_vbo);
|
glDeleteBuffers(1, &_vbo);
|
||||||
glDeleteVertexArrays(1, &_vao);
|
glDeleteVertexArrays(1, &_vao);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyFramebufferShader::GetLocations()
|
void ApplyPaletteShader::GetLocations()
|
||||||
{
|
{
|
||||||
uTexture = GetUniformLocation("uTexture");
|
uTexture = GetUniformLocation("uTexture");
|
||||||
uPalette = GetUniformLocation("uPalette");
|
uPalette = GetUniformLocation("uPalette");
|
||||||
@@ -68,17 +68,17 @@ void CopyFramebufferShader::GetLocations()
|
|||||||
vTextureCoordinate = GetAttributeLocation("vTextureCoordinate");
|
vTextureCoordinate = GetAttributeLocation("vTextureCoordinate");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyFramebufferShader::SetTexture(GLuint texture)
|
void ApplyPaletteShader::SetTexture(GLuint texture)
|
||||||
{
|
{
|
||||||
OpenGLAPI::SetTexture(0, GL_TEXTURE_2D, 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);
|
glUniform4fv(uPalette, 256, (const GLfloat *)glPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyFramebufferShader::Draw()
|
void ApplyPaletteShader::Draw()
|
||||||
{
|
{
|
||||||
glBindVertexArray(_vao);
|
glBindVertexArray(_vao);
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#include "GLSLTypes.h"
|
#include "GLSLTypes.h"
|
||||||
#include "OpenGLShaderProgram.h"
|
#include "OpenGLShaderProgram.h"
|
||||||
|
|
||||||
class CopyFramebufferShader final : public OpenGLShaderProgram
|
class ApplyPaletteShader final : public OpenGLShaderProgram
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GLuint uTexture;
|
GLuint uTexture;
|
||||||
@@ -32,8 +32,8 @@ private:
|
|||||||
GLuint _vao;
|
GLuint _vao;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CopyFramebufferShader();
|
ApplyPaletteShader();
|
||||||
~CopyFramebufferShader() override;
|
~ApplyPaletteShader() override;
|
||||||
|
|
||||||
void SetTexture(GLuint texture);
|
void SetTexture(GLuint texture);
|
||||||
void SetPalette(const vec4 * glPalette);
|
void SetPalette(const vec4 * glPalette);
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
#include "GLSLTypes.h"
|
#include "GLSLTypes.h"
|
||||||
#include "OpenGLAPI.h"
|
#include "OpenGLAPI.h"
|
||||||
#include "OpenGLFramebuffer.h"
|
#include "OpenGLFramebuffer.h"
|
||||||
#include "CopyFramebufferShader.h"
|
#include "ApplyPaletteShader.h"
|
||||||
#include "DrawCommands.h"
|
#include "DrawCommands.h"
|
||||||
#include "DrawLineShader.h"
|
#include "DrawLineShader.h"
|
||||||
#include "DrawRectShader.h"
|
#include "DrawRectShader.h"
|
||||||
@@ -139,7 +139,7 @@ private:
|
|||||||
|
|
||||||
OpenGLDrawingContext * _drawingContext;
|
OpenGLDrawingContext * _drawingContext;
|
||||||
|
|
||||||
CopyFramebufferShader * _copyFramebufferShader = nullptr;
|
ApplyPaletteShader * _applyPaletteShader = nullptr;
|
||||||
OpenGLFramebuffer * _screenFramebuffer = nullptr;
|
OpenGLFramebuffer * _screenFramebuffer = nullptr;
|
||||||
OpenGLFramebuffer * _scaleFramebuffer = nullptr;
|
OpenGLFramebuffer * _scaleFramebuffer = nullptr;
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ public:
|
|||||||
|
|
||||||
~OpenGLDrawingEngine() override
|
~OpenGLDrawingEngine() override
|
||||||
{
|
{
|
||||||
delete _copyFramebufferShader;
|
delete _applyPaletteShader;
|
||||||
delete _screenFramebuffer;
|
delete _screenFramebuffer;
|
||||||
|
|
||||||
delete _drawingContext;
|
delete _drawingContext;
|
||||||
@@ -191,7 +191,7 @@ public:
|
|||||||
|
|
||||||
_drawingContext->Initialise();
|
_drawingContext->Initialise();
|
||||||
|
|
||||||
_copyFramebufferShader = new CopyFramebufferShader();
|
_applyPaletteShader = new ApplyPaletteShader();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resize(uint32 width, uint32 height) override
|
void Resize(uint32 width, uint32 height) override
|
||||||
@@ -218,8 +218,8 @@ public:
|
|||||||
colour.a / 255.0f };
|
colour.a / 255.0f };
|
||||||
}
|
}
|
||||||
|
|
||||||
_copyFramebufferShader->Use();
|
_applyPaletteShader->Use();
|
||||||
_copyFramebufferShader->SetPalette(GLPalette);
|
_applyPaletteShader->SetPalette(GLPalette);
|
||||||
_drawingContext->ResetPalette();
|
_drawingContext->ResetPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,9 +254,9 @@ public:
|
|||||||
_screenFramebuffer->Bind();
|
_screenFramebuffer->Bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
_copyFramebufferShader->Use();
|
_applyPaletteShader->Use();
|
||||||
_copyFramebufferShader->SetTexture(_drawingContext->GetFinalFramebuffer().GetTexture());
|
_applyPaletteShader->SetTexture(_drawingContext->GetFinalFramebuffer().GetTexture());
|
||||||
_copyFramebufferShader->Draw();
|
_applyPaletteShader->Draw();
|
||||||
|
|
||||||
if (_scaleFramebuffer != nullptr)
|
if (_scaleFramebuffer != nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#ifndef DISABLE_OPENGL
|
#ifndef DISABLE_OPENGL
|
||||||
|
|
||||||
#include "CopyFramebufferShader.h"
|
|
||||||
#include "OpenGLFramebuffer.h"
|
#include "OpenGLFramebuffer.h"
|
||||||
#include "SwapFramebuffer.h"
|
#include "SwapFramebuffer.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user