Merge pull request #56 from asmaloney/init_stuff

Make sure members are initialized properly
This commit is contained in:
Alexander Gessler
2013-06-21 09:53:41 -07:00
2 changed files with 28 additions and 27 deletions

1
code/ObjFileData.h Normal file → Executable file
View File

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

View File

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