|
|
|
|
@ -24,6 +24,7 @@
|
|
|
|
|
#include <set> |
|
|
|
|
|
|
|
|
|
#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<class T> void bindAttribute(Buffer* buffer, GLuint attribute); |
|
|
|
|
template<class T> inline void bindAttribute(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, TypeTraits<T>::count(), TypeTraits<T>::glType()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Draw the mesh |
|
|
|
|
@ -207,50 +210,6 @@ class Mesh {
|
|
|
|
|
GLsizei sizeOf(GLenum type); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLbyte>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_BYTE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLubyte>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_UNSIGNED_BYTE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLshort>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_SHORT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLushort>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_UNSIGNED_SHORT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLint>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_INT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLuint>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_UNSIGNED_INT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLfloat>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_FLOAT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<GLdouble>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 1, GL_DOUBLE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<Vector2>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 2, GL_FLOAT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<Vector3>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 3, GL_FLOAT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<> inline void Mesh::bindAttribute<Vector4>(Buffer* buffer, GLuint attribute) { |
|
|
|
|
bindAttribute(buffer, attribute, 4, GL_FLOAT); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|