summaryrefslogtreecommitdiff
path: root/game/scenary
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-08-28 03:48:43 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-08-28 03:48:43 +0100
commit75905c01b13fd7a1d58494b8aaacb3b4b3cccdaa (patch)
tree51b8def5a9aa79d3d398aa8285bd88715c0a8897 /game/scenary
parentInitial cut of shadow map creation with support for billboard shadows (diff)
downloadilt-75905c01b13fd7a1d58494b8aaacb3b4b3cccdaa.tar.bz2
ilt-75905c01b13fd7a1d58494b8aaacb3b4b3cccdaa.tar.xz
ilt-75905c01b13fd7a1d58494b8aaacb3b4b3cccdaa.zip
Use billboard shadows for foliage
Diffstat (limited to 'game/scenary')
-rw-r--r--game/scenary/foliage.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/game/scenary/foliage.cpp b/game/scenary/foliage.cpp
index 1c03217..af67ea6 100644
--- a/game/scenary/foliage.cpp
+++ b/game/scenary/foliage.cpp
@@ -45,10 +45,12 @@ void
Foliage::shadows(const ShadowMapper & mapper) const
{
if (const auto count = instances.size()) {
- mapper.dynamicPointInstWithTextures.use();
- if (texture) {
- texture->bind(GL_TEXTURE3);
- }
- bodyMesh->DrawInstanced(instanceVAO, static_cast<GLsizei>(count));
+ const auto dimensions = bodyMesh->getDimensions();
+ mapper.stencilShadowProgram.use(dimensions.centre, dimensions.size);
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, shadowStencil);
+ glBindVertexArray(instancePointVAO);
+ glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(count));
+ glBindVertexArray(0);
}
}