Commit 07bc66af authored by bitplane's avatar bitplane

Renamed ISceneLoader::isALoadableFileType to isALoadableFileFormat to match...

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
parent 901dac35
...@@ -117,11 +117,6 @@ public: ...@@ -117,11 +117,6 @@ public:
E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN, E_FILE_ARCHIVE_TYPE archiveType=EFAT_UNKNOWN,
const core::stringc& password="") =0; 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 //! Get the number of archives currently attached to the file system
virtual u32 getFileArchiveCount() const =0; virtual u32 getFileArchiveCount() const =0;
...@@ -149,6 +144,20 @@ public: ...@@ -149,6 +144,20 @@ public:
//! Get the archive at a given index. //! Get the archive at a given index.
virtual IFileArchive* getFileArchive(u32 index) =0; 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. //! Adds a zip archive to the file system.
/** \deprecated This function is provided for compatibility /** \deprecated This function is provided for compatibility
with older versions of Irrlicht and may be removed in future versions, with older versions of Irrlicht and may be removed in future versions,
......
...@@ -34,7 +34,7 @@ public: ...@@ -34,7 +34,7 @@ public:
/** This decision will be based on a quick look at the contents of the file. /** This decision will be based on a quick look at the contents of the file.
\param file The file to test. \param file The file to test.
\return True if the extension is a recognised type. */ \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. //! Loads the scene into the scene manager.
/** \param file File which contains the scene. /** \param file File which contains the scene.
......
...@@ -215,6 +215,8 @@ namespace scene ...@@ -215,6 +215,8 @@ namespace scene
* following naming scheme: * following naming scheme:
* "path/to/file/file.dea#meshname". The loading of such * "path/to/file/file.dea#meshname". The loading of such
* meshes is logged. Currently, this loader is able to * meshes is logged. Currently, this loader is able to
* create meshes (made of only polygons), lights, and * create meshes (made of only polygons), lights, and
* cameras. Materials and animations are currently not * cameras. Materials and animations are currently not
* supported but this will change with future releases. * supported but this will change with future releases.
...@@ -260,7 +262,7 @@ namespace scene ...@@ -260,7 +262,7 @@ namespace scene
* <TR> * <TR>
* <TD>Irrlicht Mesh (.irrMesh)</TD> * <TD>Irrlicht Mesh (.irrMesh)</TD>
* <TD>This is a static mesh format written in XML, native * <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 * This format is exported by the CopperCube engine's
* lightmapper.</TD> * lightmapper.</TD>
* </TR> * </TR>
...@@ -1360,6 +1362,15 @@ namespace scene ...@@ -1360,6 +1362,15 @@ namespace scene
\param externalLoader: Implementation of a new mesh loader. */ \param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalMeshLoader(IMeshLoader* externalLoader) = 0; 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. //! Adds an external scene loader for extending the engine with new file formats.
/** If you want the engine to be extended with /** If you want the engine to be extended with
file formats it currently is not able to load (e.g. .vrml), just implement file formats it currently is not able to load (e.g. .vrml), just implement
...@@ -1369,6 +1380,15 @@ namespace scene ...@@ -1369,6 +1380,15 @@ namespace scene
\param externalLoader: Implementation of a new mesh loader. */ \param externalLoader: Implementation of a new mesh loader. */
virtual void addExternalSceneLoader(ISceneLoader* externalLoader) = 0; 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. //! Get pointer to the scene collision manager.
/** \return Pointer to the collision manager /** \return Pointer to the collision manager
This pointer should not be dropped. See IReferenceCounted::drop() for more information. */ This pointer should not be dropped. See IReferenceCounted::drop() for more information. */
......
...@@ -336,7 +336,7 @@ namespace video ...@@ -336,7 +336,7 @@ namespace video
//! Retrieve the given image loader //! Retrieve the given image loader
/** \param n The index of the loader to retrieve. This parameter is an 0-based /** \param n The index of the loader to retrieve. This parameter is an 0-based
array index. 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; virtual IImageLoader* getImageLoader(u32 n) = 0;
//! Retrieve the number of image writers //! Retrieve the number of image writers
...@@ -346,7 +346,7 @@ namespace video ...@@ -346,7 +346,7 @@ namespace video
//! Retrieve the given image writer //! Retrieve the given image writer
/** \param n The index of the writer to retrieve. This parameter is an 0-based /** \param n The index of the writer to retrieve. This parameter is an 0-based
array index. 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; virtual IImageWriter* getImageWriter(u32 n) = 0;
//! Sets a material. //! Sets a material.
......
...@@ -171,6 +171,20 @@ void CFileSystem::addArchiveLoader(IArchiveLoader* loader) ...@@ -171,6 +171,20 @@ void CFileSystem::addArchiveLoader(IArchiveLoader* loader)
ArchiveLoader.push_back(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 //! move the hirarchy of the filesystem. moves sourceIndex relative up or down
bool CFileSystem::moveFileArchive(u32 sourceIndex, s32 relative) bool CFileSystem::moveFileArchive(u32 sourceIndex, s32 relative)
......
...@@ -57,6 +57,12 @@ public: ...@@ -57,6 +57,12 @@ public:
//! Adds an external archive loader to the engine. //! Adds an external archive loader to the engine.
virtual void addArchiveLoader(IArchiveLoader* loader); 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 //! gets the file archive count
virtual u32 getFileArchiveCount() const; virtual u32 getFileArchiveCount() const;
......
...@@ -34,7 +34,7 @@ bool CSceneLoaderIrr::isALoadableFileExtension(const io::path& filename) const ...@@ -34,7 +34,7 @@ bool CSceneLoaderIrr::isALoadableFileExtension(const io::path& filename) const
} }
//! Returns true if the class might be able to load this file. //! 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 // todo: check inside the file
return true; return true;
......
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
virtual bool isALoadableFileExtension(const io::path& filename) const; virtual bool isALoadableFileExtension(const io::path& filename) const;
//! Returns true if the class might be able to load this file. //! 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. //! Loads the scene into the scene manager.
virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0, virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,
......
...@@ -1726,6 +1726,22 @@ void CSceneManager::addExternalMeshLoader(IMeshLoader* externalLoader) ...@@ -1726,6 +1726,22 @@ void CSceneManager::addExternalMeshLoader(IMeshLoader* externalLoader)
MeshLoaderList.push_back(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. //! Adds an external scene loader.
void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader) void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader)
{ {
...@@ -1736,6 +1752,22 @@ void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader) ...@@ -1736,6 +1752,22 @@ void CSceneManager::addExternalSceneLoader(ISceneLoader* externalLoader)
SceneLoaderList.push_back(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. //! Returns a pointer to the scene collision manager.
ISceneCollisionManager* CSceneManager::getSceneCollisionManager() ISceneCollisionManager* CSceneManager::getSceneCollisionManager()
{ {
...@@ -2148,7 +2180,7 @@ bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* use ...@@ -2148,7 +2180,7 @@ bool CSceneManager::loadScene(io::IReadFile* file, ISceneUserDataSerializer* use
// try scene loaders in reverse order // try scene loaders in reverse order
s32 i = SceneLoaderList.size()-1; s32 i = SceneLoaderList.size()-1;
for (; i >= 0 && !ret; --i) for (; i >= 0 && !ret; --i)
if (SceneLoaderList[i]->isALoadableFileType(file)) if (SceneLoaderList[i]->isALoadableFileFormat(file))
ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode); ret = SceneLoaderList[i]->loadScene(file, userDataSerializer, rootNode);
if (!ret) if (!ret)
......
...@@ -371,9 +371,21 @@ namespace scene ...@@ -371,9 +371,21 @@ namespace scene
//! Adds an external mesh loader. //! Adds an external mesh loader.
virtual void addExternalMeshLoader(IMeshLoader* externalLoader); 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. //! Adds an external scene loader.
virtual void addExternalSceneLoader(ISceneLoader* externalLoader); 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. //! Returns a pointer to the scene collision manager.
virtual ISceneCollisionManager* getSceneCollisionManager(); virtual ISceneCollisionManager* getSceneCollisionManager();
......
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