summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/scenary/foliage.cpp9
-rw-r--r--game/vehicles/railVehicleClass.cpp15
2 files changed, 22 insertions, 2 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp
index 35be051..e54dfbd 100644
--- a/game/scenary/foliage.cpp
+++ b/game/scenary/foliage.cpp
@@ -34,6 +34,13 @@ Foliage::render(const SceneShader & shader) const
}
void
-Foliage::shadows(const ShadowMapper &) const
+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);
+ }
}
diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp
index 3e62bf1..66d7ba3 100644
--- a/game/vehicles/railVehicleClass.cpp
+++ b/game/vehicles/railVehicleClass.cpp
@@ -65,6 +65,19 @@ RailVehicleClass::render(const SceneShader & shader) const
}
void
-RailVehicleClass::shadows(const ShadowMapper &) const
+RailVehicleClass::shadows(const ShadowMapper & mapper) const
{
+ if (const auto count = instancesBody.count()) {
+ mapper.dynamicPointInst.use();
+ glBindVertexArray(instanceVAO);
+ glDrawElementsInstanced(
+ bodyMesh->type(), bodyMesh->count(), GL_UNSIGNED_INT, nullptr, static_cast<GLsizei>(count));
+ glBindVertexArray(instancesBogiesVAO.front());
+ glDrawElementsInstanced(bogies.front()->type(), bogies.front()->count(), GL_UNSIGNED_INT, nullptr,
+ static_cast<GLsizei>(instancesBogies.front().count()));
+ glBindVertexArray(instancesBogiesVAO.back());
+ glDrawElementsInstanced(bogies.back()->type(), bogies.back()->count(), GL_UNSIGNED_INT, nullptr,
+ static_cast<GLsizei>(instancesBogies.back().count()));
+ glBindVertexArray(0);
+ }
}