diff --git a/src/converter/collada.cpp b/src/converter/collada.cpp index e0b467c7..b48816d4 100644 --- a/src/converter/collada.cpp +++ b/src/converter/collada.cpp @@ -1056,6 +1056,11 @@ void loadImage(ColladaContext &ctx, domImage &image) { SLog(EDebug, "Converting texture \"%s\" ..", identifier.c_str()); std::string filename = cdom::uriToFilePath(image.getInit_from()->getValue().str()); + /* Prevent Linux/OSX fs::path handling issues for DAE files created on Windows */ + for (size_t i=0; i" << endl; ctx.os << "\t\t\t" << endl; ctx.os << "\t\t" << endl << endl; - ctx.os << "\t\t" << endl; + ctx.os << "\t\t" << endl; ctx.os << "\t\t\t" << endl; ctx.os << "\t\t" << endl << endl; - ctx.os << "\t\tm_filmType << "\">" << endl; + ctx.os << "\t\tm_filmType << "\">" << endl; ctx.os << "\t\t\t" << endl; ctx.os << "\t\t\t" << endl; ctx.os << "\t\t\t" << endl; diff --git a/src/converter/obj.cpp b/src/converter/obj.cpp index a6ea0fd9..a35ae1bd 100644 --- a/src/converter/obj.cpp +++ b/src/converter/obj.cpp @@ -30,6 +30,12 @@ std::set availableTextures; void referenceTexture(GeometryConverter *cvt, std::ostream &os, const std::string ¶meter, const std::string &indent, const fs::path &textureDir, std::string filename) { + /* Prevent Linux/OSX fs::path handling issues for OBJ files created on Windows */ + for (size_t i=0; i 0 0 - 353 - 273 + 358 + 282 @@ -234,9 +234,9 @@ 0 - + - Linear + sRGB true @@ -244,9 +244,12 @@ - + - sRGB + Linear + + + false diff --git a/src/shapes/obj.cpp b/src/shapes/obj.cpp index b87f7eaf..a728dc3f 100644 --- a/src/shapes/obj.cpp +++ b/src/shapes/obj.cpp @@ -377,13 +377,25 @@ public: Texture *loadTexture(const FileResolver *fileResolver, std::map &cache, - const fs::path &mtlPath, const std::string &filename) { + const fs::path &mtlPath, std::string filename) { + /* Prevent Linux/OSX fs::path handling issues for DAE files created on Windows */ + for (size_t i=0; iresolve(filename); - if (!fs::exists(path)) - Log(EError, "Unable to find texture \"%s\" referenced from \"%s\"!", - path.string().c_str(), mtlPath.string().c_str()); + if (!fs::exists(path)) { + path = fileResolver->resolve(fs::path(filename).filename()); + if (!fs::exists(path)) { + Log(EWarn, "Unable to find texture \"%s\" referenced from \"%s\"!", + path.string().c_str(), mtlPath.string().c_str()); + return new ConstantSpectrumTexture(Spectrum(0.0f)); + } + } Properties props("bitmap"); props.setString("filename", path.string()); ref texture = static_cast (PluginManager::getInstance()-> @@ -424,7 +436,7 @@ public: if (mtlName != "") addMaterial(mtlName, diffuse, specular, exponent, bump, mask, illum); - mtlName = trim(line.substr(7, line.length()-7)); + mtlName = trim(line.substr(6, line.length()-6)); specular = new ConstantSpectrumTexture(Spectrum(0.0f)); diffuse = new ConstantSpectrumTexture(Spectrum(0.0f));