Added mesh name importing to .X ascii format.

pull/588/head
Henry Stratmann III 2015-06-20 17:35:30 -05:00
parent daabf4bf86
commit 328cae8a81
3 changed files with 6 additions and 2 deletions

View File

@ -110,6 +110,7 @@ struct Bone
/** Helper structure to represent an XFile mesh */ /** Helper structure to represent an XFile mesh */
struct Mesh struct Mesh
{ {
std::string mName;
std::vector<aiVector3D> mPositions; std::vector<aiVector3D> mPositions;
std::vector<Face> mPosFaces; std::vector<Face> mPosFaces;
std::vector<aiVector3D> mNormals; std::vector<aiVector3D> mNormals;
@ -124,7 +125,7 @@ struct Mesh
std::vector<Bone> mBones; std::vector<Bone> mBones;
Mesh() { mNumTextures = 0; mNumColorSets = 0; } Mesh(const std::string &pName = "") { mName = pName; mNumTextures = 0; mNumColorSets = 0; }
}; };
/** Helper structure to represent a XFile frame */ /** Helper structure to represent a XFile frame */

View File

@ -294,6 +294,9 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
mesh->mNumFaces = (unsigned int)faces.size(); mesh->mNumFaces = (unsigned int)faces.size();
mesh->mFaces = new aiFace[mesh->mNumFaces]; mesh->mFaces = new aiFace[mesh->mNumFaces];
// name
mesh->mName.Set(sourceMesh->mName);
// normals? // normals?
if( sourceMesh->mNormals.size() > 0) if( sourceMesh->mNormals.size() > 0)
mesh->mNormals = new aiVector3D[numVertices]; mesh->mNormals = new aiVector3D[numVertices];

View File

@ -414,7 +414,7 @@ void XFileParser::ParseDataObjectFrame( Node* pParent)
else else
if( objectName == "Mesh") if( objectName == "Mesh")
{ {
Mesh* mesh = new Mesh; Mesh* mesh = new Mesh(name);
node->mMeshes.push_back( mesh); node->mMeshes.push_back( mesh);
ParseDataObjectMesh( mesh); ParseDataObjectMesh( mesh);
} else } else