From d130c2c7314cf4884f444db16d7717b7356b54ff Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Thu, 8 Feb 2024 07:58:22 -0800 Subject: Add window width and height to game. --- game/src/plugins/gltf_view.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'game/src/plugins/gltf_view.c') diff --git a/game/src/plugins/gltf_view.c b/game/src/plugins/gltf_view.c index c19d1b8..4ffdd1e 100644 --- a/game/src/plugins/gltf_view.c +++ b/game/src/plugins/gltf_view.c @@ -169,7 +169,7 @@ static void render_bounding_boxes(ImmRenderer* imm, const SceneNode* node) { const SceneObject* obj = gfx_get_node_object(node); const aabb3 box = gfx_calc_object_aabb(obj); gfx_imm_set_model_matrix(imm, &model); - gfx_imm_draw_aabb(imm, box); + gfx_imm_draw_aabb3(imm, box); } // Render children's boxes. @@ -194,3 +194,17 @@ void render(const Game* game, const State* state) { render_bounding_boxes(imm, gfx_get_scene_root(state->scene)); gfx_imm_end(imm); } + +void resize(Game* game, State* state, int width, int height) { + assert(game); + assert(state); + + const R fovy = 90 * TO_RAD; + const R aspect = (R)width / (R)height; + const R near = 0.1; + const R far = 1000; + const mat4 projection = mat4_perspective(fovy, aspect, near, far); + + Camera* camera = gfx_get_camera_camera(state->camera); + camera->projection = projection; +} -- cgit v1.2.3