1/*
2---------------------------------------------------------------------------
3Open Asset Import Library (assimp)
4---------------------------------------------------------------------------
5
6Copyright (c) 2006-2017, assimp team
7
8All rights reserved.
9
10Redistribution and use of this software in source and binary forms,
11with or without modification, are permitted provided that the following
12conditions are met:
13
14* Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
17
18* Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
22
23* Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
27
28THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39---------------------------------------------------------------------------
40*/
41
42// Actually just a dummy, used by the compiler to build the precompiled header.
43
44#include <assimp/version.h>
45#include <assimp/scene.h>
46#include "ScenePrivate.h"
47
48static const unsigned int MajorVersion = 4;
49static const unsigned int MinorVersion = 1;
50
51// --------------------------------------------------------------------------------
52// Legal information string - dont't remove this.
53static const char* LEGAL_INFORMATION =
54
55"Open Asset Import Library (Assimp).\n"
56"A free C/C++ library to import various 3D file formats into applications\n\n"
57
58"(c) 2008-2017, assimp team\n"
59"License under the terms and conditions of the 3-clause BSD license\n"
60"http://assimp.sourceforge.net\n"
61;
62
63// ------------------------------------------------------------------------------------------------
64// Get legal string
65ASSIMP_API const char* aiGetLegalString () {
66 return LEGAL_INFORMATION;
67}
68
69// ------------------------------------------------------------------------------------------------
70// Get Assimp minor version
71ASSIMP_API unsigned int aiGetVersionMinor () {
72 return MinorVersion;
73}
74
75// ------------------------------------------------------------------------------------------------
76// Get Assimp major version
77ASSIMP_API unsigned int aiGetVersionMajor () {
78 return MajorVersion;
79}
80
81// ------------------------------------------------------------------------------------------------
82// Get flags used for compilation
83ASSIMP_API unsigned int aiGetCompileFlags () {
84
85 unsigned int flags = 0;
86
87#ifdef ASSIMP_BUILD_BOOST_WORKAROUND
88 flags |= ASSIMP_CFLAGS_NOBOOST;
89#endif
90#ifdef ASSIMP_BUILD_SINGLETHREADED
91 flags |= ASSIMP_CFLAGS_SINGLETHREADED;
92#endif
93#ifdef ASSIMP_BUILD_DEBUG
94 flags |= ASSIMP_CFLAGS_DEBUG;
95#endif
96#ifdef ASSIMP_BUILD_DLL_EXPORT
97 flags |= ASSIMP_CFLAGS_SHARED;
98#endif
99#ifdef _STLPORT_VERSION
100 flags |= ASSIMP_CFLAGS_STLPORT;
101#endif
102
103 return flags;
104}
105
106// include current build revision, which is even updated from time to time -- :-)
107#include "revision.h"
108
109// ------------------------------------------------------------------------------------------------
110ASSIMP_API unsigned int aiGetVersionRevision() {
111 return GitVersion;
112}
113
114// ------------------------------------------------------------------------------------------------
115ASSIMP_API aiScene::aiScene()
116: mFlags(0)
117, mRootNode(NULL)
118, mNumMeshes(0)
119, mMeshes(NULL)
120, mNumMaterials(0)
121, mMaterials(NULL)
122, mNumAnimations(0)
123, mAnimations(NULL)
124, mNumTextures(0)
125, mTextures(NULL)
126, mNumLights(0)
127, mLights(NULL)
128, mNumCameras(0)
129, mCameras(NULL)
130, mPrivate(new Assimp::ScenePrivateData()) {
131 // empty
132}
133
134// ------------------------------------------------------------------------------------------------
135ASSIMP_API aiScene::~aiScene() {
136 // delete all sub-objects recursively
137 delete mRootNode;
138
139 // To make sure we won't crash if the data is invalid it's
140 // much better to check whether both mNumXXX and mXXX are
141 // valid instead of relying on just one of them.
142 if (mNumMeshes && mMeshes)
143 for( unsigned int a = 0; a < mNumMeshes; a++)
144 delete mMeshes[a];
145 delete [] mMeshes;
146
147 if (mNumMaterials && mMaterials)
148 for( unsigned int a = 0; a < mNumMaterials; a++)
149 delete mMaterials[a];
150 delete [] mMaterials;
151
152 if (mNumAnimations && mAnimations)
153 for( unsigned int a = 0; a < mNumAnimations; a++)
154 delete mAnimations[a];
155 delete [] mAnimations;
156
157 if (mNumTextures && mTextures)
158 for( unsigned int a = 0; a < mNumTextures; a++)
159 delete mTextures[a];
160 delete [] mTextures;
161
162 if (mNumLights && mLights)
163 for( unsigned int a = 0; a < mNumLights; a++)
164 delete mLights[a];
165 delete [] mLights;
166
167 if (mNumCameras && mCameras)
168 for( unsigned int a = 0; a < mNumCameras; a++)
169 delete mCameras[a];
170 delete [] mCameras;
171
172 delete static_cast<Assimp::ScenePrivateData*>( mPrivate );
173}
174
175