From 4b560f03201f1c2d7c632126cd1e512ed4027072 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 26 Apr 2023 01:16:06 +0100 Subject: Add Mesh helper for drawing instances Assumes the supplied VAO was created and configured for the mesh it's passed back to. --- gfx/models/mesh.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gfx/models/mesh.cpp') diff --git a/gfx/models/mesh.cpp b/gfx/models/mesh.cpp index 55759cb..3faf252 100644 --- a/gfx/models/mesh.cpp +++ b/gfx/models/mesh.cpp @@ -42,3 +42,13 @@ Mesh::Draw() const glBindVertexArray(0); } + +void +Mesh::DrawInstanced(GLuint vao, GLsizei count) const +{ + glBindVertexArray(vao); + + glDrawElementsInstanced(mode, m_numIndices, GL_UNSIGNED_INT, nullptr, count); + + glBindVertexArray(0); +} -- cgit v1.2.3 From c3af3f3ec6aff3e366acb8825413096581c736c1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 26 Apr 2023 02:04:17 +0100 Subject: Revert "Export mesh size and primitive type" This reverts commit f3343e1cc8a56f039888d4d375a6d5a088a68494. --- gfx/models/mesh.cpp | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'gfx/models/mesh.cpp') diff --git a/gfx/models/mesh.cpp b/gfx/models/mesh.cpp index 3faf252..52c9275 100644 --- a/gfx/models/mesh.cpp +++ b/gfx/models/mesh.cpp @@ -21,18 +21,6 @@ Mesh::configureVAO(VertexArrayObject && vao) const .addIndices(m_vertexArrayBuffers[1]); } -GLsizei -Mesh::count() const -{ - return m_numIndices; -} - -GLenum -Mesh::type() const -{ - return mode; -} - void Mesh::Draw() const { -- cgit v1.2.3