summaryrefslogtreecommitdiff
path: root/game/scenary/foliage.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-08-18 16:14:29 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-08-18 18:00:06 +0100
commit172beac34e82c86f8c16b8a1be5fca9d7ccfc0d1 (patch)
tree22607b9012b8140e6f80fad39f49d899ef12908c /game/scenary/foliage.cpp
parentAdd updateStencil to Renderable interface (diff)
downloadilt-172beac34e82c86f8c16b8a1be5fca9d7ccfc0d1.tar.bz2
ilt-172beac34e82c86f8c16b8a1be5fca9d7ccfc0d1.tar.xz
ilt-172beac34e82c86f8c16b8a1be5fca9d7ccfc0d1.zip
Update asset stencils from shadow mapper
Diffstat (limited to 'game/scenary/foliage.cpp')
-rw-r--r--game/scenary/foliage.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp
index ba1b37e..13d2f3b 100644
--- a/game/scenary/foliage.cpp
+++ b/game/scenary/foliage.cpp
@@ -3,7 +3,6 @@
#include "gfx/gl/shadowMapper.h"
#include "gfx/gl/vertexArrayObject.h"
#include "gfx/models/texture.h"
-#include "location.h"
bool
Foliage::persist(Persistence::PersistenceStore & store)
@@ -17,9 +16,15 @@ Foliage::postLoad()
texture = getTexture();
bodyMesh->configureVAO(instanceVAO)
.addAttribs<LocationVertex, &LocationVertex::first, &LocationVertex::second>(instances.bufferName(), 1);
- ShadowStenciller ss;
- ss.renderStencil(shadowStencil, *bodyMesh, texture);
- Texture::saveDepth(shadowStencil, std::format("/tmp/stencil-{}.tga", id).c_str());
+}
+
+void
+Foliage::updateStencil(const ShadowStenciller & ss) const
+{
+ if (instances.size() > 0) {
+ ss.renderStencil(shadowStencil, *bodyMesh, texture);
+ Texture::saveDepth(shadowStencil, std::format("/tmp/stencil-{}.tga", id).c_str());
+ }
}
void