mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
fix sun and shadows position synchronization
This commit is contained in:
parent
3e66ff5924
commit
1b84b7df5e
5 changed files with 35 additions and 18 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue