fix merge issues

pull/2966/head
kimkulling 2020-08-18 17:41:37 +02:00
parent 7e93ae4428
commit 6a8edb21f8
2 changed files with 25 additions and 29 deletions

View File

@ -249,7 +249,7 @@ void XGLImporter::InternReadFile(const std::string &pFile,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void XGLImporter::ReadWorld(TempScope &scope) { void XGLImporter::ReadWorld(TempScope &scope) {
XmlNode *root = m_xmlParser->getRootNode(); XmlNode *root = mXmlParser->getRootNode();
for (XmlNode &node : root->children()) { for (XmlNode &node : root->children()) {
const std::string &s = node.name(); const std::string &s = node.name();
// XXX right now we'd skip <lighting> if it comes after // XXX right now we'd skip <lighting> 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) { if (!nd) {
ThrowException("failure reading <world>"); ThrowException("failure reading <world>");
} }
@ -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; aiNode *nd = new aiNode;
std::vector<aiNode *> children; std::vector<aiNode *> children;
std::vector<unsigned int> meshes; std::vector<unsigned int> meshes;
@ -546,22 +546,22 @@ bool XGLImporter::ReadMesh(XmlNode &node, TempScope &scope) {
TempFace tf[3]; TempFace tf[3];
bool has[3] = { false }; bool has[3] = { false };
for (XmlNode &sub_child : child.children()) { for (XmlNode &sub_child : child.children()) {
const std::string &s = sub_child.name(); const std::string &scn = sub_child.name();
if (s == "fv1" || s == "lv1" || s == "pv1") { if (scn == "fv1" || scn == "lv1" || scn == "pv1") {
ReadFaceVertex(sub_child, t, tf[0]); ReadFaceVertex(sub_child, t, tf[0]);
has[0] = true; has[0] = true;
} else if (s == "fv2" || s == "lv2") { } else if (scn == "fv2" || scn == "lv2") {
ReadFaceVertex(sub_child, t, tf[1]); ReadFaceVertex(sub_child, t, tf[1]);
has[1] = true; has[1] = true;
} else if (s == "fv3") { } else if (scn == "fv3") {
ReadFaceVertex(sub_child, t, tf[2]); ReadFaceVertex(sub_child, t, tf[2]);
has[2] = true; has[2] = true;
} else if (s == "mat") { } else if (scn == "mat") {
if (mid != ~0u) { if (mid != ~0u) {
LogWarn("only one material tag allowed per <f>"); LogWarn("only one material tag allowed per <f>");
} }
mid = ResolveMaterialRef(sub_child, scope); mid = ResolveMaterialRef(sub_child, scope);
} else if (s == "matref") { } else if (scn == "matref") {
if (mid != ~0u) { if (mid != ~0u) {
LogWarn("only one material tag allowed per <f>"); LogWarn("only one material tag allowed per <f>");
} }
@ -688,10 +688,7 @@ void XGLImporter::ReadMaterial(XmlNode &node, TempScope &scope) {
// ---------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------
void XGLImporter::ReadFaceVertex(XmlNode &node, const TempMesh &t, TempFace &out) { void XGLImporter::ReadFaceVertex(XmlNode &node, const TempMesh &t, TempFace &out) {
const std::string &end = node.name();
bool havep = false; bool havep = false;
//while (ReadElementUpToClosing(end.c_str())) {
for (XmlNode &child : node.children()) { for (XmlNode &child : node.children()) {
const std::string &s = child.name(); const std::string &s = child.name();
if (s == "pref") { if (s == "pref") {

View File

@ -171,27 +171,26 @@ private:
bool ReadElement(); bool ReadElement();
bool ReadElementUpToClosing(const char *closetag); bool ReadElementUpToClosing(const char *closetag);
bool SkipToText(); bool SkipToText();
unsigned int ReadIDAttr(); unsigned int ReadIDAttr(XmlNode &node);
void ReadWorld(TempScope &scope); void ReadWorld(TempScope &scope);
void ReadLighting(TempScope &scope); void ReadLighting(XmlNode &node, TempScope &scope);
aiLight *ReadDirectionalLight(); aiLight *ReadDirectionalLight(XmlNode &node);
aiNode *ReadObject(TempScope &scope, bool skipFirst = false, const char *closetag = "object"); aiNode *ReadObject(XmlNode &node, TempScope &scope, bool skipFirst = false/*, const char *closetag = "object"*/);
bool ReadMesh(TempScope &scope); bool ReadMesh(XmlNode &node, TempScope &scope);
void ReadMaterial(TempScope &scope); void ReadMaterial(XmlNode &node, TempScope &scope);
aiVector2D ReadVec2(); aiVector2D ReadVec2(XmlNode &node);
aiVector3D ReadVec3(); aiVector3D ReadVec3(XmlNode &node);
aiColor3D ReadCol3(); aiColor3D ReadCol3(XmlNode &node);
aiMatrix4x4 ReadTrafo(); aiMatrix4x4 ReadTrafo(XmlNode &node);
unsigned int ReadIndexFromText(); unsigned int ReadIndexFromText(XmlNode &node);
float ReadFloat(); float ReadFloat(XmlNode &node);
aiMesh *ToOutputMesh(const TempMaterialMesh &m); aiMesh *ToOutputMesh(const TempMaterialMesh &m);
void ReadFaceVertex(const TempMesh &t, TempFace &out); void ReadFaceVertex(XmlNode &node, const TempMesh &t, TempFace &out);
unsigned int ResolveMaterialRef(TempScope &scope); unsigned int ResolveMaterialRef(XmlNode &node, TempScope &scope);
private: private:
//std::shared_ptr<irr::io::IrrXMLReader> m_reader;
XmlParser *mXmlParser; XmlParser *mXmlParser;
aiScene *m_scene; aiScene *m_scene;
}; };