diff -r e806822a0e9a lib/irrlicht/include/SceneParameters.h --- a/lib/irrlicht/include/SceneParameters.h Mon Mar 02 17:21:46 2009 +0100 +++ b/lib/irrlicht/include/SceneParameters.h Mon Mar 02 20:43:47 2009 +0100 @@ -120,6 +120,15 @@ deleting scene nodes for example */ const c8* const IRR_SCENE_MANAGER_IS_EDITOR = "IRR_Editor"; + + //! 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"; + } // end namespace scene } // end namespace irr diff -r e806822a0e9a lib/irrlicht/source/Irrlicht/CB3DMeshFileLoader.cpp --- a/lib/irrlicht/source/Irrlicht/CB3DMeshFileLoader.cpp Mon Mar 02 17:21:46 2009 +0100 +++ b/lib/irrlicht/source/Irrlicht/CB3DMeshFileLoader.cpp Mon Mar 02 20:43:47 2009 +0100 @@ -667,13 +667,29 @@ os::Printer::log("read ChunkTEXS"); #endif + core::stringc texturePath = + SceneManager->getParameters()->getAttributeAsString(B3D_TEXTURE_PATH); + while((B3dStack.getLast().startposition + B3dStack.getLast().length) > B3DFile->getPos()) //this chunk repeats { Textures.push_back(SB3dTexture()); SB3dTexture& B3dTexture = Textures.getLast(); B3dTexture.TextureName=readString(); - B3dTexture.TextureName=stripPathFromString(B3DFile->getFileName(),true) + stripPathFromString(B3dTexture.TextureName,false); + if ( texturePath.size() ) + { + core::stringc texName = texturePath; + if ( texName.size() ) + texName += "/"; + texName += stripPathFromString(B3dTexture.TextureName, false); + B3dTexture.TextureName = texName; + } + else + { + B3dTexture.TextureName=stripPathFromString(B3DFile->getFileName(),true) + stripPathFromString(B3dTexture.TextureName,false); + } + + #ifdef _B3D_READER_DEBUG os::Printer::log("read Texture", B3dTexture.TextureName.c_str()); #endif