fix md2 orientation
parent
96d0524fab
commit
edf12bd357
|
@ -433,10 +433,6 @@ void MD2Importer::InternReadFile( const std::string& pFile,
|
||||||
aiVector3D& vNormal = pcMesh->mNormals[iCurrent];
|
aiVector3D& vNormal = pcMesh->mNormals[iCurrent];
|
||||||
LookupNormalIndex(pcVerts[iIndex].lightNormalIndex,vNormal);
|
LookupNormalIndex(pcVerts[iIndex].lightNormalIndex,vNormal);
|
||||||
|
|
||||||
// flip z and y to become right-handed
|
|
||||||
std::swap((float&)vNormal.z,(float&)vNormal.y);
|
|
||||||
std::swap((float&)vec.z,(float&)vec.y);
|
|
||||||
|
|
||||||
if (m_pcHeader->numTexCoords) {
|
if (m_pcHeader->numTexCoords) {
|
||||||
// validate texture coordinates
|
// validate texture coordinates
|
||||||
iIndex = pcTriangles[i].textureIndices[c];
|
iIndex = pcTriangles[i].textureIndices[c];
|
||||||
|
@ -454,7 +450,15 @@ void MD2Importer::InternReadFile( const std::string& pFile,
|
||||||
}
|
}
|
||||||
pScene->mMeshes[0]->mFaces[i].mIndices[c] = iCurrent;
|
pScene->mMeshes[0]->mFaces[i].mIndices[c] = iCurrent;
|
||||||
}
|
}
|
||||||
|
// flip the face order
|
||||||
|
std::swap( pScene->mMeshes[0]->mFaces[i].mIndices[0], pScene->mMeshes[0]->mFaces[i].mIndices[2] );
|
||||||
}
|
}
|
||||||
|
// Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system
|
||||||
|
pScene->mRootNode->mTransformation = aiMatrix4x4(
|
||||||
|
1.f, 0.f, 0.f, 0.f,
|
||||||
|
0.f, 0.f, 1.f, 0.f,
|
||||||
|
0.f, -1.f, 0.f, 0.f,
|
||||||
|
0.f, 0.f, 0.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !! ASSIMP_BUILD_NO_MD2_IMPORTER
|
#endif // !! ASSIMP_BUILD_NO_MD2_IMPORTER
|
||||||
|
|
Loading…
Reference in New Issue