Version.cpp 6.2 KB

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