Skip to content

Commit

Permalink
Merge pull request #56 from asmaloney/init_stuff
Browse files Browse the repository at this point in the history
Make sure members are initialized properly
  • Loading branch information
acgessler committed Jun 21, 2013
2 parents f91abbc + 1da281c commit fd2f1ca
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions code/ObjFileData.h 100644 → 100755
Expand Up @@ -283,6 +283,7 @@ struct Model
m_pCurrent(NULL),
m_pCurrentMaterial(NULL),
m_pDefaultMaterial(NULL),
m_pGroupFaceIDs(NULL),
m_strActiveGroup(""),
m_pCurrentMesh(NULL)
{
Expand Down
54 changes: 27 additions & 27 deletions include/assimp/mesh.h
Expand Up @@ -135,8 +135,9 @@ struct aiFace

//! Default constructor
aiFace()
: mNumIndices( 0 )
, mIndices( NULL )
{
mNumIndices = 0; mIndices = NULL;
}

//! Default destructor. Delete the index array
Expand All @@ -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;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fd2f1ca

Please sign in to comment.