CmSpecificImporter.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include "CmPrerequisites.h"
  3. namespace CamelotFramework
  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 CM_EXPORT SpecificImporter
  14. {
  15. public:
  16. SpecificImporter() {}
  17. virtual ~SpecificImporter() {}
  18. virtual bool isExtensionSupported(const String& ext) const = 0;
  19. virtual bool isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const = 0;
  20. /**
  21. * @brief Imports the given file.
  22. *
  23. * @param filePath Pathname of the file, with file extension.
  24. *
  25. * @return null if it fails, otherwise the loaded object.
  26. */
  27. virtual HResource import(const String& filePath, ConstImportOptionsPtr importOptions) = 0;
  28. /**
  29. * @brief Creates import options specific for this importer. Import
  30. * options are provided when calling import() in order to customize the
  31. * import, and provide additional information.
  32. */
  33. virtual ImportOptionsPtr createImportOptions() const;
  34. /**
  35. * @brief Gets the default import options.
  36. *
  37. * @return The default import options.
  38. */
  39. ConstImportOptionsPtr getDefaultImportOptions() const;
  40. private:
  41. mutable ConstImportOptionsPtr mDefaultImportOptions;
  42. };
  43. }