Move aiScene constructor (#5614)
parent
75a10fedd0
commit
a722e33027
|
@ -118,83 +118,3 @@ ASSIMP_API const char *aiGetBranchName() {
|
|||
return GitBranch;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
ASSIMP_API aiScene::aiScene() :
|
||||
mFlags(0),
|
||||
mRootNode(nullptr),
|
||||
mNumMeshes(0),
|
||||
mMeshes(nullptr),
|
||||
mNumMaterials(0),
|
||||
mMaterials(nullptr),
|
||||
mNumAnimations(0),
|
||||
mAnimations(nullptr),
|
||||
mNumTextures(0),
|
||||
mTextures(nullptr),
|
||||
mNumLights(0),
|
||||
mLights(nullptr),
|
||||
mNumCameras(0),
|
||||
mCameras(nullptr),
|
||||
mMetaData(nullptr),
|
||||
mName(),
|
||||
mNumSkeletons(0),
|
||||
mSkeletons(nullptr),
|
||||
mPrivate(new Assimp::ScenePrivateData()) {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
ASSIMP_API aiScene::~aiScene() {
|
||||
// delete all sub-objects recursively
|
||||
delete mRootNode;
|
||||
|
||||
// To make sure we won't crash if the data is invalid it's
|
||||
// much better to check whether both mNumXXX and mXXX are
|
||||
// valid instead of relying on just one of them.
|
||||
if (mNumMeshes && mMeshes) {
|
||||
for (unsigned int a = 0; a < mNumMeshes; ++a) {
|
||||
delete mMeshes[a];
|
||||
}
|
||||
}
|
||||
delete[] mMeshes;
|
||||
|
||||
if (mNumMaterials && mMaterials) {
|
||||
for (unsigned int a = 0; a < mNumMaterials; ++a) {
|
||||
delete mMaterials[a];
|
||||
}
|
||||
}
|
||||
delete[] mMaterials;
|
||||
|
||||
if (mNumAnimations && mAnimations) {
|
||||
for (unsigned int a = 0; a < mNumAnimations; ++a) {
|
||||
delete mAnimations[a];
|
||||
}
|
||||
}
|
||||
delete[] mAnimations;
|
||||
|
||||
if (mNumTextures && mTextures) {
|
||||
for (unsigned int a = 0; a < mNumTextures; ++a) {
|
||||
delete mTextures[a];
|
||||
}
|
||||
}
|
||||
delete[] mTextures;
|
||||
|
||||
if (mNumLights && mLights) {
|
||||
for (unsigned int a = 0; a < mNumLights; ++a) {
|
||||
delete mLights[a];
|
||||
}
|
||||
}
|
||||
delete[] mLights;
|
||||
|
||||
if (mNumCameras && mCameras) {
|
||||
for (unsigned int a = 0; a < mNumCameras; ++a) {
|
||||
delete mCameras[a];
|
||||
}
|
||||
}
|
||||
delete[] mCameras;
|
||||
|
||||
aiMetadata::Dealloc(mMetaData);
|
||||
|
||||
delete[] mSkeletons;
|
||||
|
||||
delete static_cast<Assimp::ScenePrivateData *>(mPrivate);
|
||||
}
|
||||
|
|
|
@ -40,6 +40,87 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
#include <assimp/scene.h>
|
||||
|
||||
#include "ScenePrivate.h"
|
||||
|
||||
aiScene::aiScene() :
|
||||
mFlags(0),
|
||||
mRootNode(nullptr),
|
||||
mNumMeshes(0),
|
||||
mMeshes(nullptr),
|
||||
mNumMaterials(0),
|
||||
mMaterials(nullptr),
|
||||
mNumAnimations(0),
|
||||
mAnimations(nullptr),
|
||||
mNumTextures(0),
|
||||
mTextures(nullptr),
|
||||
mNumLights(0),
|
||||
mLights(nullptr),
|
||||
mNumCameras(0),
|
||||
mCameras(nullptr),
|
||||
mMetaData(nullptr),
|
||||
mName(),
|
||||
mNumSkeletons(0),
|
||||
mSkeletons(nullptr),
|
||||
mPrivate(new Assimp::ScenePrivateData()) {
|
||||
// empty
|
||||
}
|
||||
|
||||
aiScene::~aiScene() {
|
||||
// delete all sub-objects recursively
|
||||
delete mRootNode;
|
||||
|
||||
// To make sure we won't crash if the data is invalid it's
|
||||
// much better to check whether both mNumXXX and mXXX are
|
||||
// valid instead of relying on just one of them.
|
||||
if (mNumMeshes && mMeshes) {
|
||||
for (unsigned int a = 0; a < mNumMeshes; ++a) {
|
||||
delete mMeshes[a];
|
||||
}
|
||||
}
|
||||
delete[] mMeshes;
|
||||
|
||||
if (mNumMaterials && mMaterials) {
|
||||
for (unsigned int a = 0; a < mNumMaterials; ++a) {
|
||||
delete mMaterials[a];
|
||||
}
|
||||
}
|
||||
delete[] mMaterials;
|
||||
|
||||
if (mNumAnimations && mAnimations) {
|
||||
for (unsigned int a = 0; a < mNumAnimations; ++a) {
|
||||
delete mAnimations[a];
|
||||
}
|
||||
}
|
||||
delete[] mAnimations;
|
||||
|
||||
if (mNumTextures && mTextures) {
|
||||
for (unsigned int a = 0; a < mNumTextures; ++a) {
|
||||
delete mTextures[a];
|
||||
}
|
||||
}
|
||||
delete[] mTextures;
|
||||
|
||||
if (mNumLights && mLights) {
|
||||
for (unsigned int a = 0; a < mNumLights; ++a) {
|
||||
delete mLights[a];
|
||||
}
|
||||
}
|
||||
delete[] mLights;
|
||||
|
||||
if (mNumCameras && mCameras) {
|
||||
for (unsigned int a = 0; a < mNumCameras; ++a) {
|
||||
delete mCameras[a];
|
||||
}
|
||||
}
|
||||
delete[] mCameras;
|
||||
|
||||
aiMetadata::Dealloc(mMetaData);
|
||||
|
||||
delete[] mSkeletons;
|
||||
|
||||
delete static_cast<Assimp::ScenePrivateData *>(mPrivate);
|
||||
}
|
||||
|
||||
aiNode::aiNode() :
|
||||
mName(""),
|
||||
mParent(nullptr),
|
||||
|
|
|
@ -141,25 +141,28 @@ struct ASSIMP_API aiNode {
|
|||
/** Destructor */
|
||||
~aiNode();
|
||||
|
||||
/** Searches for a node with a specific name, beginning at this
|
||||
/**
|
||||
* @brief Searches for a node with a specific name, beginning at this
|
||||
* nodes. Normally you will call this method on the root node
|
||||
* of the scene.
|
||||
*
|
||||
* @param name Name to search for
|
||||
* @return nullptr or a valid Node if the search was successful.
|
||||
*/
|
||||
inline
|
||||
const aiNode* FindNode(const aiString& name) const {
|
||||
inline const aiNode* FindNode(const aiString& name) const {
|
||||
return FindNode(name.data);
|
||||
}
|
||||
|
||||
inline
|
||||
aiNode* FindNode(const aiString& name) {
|
||||
inline aiNode* FindNode(const aiString& name) {
|
||||
return FindNode(name.data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Will search for a node described by its name.
|
||||
* @param[in] name The name for the node to look for.
|
||||
* @return Pointer showing to the node or nullptr if not found.
|
||||
*/
|
||||
const aiNode* FindNode(const char* name) const;
|
||||
|
||||
aiNode* FindNode(const char* name);
|
||||
|
||||
/**
|
||||
|
@ -240,8 +243,7 @@ struct ASSIMP_API aiNode {
|
|||
* delete a given scene on your own.
|
||||
*/
|
||||
// -------------------------------------------------------------------------------
|
||||
struct aiScene
|
||||
{
|
||||
struct ASSIMP_API aiScene {
|
||||
/** Any combination of the AI_SCENE_FLAGS_XXX flags. By default
|
||||
* this value is 0, no flags are set. Most applications will
|
||||
* want to reject all scenes with the AI_SCENE_FLAGS_INCOMPLETE
|
||||
|
@ -355,10 +357,10 @@ struct aiScene
|
|||
#ifdef __cplusplus
|
||||
|
||||
//! Default constructor - set everything to 0/nullptr
|
||||
ASSIMP_API aiScene();
|
||||
aiScene();
|
||||
|
||||
//! Destructor
|
||||
ASSIMP_API ~aiScene();
|
||||
~aiScene();
|
||||
|
||||
//! Check whether the scene contains meshes
|
||||
//! Unless no special scene flags are set this will always be true.
|
||||
|
|
Loading…
Reference in New Issue