diff --git a/code/XFileHelper.h b/code/XFileHelper.h index 35a893ad7..e58df152d 100644 --- a/code/XFileHelper.h +++ b/code/XFileHelper.h @@ -110,6 +110,7 @@ struct Bone /** Helper structure to represent an XFile mesh */ struct Mesh { + std::string mName; std::vector mPositions; std::vector mPosFaces; std::vector mNormals; @@ -124,7 +125,7 @@ struct Mesh std::vector mBones; - Mesh() { mNumTextures = 0; mNumColorSets = 0; } + Mesh(const std::string &pName = "") { mName = pName; mNumTextures = 0; mNumColorSets = 0; } }; /** Helper structure to represent a XFile frame */ diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index 41b8b411f..800f9a335 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -294,6 +294,9 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec mesh->mNumFaces = (unsigned int)faces.size(); mesh->mFaces = new aiFace[mesh->mNumFaces]; + // name + mesh->mName.Set(sourceMesh->mName); + // normals? if( sourceMesh->mNormals.size() > 0) mesh->mNormals = new aiVector3D[numVertices]; diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index 016c68731..dd5a17110 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -414,7 +414,7 @@ void XFileParser::ParseDataObjectFrame( Node* pParent) else if( objectName == "Mesh") { - Mesh* mesh = new Mesh; + Mesh* mesh = new Mesh(name); node->mMeshes.push_back( mesh); ParseDataObjectMesh( mesh); } else