diff options
| author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2026-02-18 17:14:31 +0000 |
|---|---|---|
| committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2026-02-18 19:02:27 +0000 |
| commit | d8464a28c6066931dd638653e2a082e2640191dc (patch) | |
| tree | 18134e3ee51c9fd423b9395b90c3f19b6e54cfc3 /game/environment.cpp | |
| parent | Add Renderable::preFrame for doing non-const frame prep work (diff) | |
| download | ilt-d8464a28c6066931dd638653e2a082e2640191dc.tar.bz2 ilt-d8464a28c6066931dd638653e2a082e2640191dc.tar.xz ilt-d8464a28c6066931dd638653e2a082e2640191dc.zip | |
Fix up the preFrame process to use both frustums
(camera and directional light frustums)
This has made the whole preFrame process far more fiddly and repetitive
than I'd like, but it does work. Maybe we can tidy it up later.
Diffstat (limited to 'game/environment.cpp')
| -rw-r--r-- | game/environment.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/game/environment.cpp b/game/environment.cpp index acb4f21..1ef6e22 100644 --- a/game/environment.cpp +++ b/game/environment.cpp @@ -11,13 +11,19 @@ Environment::tick(TickDuration) worldTime += 50; } +Direction2D +Environment::getSunPos() const +{ + return getSunPos({}, worldTime); +} + void Environment::render(const SceneRenderer & renderer, const SceneProvider & scene) const { constexpr RGB baseAmbient {0.1F}, baseDirectional {0.0F}; constexpr RGB relativeAmbient {0.3F, 0.3F, 0.4F}, relativeDirectional {0.6F, 0.6F, 0.5F}; - const LightDirection sunPos = getSunPos({}, worldTime); + const LightDirection sunPos = getSunPos(); const auto ambient = baseAmbient + relativeAmbient * sunPos.ambient(); const auto directional = baseDirectional + relativeDirectional * sunPos.directional(); |
