BsSpecificImporter.h 1.7 KB

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