fix sun and shadows position synchronization

This commit is contained in:
MihailRis
2025-06-15 03:35:40 +03:00
parent 3e66ff5924
commit 1b84b7df5e
5 changed files with 35 additions and 18 deletions
+4 -3
View File
@@ -384,10 +384,11 @@ void WorldRenderer::generateShadowsMap(
90.0f -
((static_cast<int>(t / sunCycleStep)) * sunCycleStep + 0.25f) * 360.0f
);
float sunAltitude = glm::pi<float>() * 0.25f;
shadowCamera.rotate(
sunAngle,
glm::radians(-45.0f),
glm::radians(-0.0f)
-glm::cos(sunAngle + glm::pi<float>() * 0.5f) * sunAltitude,
sunAngle - glm::pi<float>() * 0.5f,
glm::radians(0.0f)
);
shadowCamera.updateVectors();