2
0

BaseImporter.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /** @file Implementation of the few default functions of the base importer class */
  2. #include "BaseImporter.h"
  3. #include "../include/aiScene.h"
  4. #include "aiAssert.h"
  5. using namespace Assimp;
  6. // ------------------------------------------------------------------------------------------------
  7. // Constructor to be privately used by Importer
  8. BaseImporter::BaseImporter()
  9. {
  10. // nothing to do here
  11. }
  12. // ------------------------------------------------------------------------------------------------
  13. // Destructor, private as well
  14. BaseImporter::~BaseImporter()
  15. {
  16. // nothing to do here
  17. }
  18. // ------------------------------------------------------------------------------------------------
  19. // Imports the given file and returns the imported data.
  20. aiScene* BaseImporter::ReadFile( const std::string& pFile, IOSystem* pIOHandler)
  21. {
  22. // create a scene object to hold the data
  23. aiScene* scene = new aiScene;
  24. // dispatch importing
  25. try
  26. {
  27. InternReadFile( pFile, scene, pIOHandler);
  28. } catch( ImportErrorException* exception)
  29. {
  30. // extract error description
  31. mErrorText = exception->GetErrorText();
  32. delete exception;
  33. // and kill the partially imported data
  34. delete scene;
  35. scene = NULL;
  36. }
  37. // return what we gathered from the import.
  38. return scene;
  39. }