BsSpecificImporter.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "BsCorePrerequisites.h"
  3. namespace BansheeEngine
  4. {
  5. /** @cond INTERNAL */
  6. /** @addtogroup Importer
  7. * @{
  8. */
  9. /**
  10. * Abstract class that is to be specialized in convertinga certain asset type into an engine usable resource.
  11. * (e.g. a .png file into an engine usable texture).
  12. *
  13. * On initialization this class must register itself with the Importer module, which delegates asset import calls to a
  14. * specific importer.
  15. */
  16. class BS_CORE_EXPORT SpecificImporter
  17. {
  18. public:
  19. SpecificImporter() {}
  20. virtual ~SpecificImporter() {}
  21. /**
  22. * Check is the provided extension supported by this importer.
  23. *
  24. * @note Provided extension should be without the leading dot.
  25. */
  26. virtual bool isExtensionSupported(const WString& ext) const = 0;
  27. /** Check if the provided magic number is supported by this importer. */
  28. virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const = 0;
  29. /**
  30. * Imports the given file.
  31. *
  32. * @param[in] filePath Pathname of the file, with file extension.
  33. *
  34. * @return null if it fails, otherwise the loaded object.
  35. */
  36. virtual ResourcePtr import(const Path& filePath, ConstImportOptionsPtr importOptions) = 0;
  37. /**
  38. * Creates import options specific for this importer. Import options are provided when calling import() in order
  39. * to customize the import, and provide additional information.
  40. */
  41. virtual ImportOptionsPtr createImportOptions() const;
  42. /**
  43. * Gets the default import options.
  44. *
  45. * @return The default import options.
  46. */
  47. ConstImportOptionsPtr getDefaultImportOptions() const;
  48. private:
  49. mutable ConstImportOptionsPtr mDefaultImportOptions;
  50. };
  51. /** @} */
  52. /** @endcond */
  53. }