It was one line again.

This commit is contained in:
Zed A. Shaw 2026-09-20 12:38:23 -04:00
parent 5577ab0f0b
commit 621c355876
3 changed files with 13 additions and 8 deletions

View file

@ -62,6 +62,10 @@
"light_bulb": { "light_bulb": {
"directory": "assets", "directory": "assets",
"model_path": "light_bulb.glb" "model_path": "light_bulb.glb"
},
"human": {
"directory": "../assets",
"model_path": "human.glb"
} }
}, },
"things": [ "things": [
@ -73,15 +77,15 @@
"rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]}, "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]},
"scale": 1.0, "scale": 1.0,
"material": "shiny"}, "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]}, "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]},
"scale": 1.0, "scale": 1.0,
"material": "default"}, "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]}, "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]},
"scale": 1.0, "scale": 1.0,
"material": "shiny"}, "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]}, "rotation": {"angle": 0.0, "axes": [1.0, 1.0, 1.0]},
"scale": 1.0, "scale": 1.0,
"material": "shiny"}, "material": "shiny"},

View file

@ -53,8 +53,6 @@ void Scene::render_scene(GLFWwindow* window, Shader& with_shader) {
} }
void Scene::render_shadows(GLFWwindow* window) { 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 // temporarily use the config.json positioned even though this is doing a directional
auto& light_pos = light.positioned.at(0).position; 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); depth_shader.setFloat("far_plane", depth_far_plane);
glViewport(0, 0, SHADOW_WIDTH, SHADOW_HEIGHT); 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); glBindFramebuffer(GL_FRAMEBUFFER, depth_FBO);
glEnable(GL_DEPTH_TEST);
glClear(GL_DEPTH_BUFFER_BIT); glClear(GL_DEPTH_BUFFER_BIT);
render_scene(window, depth_shader); render_scene(window, depth_shader);
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDisable(GL_DEPTH_TEST);
glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT); glViewport(0, 0, SCR_WIDTH, SCR_HEIGHT);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
} }
@ -98,6 +100,7 @@ void Scene::render(GLFWwindow* window) {
framebuffer.begin(); framebuffer.begin();
render_scene(window, with_shader); render_scene(window, with_shader);
render_skybox();
framebuffer.commit(); framebuffer.commit();
framebuffer.draw(screen); framebuffer.draw(screen);
@ -163,7 +166,6 @@ void Scene::init_shadows() {
} }
void Scene::init_skybox() { void Scene::init_skybox() {
dbc::sentinel("DISABLED, do not run me.");
glBindVertexArray(skyboxVAO); glBindVertexArray(skyboxVAO);
glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO); glBindBuffer(GL_ARRAY_BUFFER, skyboxVBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, sizeof(skyboxVertices), &skyboxVertices, GL_STATIC_DRAW);
@ -216,7 +218,6 @@ void Scene::load_skybox_textures() {
} }
void Scene::render_skybox() { void Scene::render_skybox() {
dbc::sentinel("DISABLED, do not run me.");
glDepthFunc(GL_LEQUAL); glDepthFunc(GL_LEQUAL);
skybox_shader.use(); skybox_shader.use();
glm::mat4 view = glm::mat4(glm::mat3(camera.look_at())); glm::mat4 view = glm::mat4(glm::mat3(camera.look_at()));

View file

@ -117,7 +117,7 @@ struct Scene {
framebuffer.init(); framebuffer.init();
screen.init(); screen.init();
// init_skybox(); init_skybox();
init_shadows(); init_shadows();
init_debug(); init_debug();
} }