From: Mikko Rasa Date: Tue, 13 Apr 2021 21:26:24 +0000 (+0300) Subject: New way of loading scenes in the viewer X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=bed45cf18a592f4dc3d899a48610eaea056f69f3;p=libs%2Fgl.git New way of loading scenes in the viewer --- diff --git a/tools/viewer.cpp b/tools/viewer.cpp index e19353c8..4ae9c87b 100644 --- a/tools/viewer.cpp +++ b/tools/viewer.cpp @@ -175,9 +175,16 @@ Viewer::Viewer(int argc, char **argv): renderable = load(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(opts.renderable_name); } else throw usage_error("Unknown renderable type");