From dc2466b88b4478d8944251d9d97cbe0c774f5ca0 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 17 Feb 2024 13:54:40 -0800 Subject: Address viewer reloading TODO. This works now with the recent changes to the asset cache. --- game/src/plugins/viewer.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'game/src') diff --git a/game/src/plugins/viewer.c b/game/src/plugins/viewer.c index c58b0e0..945a422 100644 --- a/game/src/plugins/viewer.c +++ b/game/src/plugins/viewer.c @@ -102,6 +102,10 @@ static Model* load_scene(Game* game, State* state, const char* scene_filepath) { bool init(Game* game, State** pp_state) { assert(game); + // Usage: + const char* scene_filepath = + game->argc > 1 ? game->argv[1] : DEFAULT_SCENE_FILE; + State* state = calloc(1, sizeof(State)); if (!state) { goto cleanup; @@ -114,12 +118,6 @@ bool init(Game* game, State** pp_state) { goto cleanup; } - const int argc = game->argc; - const char** argv = game->argv; - - // Usage: - const char* scene_filepath = argc > 1 ? argv[1] : DEFAULT_SCENE_FILE; - state->model = load_scene(game, state, scene_filepath); if (!state->model) { goto cleanup; @@ -145,10 +143,6 @@ cleanup: void shutdown(Game* game, State* state) { assert(game); if (state) { - // TODO: Destroying the scene here currently does not play well with asset - // reloading. The issue is that we expect to mutate the scene/model during - // animation. This needs to change if we want to be able to cache assets - // in memory. gfx_destroy_camera(&state->camera); gfx_destroy_scene(&state->scene); // State freed by plugin engine. -- cgit v1.2.3