diff --git a/src/Mesh.h b/src/Mesh.h index ffe47da53..c1e3b5770 100644 --- a/src/Mesh.h +++ b/src/Mesh.h @@ -24,6 +24,7 @@ #include #include "Magnum.h" +#include "TypeTraits.h" namespace Magnum { @@ -143,7 +144,9 @@ class Mesh { * initialized with addBuffer) or the mesh was already drawn, the * function does nothing. */ - template void bindAttribute(Buffer* buffer, GLuint attribute); + template inline void bindAttribute(Buffer* buffer, GLuint attribute) { + bindAttribute(buffer, attribute, TypeTraits::count(), TypeTraits::glType()); + } /** * @brief Draw the mesh @@ -207,50 +210,6 @@ class Mesh { GLsizei sizeOf(GLenum type); }; -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_BYTE); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_UNSIGNED_BYTE); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_SHORT); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_UNSIGNED_SHORT); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_INT); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_UNSIGNED_INT); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_FLOAT); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 1, GL_DOUBLE); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 2, GL_FLOAT); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 3, GL_FLOAT); -} - -template<> inline void Mesh::bindAttribute(Buffer* buffer, GLuint attribute) { - bindAttribute(buffer, attribute, 4, GL_FLOAT); -} - } #endif