From f7863ba011432d1c9b28601dfb5dcece2c37fd62 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Tue, 30 May 2023 09:31:16 -0700 Subject: Move debug rendering to the renderer. --- gltfview/src/game.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'gltfview') diff --git a/gltfview/src/game.c b/gltfview/src/game.c index 698267e..c711ce1 100644 --- a/gltfview/src/game.c +++ b/gltfview/src/game.c @@ -40,24 +40,6 @@ static const char* GIRL = static const char* CLOUDS1_TEXTURE = "/assets/skybox/clouds1/clouds1_west.bmp"; -// TODO: Move this debug rendering to the renderer. -static ShaderProgram* load_shader( - RenderBackend* render_backend, const char* view_mode) { - ShaderProgram* shader = 0; - if (strcmp(view_mode, "debug") == 0) { - shader = gfx_make_debug3d_shader(render_backend); - } else if (strcmp(view_mode, "normals") == 0) { - shader = gfx_make_view_normals_shader(render_backend); - } else if (strcmp(view_mode, "normal_mapped_normals") == 0) { - shader = gfx_make_view_normal_mapped_normals_shader(render_backend); - } else if (strcmp(view_mode, "tangents") == 0) { - shader = gfx_make_view_tangents_shader(render_backend); - } else { - shader = gfx_make_cook_torrance_shader(render_backend); - } - return shader; -} - /// Load the skyquad texture. static Texture* load_environment_map(RenderBackend* render_backend) { return gfx_load_texture( @@ -111,12 +93,6 @@ static SceneNode* load_scene( return 0; } - // TODO: Move the debug rendering to the renderer. - // ShaderProgram* shader = load_shader(game->render_backend, view_mode); - // if (!shader) { - // return false; - // } - SceneNode* scene_node = gfx_load_scene( game->gfx, sky_light_node, &(LoadSceneCmd){.origin = SceneFromFile, .filepath = scene_filepath}); @@ -285,16 +261,16 @@ void game_update(Game* game, double t, double dt) { } void game_render(const Game* game) { - gfx_render_scene(game->renderer, game->scene, game->camera); + gfx_render_scene( + game->renderer, + &(RenderSceneParams){ + .mode = RenderDefault, .scene = game->scene, .camera = game->camera}); ImmRenderer* imm = gfx_get_imm_renderer(game->gfx); assert(imm); gfx_imm_start(imm); gfx_imm_set_camera(imm, gfx_get_camera_camera(game->camera)); gfx_imm_set_colour(imm, vec4_make(0.2, 0.2, 1.0, 0.3)); - // DEBUG - // const aabb3 box = aabb3_make(vec3_make(0, 0, 0), vec3_make(1, 1, 1)); - // gfx_imm_draw_aabb(imm, box); render_bounding_boxes(imm, gfx_get_scene_root(game->scene)); gfx_imm_end(imm); } -- cgit v1.2.3