diff options
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/models/mesh.cpp | 10 | ||||
-rw-r--r-- | gfx/models/mesh.h | 1 |
2 files changed, 11 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);
+}
diff --git a/gfx/models/mesh.h b/gfx/models/mesh.h index 472b7ed..a2205a1 100644 --- a/gfx/models/mesh.h +++ b/gfx/models/mesh.h @@ -14,6 +14,7 @@ public: Mesh(const std::span<const Vertex> vertices, const std::span<const unsigned int> indices, GLenum = GL_TRIANGLES);
void Draw() const;
+ void DrawInstanced(GLuint vao, GLsizei count) const;
VertexArrayObject & configureVAO(VertexArrayObject &&) const;
GLsizei count() const;
GLenum type() const;
|