added delayed init call after scenegraph/meshes are done loading
[laserbrain_demo] / src / app.cc
index 63e7cd7..7b4280d 100644 (file)
@@ -84,6 +84,8 @@ static Renderer *rend;
 
 static Ray last_pick_ray;
 
+static bool post_scene_init_pending = true;
+
 
 bool app_init(int argc, char **argv)
 {
@@ -206,6 +208,11 @@ bool app_init(int argc, char **argv)
        return true;
 }
 
+static void post_scene_init()
+{
+       exman->load(mscn, "data/exhibits");
+}
+
 void app_cleanup()
 {
        if(mscn->music) {
@@ -257,6 +264,11 @@ static void update(float dt)
        texman.update();
        sceneman.update();
 
+       if(post_scene_init_pending && !sceneman.pending()) {
+               post_scene_init_pending = false;
+               post_scene_init();
+       }
+
        mscn->update(dt);
        exman->update(dt);
        exui_update(dt);