From 694596321f0bdb109ae3c92e2a2fd39231280102 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Thu, 20 Sep 2018 22:42:47 +0200 Subject: [PATCH 1/2] Remove unneeded map `semantic_to_attrib_array` --- rwcore/gl/DrawBuffer.cpp | 6 +----- rwcore/gl/GeometryBuffer.hpp | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/rwcore/gl/DrawBuffer.cpp b/rwcore/gl/DrawBuffer.cpp index b88cb2d5..b8ec0749 100644 --- a/rwcore/gl/DrawBuffer.cpp +++ b/rwcore/gl/DrawBuffer.cpp @@ -5,10 +5,6 @@ #include #include -/* TODO: Come up with a more elegant solution to "WHICH ARRAY IS IT?" */ -std::map semantic_to_attrib_array = { - {ATRS_Position, 0}, {ATRS_Normal, 1}, {ATRS_Colour, 2}, {ATRS_TexCoord, 3}}; - DrawBuffer::DrawBuffer() : vao(0) { } @@ -27,7 +23,7 @@ void DrawBuffer::addGeometry(GeometryBuffer* gbuff) { glBindBuffer(GL_ARRAY_BUFFER, gbuff->getVBOName()); // Iterate the attributes present in the gbuff for (const AttributeIndex& at : gbuff->getDataAttributes()) { - GLuint vaoindex = semantic_to_attrib_array[at.sem]; + auto vaoindex = static_cast(at.sem); glEnableVertexAttribArray(vaoindex); glVertexAttribPointer(vaoindex, static_cast(at.size), at.type, GL_TRUE, at.stride, reinterpret_cast(at.offset)); diff --git a/rwcore/gl/GeometryBuffer.hpp b/rwcore/gl/GeometryBuffer.hpp index b16f898a..f7d03814 100644 --- a/rwcore/gl/GeometryBuffer.hpp +++ b/rwcore/gl/GeometryBuffer.hpp @@ -7,10 +7,10 @@ * Enum used to determine which shader input an attribute maps to */ enum AttributeSemantic { - ATRS_Position, - ATRS_Normal, - ATRS_Colour, - ATRS_TexCoord + ATRS_Position = 0, + ATRS_Normal = 1, + ATRS_Colour = 2, + ATRS_TexCoord = 3 }; /** From c6a0c6eb455a33c717509ed8cf0731e41a5c4122 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Thu, 20 Sep 2018 22:52:04 +0200 Subject: [PATCH 2/2] Remove already handled "todo" --- rwengine/src/render/GameRenderer.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/rwengine/src/render/GameRenderer.hpp b/rwengine/src/render/GameRenderer.hpp index d1888b74..291e5a05 100644 --- a/rwengine/src/render/GameRenderer.hpp +++ b/rwengine/src/render/GameRenderer.hpp @@ -69,7 +69,6 @@ public: GameRenderer(Logger* log, GameData* data); ~GameRenderer(); - /** @todo Clean up all these shader program and location variables */ std::unique_ptr worldProg; std::unique_ptr skyProg; std::unique_ptr particleProg;