diff --git a/doomsday/libgui/include/de/gui/glbuffer.h b/doomsday/libgui/include/de/gui/glbuffer.h index 8cb7f768a9..c65b7b96e1 100644 --- a/doomsday/libgui/include/de/gui/glbuffer.h +++ b/doomsday/libgui/include/de/gui/glbuffer.h @@ -43,6 +43,7 @@ namespace internal TexCoord1, TexCoord2, TexCoord3, + TexBounds0, Color, Normal, Tangent, @@ -130,6 +131,20 @@ struct LIBGUI_PUBLIC Vertex3TexRgba LIBGUI_DECLARE_VERTEX_FORMAT(3) }; +/** + * Vertex format with 3D coordinates, one set of texture coordinates with indirect + * bounds, and an RGBA color. + */ +struct LIBGUI_PUBLIC Vertex3TexBoundsRgba +{ + Vector3f pos; + Vector2f texCoord; ///< mapped using texBounds + Vector4f texBounds; ///< UV space: x, y, width, height + Vector4f rgba; + + LIBGUI_DECLARE_VERTEX_FORMAT(4) +}; + /** * Vertex format with 3D coordinates, two sets of texture coordinates, and an * RGBA color. diff --git a/doomsday/libgui/src/glbuffer.cpp b/doomsday/libgui/src/glbuffer.cpp index a03c9c7149..34ac1fe035 100644 --- a/doomsday/libgui/src/glbuffer.cpp +++ b/doomsday/libgui/src/glbuffer.cpp @@ -59,6 +59,14 @@ AttribSpec const Vertex3TexRgba::_spec[3] = { }; LIBGUI_VERTEX_FORMAT_SPEC(Vertex3TexRgba, 9 * sizeof(float)) +AttribSpec const Vertex3TexBoundsRgba::_spec[4] = { + { AttribSpec::Position, 3, GL_FLOAT, false, sizeof(Vertex3TexBoundsRgba), 0 }, + { AttribSpec::TexCoord0, 2, GL_FLOAT, false, sizeof(Vertex3TexBoundsRgba), 3 * sizeof(float) }, + { AttribSpec::TexBounds0, 4, GL_FLOAT, false, sizeof(Vertex3TexBoundsRgba), 5 * sizeof(float) }, + { AttribSpec::Color, 4, GL_FLOAT, false, sizeof(Vertex3TexBoundsRgba), 9 * sizeof(float) } +}; +LIBGUI_VERTEX_FORMAT_SPEC(Vertex3TexBoundsRgba, 13 * sizeof(float)) + AttribSpec const Vertex3Tex2Rgba::_spec[4] = { { AttribSpec::Position, 3, GL_FLOAT, false, sizeof(Vertex3Tex2Rgba), 0 }, { AttribSpec::TexCoord0, 2, GL_FLOAT, false, sizeof(Vertex3Tex2Rgba), 3 * sizeof(float) }, diff --git a/doomsday/libgui/src/glprogram.cpp b/doomsday/libgui/src/glprogram.cpp index 69b64f067e..6b5f0e77cd 100644 --- a/doomsday/libgui/src/glprogram.cpp +++ b/doomsday/libgui/src/glprogram.cpp @@ -164,15 +164,16 @@ DENG2_PIMPL(GLProgram) char const *varName; } const names[] = { - { AttribSpec::Position, "aVertex" }, - { AttribSpec::TexCoord0, "aUV" }, - { AttribSpec::TexCoord1, "aUV2" }, - { AttribSpec::TexCoord2, "aUV3" }, - { AttribSpec::TexCoord3, "aUV4" }, - { 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" } }; for(uint i = 0; i < sizeof(names)/sizeof(names[0]); ++i)