From c977c02ba3a6ad6ada3f1a458b41a77f2be2b871 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 1 May 2023 21:29:01 +0100 Subject: Refactor InstanceVertices in terms of glContainer --- game/scenary/foliage.cpp | 4 ++-- game/vehicles/railVehicleClass.cpp | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'game') diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp index 9304842..702a52c 100644 --- a/game/scenary/foliage.cpp +++ b/game/scenary/foliage.cpp @@ -21,7 +21,7 @@ Foliage::postLoad() void Foliage::render(const SceneShader & shader) const { - if (const auto count = instances.count()) { + if (const auto count = instances.size()) { shader.basicInst.use(); if (texture) { texture->bind(); @@ -33,7 +33,7 @@ Foliage::render(const SceneShader & shader) const void Foliage::shadows(const ShadowMapper & mapper) const { - if (const auto count = instances.count()) { + if (const auto count = instances.size()) { mapper.dynamicPointInst.use(); bodyMesh->DrawInstanced(instanceVAO, static_cast(count)); } diff --git a/game/vehicles/railVehicleClass.cpp b/game/vehicles/railVehicleClass.cpp index 64a21be..148081f 100644 --- a/game/vehicles/railVehicleClass.cpp +++ b/game/vehicles/railVehicleClass.cpp @@ -46,26 +46,24 @@ RailVehicleClass::postLoad() void RailVehicleClass::render(const SceneShader & shader) const { - if (const auto count = instancesBody.count()) { + if (const auto count = instancesBody.size()) { if (texture) { texture->bind(); } shader.basicInst.use(); bodyMesh->DrawInstanced(instanceVAO, static_cast(count)); - bogies.front()->DrawInstanced( - instancesBogiesVAO.front(), static_cast(instancesBogies.front().count())); - bogies.back()->DrawInstanced(instancesBogiesVAO.back(), static_cast(instancesBogies.back().count())); + bogies.front()->DrawInstanced(instancesBogiesVAO.front(), static_cast(instancesBogies.front().size())); + bogies.back()->DrawInstanced(instancesBogiesVAO.back(), static_cast(instancesBogies.back().size())); } } void RailVehicleClass::shadows(const ShadowMapper & mapper) const { - if (const auto count = instancesBody.count()) { + if (const auto count = instancesBody.size()) { mapper.dynamicPointInst.use(); bodyMesh->DrawInstanced(instanceVAO, static_cast(count)); - bogies.front()->DrawInstanced( - instancesBogiesVAO.front(), static_cast(instancesBogies.front().count())); - bogies.back()->DrawInstanced(instancesBogiesVAO.back(), static_cast(instancesBogies.back().count())); + bogies.front()->DrawInstanced(instancesBogiesVAO.front(), static_cast(instancesBogies.front().size())); + bogies.back()->DrawInstanced(instancesBogiesVAO.back(), static_cast(instancesBogies.back().size())); } } -- cgit v1.2.3