Version.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2020, 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. // Actually just a dummy, used by the compiler to build the precompiled header.
  35. #include <assimp/version.h>
  36. #include <assimp/scene.h>
  37. #include "ScenePrivate.h"
  38. #include "revision.h"
  39. // --------------------------------------------------------------------------------
  40. // Legal information string - don't remove this.
  41. static const char* LEGAL_INFORMATION =
  42. "Open Asset Import Library (Assimp).\n"
  43. "A free C/C++ library to import various 3D file formats into applications\n\n"
  44. "(c) 2006-2020, assimp team\n"
  45. "License under the terms and conditions of the 3-clause BSD license\n"
  46. "http://assimp.org\n"
  47. ;
  48. // ------------------------------------------------------------------------------------------------
  49. // Get legal string
  50. ASSIMP_API const char* aiGetLegalString () {
  51. return LEGAL_INFORMATION;
  52. }
  53. // ------------------------------------------------------------------------------------------------
  54. // Get Assimp patch version
  55. ASSIMP_API unsigned int aiGetVersionPatch() {
  56. return VER_PATCH;
  57. }
  58. // ------------------------------------------------------------------------------------------------
  59. // Get Assimp minor version
  60. ASSIMP_API unsigned int aiGetVersionMinor () {
  61. return VER_MINOR;
  62. }
  63. // ------------------------------------------------------------------------------------------------
  64. // Get Assimp major version
  65. ASSIMP_API unsigned int aiGetVersionMajor () {
  66. return VER_MAJOR;
  67. }
  68. // ------------------------------------------------------------------------------------------------
  69. // Get flags used for compilation
  70. ASSIMP_API unsigned int aiGetCompileFlags () {
  71. unsigned int flags = 0;
  72. #ifdef ASSIMP_BUILD_BOOST_WORKAROUND
  73. flags |= ASSIMP_CFLAGS_NOBOOST;
  74. #endif
  75. #ifdef ASSIMP_BUILD_SINGLETHREADED
  76. flags |= ASSIMP_CFLAGS_SINGLETHREADED;
  77. #endif
  78. #ifdef ASSIMP_BUILD_DEBUG
  79. flags |= ASSIMP_CFLAGS_DEBUG;
  80. #endif
  81. #ifdef ASSIMP_BUILD_DLL_EXPORT
  82. flags |= ASSIMP_CFLAGS_SHARED;
  83. #endif
  84. #ifdef _STLPORT_VERSION
  85. flags |= ASSIMP_CFLAGS_STLPORT;
  86. #endif
  87. return flags;
  88. }
  89. // ------------------------------------------------------------------------------------------------
  90. ASSIMP_API unsigned int aiGetVersionRevision() {
  91. return GitVersion;
  92. }
  93. ASSIMP_API const char *aiGetBranchName() {
  94. return GitBranch;
  95. }
  96. // ------------------------------------------------------------------------------------------------
  97. ASSIMP_API aiScene::aiScene()
  98. : mFlags(0)
  99. , mRootNode(nullptr)
  100. , mNumMeshes(0)
  101. , mMeshes(nullptr)
  102. , mNumMaterials(0)
  103. , mMaterials(nullptr)
  104. , mNumAnimations(0)
  105. , mAnimations(nullptr)
  106. , mNumTextures(0)
  107. , mTextures(nullptr)
  108. , mNumLights(0)
  109. , mLights(nullptr)
  110. , mNumCameras(0)
  111. , mCameras(nullptr)
  112. , mMetaData(nullptr)
  113. , mPrivate(new Assimp::ScenePrivateData()) {
  114. // empty
  115. }
  116. // ------------------------------------------------------------------------------------------------
  117. ASSIMP_API aiScene::~aiScene() {
  118. // delete all sub-objects recursively
  119. delete mRootNode;
  120. // To make sure we won't crash if the data is invalid it's
  121. // much better to check whether both mNumXXX and mXXX are
  122. // valid instead of relying on just one of them.
  123. if (mNumMeshes && mMeshes)
  124. for( unsigned int a = 0; a < mNumMeshes; a++)
  125. delete mMeshes[a];
  126. delete [] mMeshes;
  127. if (mNumMaterials && mMaterials) {
  128. for (unsigned int a = 0; a < mNumMaterials; ++a ) {
  129. delete mMaterials[ a ];
  130. }
  131. }
  132. delete [] mMaterials;
  133. if (mNumAnimations && mAnimations)
  134. for( unsigned int a = 0; a < mNumAnimations; a++)
  135. delete mAnimations[a];
  136. delete [] mAnimations;
  137. if (mNumTextures && mTextures)
  138. for( unsigned int a = 0; a < mNumTextures; a++)
  139. delete mTextures[a];
  140. delete [] mTextures;
  141. if (mNumLights && mLights)
  142. for( unsigned int a = 0; a < mNumLights; a++)
  143. delete mLights[a];
  144. delete [] mLights;
  145. if (mNumCameras && mCameras)
  146. for( unsigned int a = 0; a < mNumCameras; a++)
  147. delete mCameras[a];
  148. delete [] mCameras;
  149. aiMetadata::Dealloc(mMetaData);
  150. mMetaData = nullptr;
  151. delete static_cast<Assimp::ScenePrivateData*>( mPrivate );
  152. }