mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 08:30:13 +00:00
Align sun placement and shadow direction to active lighting
- drive shadow light direction from live LightingManager directionalDir - normalize shadow light to downward-facing convention with grazing-angle guard - make celestial/sky sun placement robust to directionalDir convention mismatches - keep visible sun above horizon while preserving shadow alignment
This commit is contained in:
parent
566e7138f3
commit
8156942b66
3 changed files with 43 additions and 4 deletions
|
|
@ -148,9 +148,13 @@ void SkySystem::render(const Camera& camera, const SkyParams& params) {
|
|||
glm::vec3 SkySystem::getSunPosition(const SkyParams& params) const {
|
||||
glm::vec3 dir = glm::normalize(params.directionalDir);
|
||||
if (glm::length(dir) < 0.0001f) {
|
||||
dir = glm::vec3(0.0f, 0.0f, 1.0f);
|
||||
dir = glm::vec3(0.0f, 0.0f, -1.0f);
|
||||
}
|
||||
glm::vec3 pos = dir * 800.0f;
|
||||
glm::vec3 sunDir = -dir;
|
||||
if (sunDir.z < 0.0f) {
|
||||
sunDir = dir;
|
||||
}
|
||||
glm::vec3 pos = sunDir * 800.0f;
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue