diff -r 8b51e7b887a5 lib/irrlicht/include/SceneParameters.h --- a/lib/irrlicht/include/SceneParameters.h Wed Sep 23 00:30:32 2009 +0200 +++ b/lib/irrlicht/include/SceneParameters.h Wed Sep 23 01:01:28 2009 +0200 @@ -159,6 +159,21 @@ namespace scene **/ const c8* const DEBUG_NORMAL_COLOR = "DEBUG_Normal_Color"; + //! Name of the parameter for changing the texture path of the built-in b3d loader. + /** Use it like this: + \code + SceneManager->getParameters()->setAttribute(scene::B3D_TEXTURE_PATH, "path/to/your/textures"); + \endcode + **/ + 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 8b51e7b887a5 lib/irrlicht/source/Irrlicht/CB3DMeshFileLoader.cpp --- a/lib/irrlicht/source/Irrlicht/CB3DMeshFileLoader.cpp Wed Sep 23 00:30:32 2009 +0200 +++ b/lib/irrlicht/source/Irrlicht/CB3DMeshFileLoader.cpp Wed Sep 23 01:01:28 2009 +0200 @@ -912,7 +912,15 @@ void CB3DMeshFileLoader::loadTextures(SB { video::ITexture* tex = 0; io::IFileSystem* fs = SceneManager->getFileSystem(); - if (fs->existFile(B3dTexture->TextureName)) + io::path texnameWithUserPath( SceneManager->getParameters()->getAttributeAsString(B3D_TEXTURE_PATH) ); + if ( texnameWithUserPath.size() ) + { + texnameWithUserPath += '/'; + texnameWithUserPath += B3dTexture->TextureName; + } + if (fs->existFile(texnameWithUserPath)) + tex = SceneManager->getVideoDriver()->getTexture(texnameWithUserPath); + else if (fs->existFile(B3dTexture->TextureName)) tex = SceneManager->getVideoDriver()->getTexture(B3dTexture->TextureName); else if (fs->existFile(fs->getFileDir(B3DFile->getFileName()) +"/"+ fs->getFileBasename(B3dTexture->TextureName))) tex = SceneManager->getVideoDriver()->getTexture(fs->getFileDir(B3DFile->getFileName()) +"/"+ fs->getFileBasename(B3dTexture->TextureName)); diff -r 8b51e7b887a5 lib/irrlicht/source/Irrlicht/COBJMeshFileLoader.cpp --- a/lib/irrlicht/source/Irrlicht/COBJMeshFileLoader.cpp Wed Sep 23 00:30:32 2009 +0200 +++ b/lib/irrlicht/source/Irrlicht/COBJMeshFileLoader.cpp Wed Sep 23 01:01:28 2009 +0200 @@ -425,7 +425,15 @@ const c8* COBJMeshFileLoader::readTextur video::ITexture * texture = 0; if (texname.size()) { - if (FileSystem->existFile(texname)) + io::path texnameWithUserPath( SceneManager->getParameters()->getAttributeAsString(OBJ_TEXTURE_PATH) ); + if ( texnameWithUserPath.size() ) + { + texnameWithUserPath += '/'; + texnameWithUserPath += texname; + } + if (FileSystem->existFile(texnameWithUserPath)) + texture = SceneManager->getVideoDriver()->getTexture(texnameWithUserPath); + else if (FileSystem->existFile(texname)) texture = SceneManager->getVideoDriver()->getTexture(texname); else // try to read in the relative path, the .obj is loaded from