From 328cae8a8153f9a6b01f3bdf395ae009c7aa20ce Mon Sep 17 00:00:00 2001 From: Henry Stratmann III Date: Sat, 20 Jun 2015 17:35:30 -0500 Subject: [PATCH] Added mesh name importing to .X ascii format. --- code/XFileHelper.h | 3 ++- code/XFileImporter.cpp | 3 +++ code/XFileParser.cpp | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) 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