Merge pull request #2201 from assimp/MD5-Meshnames

MD5-Loader: set meshnames.
pull/2208/head
Kim Kulling 2018-11-02 21:30:10 +01:00 committed by GitHub
commit 2d74514eab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -420,6 +420,9 @@ void MD5Importer::LoadMD5MeshFile ()
// generate unique vertices in our internal verbose format // generate unique vertices in our internal verbose format
MakeDataUnique(meshSrc); MakeDataUnique(meshSrc);
std::string name( meshSrc.mShader.C_Str() );
name += ".msh";
mesh->mName = name;
mesh->mNumVertices = (unsigned int) meshSrc.mVertices.size(); mesh->mNumVertices = (unsigned int) meshSrc.mVertices.size();
mesh->mVertices = new aiVector3D[mesh->mNumVertices]; mesh->mVertices = new aiVector3D[mesh->mNumVertices];
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]; mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
@ -471,7 +474,6 @@ void MD5Importer::LoadMD5MeshFile ()
MD5::ConvertQuaternion( boneSrc.mRotationQuat, boneSrc.mRotationQuatConverted ); MD5::ConvertQuaternion( boneSrc.mRotationQuat, boneSrc.mRotationQuatConverted );
} }
//unsigned int g = 0;
pv = mesh->mVertices; pv = mesh->mVertices;
for (MD5::VertexList::const_iterator iter = meshSrc.mVertices.begin();iter != meshSrc.mVertices.end();++iter,++pv) { for (MD5::VertexList::const_iterator iter = meshSrc.mVertices.begin();iter != meshSrc.mVertices.end();++iter,++pv) {
// compute the final vertex position from all single weights // compute the final vertex position from all single weights
@ -559,7 +561,9 @@ void MD5Importer::LoadMD5MeshFile ()
// set this also as material name // set this also as material name
mat->AddProperty(&meshSrc.mShader,AI_MATKEY_NAME); mat->AddProperty(&meshSrc.mShader,AI_MATKEY_NAME);
} }
else mat->AddProperty(&meshSrc.mShader,AI_MATKEY_TEXTURE_DIFFUSE(0)); else {
mat->AddProperty(&meshSrc.mShader, AI_MATKEY_TEXTURE_DIFFUSE(0));
}
mesh->mMaterialIndex = n++; mesh->mMaterialIndex = n++;
} }
#endif #endif