Skip to content

Commit

Permalink
libgui: Added vertex attributes for bone IDs and weights
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 13, 2014
1 parent 76f6a6e commit 762d557
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
4 changes: 3 additions & 1 deletion doomsday/libgui/include/de/gui/glbuffer.h
Expand Up @@ -47,7 +47,9 @@ namespace internal
Color,
Normal,
Tangent,
Bitangent
Bitangent,
BoneIDs,
BoneWeights
};

Semantic semantic;
Expand Down
6 changes: 6 additions & 0 deletions doomsday/libgui/src/glbuffer.cpp
Expand Up @@ -208,12 +208,16 @@ DENG2_PIMPL(GLBuffer)
if(enable)
{
glEnableVertexAttribArray(index);
LIBGUI_ASSERT_GL_OK();

glVertexAttribPointer(index, spec.size, spec.type, spec.normalized, spec.stride,
(void const *) dintptr(spec.startOffset));
LIBGUI_ASSERT_GL_OK();
}
else
{
glDisableVertexAttribArray(index);
LIBGUI_ASSERT_GL_OK();
}
}
}
Expand Down Expand Up @@ -304,6 +308,7 @@ void GLBuffer::draw(duint first, dint count) const
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, d->idxName);
glDrawElements(Instance::glPrimitive(d->prim), count, GL_UNSIGNED_SHORT,
(void const *) dintptr(first * 2));
LIBGUI_ASSERT_GL_OK();
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
else
Expand All @@ -314,6 +319,7 @@ void GLBuffer::draw(duint first, dint count) const
DENG2_ASSERT(count >= 0);

glDrawArrays(Instance::glPrimitive(d->prim), first, count);
LIBGUI_ASSERT_GL_OK();
}

d->enableArrays(false);
Expand Down
22 changes: 12 additions & 10 deletions doomsday/libgui/src/glprogram.cpp
Expand Up @@ -164,16 +164,18 @@ DENG2_PIMPL(GLProgram)
char const *varName;
}
const names[] = {
{ AttribSpec::Position, "aVertex" },
{ AttribSpec::TexCoord0, "aUV" },
{ AttribSpec::TexCoord1, "aUV2" },
{ AttribSpec::TexCoord2, "aUV3" },
{ AttribSpec::TexCoord3, "aUV4" },
{ AttribSpec::TexBounds0, "aBounds" },
{ AttribSpec::Color, "aColor" },
{ AttribSpec::Normal, "aNormal" },
{ AttribSpec::Tangent, "aTangent" },
{ AttribSpec::Bitangent, "aBitangent" }
{ AttribSpec::Position, "aVertex" },
{ AttribSpec::TexCoord0, "aUV" },
{ AttribSpec::TexCoord1, "aUV2" },
{ AttribSpec::TexCoord2, "aUV3" },
{ AttribSpec::TexCoord3, "aUV4" },
{ AttribSpec::TexBounds0, "aBounds" },
{ AttribSpec::Color, "aColor" },
{ AttribSpec::Normal, "aNormal" },
{ AttribSpec::Tangent, "aTangent" },
{ AttribSpec::Bitangent, "aBitangent" },
{ AttribSpec::BoneIDs, "aBoneIDs" },
{ AttribSpec::BoneWeights, "aBoneWeights" },
};

for(uint i = 0; i < sizeof(names)/sizeof(names[0]); ++i)
Expand Down

0 comments on commit 762d557

Please sign in to comment.