Commit 6eaddbf1 authored by bitplane's avatar bitplane

Order the list of mesh loaders so that the least commonly used ones are at the...

Order the list of mesh loaders so that the least commonly used ones are at the bottom of the stack, may give a small performance boost when loading many models from a zip file



git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3565 dfc29bdd-3216-0410-991c-e03cc46cb475
parent ff9e6edd
...@@ -212,28 +212,14 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs, ...@@ -212,28 +212,14 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
// create geometry creator // create geometry creator
GeometryCreator = new CGeometryCreator(); GeometryCreator = new CGeometryCreator();
// add file format loaders // add file format loaders. add the least commonly used ones first,
// as these are checked last
#ifdef _IRR_COMPILE_WITH_IRR_MESH_LOADER_ #ifdef _IRR_COMPILE_WITH_STL_LOADER_
MeshLoaderList.push_back(new CIrrMeshFileLoader(this, FileSystem)); MeshLoaderList.push_back(new CSTLMeshFileLoader());
#endif
#ifdef _IRR_COMPILE_WITH_BSP_LOADER_
MeshLoaderList.push_back(new CBSPMeshFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_MD2_LOADER_
MeshLoaderList.push_back(new CMD2MeshFileLoader());
#endif
#ifdef _IRR_COMPILE_WITH_MS3D_LOADER_
MeshLoaderList.push_back(new CMS3DMeshFileLoader(Driver));
#endif
#ifdef _IRR_COMPILE_WITH_HALFLIFE_LOADER_
MeshLoaderList.push_back(new CHalflifeMDLMeshFileLoader( this ));
#endif
#ifdef _IRR_COMPILE_WITH_3DS_LOADER_
MeshLoaderList.push_back(new C3DSMeshFileLoader(this, FileSystem));
#endif #endif
#ifdef _IRR_COMPILE_WITH_X_LOADER_ #ifdef _IRR_COMPILE_WITH_PLY_LOADER_
MeshLoaderList.push_back(new CXMeshFileLoader(this, FileSystem)); MeshLoaderList.push_back(new CPLYMeshFileLoader());
#endif #endif
#ifdef _IRR_COMPILE_WITH_OCT_LOADER_ #ifdef _IRR_COMPILE_WITH_OCT_LOADER_
MeshLoaderList.push_back(new COCTLoader(this, FileSystem)); MeshLoaderList.push_back(new COCTLoader(this, FileSystem));
...@@ -247,32 +233,47 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs, ...@@ -247,32 +233,47 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
#ifdef _IRR_COMPILE_WITH_MY3D_LOADER_ #ifdef _IRR_COMPILE_WITH_MY3D_LOADER_
MeshLoaderList.push_back(new CMY3DMeshFileLoader(this, FileSystem)); MeshLoaderList.push_back(new CMY3DMeshFileLoader(this, FileSystem));
#endif #endif
#ifdef _IRR_COMPILE_WITH_COLLADA_LOADER_
MeshLoaderList.push_back(new CColladaFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_DMF_LOADER_ #ifdef _IRR_COMPILE_WITH_DMF_LOADER_
MeshLoaderList.push_back(new CDMFLoader(this, FileSystem)); MeshLoaderList.push_back(new CDMFLoader(this, FileSystem));
#endif #endif
#ifdef _IRR_COMPILE_WITH_OGRE_LOADER_ #ifdef _IRR_COMPILE_WITH_OGRE_LOADER_
MeshLoaderList.push_back(new COgreMeshFileLoader(FileSystem, Driver)); MeshLoaderList.push_back(new COgreMeshFileLoader(FileSystem, Driver));
#endif #endif
#ifdef _IRR_COMPILE_WITH_OBJ_LOADER_ #ifdef _IRR_COMPILE_WITH_HALFLIFE_LOADER_
MeshLoaderList.push_back(new COBJMeshFileLoader(this, FileSystem)); MeshLoaderList.push_back(new CHalflifeMDLMeshFileLoader( this ));
#endif #endif
#ifdef _IRR_COMPILE_WITH_MD3_LOADER_ #ifdef _IRR_COMPILE_WITH_MD3_LOADER_
MeshLoaderList.push_back(new CMD3MeshFileLoader( this)); MeshLoaderList.push_back(new CMD3MeshFileLoader( this));
#endif #endif
#ifdef _IRR_COMPILE_WITH_B3D_LOADER_
MeshLoaderList.push_back(new CB3DMeshFileLoader(this));
#endif
#ifdef _IRR_COMPILE_WITH_LWO_LOADER_ #ifdef _IRR_COMPILE_WITH_LWO_LOADER_
MeshLoaderList.push_back(new CLWOMeshFileLoader(this, FileSystem)); MeshLoaderList.push_back(new CLWOMeshFileLoader(this, FileSystem));
#endif #endif
#ifdef _IRR_COMPILE_WITH_STL_LOADER_ #ifdef _IRR_COMPILE_WITH_MD2_LOADER_
MeshLoaderList.push_back(new CSTLMeshFileLoader()); MeshLoaderList.push_back(new CMD2MeshFileLoader());
#endif #endif
#ifdef _IRR_COMPILE_WITH_PLY_LOADER_ #ifdef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
MeshLoaderList.push_back(new CPLYMeshFileLoader()); MeshLoaderList.push_back(new CIrrMeshFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_BSP_LOADER_
MeshLoaderList.push_back(new CBSPMeshFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_COLLADA_LOADER_
MeshLoaderList.push_back(new CColladaFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_3DS_LOADER_
MeshLoaderList.push_back(new C3DSMeshFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_X_LOADER_
MeshLoaderList.push_back(new CXMeshFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_MS3D_LOADER_
MeshLoaderList.push_back(new CMS3DMeshFileLoader(Driver));
#endif
#ifdef _IRR_COMPILE_WITH_OBJ_LOADER_
MeshLoaderList.push_back(new COBJMeshFileLoader(this, FileSystem));
#endif
#ifdef _IRR_COMPILE_WITH_B3D_LOADER_
MeshLoaderList.push_back(new CB3DMeshFileLoader(this));
#endif #endif
// factories // factories
...@@ -358,6 +359,7 @@ IAnimatedMesh* CSceneManager::getMesh(const io::path& filename) ...@@ -358,6 +359,7 @@ IAnimatedMesh* CSceneManager::getMesh(const io::path& filename)
return 0; return 0;
} }
// iterate the list in reverse order so user-added loaders can override the built-in ones
s32 count = MeshLoaderList.size(); s32 count = MeshLoaderList.size();
for (s32 i=count-1; i>=0; --i) for (s32 i=count-1; i>=0; --i)
{ {
...@@ -397,6 +399,7 @@ IAnimatedMesh* CSceneManager::getMesh(io::IReadFile* file) ...@@ -397,6 +399,7 @@ IAnimatedMesh* CSceneManager::getMesh(io::IReadFile* file)
if (msh) if (msh)
return msh; return msh;
// iterate the list in reverse order so user-added loaders can override the built-in ones
s32 count = MeshLoaderList.size(); s32 count = MeshLoaderList.size();
for (s32 i=count-1; i>=0; --i) for (s32 i=count-1; i>=0; --i)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment