IMeshLoader.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #pragma once
  5. #include "IReferenceCounted.h"
  6. #include "path.h"
  7. namespace irr
  8. {
  9. namespace io
  10. {
  11. class IReadFile;
  12. } // end namespace io
  13. namespace scene
  14. {
  15. class IAnimatedMesh;
  16. //! Class which is able to load an animated mesh from a file.
  17. /** If you want Irrlicht be able to load meshes of
  18. currently unsupported file formats (e.g. .cob), then implement
  19. this and add your new Meshloader with
  20. ISceneManager::addExternalMeshLoader() to the engine. */
  21. class IMeshLoader : public virtual IReferenceCounted
  22. {
  23. public:
  24. //! Constructor
  25. IMeshLoader() {}
  26. //! Destructor
  27. virtual ~IMeshLoader() {}
  28. //! Returns true if the file might be loaded by this class.
  29. /** This decision should be based on the file extension (e.g. ".cob")
  30. only.
  31. \param filename Name of the file to test.
  32. \return True if the file might be loaded by this class. */
  33. virtual bool isALoadableFileExtension(const io::path &filename) const = 0;
  34. //! Creates/loads an animated mesh from the file.
  35. /** \param file File handler to load the file from.
  36. \return Pointer to the created mesh. Returns 0 if loading failed.
  37. If you no longer need the mesh, you should call IAnimatedMesh::drop().
  38. See IReferenceCounted::drop() for more information. */
  39. virtual IAnimatedMesh *createMesh(io::IReadFile *file) = 0;
  40. };
  41. } // end namespace scene
  42. } // end namespace irr