您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

128 行
4.3 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 AssimpCExport.cpp
  35. Assimp C export interface. See Exporter.cpp for some notes.
  36. */
  37. #include "AssimpPCH.h"
  38. #ifndef ASSIMP_BUILD_NO_EXPORT
  39. #include "CInterfaceIOWrapper.h"
  40. #include "SceneCombiner.h"
  41. using namespace Assimp;
  42. // ------------------------------------------------------------------------------------------------
  43. ASSIMP_API size_t aiGetExportFormatCount(void)
  44. {
  45. return Exporter().GetExportFormatCount();
  46. }
  47. // ------------------------------------------------------------------------------------------------
  48. ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex)
  49. {
  50. return Exporter().GetExportFormatDescription(pIndex);
  51. }
  52. // ------------------------------------------------------------------------------------------------
  53. ASSIMP_API void aiCopyScene(const aiScene* pIn, aiScene** pOut)
  54. {
  55. if (!pOut || !pIn) {
  56. return;
  57. }
  58. SceneCombiner::CopyScene(pOut,pIn,true);
  59. ScenePriv(*pOut)->mIsCopy = true;
  60. }
  61. // ------------------------------------------------------------------------------------------------
  62. ASSIMP_API void aiFreeScene(const C_STRUCT aiScene* pIn)
  63. {
  64. // note: aiReleaseImport() is also able to delete scene copies, but in addition
  65. // it also handles scenes with import metadata.
  66. delete pIn;
  67. }
  68. // ------------------------------------------------------------------------------------------------
  69. ASSIMP_API aiReturn aiExportScene( const aiScene* pScene, const char* pFormatId, const char* pFileName, unsigned int pPreprocessing )
  70. {
  71. return ::aiExportSceneEx(pScene,pFormatId,pFileName,NULL,pPreprocessing);
  72. }
  73. // ------------------------------------------------------------------------------------------------
  74. ASSIMP_API aiReturn aiExportSceneEx( const aiScene* pScene, const char* pFormatId, const char* pFileName, aiFileIO* pIO, unsigned int pPreprocessing )
  75. {
  76. Exporter exp;
  77. if (pIO) {
  78. exp.SetIOHandler(new CIOSystemWrapper(pIO));
  79. }
  80. return exp.Export(pScene,pFormatId,pFileName,pPreprocessing);
  81. }
  82. // ------------------------------------------------------------------------------------------------
  83. ASSIMP_API const C_STRUCT aiExportDataBlob* aiExportSceneToBlob( const aiScene* pScene, const char* pFormatId, unsigned int pPreprocessing )
  84. {
  85. Exporter exp;
  86. if (!exp.ExportToBlob(pScene,pFormatId,pPreprocessing)) {
  87. return NULL;
  88. }
  89. const aiExportDataBlob* blob = exp.GetOrphanedBlob();
  90. ai_assert(blob);
  91. return blob;
  92. }
  93. // ------------------------------------------------------------------------------------------------
  94. ASSIMP_API C_STRUCT void aiReleaseExportBlob( const aiExportDataBlob* pData )
  95. {
  96. delete pData;
  97. }
  98. #endif // !ASSIMP_BUILD_NO_EXPORT