diff --git a/core/shadows/ShadowRenderer.h b/core/shadows/ShadowRenderer.h index 2016911..28a66e1 100644 --- a/core/shadows/ShadowRenderer.h +++ b/core/shadows/ShadowRenderer.h @@ -58,7 +58,7 @@ class ShadowRenderer { float near_plane = 1.0f, far_plane = 75.0f; glm::mat4 lightProjection = glm::ortho(-50.0f, 50.0f, -50.0f, 50.0f, near_plane, far_plane); - glm::mat4 lightView = glm::lookAt(glm::vec3(-8.0f, 8.0f, -2.0f), + glm::mat4 lightView = glm::lookAt(*(_directionalLight->getDirection()) * 10.0f, glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/main.cpp b/main.cpp index 9e2330a..e4ae3a8 100644 --- a/main.cpp +++ b/main.cpp @@ -102,6 +102,9 @@ int main() { scene.onBeforeRenderObservable.add([&]() { float deltaTime = engine.getDeltaTime(); + glm::vec3 newLightDirection = glm::vec3(cosf(engine.getElapsedTime()), 1.0f, sinf(engine.getElapsedTime())); + light.setDirection(newLightDirection); + if (realTimePhysics) solver.solve(deltaTime); camera.update();