From e751ab465bbbf1365ec6e108c64dafd03ce42f1d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 23 Apr 2023 21:46:21 +0100 Subject: Pop and complete instanced shadow support --- game/vehicles/railVehicleClass.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'game/vehicles/railVehicleClass.cpp') 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(count)); + glBindVertexArray(instancesBogiesVAO.front()); + glDrawElementsInstanced(bogies.front()->type(), bogies.front()->count(), GL_UNSIGNED_INT, nullptr, + static_cast(instancesBogies.front().count())); + glBindVertexArray(instancesBogiesVAO.back()); + glDrawElementsInstanced(bogies.back()->type(), bogies.back()->count(), GL_UNSIGNED_INT, nullptr, + static_cast(instancesBogies.back().count())); + glBindVertexArray(0); + } } -- cgit v1.2.3