mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-26 04:12:41 +01:00
commit
4b1e4d3aa6
@ -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));
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user