ISceneManager::getMesh can now creates meshes with alternative cache-names.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5483 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-06-11 10:04:00 +00:00
parent 3af4847b8a
commit 51961da07d
4 changed files with 8 additions and 5 deletions

View File

@ -1,6 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- ISceneManager::getMesh can now creates meshes with alternative cache-names.
- Lets the BSP loader find textures inserted with relative paths. Thx@ curaga for patch
- Slightly simplified ALLOC_STRATEGY_DOUBLE in arrays
- Add alternavive BoundingBox calculation for BillboardSceneNode which can take in a camera node. Thx @Seven and @JacKDuRdEn for bugreports.

View File

@ -379,10 +379,11 @@ namespace scene
* If you would like to implement and add your own file format loader to Irrlicht,
* see addExternalMeshLoader().
* \param filename: Filename of the mesh to load.
* \param alternativeCacheName: In case you want to have the mesh under another name in the cache (to create real copies)
* \return Null if failed, otherwise pointer to the mesh.
* This pointer should not be dropped. See IReferenceCounted::drop() for more information.
**/
virtual IAnimatedMesh* getMesh(const io::path& filename) = 0;
virtual IAnimatedMesh* getMesh(const io::path& filename, const io::path& alternativeCacheName=io::path("")) = 0;
//! Get pointer to an animateable mesh. Loads the file if not loaded already.
/** Works just as getMesh(const char* filename). If you want to

View File

@ -401,9 +401,10 @@ CSceneManager::~CSceneManager()
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
IAnimatedMesh* CSceneManager::getMesh(const io::path& filename)
IAnimatedMesh* CSceneManager::getMesh(const io::path& filename, const io::path& alternativeCacheName)
{
IAnimatedMesh* msh = MeshCache->getMeshByName(filename);
io::path cacheName = alternativeCacheName.empty() ? filename : alternativeCacheName;
IAnimatedMesh* msh = MeshCache->getMeshByName(cacheName);
if (msh)
return msh;
@ -425,7 +426,7 @@ IAnimatedMesh* CSceneManager::getMesh(const io::path& filename)
msh = MeshLoaderList[i]->createMesh(file);
if (msh)
{
MeshCache->addMesh(filename, msh);
MeshCache->addMesh(cacheName, msh);
msh->drop();
break;
}

View File

@ -42,7 +42,7 @@ namespace scene
virtual ~CSceneManager();
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
virtual IAnimatedMesh* getMesh(const io::path& filename) _IRR_OVERRIDE_;
virtual IAnimatedMesh* getMesh(const io::path& filename, const io::path& alternativeCacheName) _IRR_OVERRIDE_;
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
virtual IAnimatedMesh* getMesh(io::IReadFile* file) _IRR_OVERRIDE_;