From bed45cf18a592f4dc3d899a48610eaea056f69f3 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 14 Apr 2021 00:26:24 +0300 Subject: [PATCH] New way of loading scenes in the viewer --- tools/viewer.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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"); -- 2.45.2