BsSpecificImporter.h 2.0 KB

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