summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/src/plugins/viewer.c14
1 files changed, 4 insertions, 10 deletions
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) {
102bool init(Game* game, State** pp_state) { 102bool init(Game* game, State** pp_state) {
103 assert(game); 103 assert(game);
104 104
105 // Usage: <scene file>
106 const char* scene_filepath =
107 game->argc > 1 ? game->argv[1] : DEFAULT_SCENE_FILE;
108
105 State* state = calloc(1, sizeof(State)); 109 State* state = calloc(1, sizeof(State));
106 if (!state) { 110 if (!state) {
107 goto cleanup; 111 goto cleanup;
@@ -114,12 +118,6 @@ bool init(Game* game, State** pp_state) {
114 goto cleanup; 118 goto cleanup;
115 } 119 }
116 120
117 const int argc = game->argc;
118 const char** argv = game->argv;
119
120 // Usage: <scene file>
121 const char* scene_filepath = argc > 1 ? argv[1] : DEFAULT_SCENE_FILE;
122
123 state->model = load_scene(game, state, scene_filepath); 121 state->model = load_scene(game, state, scene_filepath);
124 if (!state->model) { 122 if (!state->model) {
125 goto cleanup; 123 goto cleanup;
@@ -145,10 +143,6 @@ cleanup:
145void shutdown(Game* game, State* state) { 143void shutdown(Game* game, State* state) {
146 assert(game); 144 assert(game);
147 if (state) { 145 if (state) {
148 // TODO: Destroying the scene here currently does not play well with asset
149 // reloading. The issue is that we expect to mutate the scene/model during
150 // animation. This needs to change if we want to be able to cache assets
151 // in memory.
152 gfx_destroy_camera(&state->camera); 146 gfx_destroy_camera(&state->camera);
153 gfx_destroy_scene(&state->scene); 147 gfx_destroy_scene(&state->scene);
154 // State freed by plugin engine. 148 // State freed by plugin engine.