//============================================================================== void Material::load(const CString& filename, ResourceInitializer& init) { try { m_vars = std::move(ResourceVector<MaterialVariable*>(init.m_alloc)); Dictionary<MaterialVariable*> dict(10, Dictionary<MaterialVariable*>::hasher(), Dictionary<MaterialVariable*>::key_equal(), init.m_alloc); m_varDict = std::move(dict); m_progs = std::move(ResourceVector<ProgramResourcePointer>(init.m_alloc)); m_pplines = std::move(ResourceVector<GlProgramPipelineHandle>(init.m_alloc)); XmlDocument doc; doc.loadFile(filename, init.m_tempAlloc); parseMaterialTag(doc.getChildElement("material"), init); } catch(std::exception& e) { throw ANKI_EXCEPTION("Failed to load material") << e; } }
//============================================================================== Error Material::load(const CString& filename, ResourceInitializer& init) { Error err = ErrorCode::NONE; m_resources = &init.m_resources; XmlDocument doc; ANKI_CHECK(doc.loadFile(filename, init.m_tempAlloc)); XmlElement el; ANKI_CHECK(doc.getChildElement("material", el)); ANKI_CHECK(parseMaterialTag(el , init)); return err; }