summaryrefslogtreecommitdiff
path: root/gfx/models/mesh.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-26 01:16:06 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-26 01:16:06 +0100
commit4b560f03201f1c2d7c632126cd1e512ed4027072 (patch)
treec270b684f3886130d6ef079064113b40e374a965 /gfx/models/mesh.cpp
parentPoint shaders (shadows) can all share the same implementation now in a single... (diff)
downloadilt-4b560f03201f1c2d7c632126cd1e512ed4027072.tar.bz2
ilt-4b560f03201f1c2d7c632126cd1e512ed4027072.tar.xz
ilt-4b560f03201f1c2d7c632126cd1e512ed4027072.zip
Add Mesh helper for drawing instances
Assumes the supplied VAO was created and configured for the mesh it's passed back to.
Diffstat (limited to 'gfx/models/mesh.cpp')
-rw-r--r--gfx/models/mesh.cpp10
1 files changed, 10 insertions, 0 deletions
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);
+}