From 621c35587650a9a4e2e0c66943ce0f4c688b0fa0 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sun, 20 Sep 2026 12:38:23 -0400 Subject: [PATCH] It was one line again. --- 33-shadow-mapping/config.json | 10 +++++++--- 33-shadow-mapping/src/scene.cpp | 9 +++++---- 33-shadow-mapping/src/scene.hpp | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/33-shadow-mapping/config.json b/33-shadow-mapping/config.json index 833a5a3..585ef07 100644 --- a/33-shadow-mapping/config.json +++ b/33-shadow-mapping/config.json @@ -62,6 +62,10 @@ "light_bulb": { "directory": "assets", "model_path": "light_bulb.glb" + }, + "human": { + "directory": "../assets", + "model_path": "human.glb" } }, "things": [ @@ -73,15 +77,15 @@ "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]}, "scale": 1.0, "material": "shiny"}, - {"model": "marble_cube", "position": [1.28, 0.0, 1.33], + {"model": "human", "position": [1.28, 0.0, 1.33], "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]}, "scale": 1.0, "material": "default"}, - {"model": "marble_cube", "position": [1.28, 0.0, 1.85], + {"model": "human", "position": [1.28, 0.0, 1.85], "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]}, "scale": 1.0, "material": "shiny"}, - {"model": "marble_cube", "position": [3.13, 0.80, 3.04], + {"model": "human", "position": [3.13, 0.80, 3.04], "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]}, "scale": 1.0, "material": "shiny"}, diff --git a/33-shadow-mapping/src/scene.cpp b/33-shadow-mapping/src/scene.cpp index b711d3f..19ff320 100644 --- a/33-shadow-mapping/src/scene.cpp +++ b/33-shadow-mapping/src/scene.cpp @@ -53,8 +53,6 @@ void Scene::render_scene(GLFWwindow* window, Shader& with_shader) { } void Scene::render_shadows(GLFWwindow* window) { - glClearColor(0.1f, 0.1f, 0.1f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // temporarily use the config.json positioned even though this is doing a directional auto& light_pos = light.positioned.at(0).position; @@ -69,12 +67,16 @@ void Scene::render_shadows(GLFWwindow* window) { depth_shader.setFloat("far_plane", depth_far_plane); glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); + glClearColor(0.1f, 0.1f, 0.1f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBindFramebuffer(GL_FRAMEBUFFER, depth_FBO); + glEnable(GL_DEPTH_TEST); glClear(GL_DEPTH_BUFFER_BIT); render_scene(window, depth_shader); glBindFramebuffer(GL_FRAMEBUFFER, 0); + glDisable(GL_DEPTH_TEST); glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } @@ -98,6 +100,7 @@ void Scene::render(GLFWwindow* window) { framebuffer.begin(); render_scene(window, with_shader); + render_skybox(); framebuffer.commit(); framebuffer.draw(screen); @@ -163,7 +166,6 @@ void Scene::init_shadows() { } void Scene::init_skybox() { - dbc::sentinel("DISABLED, do not run me."); glBindVertexArray(skyboxVAO); glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO); glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW); @@ -216,7 +218,6 @@ void Scene::load_skybox_textures() { } void Scene::render_skybox() { - dbc::sentinel("DISABLED, do not run me."); glDepthFunc(GL_LEQUAL); skybox_shader.use(); glm::mat4 view = glm::mat4(glm::mat3(camera.look_at())); diff --git a/33-shadow-mapping/src/scene.hpp b/33-shadow-mapping/src/scene.hpp index b7d1279..cc28cf1 100644 --- a/33-shadow-mapping/src/scene.hpp +++ b/33-shadow-mapping/src/scene.hpp @@ -117,7 +117,7 @@ struct Scene { framebuffer.init(); screen.init(); - // init_skybox(); + init_skybox(); init_shadows(); init_debug(); }