Set the B3D_TEXTURE_PATH Irrlicht Scene Manager attribute upon B3D file loading. Hope that this fixes the rare bug where I got Beastie's kart.png texture applied instead of Beagle's kart.png texture.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14410 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -686,11 +686,11 @@ void IrrDriver::printRenderStats()
|
||||
scene::IAnimatedMesh *IrrDriver::getAnimatedMesh(const std::string &filename)
|
||||
{
|
||||
scene::IAnimatedMesh *m = NULL;
|
||||
io::IFileSystem* file_system = getDevice()->getFileSystem();
|
||||
|
||||
if (StringUtils::getExtension(filename) == "b3dz")
|
||||
{
|
||||
// compressed file
|
||||
io::IFileSystem* file_system = getDevice()->getFileSystem();
|
||||
if (!file_system->addFileArchive(filename.c_str(),
|
||||
/*ignoreCase*/false,
|
||||
/*ignorePath*/true, io::EFAT_ZIP))
|
||||
@@ -705,6 +705,8 @@ scene::IAnimatedMesh *IrrDriver::getAnimatedMesh(const std::string &filename)
|
||||
io::IFileArchive* zip_archive =
|
||||
file_system->getFileArchive(file_system->getFileArchiveCount()-1);
|
||||
io::IReadFile* content = zip_archive->createAndOpenFile(0);
|
||||
|
||||
m_scene_manager->getParameters()->setAttribute(irr::scene::B3D_TEXTURE_PATH, file_system->getFileDir(irr::io::path(filename.c_str()) ).c_str() );
|
||||
m = m_scene_manager->getMesh(content);
|
||||
content->drop();
|
||||
|
||||
@@ -712,6 +714,7 @@ scene::IAnimatedMesh *IrrDriver::getAnimatedMesh(const std::string &filename)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_scene_manager->getParameters()->setAttribute(irr::scene::B3D_TEXTURE_PATH, file_system->getFileDir(irr::io::path(filename.c_str()) ).c_str() );
|
||||
m = m_scene_manager->getMesh(filename.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user