diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-27 17:55:30 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-27 17:55:30 +0100 |
commit | 4f34ed9c949785784f0006f971b5fd2bb9508553 (patch) | |
tree | 20f6627a2f441212365d05d04160a5a6a97063e7 /gfx/models/mesh.cpp | |
parent | Merge remote-tracking branch 'origin/assimp-normals' (diff) | |
parent | Revert "Export mesh size and primitive type" (diff) | |
download | ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.bz2 ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.xz ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.zip |
Merge branch 'instancing-pt2'
Diffstat (limited to 'gfx/models/mesh.cpp')
-rw-r--r-- | gfx/models/mesh.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/gfx/models/mesh.cpp b/gfx/models/mesh.cpp index 55759cb..52c9275 100644 --- a/gfx/models/mesh.cpp +++ b/gfx/models/mesh.cpp @@ -21,24 +21,22 @@ Mesh::configureVAO(VertexArrayObject && vao) const .addIndices(m_vertexArrayBuffers[1]);
}
-GLsizei
-Mesh::count() const
+void
+Mesh::Draw() const
{
- return m_numIndices;
-}
+ glBindVertexArray(m_vertexArrayObject);
-GLenum
-Mesh::type() const
-{
- return mode;
+ glDrawElements(mode, m_numIndices, GL_UNSIGNED_INT, nullptr);
+
+ glBindVertexArray(0);
}
void
-Mesh::Draw() const
+Mesh::DrawInstanced(GLuint vao, GLsizei count) const
{
- glBindVertexArray(m_vertexArrayObject);
+ glBindVertexArray(vao);
- glDrawElements(mode, m_numIndices, GL_UNSIGNED_INT, nullptr);
+ glDrawElementsInstanced(mode, m_numIndices, GL_UNSIGNED_INT, nullptr, count);
glBindVertexArray(0);
}
|