BsSLImporter.cpp 804 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "BsSLImporter.h"
  2. #include "BsDataStream.h"
  3. #include "BsFileSystem.h"
  4. #include "BsSLFXCompiler.h"
  5. namespace BansheeEngine
  6. {
  7. SLImporter::SLImporter()
  8. :SpecificImporter()
  9. {
  10. }
  11. SLImporter::~SLImporter()
  12. {
  13. }
  14. bool SLImporter::isExtensionSupported(const WString& ext) const
  15. {
  16. WString lowerCaseExt = ext;
  17. StringUtil::toLowerCase(lowerCaseExt);
  18. return lowerCaseExt == L"bsl";
  19. }
  20. bool SLImporter::isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const
  21. {
  22. return true; // Plain-text so I don't even check for magic number
  23. }
  24. ResourcePtr SLImporter::import(const Path& filePath, ConstImportOptionsPtr importOptions)
  25. {
  26. DataStreamPtr stream = FileSystem::openFile(filePath);
  27. String source = stream->getAsString();
  28. return BSLFXCompiler::compile(source);
  29. }
  30. }