Browse Source

Don't spit assert in Mesh::addVertexBuffer() when it's not needed.

Vertex count is needed only for more than one attribute. Also updated
the assertion message to include function name.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
7e9e8913ed
  1. 9
      src/Mesh.h

9
src/Mesh.h

@ -592,9 +592,9 @@ class MAGNUM_EXPORT Mesh {
* mesh->vertexCount(), Shaders::PhongShader::Normal()); * mesh->vertexCount(), Shaders::PhongShader::Normal());
* @endcode * @endcode
* *
* @attention The actual vertex count must be set before calling this * @attention If specifying more than one attribute the actual vertex
* function, otherwise vertex data positions in the buffer will * count must be set before calling this function. Otherwise
* be miscalculated. * vertex data positions in the buffer will be miscalculated.
* @attention The buffer passed as parameter is not managed by the * @attention The buffer passed as parameter is not managed by the
* mesh, you must ensure it will exist for whole lifetime of the * mesh, you must ensure it will exist for whole lifetime of the
* mesh and delete it afterwards. * mesh and delete it afterwards.
@ -608,7 +608,8 @@ class MAGNUM_EXPORT Mesh {
* if @extension{APPLE,vertex_array_object} is available * if @extension{APPLE,vertex_array_object} is available
*/ */
template<class ...T> inline Mesh* addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { template<class ...T> inline Mesh* addVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) {
CORRADE_ASSERT(_vertexCount != 0, "Mesh: vertex count must be set before binding attributes", this); CORRADE_ASSERT(sizeof...(attributes) == 1 || _vertexCount != 0,
"Mesh::addVertexBuffer(): vertex count must be set before binding attributes", this);
addVertexBufferInternal(buffer, offset, attributes...); addVertexBufferInternal(buffer, offset, attributes...);
return this; return this;

Loading…
Cancel
Save