1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-22 10:22:52 +01:00

Merge pull request #634 from ShFil119/minor_stuff

Minor stuff
This commit is contained in:
Daniel Evans 2018-09-23 17:17:53 +01:00 committed by GitHub
commit 4b1e4d3aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 10 deletions

View File

@ -5,10 +5,6 @@
#include <gl/gl_core_3_3.h>
#include <gl/GeometryBuffer.hpp>
/* TODO: Come up with a more elegant solution to "WHICH ARRAY IS IT?" */
std::map<AttributeSemantic, GLuint> 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<GLuint>(at.sem);
glEnableVertexAttribArray(vaoindex);
glVertexAttribPointer(vaoindex, static_cast<GLint>(at.size), at.type, GL_TRUE, at.stride,
reinterpret_cast<void*>(at.offset));

View File

@ -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
};
/**

View File

@ -69,7 +69,6 @@ public:
GameRenderer(Logger* log, GameData* data);
~GameRenderer();
/** @todo Clean up all these shader program and location variables */
std::unique_ptr<Renderer::ShaderProgram> worldProg;
std::unique_ptr<Renderer::ShaderProgram> skyProg;
std::unique_ptr<Renderer::ShaderProgram> particleProg;