Skip to content

Commit

Permalink
animated shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
BarthPaleologue committed Oct 21, 2023
1 parent 0339bc7 commit e7dc5c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/shadows/ShadowRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
3 changes: 3 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e7dc5c3

Please sign in to comment.