Renamed ISceneLoader::isALoadableFileType to isALoadableFileFormat to match the archive and image loader interfaces. Added getters for mesh, scene and archive loaders.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3567 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
bitplane 2011-01-20 05:47:50 +00:00
parent 901dac358a
commit 07bc66af6c
10 changed files with 105 additions and 12 deletions

View File

@ -117,11 +117,6 @@ public:
E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
const core::stringc& password="") =0;
//! Adds an external archive loader to the engine.
/** Use this function to add support for new archive types to the
engine, for example proprietary or encrypted file storage. */
virtual void addArchiveLoader(IArchiveLoader* loader) =0;
//! Get the number of archives currently attached to the file system
virtual u32 getFileArchiveCount() const =0;
@ -149,6 +144,20 @@ public:
//! Get the archive at a given index.
virtual IFileArchive* getFileArchive(u32 index) =0;
//! Adds an external archive loader to the engine.
/** Use this function to add support for new archive types to the
engine, for example proprietary or encrypted file storage. */
virtual void addArchiveLoader(IArchiveLoader* loader) =0;
//! Gets the number of archive loaders currently added
virtual u32 getArchiveLoaderCount() const = 0;
//! Retrieve the given archive loader
/** \param index The index of the loader to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified loader, 0 if the index is incorrect. */
virtual IArchiveLoader* getArchiveLoader(u32 index) const = 0;
//! Adds a zip archive to the file system.
/** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in future versions,

View File

@ -34,7 +34,7 @@ public:
/** This decision will be based on a quick look at the contents of the file.
\param file The file to test.
\return True if the extension is a recognised type. */
virtual bool isALoadableFileType(io::IReadFile* file) const = 0;
virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
//! Loads the scene into the scene manager.
/** \param file File which contains the scene.

View File

@ -215,6 +215,8 @@ namespace scene
* following naming scheme:
* "path/to/file/file.dea#meshname". The loading of such
* meshes is logged. Currently, this loader is able to
* create meshes (made of only polygons), lights, and
* cameras. Materials and animations are currently not
* supported but this will change with future releases.
@ -260,7 +262,7 @@ namespace scene
* <TR>
* <TD>Irrlicht Mesh (.irrMesh)</TD>
* <TD>This is a static mesh format written in XML, native
* to Irrlicht and written by ISceneManager::saveMesh.
* to Irrlicht and written by the irr mesh writer.
* This format is exported by the CopperCube engine's
* lightmapper.</TD>
* </TR>
@ -1360,6 +1362,15 @@ namespace scene
\param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0;
//! Returns the number of mesh loaders supported by Irrlicht at this time
virtual u32 getMeshLoaderCount() const = 0;
//! Retrieve the given mesh loader
/** \param index The index of the loader to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified loader, 0 if the index is incorrect. */
virtual IMeshLoader* getMeshLoader(u32 index) const = 0;
//! Adds an external scene loader for extending the engine with new file formats.
/** If you want the engine to be extended with
file formats it currently is not able to load (e.g. .vrml), just implement
@ -1369,6 +1380,15 @@ namespace scene
\param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0;
//! Returns the number of scene loaders supported by Irrlicht at this time
virtual u32 getSceneLoaderCount() const = 0;
//! Retrieve the given scene loader
/** \param index The index of the loader to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified loader, 0 if the index is incorrect. */
virtual ISceneLoader* getSceneLoader(u32 index) const = 0;
//! Get pointer to the scene collision manager.
/** \return Pointer to the collision manager
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */

View File

@ -336,7 +336,7 @@ namespace video
//! Retrieve the given image loader
/** \param n The index of the loader to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified loader, 0 if the index is uncorrect. */
\return A pointer to the specified loader, 0 if the index is incorrect. */
virtual IImageLoader* getImageLoader(u32 n) = 0;
//! Retrieve the number of image writers
@ -346,7 +346,7 @@ namespace video
//! Retrieve the given image writer
/** \param n The index of the writer to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified writer, 0 if the index is uncorrect. */
\return A pointer to the specified writer, 0 if the index is incorrect. */
virtual IImageWriter* getImageWriter(u32 n) = 0;
//! Sets a material.

View File

@ -171,6 +171,20 @@ void CFileSystem::addArchiveLoader(IArchiveLoader* loader)
ArchiveLoader.push_back(loader);
}
//! Returns the total number of archive loaders added.
u32 CFileSystem::getArchiveLoaderCount() const
{
return ArchiveLoader.size();
}
//! Gets the archive loader by index.
IArchiveLoader* CFileSystem::getArchiveLoader(u32 index) const
{
if (index < ArchiveLoader.size())
return ArchiveLoader[index];
else
return 0;
}
//! move the hirarchy of the filesystem. moves sourceIndex relative up or down
bool CFileSystem::moveFileArchive(u32 sourceIndex, s32 relative)

View File

@ -57,6 +57,12 @@ public:
//! Adds an external archive loader to the engine.
virtual void addArchiveLoader(IArchiveLoader* loader);
//! Returns the total number of archive loaders added.
virtual u32 getArchiveLoaderCount() const;
//! Gets the archive loader by index.
virtual IArchiveLoader* getArchiveLoader(u32 index) const;
//! gets the file archive count
virtual u32 getFileArchiveCount() const;

View File

@ -34,7 +34,7 @@ bool CSceneLoaderIrr::isALoadableFileExtension(const io::path& filename) const
}
//! Returns true if the class might be able to load this file.
bool CSceneLoaderIrr::isALoadableFileType(io::IReadFile *file) const
bool CSceneLoaderIrr::isALoadableFileFormat(io::IReadFile *file) const
{
// todo: check inside the file
return true;

View File

@ -33,7 +33,7 @@ public:
virtual bool isALoadableFileExtension(const io::path& filename) const;
//! Returns true if the class might be able to load this file.
virtual bool isALoadableFileType(io::IReadFile *file) const;
virtual bool isALoadableFileFormat(io::IReadFile *file) const;
//! Loads the scene into the scene manager.
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,

View File

@ -1726,6 +1726,22 @@ void CSceneManager::addExternalMeshLoader(IMeshLoader* externalLoader)
MeshLoaderList.push_back(externalLoader);
}
//! Returns the number of mesh loaders supported by Irrlicht at this time
u32 CSceneManager::getMeshLoaderCount() const
{
return MeshLoaderList.size();
}
//! Retrieve the given mesh loader
IMeshLoader* CSceneManager::getMeshLoader(u32 index) const
{
if (index < MeshLoaderList.size())
return MeshLoaderList[index];
else
return 0;
}
//! Adds an external scene loader.
void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader)
{
@ -1736,6 +1752,22 @@ void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader)
SceneLoaderList.push_back(externalLoader);
}
//! Returns the number of scene loaders
u32 CSceneManager::getSceneLoaderCount() const
{
return SceneLoaderList.size();
}
//! Retrieve the given scene loader
ISceneLoader* CSceneManager::getSceneLoader(u32 index) const
{
if (index < SceneLoaderList.size())
return SceneLoaderList[index];
else
return 0;
}
//! Returns a pointer to the scene collision manager.
ISceneCollisionManager* CSceneManager::getSceneCollisionManager()
{
@ -2148,7 +2180,7 @@ bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* use
// try scene loaders in reverse order
s32 i = SceneLoaderList.size()-1;
for (; i >= 0 && !ret; --i)
if (SceneLoaderList[i]->isALoadableFileType(file))
if (SceneLoaderList[i]->isALoadableFileFormat(file))
ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode);
if (!ret)

View File

@ -371,9 +371,21 @@ namespace scene
//! Adds an external mesh loader.
virtual void addExternalMeshLoader(IMeshLoader* externalLoader);
//! Returns the number of mesh loaders supported by Irrlicht at this time
virtual u32 getMeshLoaderCount() const;
//! Retrieve the given mesh loader
virtual IMeshLoader* getMeshLoader(u32 index) const;
//! Adds an external scene loader.
virtual void addExternalSceneLoader(ISceneLoader* externalLoader);
//! Returns the number of scene loaders supported by Irrlicht at this time
virtual u32 getSceneLoaderCount() const;
//! Retrieve the given scene loader
virtual ISceneLoader* getSceneLoader(u32 index) const;
//! Returns a pointer to the scene collision manager.
virtual ISceneCollisionManager* getSceneCollisionManager();