diff options
author | 3gg <3gg@shellblade.net> | 2024-02-08 08:09:11 -0800 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2024-02-08 08:09:11 -0800 |
commit | 1e75db817c3bef320b57e3c8ef608715f36550a7 (patch) | |
tree | 3620779de1369541c4b98dece2eb783cf3310781 | |
parent | d130c2c7314cf4884f444db16d7717b7356b54ff (diff) |
Address TODO.
-rw-r--r-- | game/src/plugins/gltf_view.c | 13 | ||||
-rw-r--r-- | 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) { | |||
186 | assert(state->scene); | 186 | assert(state->scene); |
187 | assert(state->camera); | 187 | assert(state->camera); |
188 | 188 | ||
189 | ImmRenderer* imm = gfx_get_imm_renderer(game->gfx); | 189 | RenderBackend* render_backend = gfx_get_render_backend(game->gfx); |
190 | ImmRenderer* imm = gfx_get_imm_renderer(game->gfx); | ||
191 | assert(render_backend); | ||
190 | assert(imm); | 192 | assert(imm); |
193 | |||
194 | gfx_set_blending(render_backend, true); | ||
195 | gfx_set_depth_mask(render_backend, false); | ||
196 | gfx_set_polygon_offset(render_backend, 0.5f, 0.5f); | ||
197 | |||
191 | gfx_imm_start(imm); | 198 | gfx_imm_start(imm); |
192 | gfx_imm_set_camera(imm, gfx_get_camera_camera(state->camera)); | 199 | gfx_imm_set_camera(imm, gfx_get_camera_camera(state->camera)); |
193 | gfx_imm_set_colour(imm, vec4_make(0.2, 0.2, 1.0, 0.3)); | 200 | gfx_imm_set_colour(imm, vec4_make(0.2, 0.2, 1.0, 0.3)); |
194 | render_bounding_boxes(imm, gfx_get_scene_root(state->scene)); | 201 | render_bounding_boxes(imm, gfx_get_scene_root(state->scene)); |
195 | gfx_imm_end(imm); | 202 | gfx_imm_end(imm); |
203 | |||
204 | gfx_set_polygon_offset(render_backend, 0.0f, 0.0f); | ||
205 | gfx_set_depth_mask(render_backend, true); | ||
206 | gfx_set_blending(render_backend, false); | ||
196 | } | 207 | } |
197 | 208 | ||
198 | void resize(Game* game, State* state, int width, int height) { | 209 | 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) { | |||
81 | 81 | ||
82 | void gfx_imm_start(ImmRenderer* renderer) { | 82 | void gfx_imm_start(ImmRenderer* renderer) { |
83 | assert(renderer); | 83 | assert(renderer); |
84 | |||
85 | // Shader uniforms are applied lazily. | 84 | // Shader uniforms are applied lazily. |
86 | // TODO: In the event that gfx_activate_shader_program() activates uniforms | 85 | // TODO: In the event that gfx_activate_shader_program() activates uniforms |
87 | // automatically for convenience, call an overload here that doesn't do so. | 86 | // automatically for convenience, call an overload here that doesn't do so. |
88 | ShaderProgram* shader = renderer->shader; | 87 | ShaderProgram* shader = renderer->shader; |
89 | gfx_activate_shader_program(shader); | 88 | gfx_activate_shader_program(shader); |
90 | |||
91 | // TODO: Move this to the gltf_view program. | ||
92 | // gfx_set_blending(renderer->render_backend, true); | ||
93 | // gfx_set_depth_mask(renderer->render_backend, false); | ||
94 | // gfx_set_polygon_offset(renderer->render_backend, 0.5f, 0.5f); | ||
95 | } | 89 | } |
96 | 90 | ||
97 | void gfx_imm_end(ImmRenderer* renderer) { | 91 | void gfx_imm_end(ImmRenderer* renderer) { |
98 | assert(renderer); | 92 | assert(renderer); |
99 | |||
100 | imm_renderer_flush(renderer); | 93 | imm_renderer_flush(renderer); |
101 | |||
102 | // TODO: Move this to the gltf_view program. | ||
103 | // gfx_set_polygon_offset(renderer->render_backend, 0.0f, 0.0f); | ||
104 | // gfx_set_depth_mask(renderer->render_backend, true); | ||
105 | // gfx_set_blending(renderer->render_backend, false); | ||
106 | |||
107 | gfx_deactivate_shader_program(renderer->shader); | 94 | gfx_deactivate_shader_program(renderer->shader); |
108 | } | 95 | } |
109 | 96 | ||