From 5ef729e89747c2974a47d0a639f57c439239c8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 19 Nov 2012 12:08:12 +0100 Subject: [PATCH] Overloads in IndexedMesh to avoid WTFs in method chaining order. --- src/IndexedMesh.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/IndexedMesh.h b/src/IndexedMesh.h index 9684d2305..06af7e492 100644 --- a/src/IndexedMesh.h +++ b/src/IndexedMesh.h @@ -117,6 +117,30 @@ class MAGNUM_EXPORT IndexedMesh: public Mesh { */ void draw() override; + /* Overloads to remove WTF-factor from method chaining order */ + #ifndef DOXYGEN_GENERATING_OUTPUT + inline IndexedMesh* setPrimitive(Primitive primitive) { + Mesh::setPrimitive(primitive); + return this; + } + inline IndexedMesh* setVertexCount(GLsizei vertexCount) { + Mesh::setVertexCount(vertexCount); + return this; + } + template inline IndexedMesh* addVertexBuffer(Buffer* buffer, const T&... attributes) { + Mesh::addVertexBuffer(buffer, attributes...); + return this; + } + template inline IndexedMesh* addInterleavedVertexBuffer(Buffer* buffer, GLintptr offset, const T&... attributes) { + Mesh::addInterleavedVertexBuffer(buffer, offset, attributes...); + return this; + } + template inline IndexedMesh* addVertexBufferStride(Buffer* buffer, GLintptr offset, GLsizei stride, const AbstractShaderProgram::Attribute& attribute) { + Mesh::addVertexBufferStride(buffer, offset, stride, attribute); + return this; + } + #endif + private: static void MAGNUM_LOCAL initializeContextBasedFunctionality(Context* context);