Skip to content

Commit

Permalink
libgui|GLBuffer: Added a 3D vertex with tangent-space
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Mar 11, 2014
1 parent 17e06b8 commit d9e2278
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doomsday/libgui/include/de/gui/glbuffer.h
Expand Up @@ -199,6 +199,21 @@ struct LIBGUI_PUBLIC Vertex3NormalTexRgba
LIBGUI_DECLARE_VERTEX_FORMAT(4)
};

/**
* Vertex format with 3D coordinates, normal/tangent/bitangent vectors, one set of
* texture coordinates, and an RGBA color.
*/
struct LIBGUI_PUBLIC Vertex3NormalTangentTex
{
Vector3f pos;
Vector3f normal;
Vector3f tangent;
Vector3f bitangent;
Vector2f texCoord;

LIBGUI_DECLARE_VERTEX_FORMAT(5)
};

namespace gl
{
enum Usage {
Expand Down
9 changes: 9 additions & 0 deletions doomsday/libgui/src/glbuffer.cpp
Expand Up @@ -101,6 +101,15 @@ AttribSpec const Vertex3NormalTexRgba::_spec[4] = {
};
LIBGUI_VERTEX_FORMAT_SPEC(Vertex3NormalTexRgba, 12 * sizeof(float))

AttribSpec const Vertex3NormalTangentTex::_spec[5] = {
{ AttribSpec::Position, 3, GL_FLOAT, false, sizeof(Vertex3NormalTangentTex), 0 },
{ AttribSpec::Normal, 3, GL_FLOAT, false, sizeof(Vertex3NormalTangentTex), 3 * sizeof(float) },
{ AttribSpec::Tangent, 3, GL_FLOAT, false, sizeof(Vertex3NormalTangentTex), 6 * sizeof(float) },
{ AttribSpec::Bitangent, 3, GL_FLOAT, false, sizeof(Vertex3NormalTangentTex), 9 * sizeof(float) },
{ AttribSpec::TexCoord0, 2, GL_FLOAT, false, sizeof(Vertex3NormalTangentTex), 12 * sizeof(float) }
};
LIBGUI_VERTEX_FORMAT_SPEC(Vertex3NormalTangentTex, 14 * sizeof(float))

//----------------------------------------------------------------------------

DENG2_PIMPL(GLBuffer)
Expand Down

0 comments on commit d9e2278

Please sign in to comment.