From 1e75db817c3bef320b57e3c8ef608715f36550a7 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 8 Feb 2024 08:09:11 -0800 Subject: Address TODO. --- game/src/plugins/gltf_view.c | 13 ++++++++++++- gfx/src/renderer/imm_renderer.c | 13 ------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/game/src/plugins/gltf_view.c b/game/src/plugins/gltf_view.c index 4ffdd1e..7c73844 100644 --- a/game/src/plugins/gltf_view.c +++ b/game/src/plugins/gltf_view.c @@ -186,13 +186,24 @@ void render(const Game* game, const State* state) { assert(state->scene); assert(state->camera); - ImmRenderer* imm = gfx_get_imm_renderer(game->gfx); + RenderBackend* render_backend = gfx_get_render_backend(game->gfx); + ImmRenderer* imm = gfx_get_imm_renderer(game->gfx); + assert(render_backend); assert(imm); + + gfx_set_blending(render_backend, true); + gfx_set_depth_mask(render_backend, false); + gfx_set_polygon_offset(render_backend, 0.5f, 0.5f); + gfx_imm_start(imm); gfx_imm_set_camera(imm, gfx_get_camera_camera(state->camera)); gfx_imm_set_colour(imm, vec4_make(0.2, 0.2, 1.0, 0.3)); render_bounding_boxes(imm, gfx_get_scene_root(state->scene)); gfx_imm_end(imm); + + gfx_set_polygon_offset(render_backend, 0.0f, 0.0f); + gfx_set_depth_mask(render_backend, true); + gfx_set_blending(render_backend, false); } void resize(Game* game, State* state, int width, int height) { diff --git a/gfx/src/renderer/imm_renderer.c b/gfx/src/renderer/imm_renderer.c index 492c7af..87e7717 100644 --- a/gfx/src/renderer/imm_renderer.c +++ b/gfx/src/renderer/imm_renderer.c @@ -81,29 +81,16 @@ void imm_renderer_flush(ImmRenderer* renderer) { void gfx_imm_start(ImmRenderer* renderer) { assert(renderer); - // Shader uniforms are applied lazily. // TODO: In the event that gfx_activate_shader_program() activates uniforms // automatically for convenience, call an overload here that doesn't do so. ShaderProgram* shader = renderer->shader; gfx_activate_shader_program(shader); - - // TODO: Move this to the gltf_view program. - // gfx_set_blending(renderer->render_backend, true); - // gfx_set_depth_mask(renderer->render_backend, false); - // gfx_set_polygon_offset(renderer->render_backend, 0.5f, 0.5f); } void gfx_imm_end(ImmRenderer* renderer) { assert(renderer); - imm_renderer_flush(renderer); - - // TODO: Move this to the gltf_view program. - // gfx_set_polygon_offset(renderer->render_backend, 0.0f, 0.0f); - // gfx_set_depth_mask(renderer->render_backend, true); - // gfx_set_blending(renderer->render_backend, false); - gfx_deactivate_shader_program(renderer->shader); } -- cgit v1.2.3