From 5b4a34cb8c272c96f94fc0d45684f675085587a6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 21 Feb 2026 00:50:31 +0000 Subject: Simplified Frustum Don't need to differentiate between shadedBy by contains. The 5 plane/face variant is actually fine in both cases. For a perspective projection, the near plane is essentially at the origin and is handled by the left/right/top/bottom planes meeting. For the directional light case (orthographic projection) the near plane is omitted as objects in front of the clip space still cast shadows into it. Also includes a fix the distance calculation to not add .w, don't know where I got the idea this was right. --- game/terrain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'game/terrain.cpp') diff --git a/game/terrain.cpp b/game/terrain.cpp index f10aac6..187d035 100644 --- a/game/terrain.cpp +++ b/game/terrain.cpp @@ -152,7 +152,7 @@ Terrain::shadows(const ShadowMapper & shadowMapper, const Frustum & frustum) con { shadowMapper.landmess.use(); for (const auto & [surface, sab] : meshes) { - if (frustum.shadedBy(sab.aabb)) { + if (frustum.contains(sab.aabb)) { glBindVertexArray(sab.vertexArray); glDrawElements(GL_TRIANGLES, sab.count, GL_UNSIGNED_INT, nullptr); } -- cgit v1.3