Skip to content

Commit

Permalink
GRAPHICS: Change how vertex declaration is set
Browse files Browse the repository at this point in the history
  • Loading branch information
mirv-sillyfish authored and DrMcCoy committed Nov 17, 2018
1 parent f61bbad commit 0bc1bc5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/graphics/vertexbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ uint32 VertexBuffer::getTypeSize(GLenum type) {

void VertexBuffer::setVertexDeclLinear(uint32 vertCount, VertexDecl &decl) {
uint32 vertSize = 0;
_decl.clear();
for (VertexDecl::iterator a = decl.begin(); a != decl.end(); ++a)
vertSize += a->size * getTypeSize(a->type);

Expand All @@ -191,13 +192,13 @@ void VertexBuffer::setVertexDeclLinear(uint32 vertCount, VertexDecl &decl) {
a->pointer = data;

data += vertCount * a->size * getTypeSize(a->type);
_decl.push_back(*a);
}

_decl = decl;
}

void VertexBuffer::setVertexDeclInterleave(uint32 vertCount, VertexDecl &decl) {
uint32 vertSize = 0;
_decl.clear();
for (VertexDecl::iterator a = decl.begin(); a != decl.end(); ++a)
vertSize += a->size * getTypeSize(a->type);

Expand All @@ -209,9 +210,8 @@ void VertexBuffer::setVertexDeclInterleave(uint32 vertCount, VertexDecl &decl) {
a->pointer = _data + offset;

offset += a->size * getTypeSize(a->type);
_decl.push_back(*a);
}

_decl = decl;
}

GLvoid *VertexBuffer::getData() {
Expand Down

0 comments on commit 0bc1bc5

Please sign in to comment.