diff options
| author | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-02-21 00:50:31 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-02-21 00:50:31 +0000 |
| commit | 5b4a34cb8c272c96f94fc0d45684f675085587a6 (patch) | |
| tree | 271f0d18dd241aa7c53a221a28eababb65b32578 /gfx/frustum.h | |
| parent | Reduce shader includes, doesn't use materialInterface, just Detail (diff) | |
| download | ilt-5b4a34cb8c272c96f94fc0d45684f675085587a6.tar.bz2 ilt-5b4a34cb8c272c96f94fc0d45684f675085587a6.tar.xz ilt-5b4a34cb8c272c96f94fc0d45684f675085587a6.zip | |
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.
Diffstat (limited to 'gfx/frustum.h')
| -rw-r--r-- | gfx/frustum.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/gfx/frustum.h b/gfx/frustum.h index 1493a36..cd4cbe1 100644 --- a/gfx/frustum.h +++ b/gfx/frustum.h @@ -33,14 +33,11 @@ public: using BoundingBox = AxisAlignedBoundingBox<GlobalDistance>; [[nodiscard]] bool contains(const BoundingBox &) const; [[nodiscard]] bool contains(GlobalPosition3D, RelativeDistance size = 0) const; - [[nodiscard]] bool shadedBy(const BoundingBox &) const; - [[nodiscard]] bool shadedBy(GlobalPosition3D, RelativeDistance size = 0) const; protected: - static constexpr size_t FACES = 6; + static constexpr size_t FACES = 5; void updateCache(); - [[nodiscard]] bool boundByPlanes(const BoundingBox &, size_t nplanes) const; - [[nodiscard]] bool contains(std::span<const RelativePosition4D>, size_t nplanes, RelativeDistance) const; + [[nodiscard]] bool contains(std::span<const RelativePosition4D>, RelativeDistance) const; GlobalPosition3D position; glm::mat4 view, projection; |
