Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

106 řádky
3.4 KiB

  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2012, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file Implementation of BaseProcess */
  35. #include "AssimpPCH.h"
  36. #include "BaseImporter.h"
  37. #include "BaseProcess.h"
  38. #include "Importer.h"
  39. using namespace Assimp;
  40. // ------------------------------------------------------------------------------------------------
  41. // Constructor to be privately used by Importer
  42. BaseProcess::BaseProcess()
  43. : shared()
  44. , progress()
  45. {
  46. }
  47. // ------------------------------------------------------------------------------------------------
  48. // Destructor, private as well
  49. BaseProcess::~BaseProcess()
  50. {
  51. // nothing to do here
  52. }
  53. // ------------------------------------------------------------------------------------------------
  54. void BaseProcess::ExecuteOnScene( Importer* pImp)
  55. {
  56. ai_assert(NULL != pImp && NULL != pImp->Pimpl()->mScene);
  57. progress = pImp->GetProgressHandler();
  58. ai_assert(progress);
  59. SetupProperties( pImp );
  60. // catch exceptions thrown inside the PostProcess-Step
  61. try
  62. {
  63. Execute(pImp->Pimpl()->mScene);
  64. } catch( const std::exception& err ) {
  65. // extract error description
  66. pImp->Pimpl()->mErrorString = err.what();
  67. DefaultLogger::get()->error(pImp->Pimpl()->mErrorString);
  68. // and kill the partially imported data
  69. delete pImp->Pimpl()->mScene;
  70. pImp->Pimpl()->mScene = NULL;
  71. }
  72. }
  73. // ------------------------------------------------------------------------------------------------
  74. void BaseProcess::SetupProperties(const Importer* /*pImp*/)
  75. {
  76. // the default implementation does nothing
  77. }
  78. // ------------------------------------------------------------------------------------------------
  79. bool BaseProcess::RequireVerboseFormat() const
  80. {
  81. return true;
  82. }