Version.cpp 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2019, 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-2019, 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 minor version
  55. ASSIMP_API unsigned int aiGetVersionMinor () {
  56. return VER_MINOR;
  57. }
  58. // ------------------------------------------------------------------------------------------------
  59. // Get Assimp major version
  60. ASSIMP_API unsigned int aiGetVersionMajor () {
  61. return VER_MAJOR;
  62. }
  63. // ------------------------------------------------------------------------------------------------
  64. // Get flags used for compilation
  65. ASSIMP_API unsigned int aiGetCompileFlags () {
  66. unsigned int flags = 0;
  67. #ifdef ASSIMP_BUILD_BOOST_WORKAROUND
  68. flags |= ASSIMP_CFLAGS_NOBOOST;
  69. #endif
  70. #ifdef ASSIMP_BUILD_SINGLETHREADED
  71. flags |= ASSIMP_CFLAGS_SINGLETHREADED;
  72. #endif
  73. #ifdef ASSIMP_BUILD_DEBUG
  74. flags |= ASSIMP_CFLAGS_DEBUG;
  75. #endif
  76. #ifdef ASSIMP_BUILD_DLL_EXPORT
  77. flags |= ASSIMP_CFLAGS_SHARED;
  78. #endif
  79. #ifdef _STLPORT_VERSION
  80. flags |= ASSIMP_CFLAGS_STLPORT;
  81. #endif
  82. return flags;
  83. }
  84. // ------------------------------------------------------------------------------------------------
  85. ASSIMP_API unsigned int aiGetVersionRevision() {
  86. return GitVersion;
  87. }
  88. ASSIMP_API const char *aiGetBranchName() {
  89. return GitBranch;
  90. }
  91. // ------------------------------------------------------------------------------------------------
  92. ASSIMP_API aiScene::aiScene()
  93. : mFlags(0)
  94. , mRootNode(nullptr)
  95. , mNumMeshes(0)
  96. , mMeshes(nullptr)
  97. , mNumMaterials(0)
  98. , mMaterials(nullptr)
  99. , mNumAnimations(0)
  100. , mAnimations(nullptr)
  101. , mNumTextures(0)
  102. , mTextures(nullptr)
  103. , mNumLights(0)
  104. , mLights(nullptr)
  105. , mNumCameras(0)
  106. , mCameras(nullptr)
  107. , mMetaData(nullptr)
  108. , mPrivate(new Assimp::ScenePrivateData()) {
  109. // empty
  110. }
  111. // ------------------------------------------------------------------------------------------------
  112. ASSIMP_API aiScene::~aiScene() {
  113. // delete all sub-objects recursively
  114. delete mRootNode;
  115. // To make sure we won't crash if the data is invalid it's
  116. // much better to check whether both mNumXXX and mXXX are
  117. // valid instead of relying on just one of them.
  118. if (mNumMeshes && mMeshes)
  119. for( unsigned int a = 0; a < mNumMeshes; a++)
  120. delete mMeshes[a];
  121. delete [] mMeshes;
  122. if (mNumMaterials && mMaterials) {
  123. for (unsigned int a = 0; a < mNumMaterials; ++a ) {
  124. delete mMaterials[ a ];
  125. }
  126. }
  127. delete [] mMaterials;
  128. if (mNumAnimations && mAnimations)
  129. for( unsigned int a = 0; a < mNumAnimations; a++)
  130. delete mAnimations[a];
  131. delete [] mAnimations;
  132. if (mNumTextures && mTextures)
  133. for( unsigned int a = 0; a < mNumTextures; a++)
  134. delete mTextures[a];
  135. delete [] mTextures;
  136. if (mNumLights && mLights)
  137. for( unsigned int a = 0; a < mNumLights; a++)
  138. delete mLights[a];
  139. delete [] mLights;
  140. if (mNumCameras && mCameras)
  141. for( unsigned int a = 0; a < mNumCameras; a++)
  142. delete mCameras[a];
  143. delete [] mCameras;
  144. aiMetadata::Dealloc(mMetaData);
  145. mMetaData = nullptr;
  146. delete static_cast<Assimp::ScenePrivateData*>( mPrivate );
  147. }