]> git.tdb.fi Git - libs/gl.git/commitdiff
New way of loading scenes in the viewer
authorMikko Rasa <tdb@tdb.fi>
Tue, 13 Apr 2021 21:26:24 +0000 (00:26 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 13 Apr 2021 21:26:24 +0000 (00:26 +0300)
tools/viewer.cpp

index e19353c8adbf0c4e52b7fc90c701ddc715caa837..4ae9c87b26c7483bdb1ad7c4fd2b1637d5d80aa0 100644 (file)
@@ -175,9 +175,16 @@ Viewer::Viewer(int argc, char **argv):
                renderable = load<GL::Object>(opts.renderable_name);
        else if(ext==".scene")
        {
-               GL::SimpleScene *scene = new GL::SimpleScene;
-               DataFile::load(*scene, opts.renderable_name, resources);
-               renderable = scene;
+               if(FS::exists(opts.renderable_name))
+               {
+                       GL::Scene::GenericLoader ldr(resources);
+                       IO::BufferedFile in(opts.renderable_name);
+                       DataFile::Parser parser(in, opts.renderable_name);
+                       ldr.load(parser);
+                       renderable = ldr.get_scene();
+               }
+               else
+                       renderable = &resources.get<GL::Scene>(opts.renderable_name);
        }
        else
                throw usage_error("Unknown renderable type");