/* This file is part of Mitsuba, a physically based rendering system. Copyright (c) 2007-2010 by Wenzel Jakob and others. Mitsuba is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation. Mitsuba is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include #include #include #include #include MTS_NAMESPACE_BEGIN ref Utility::loadScene(const std::string &filename) { /* Prepare for parsing scene descriptions */ FileResolver *resolver = Thread::getThread()->getFileResolver(); SAXParser* parser = new SAXParser(); fs::path schemaPath = resolver->resolveAbsolute("schema/scene.xsd"); /* Check against the 'scene.xsd' XML Schema */ parser->setDoSchema(true); parser->setValidationSchemaFullChecking(true); parser->setValidationScheme(SAXParser::Val_Always); parser->setExternalNoNamespaceSchemaLocation(schemaPath.file_string().c_str()); std::map parameters; SceneHandler *handler = new SceneHandler(parameters); parser->setDoNamespaces(true); parser->setDocumentHandler(handler); parser->setErrorHandler(handler); parser->parse(filename.c_str()); ref scene = handler->getScene(); delete parser; delete handler; return scene; } MTS_IMPLEMENT_CLASS(Utility, true, Object) MTS_NAMESPACE_END