diff --git a/code/OgreMaterial.cpp b/code/OgreMaterial.cpp index d4ee97366..4ef4b44ec 100644 --- a/code/OgreMaterial.cpp +++ b/code/OgreMaterial.cpp @@ -217,8 +217,7 @@ aiMaterial* OgreImporter::ReadMaterial(const std::string &pFile, Assimp::IOSyste // Skip commented lines if (linePart == partComment) { - string postComment = NextAfterNewLine(ss, linePart); - DefaultLogger::get()->debug("//" + postComment + " (comment line ignored)"); + NextAfterNewLine(ss, linePart); continue; } if (linePart != partMaterial) @@ -361,8 +360,7 @@ bool OgreImporter::ReadTechnique(const std::string &techniqueName, stringstream // Skip commented lines if (linePart == partComment) { - string postComment = SkipLine(ss); - DefaultLogger::get()->debug(" //" + postComment + " (comment line ignored)"); + SkipLine(ss); continue; } @@ -402,8 +400,7 @@ bool OgreImporter::ReadPass(const std::string &passName, stringstream &ss, aiMat // Skip commented lines if (linePart == partComment) { - string postComment = SkipLine(ss); - DefaultLogger::get()->debug(" //" + postComment + " (comment line ignored)"); + SkipLine(ss); continue; } @@ -471,8 +468,7 @@ bool OgreImporter::ReadTextureUnit(const std::string &textureUnitName, stringstr // Skip commented lines if (linePart == partComment) { - string postComment = SkipLine(ss); - DefaultLogger::get()->debug(" //" + postComment + " (comment line ignored)"); + SkipLine(ss); continue; } diff --git a/code/OgreStructs.cpp b/code/OgreStructs.cpp index f651e96eb..cfedc2320 100644 --- a/code/OgreStructs.cpp +++ b/code/OgreStructs.cpp @@ -346,6 +346,11 @@ VertexDataXml::VertexDataXml() { } +bool VertexDataXml::HasPositions() const +{ + return !positions.empty(); +} + bool VertexDataXml::HasNormals() const { return !normals.empty(); @@ -672,12 +677,14 @@ aiMesh *SubMesh::ConvertToAssimpMesh(Mesh *parent) { uv1->Seek((vWidthUv1 * ogreVertexIndex) + uv1Element->offset, aiOrigin_SET); uv1->Read(&uv1Dest[newIndex], sizeUv1, 1); + uv1Dest[newIndex].y = (uv1Dest[newIndex].y * -1) + 1; // Flip UV from Ogre to Assimp form } // UV1 if (uv2 && uv2Dest) { uv2->Seek((vWidthUv2 * ogreVertexIndex) + uv2Element->offset, aiOrigin_SET); uv2->Read(&uv2Dest[newIndex], sizeUv2, 1); + uv2Dest[newIndex].y = (uv2Dest[newIndex].y * -1) + 1; // Flip UV from Ogre to Assimp form } } } diff --git a/code/OgreStructs.h b/code/OgreStructs.h index 81431b65d..75cadf4b7 100644 --- a/code/OgreStructs.h +++ b/code/OgreStructs.h @@ -601,6 +601,7 @@ class VertexDataXml : public IVertexData public: VertexDataXml(); + bool HasPositions() const; bool HasNormals() const; bool HasTangents() const; bool HasUvs() const; diff --git a/code/OgreXmlSerializer.cpp b/code/OgreXmlSerializer.cpp index 3e82176c5..733e36c03 100644 --- a/code/OgreXmlSerializer.cpp +++ b/code/OgreXmlSerializer.cpp @@ -374,12 +374,16 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest) bool tangents = (HasAttribute("tangents") && ReadAttribute("tangents")); uint32_t uvs = (HasAttribute("texture_coords") ? ReadAttribute("texture_coords") : 0); - if (!positions) { + // Not having positions is a error only if a previous vertex buffer did not have them. + if (!positions && !dest->HasPositions()) { throw DeadlyImportError("Vertex buffer does not contain positions!"); } - DefaultLogger::get()->debug(" - Contains positions"); - dest->positions.reserve(dest->count); + if (positions) + { + DefaultLogger::get()->debug(" - Contains positions"); + dest->positions.reserve(dest->count); + } if (normals) { DefaultLogger::get()->debug(" - Contains normals"); @@ -454,7 +458,7 @@ void OgreXmlSerializer::ReadGeometryVertexBuffer(VertexDataXml *dest) aiVector3D uv; uv.x = ReadAttribute("u"); - uv.y = ReadAttribute("v") * (-1)+1; //flip the uv vertikal, blender exports them so! (ahem... @todo ????) + uv.y = (ReadAttribute("v") * -1) + 1; // Flip UV from Ogre to Assimp form dest->uvs[i].push_back(uv); NextNode();