summaryrefslogtreecommitdiff
path: root/game/scenary/foliage.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-26 01:42:45 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-26 01:42:45 +0100
commitc96f4f89905f96492bdfc87bc3d45bf5cbd7b005 (patch)
tree9a3e9d0443f5cc4b2ab253aa8807b90cb2d82cc6 /game/scenary/foliage.cpp
parentAdd Mesh helper for drawing instances (diff)
downloadilt-c96f4f89905f96492bdfc87bc3d45bf5cbd7b005.tar.bz2
ilt-c96f4f89905f96492bdfc87bc3d45bf5cbd7b005.tar.xz
ilt-c96f4f89905f96492bdfc87bc3d45bf5cbd7b005.zip
Draw rail vehicle classes and foliage with new mesh instance helper
Diffstat (limited to 'game/scenary/foliage.cpp')
-rw-r--r--game/scenary/foliage.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp
index e54dfbd..0913c6e 100644
--- a/game/scenary/foliage.cpp
+++ b/game/scenary/foliage.cpp
@@ -26,10 +26,7 @@ Foliage::render(const SceneShader & shader) const
if (texture) {
texture->bind();
}
- glBindVertexArray(instanceVAO);
- glDrawElementsInstanced(
- bodyMesh->type(), bodyMesh->count(), GL_UNSIGNED_INT, nullptr, static_cast<GLsizei>(count));
- glBindVertexArray(0);
+ bodyMesh->DrawInstanced(instanceVAO, static_cast<GLsizei>(count));
}
}
@@ -38,9 +35,6 @@ Foliage::shadows(const ShadowMapper & mapper) const
{
if (const auto count = instances.count()) {
mapper.dynamicPointInst.use();
- glBindVertexArray(instanceVAO);
- glDrawElementsInstanced(
- bodyMesh->type(), bodyMesh->count(), GL_UNSIGNED_INT, nullptr, static_cast<GLsizei>(count));
- glBindVertexArray(0);
+ bodyMesh->DrawInstanced(instanceVAO, static_cast<GLsizei>(count));
}
}