Merge pull request #56 from asmaloney/init_stuff

Make sure members are initialized properly
pull/60/head
Alexander Gessler 2013-06-21 09:53:41 -07:00
commit fd2f1ca3a8
2 changed files with 28 additions and 27 deletions

1
code/ObjFileData.h 100644 → 100755
View File

@ -283,6 +283,7 @@ struct Model
m_pCurrent(NULL), m_pCurrent(NULL),
m_pCurrentMaterial(NULL), m_pCurrentMaterial(NULL),
m_pDefaultMaterial(NULL), m_pDefaultMaterial(NULL),
m_pGroupFaceIDs(NULL),
m_strActiveGroup(""), m_strActiveGroup(""),
m_pCurrentMesh(NULL) m_pCurrentMesh(NULL)
{ {

View File

@ -135,8 +135,9 @@ struct aiFace
//! Default constructor //! Default constructor
aiFace() aiFace()
: mNumIndices( 0 )
, mIndices( NULL )
{ {
mNumIndices = 0; mIndices = NULL;
} }
//! Default destructor. Delete the index array //! Default destructor. Delete the index array
@ -147,13 +148,13 @@ struct aiFace
//! Copy constructor. Copy the index array //! Copy constructor. Copy the index array
aiFace( const aiFace& o) aiFace( const aiFace& o)
: mIndices( NULL )
{ {
mIndices = NULL;
*this = o; *this = o;
} }
//! Assignment operator. Copy the index array //! Assignment operator. Copy the index array
const aiFace& operator = ( const aiFace& o) aiFace& operator = ( const aiFace& o)
{ {
if (&o == this) if (&o == this)
return *this; return *this;
@ -248,17 +249,17 @@ struct aiBone
//! Default constructor //! Default constructor
aiBone() aiBone()
: mNumWeights( 0 )
, mWeights( NULL )
{ {
mNumWeights = 0; mWeights = NULL;
} }
//! Copy constructor //! Copy constructor
aiBone(const aiBone& other) aiBone(const aiBone& other)
: mName( other.mName )
, mNumWeights( other.mNumWeights )
, mOffsetMatrix( other.mOffsetMatrix )
{ {
mNumWeights = other.mNumWeights;
mOffsetMatrix = other.mOffsetMatrix;
mName = other.mName;
if (other.mWeights && other.mNumWeights) if (other.mWeights && other.mNumWeights)
{ {
mWeights = new aiVertexWeight[mNumWeights]; mWeights = new aiVertexWeight[mNumWeights];
@ -378,10 +379,10 @@ struct aiAnimMesh
#ifdef __cplusplus #ifdef __cplusplus
aiAnimMesh() aiAnimMesh()
: mVertices() : mVertices( NULL )
, mNormals() , mNormals( NULL )
, mTangents() , mTangents( NULL )
, mBitangents() , mBitangents( NULL )
, mNumVertices( 0 ) , mNumVertices( 0 )
{ {
// fixme consider moving this to the ctor initializer list as well // fixme consider moving this to the ctor initializer list as well
@ -610,29 +611,28 @@ struct aiMesh
//! Default constructor. Initializes all members to 0 //! Default constructor. Initializes all members to 0
aiMesh() aiMesh()
: mPrimitiveTypes( 0 )
, mNumVertices( 0 )
, mNumFaces( 0 )
, mVertices( NULL )
, mNormals( NULL )
, mTangents( NULL )
, mBitangents( NULL )
, mFaces( NULL )
, mNumBones( 0 )
, mBones( 0 )
, mMaterialIndex( 0 )
, mNumAnimMeshes( 0 )
, mAnimMeshes( NULL )
{ {
mNumVertices = 0;
mNumFaces = 0;
mNumAnimMeshes = 0;
mPrimitiveTypes = 0;
mVertices = NULL; mFaces = NULL;
mNormals = NULL; mTangents = NULL;
mBitangents = NULL;
mAnimMeshes = NULL;
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++) for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++)
{ {
mNumUVComponents[a] = 0; mNumUVComponents[a] = 0;
mTextureCoords[a] = NULL; mTextureCoords[a] = NULL;
} }
for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++) for( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++)
mColors[a] = NULL; mColors[a] = NULL;
mNumBones = 0; mBones = NULL;
mMaterialIndex = 0;
mNumAnimMeshes = 0;
mAnimMeshes = NULL;
} }
//! Deletes all storage allocated for the mesh //! Deletes all storage allocated for the mesh