diff -r dfefb2bc2292 lib/irrlicht/include/SceneParameters.h --- a/lib/irrlicht/include/SceneParameters.h Tue Mar 03 18:16:21 2009 +0100 +++ b/lib/irrlicht/include/SceneParameters.h Wed Mar 04 20:55:28 2009 +0100 @@ -129,6 +129,14 @@ **/ const c8* const B3D_TEXTURE_PATH = "B3D_TexturePath"; + //! Name of the parameter for changing the texture path of the built-in obj loader. + /** Use it like this: + \code + SceneManager->getParameters()->setAttribute(scene::OBJ_TEXTURE_PATH, "path/to/your/textures"); + \endcode + **/ + const c8* const OBJ_TEXTURE_PATH = "OBJ_TexturePath"; + } // end namespace scene } // end namespace irr diff -r dfefb2bc2292 lib/irrlicht/source/Irrlicht/COBJMeshFileLoader.cpp --- a/lib/irrlicht/source/Irrlicht/COBJMeshFileLoader.cpp Tue Mar 03 18:16:21 2009 +0100 +++ b/lib/irrlicht/source/Irrlicht/COBJMeshFileLoader.cpp Wed Mar 04 20:55:28 2009 +0100 @@ -2,7 +2,7 @@ // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h -#include "IrrCompileConfig.h" +#include "IrrCompileConfig.h" #ifdef _IRR_COMPILE_WITH_OBJ_LOADER_ #include "COBJMeshFileLoader.h" @@ -239,7 +239,7 @@ vertLocation = currMtl->Meshbuffer->Vertices.size() -1; currMtl->VertMap.insert(v, vertLocation); } - + faceCorners.push_back(vertLocation); // go to next vertex @@ -259,7 +259,7 @@ } break; - case '#': // comment + case '#': // comment default: break; } // end switch(bufPtr[0]) @@ -414,7 +414,15 @@ texname.replace('\\', '/'); video::ITexture * texture = 0; - if (FileSystem->existFile(texname.c_str())) + core::stringc textureFromTexPath = SceneManager->getParameters()->getAttributeAsString(OBJ_TEXTURE_PATH); + if ( textureFromTexPath.size() ) + { + textureFromTexPath += '/'; + textureFromTexPath += texname; + } + if ( FileSystem->existFile((textureFromTexPath).c_str()) ) + texture = SceneManager->getVideoDriver()->getTexture( (textureFromTexPath).c_str() ); + else if (FileSystem->existFile(texname.c_str())) texture = SceneManager->getVideoDriver()->getTexture(texname.c_str()); else // try to read in the relative path, the .obj is loaded from