diff options
Diffstat (limited to 'game/scenary')
| -rw-r--r-- | game/scenary/foliage.cpp | 7 | ||||
| -rw-r--r-- | game/scenary/illuminator.cpp | 4 |
2 files changed, 5 insertions, 6 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp index 5902e09..f27ac26 100644 --- a/game/scenary/foliage.cpp +++ b/game/scenary/foliage.cpp @@ -4,6 +4,7 @@ #include "gfx/gl/sceneShader.h" #include "gfx/gl/shadowMapper.h" #include "gfx/gl/shadowStenciller.h" +#include "util.h" #include <location.h> static_assert(std::is_constructible_v<Foliage>); @@ -40,12 +41,10 @@ Foliage::postLoad() { texture = getTexture(); glDebugScope _ {0}; - if (!(instanceVAO = commonInstanceVAO.lock())) { - commonInstanceVAO = instanceVAO = std::make_shared<glVertexArray>(); + if (createIfRequired(instanceVAO, commonInstanceVAO)) { bodyMesh->configureVAO(*instanceVAO, 0).addAttribs<InstanceVertex, &InstanceVertex::location>(1); } - if (!(instancePointVAO = commonInstancePointVAO.lock())) { - commonInstancePointVAO = instancePointVAO = std::make_shared<glVertexArray>(); + if (createIfRequired(instancePointVAO, commonInstancePointVAO)) { instancePointVAO->configure().addAttribs<InstanceVertex, &InstanceVertex::location>(0); } const auto & size = bodyMesh->getDimensions().size; diff --git a/game/scenary/illuminator.cpp b/game/scenary/illuminator.cpp index e991baa..3b73cd3 100644 --- a/game/scenary/illuminator.cpp +++ b/game/scenary/illuminator.cpp @@ -1,6 +1,7 @@ #include "illuminator.h" #include "gfx/gl/sceneShader.h" #include "gfx/models/texture.h" // IWYU pragma: keep +#include "util.h" #include <location.h> static_assert(std::is_constructible_v<Illuminator>); @@ -44,8 +45,7 @@ Illuminator::postLoad() } texture = getTexture(); glDebugScope _ {0}; - if (!(instanceVAO = commonInstanceVAO.lock())) { - commonInstanceVAO = instanceVAO = std::make_shared<glVertexArray>(); + if (createIfRequired(instanceVAO, commonInstanceVAO)) { bodyMesh->configureVAO(*instanceVAO, 0).addAttribs<InstanceVertex, &InstanceVertex::location>(1); } if (!spotLight.empty()) { |
