ISceneLoader.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright (C) 2010-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. #ifndef __I_SCENE_LOADER_H_INCLUDED__
  5. #define __I_SCENE_LOADER_H_INCLUDED__
  6. #include "IReferenceCounted.h"
  7. #include "path.h"
  8. namespace irr
  9. {
  10. namespace io
  11. {
  12. class IReadFile;
  13. } // end namespace io
  14. namespace scene
  15. {
  16. class ISceneNode;
  17. class ISceneUserDataSerializer;
  18. //! Class which can load a scene into the scene manager.
  19. /** If you want Irrlicht to be able to load currently unsupported
  20. scene file formats (e.g. .vrml), then implement this and add your
  21. new Sceneloader to the engine with ISceneManager::addExternalSceneLoader(). */
  22. class ISceneLoader : public virtual IReferenceCounted
  23. {
  24. public:
  25. //! Returns true if the class might be able to load this file.
  26. /** This decision should be based on the file extension (e.g. ".vrml")
  27. only.
  28. \param filename Name of the file to test.
  29. \return True if the extension is a recognised type. */
  30. virtual bool isALoadableFileExtension(const io::path& filename) const = 0;
  31. //! Returns true if the class might be able to load this file.
  32. /** This decision will be based on a quick look at the contents of the file.
  33. \param file The file to test.
  34. \return True if the extension is a recognised type. */
  35. virtual bool isALoadableFileFormat(io::IReadFile* file) const = 0;
  36. //! Loads the scene into the scene manager.
  37. /** \param file File which contains the scene.
  38. \param userDataSerializer: If you want to load user data which may be attached
  39. to some some scene nodes in the file, implement the ISceneUserDataSerializer
  40. interface and provide it as parameter here. Otherwise, simply specify 0 as this
  41. parameter.
  42. \param rootNode The node to load the scene into, if none is provided then the
  43. scene will be loaded into the root node.
  44. \return Returns true on success, false on failure. Returns 0 if loading failed. */
  45. virtual bool loadScene(io::IReadFile* file, ISceneUserDataSerializer* userDataSerializer=0,
  46. ISceneNode* rootNode=0) = 0;
  47. };
  48. } // end namespace scene
  49. } // end namespace irr
  50. #endif