summaryrefslogtreecommitdiff
path: root/gltfview
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2023-05-30 09:31:16 -0700
committer3gg <3gg@shellblade.net>2023-05-30 09:31:16 -0700
commitf7863ba011432d1c9b28601dfb5dcece2c37fd62 (patch)
tree30157e0ae3ea7b3ae523e843c00921fb5026a6ca /gltfview
parent42c59e0892507c577611b7af7dde90775dfe7aa0 (diff)
Move debug rendering to the renderer.
Diffstat (limited to 'gltfview')
-rw-r--r--gltfview/src/game.c32
1 files changed, 4 insertions, 28 deletions
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 =
40 40
41static const char* CLOUDS1_TEXTURE = "/assets/skybox/clouds1/clouds1_west.bmp"; 41static const char* CLOUDS1_TEXTURE = "/assets/skybox/clouds1/clouds1_west.bmp";
42 42
43// TODO: Move this debug rendering to the renderer.
44static ShaderProgram* load_shader(
45 RenderBackend* render_backend, const char* view_mode) {
46 ShaderProgram* shader = 0;
47 if (strcmp(view_mode, "debug") == 0) {
48 shader = gfx_make_debug3d_shader(render_backend);
49 } else if (strcmp(view_mode, "normals") == 0) {
50 shader = gfx_make_view_normals_shader(render_backend);
51 } else if (strcmp(view_mode, "normal_mapped_normals") == 0) {
52 shader = gfx_make_view_normal_mapped_normals_shader(render_backend);
53 } else if (strcmp(view_mode, "tangents") == 0) {
54 shader = gfx_make_view_tangents_shader(render_backend);
55 } else {
56 shader = gfx_make_cook_torrance_shader(render_backend);
57 }
58 return shader;
59}
60
61/// Load the skyquad texture. 43/// Load the skyquad texture.
62static Texture* load_environment_map(RenderBackend* render_backend) { 44static Texture* load_environment_map(RenderBackend* render_backend) {
63 return gfx_load_texture( 45 return gfx_load_texture(
@@ -111,12 +93,6 @@ static SceneNode* load_scene(
111 return 0; 93 return 0;
112 } 94 }
113 95
114 // TODO: Move the debug rendering to the renderer.
115 // ShaderProgram* shader = load_shader(game->render_backend, view_mode);
116 // if (!shader) {
117 // return false;
118 // }
119
120 SceneNode* scene_node = gfx_load_scene( 96 SceneNode* scene_node = gfx_load_scene(
121 game->gfx, sky_light_node, 97 game->gfx, sky_light_node,
122 &(LoadSceneCmd){.origin = SceneFromFile, .filepath = scene_filepath}); 98 &(LoadSceneCmd){.origin = SceneFromFile, .filepath = scene_filepath});
@@ -285,16 +261,16 @@ void game_update(Game* game, double t, double dt) {
285} 261}
286 262
287void game_render(const Game* game) { 263void game_render(const Game* game) {
288 gfx_render_scene(game->renderer, game->scene, game->camera); 264 gfx_render_scene(
265 game->renderer,
266 &(RenderSceneParams){
267 .mode = RenderDefault, .scene = game->scene, .camera = game->camera});
289 268
290 ImmRenderer* imm = gfx_get_imm_renderer(game->gfx); 269 ImmRenderer* imm = gfx_get_imm_renderer(game->gfx);
291 assert(imm); 270 assert(imm);
292 gfx_imm_start(imm); 271 gfx_imm_start(imm);
293 gfx_imm_set_camera(imm, gfx_get_camera_camera(game->camera)); 272 gfx_imm_set_camera(imm, gfx_get_camera_camera(game->camera));
294 gfx_imm_set_colour(imm, vec4_make(0.2, 0.2, 1.0, 0.3)); 273 gfx_imm_set_colour(imm, vec4_make(0.2, 0.2, 1.0, 0.3));
295 // DEBUG
296 // const aabb3 box = aabb3_make(vec3_make(0, 0, 0), vec3_make(1, 1, 1));
297 // gfx_imm_draw_aabb(imm, box);
298 render_bounding_boxes(imm, gfx_get_scene_root(game->scene)); 274 render_bounding_boxes(imm, gfx_get_scene_root(game->scene));
299 gfx_imm_end(imm); 275 gfx_imm_end(imm);
300} 276}