diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-23 21:46:21 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-26 00:07:19 +0100 |
commit | e751ab465bbbf1365ec6e108c64dafd03ce42f1d (patch) | |
tree | d0c6dc9cd16ea6cdedc89e575af7b012d935d4cb /game/vehicles/railVehicleClass.cpp | |
parent | Handle rendering of RailVehicles through RailVehicleClass instancing (diff) | |
download | ilt-e751ab465bbbf1365ec6e108c64dafd03ce42f1d.tar.bz2 ilt-e751ab465bbbf1365ec6e108c64dafd03ce42f1d.tar.xz ilt-e751ab465bbbf1365ec6e108c64dafd03ce42f1d.zip |
Pop and complete instanced shadow support
Diffstat (limited to 'game/vehicles/railVehicleClass.cpp')
-rw-r--r-- | game/vehicles/railVehicleClass.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
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); + } } |