From 75905c01b13fd7a1d58494b8aaacb3b4b3cccdaa Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 28 Aug 2024 03:48:43 +0100 Subject: Use billboard shadows for foliage --- game/scenary/foliage.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'game') 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(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(count)); + glBindVertexArray(0); } } -- cgit v1.2.3