summaryrefslogtreecommitdiff
path: root/game/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'game/src/plugins')
-rw-r--r--game/src/plugins/gltf_view.c16
-rw-r--r--game/src/plugins/plugin.h2
-rw-r--r--game/src/plugins/texture_view.c3
3 files changed, 16 insertions, 5 deletions
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) {
169 const SceneObject* obj = gfx_get_node_object(node); 169 const SceneObject* obj = gfx_get_node_object(node);
170 const aabb3 box = gfx_calc_object_aabb(obj); 170 const aabb3 box = gfx_calc_object_aabb(obj);
171 gfx_imm_set_model_matrix(imm, &model); 171 gfx_imm_set_model_matrix(imm, &model);
172 gfx_imm_draw_aabb(imm, box); 172 gfx_imm_draw_aabb3(imm, box);
173 } 173 }
174 174
175 // Render children's boxes. 175 // Render children's boxes.
@@ -194,3 +194,17 @@ void render(const Game* game, const State* state) {
194 render_bounding_boxes(imm, gfx_get_scene_root(state->scene)); 194 render_bounding_boxes(imm, gfx_get_scene_root(state->scene));
195 gfx_imm_end(imm); 195 gfx_imm_end(imm);
196} 196}
197
198void resize(Game* game, State* state, int width, int height) {
199 assert(game);
200 assert(state);
201
202 const R fovy = 90 * TO_RAD;
203 const R aspect = (R)width / (R)height;
204 const R near = 0.1;
205 const R far = 1000;
206 const mat4 projection = mat4_perspective(fovy, aspect, near, far);
207
208 Camera* camera = gfx_get_camera_camera(state->camera);
209 camera->projection = projection;
210}
diff --git a/game/src/plugins/plugin.h b/game/src/plugins/plugin.h
index a2632cd..f7219c6 100644
--- a/game/src/plugins/plugin.h
+++ b/game/src/plugins/plugin.h
@@ -41,7 +41,7 @@ void update(Game*, State*, double t, double dt);
41void render(const Game*, const State*); 41void render(const Game*, const State*);
42 42
43/// Called when the game's window is resized. 43/// Called when the game's window is resized.
44void resize(Game* game, State* state, int width, int height); 44void resize(Game*, State*, int width, int height);
45 45
46// Signatures for the plugin's exposed functions. 46// Signatures for the plugin's exposed functions.
47typedef bool (*plugin_init)(Game*, State**); 47typedef bool (*plugin_init)(Game*, State**);
diff --git a/game/src/plugins/texture_view.c b/game/src/plugins/texture_view.c
index b424158..31bf23e 100644
--- a/game/src/plugins/texture_view.c
+++ b/game/src/plugins/texture_view.c
@@ -133,9 +133,6 @@ void resize(Game* game, State* state, int width, int height) {
133 assert(game); 133 assert(game);
134 assert(state); 134 assert(state);
135 135
136 RenderBackend* render_backend = gfx_get_render_backend(game->gfx);
137 gfx_set_viewport(render_backend, width, height);
138
139 const R fovy = 90 * TO_RAD; 136 const R fovy = 90 * TO_RAD;
140 const R aspect = (R)width / (R)height; 137 const R aspect = (R)width / (R)height;
141 const R near = 0.1; 138 const R near = 0.1;