summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/src/plugins/gltf_view.c13
-rw-r--r--gfx/src/renderer/imm_renderer.c13
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
198void resize(Game* game, State* state, int width, int height) { 209void 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
82void gfx_imm_start(ImmRenderer* renderer) { 82void 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
97void gfx_imm_end(ImmRenderer* renderer) { 91void 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