1 // Copyright (C) 2002-2012 Nikolaus Gebhardt 2 // This file is part of the "Irrlicht Engine". 3 // For conditions of distribution and use, see copyright notice in irrlicht.h 4 5 #ifndef __I_MESH_LOADER_H_INCLUDED__ 6 #define __I_MESH_LOADER_H_INCLUDED__ 7 8 #include "IReferenceCounted.h" 9 #include "path.h" 10 11 namespace irr 12 { 13 namespace io 14 { 15 class IReadFile; 16 } // end namespace io 17 namespace scene 18 { 19 class IAnimatedMesh; 20 21 //! Class which is able to load an animated mesh from a file. 22 /** If you want Irrlicht be able to load meshes of 23 currently unsupported file formats (e.g. .cob), then implement 24 this and add your new Meshloader with 25 ISceneManager::addExternalMeshLoader() to the engine. */ 26 class IMeshLoader : public virtual IReferenceCounted 27 { 28 public: 29 30 //! Destructor ~IMeshLoader()31 virtual ~IMeshLoader() {} 32 33 //! Returns true if the file might be loaded by this class. 34 /** This decision should be based on the file extension (e.g. ".cob") 35 only. 36 \param filename Name of the file to test. 37 \return True if the file might be loaded by this class. */ 38 virtual bool isALoadableFileExtension(const io::path& filename) const = 0; 39 40 //! Creates/loads an animated mesh from the file. 41 /** \param file File handler to load the file from. 42 \return Pointer to the created mesh. Returns 0 if loading failed. 43 If you no longer need the mesh, you should call IAnimatedMesh::drop(). 44 See IReferenceCounted::drop() for more information. */ 45 virtual IAnimatedMesh* createMesh(io::IReadFile* file) = 0; 46 }; 47 48 49 } // end namespace scene 50 } // end namespace irr 51 52 #endif 53 54