diff --git a/code/AssetLib/XGL/XGLLoader.cpp b/code/AssetLib/XGL/XGLLoader.cpp index ba9e34be1..306841b4f 100644 --- a/code/AssetLib/XGL/XGLLoader.cpp +++ b/code/AssetLib/XGL/XGLLoader.cpp @@ -249,7 +249,7 @@ void XGLImporter::InternReadFile(const std::string &pFile, // ------------------------------------------------------------------------------------------------ void XGLImporter::ReadWorld(TempScope &scope) { - XmlNode *root = m_xmlParser->getRootNode(); + XmlNode *root = mXmlParser->getRootNode(); for (XmlNode &node : root->children()) { const std::string &s = node.name(); // XXX right now we'd skip if it comes after @@ -261,7 +261,7 @@ void XGLImporter::ReadWorld(TempScope &scope) { } } - aiNode *const nd = ReadObject(*root, scope, true, "world"); + aiNode *const nd = ReadObject( *root, scope, true); if (!nd) { ThrowException("failure reading "); } @@ -307,7 +307,7 @@ aiLight *XGLImporter::ReadDirectionalLight(XmlNode &node) { } // ------------------------------------------------------------------------------------------------ -aiNode *XGLImporter::ReadObject(XmlNode &node, TempScope &scope, bool skipFirst, const char *closetag) { +aiNode *XGLImporter::ReadObject(XmlNode &node, TempScope &scope, bool skipFirst/*, const char *closetag */) { aiNode *nd = new aiNode; std::vector children; std::vector meshes; @@ -508,7 +508,7 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) { TempMesh t; std::map bymat; - const unsigned int mesh_id = ReadIDAttr(node); + const unsigned int mesh_id = ReadIDAttr(node); for (XmlNode &child : node.children()) { const std::string &s = child.name(); @@ -546,22 +546,22 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) { TempFace tf[3]; bool has[3] = { false }; for (XmlNode &sub_child : child.children()) { - const std::string &s = sub_child.name(); - if (s == "fv1" || s == "lv1" || s == "pv1") { + const std::string &scn = sub_child.name(); + if (scn == "fv1" || scn == "lv1" || scn == "pv1") { ReadFaceVertex(sub_child, t, tf[0]); has[0] = true; - } else if (s == "fv2" || s == "lv2") { + } else if (scn == "fv2" || scn == "lv2") { ReadFaceVertex(sub_child, t, tf[1]); has[1] = true; - } else if (s == "fv3") { + } else if (scn == "fv3") { ReadFaceVertex(sub_child, t, tf[2]); has[2] = true; - } else if (s == "mat") { + } else if (scn == "mat") { if (mid != ~0u) { LogWarn("only one material tag allowed per "); } mid = ResolveMaterialRef(sub_child, scope); - } else if (s == "matref") { + } else if (scn == "matref") { if (mid != ~0u) { LogWarn("only one material tag allowed per "); } @@ -656,7 +656,7 @@ unsigned int XGLImporter::ResolveMaterialRef(XmlNode &node, TempScope &scope) { // ------------------------------------------------------------------------------------------------ void XGLImporter::ReadMaterial(XmlNode &node, TempScope &scope) { - const unsigned int mat_id = ReadIDAttr(node); + const unsigned int mat_id = ReadIDAttr(node); aiMaterial *mat(new aiMaterial); for (XmlNode &child : node.children()) { @@ -688,10 +688,7 @@ void XGLImporter::ReadMaterial(XmlNode &node, TempScope &scope) { // ---------------------------------------------------------------------------------------------- void XGLImporter::ReadFaceVertex(XmlNode &node, const TempMesh &t, TempFace &out) { - const std::string &end = node.name(); - bool havep = false; - //while (ReadElementUpToClosing(end.c_str())) { for (XmlNode &child : node.children()) { const std::string &s = child.name(); if (s == "pref") { diff --git a/code/AssetLib/XGL/XGLLoader.h b/code/AssetLib/XGL/XGLLoader.h index d8bef4f9c..c42b90f28 100644 --- a/code/AssetLib/XGL/XGLLoader.h +++ b/code/AssetLib/XGL/XGLLoader.h @@ -171,27 +171,26 @@ private: bool ReadElement(); bool ReadElementUpToClosing(const char *closetag); bool SkipToText(); - unsigned int ReadIDAttr(); + unsigned int ReadIDAttr(XmlNode &node); void ReadWorld(TempScope &scope); - void ReadLighting(TempScope &scope); - aiLight *ReadDirectionalLight(); - aiNode *ReadObject(TempScope &scope, bool skipFirst = false, const char *closetag = "object"); - bool ReadMesh(TempScope &scope); - void ReadMaterial(TempScope &scope); - aiVector2D ReadVec2(); - aiVector3D ReadVec3(); - aiColor3D ReadCol3(); - aiMatrix4x4 ReadTrafo(); - unsigned int ReadIndexFromText(); - float ReadFloat(); + void ReadLighting(XmlNode &node, TempScope &scope); + aiLight *ReadDirectionalLight(XmlNode &node); + aiNode *ReadObject(XmlNode &node, TempScope &scope, bool skipFirst = false/*, const char *closetag = "object"*/); + bool ReadMesh(XmlNode &node, TempScope &scope); + void ReadMaterial(XmlNode &node, TempScope &scope); + aiVector2D ReadVec2(XmlNode &node); + aiVector3D ReadVec3(XmlNode &node); + aiColor3D ReadCol3(XmlNode &node); + aiMatrix4x4 ReadTrafo(XmlNode &node); + unsigned int ReadIndexFromText(XmlNode &node); + float ReadFloat(XmlNode &node); aiMesh *ToOutputMesh(const TempMaterialMesh &m); - void ReadFaceVertex(const TempMesh &t, TempFace &out); - unsigned int ResolveMaterialRef(TempScope &scope); + void ReadFaceVertex(XmlNode &node, const TempMesh &t, TempFace &out); + unsigned int ResolveMaterialRef(XmlNode &node, TempScope &scope); private: - //std::shared_ptr m_reader; XmlParser *mXmlParser; aiScene *m_scene; };