Update MD3Loader.cpp

Fix typo.
pull/2371/head
Kim Kulling 2019-03-16 16:08:03 +01:00 committed by GitHub
parent 61ffe017e8
commit 64a7a46406
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 13 deletions

View File

@ -718,9 +718,7 @@ void MD3Importer::ConvertPath(const char* texture_name, const char* header_name,
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Imports the given file into the given scene structure. // Imports the given file into the given scene structure.
void MD3Importer::InternReadFile( const std::string& pFile, void MD3Importer::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
aiScene* pScene, IOSystem* pIOHandler)
{
mFile = pFile; mFile = pFile;
mScene = pScene; mScene = pScene;
mIOHandler = pIOHandler; mIOHandler = pIOHandler;
@ -912,7 +910,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
sh = convertedPath.length(); sh = convertedPath.length();
} }
const std::string without_ext = convertedPath.substr(0,s); const std::string without_ext = convertedPath.substr(0,sh);
std::list< Q3Shader::ShaderDataBlock >::const_iterator dit = std::find(shaders.blocks.begin(),shaders.blocks.end(),without_ext); std::list< Q3Shader::ShaderDataBlock >::const_iterator dit = std::find(shaders.blocks.begin(),shaders.blocks.end(),without_ext);
if (dit != shaders.blocks.end()) { if (dit != shaders.blocks.end()) {
// We made it! // We made it!
@ -947,8 +945,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
aiString szString; aiString szString;
if (convertedPath.length()) { if (convertedPath.length()) {
szString.Set(convertedPath); szString.Set(convertedPath);
} } else {
else {
ASSIMP_LOG_WARN("Texture file name has zero length. Using default name"); ASSIMP_LOG_WARN("Texture file name has zero length. Using default name");
szString.Set("dummy_texture.bmp"); szString.Set("dummy_texture.bmp");
} }
@ -957,8 +954,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
// prevent transparency by default // prevent transparency by default
int no_alpha = aiTextureFlags_IgnoreAlpha; int no_alpha = aiTextureFlags_IgnoreAlpha;
pcHelper->AddProperty(&no_alpha,1,AI_MATKEY_TEXFLAGS_DIFFUSE(0)); pcHelper->AddProperty(&no_alpha,1,AI_MATKEY_TEXFLAGS_DIFFUSE(0));
} } else {
else {
Q3Shader::ConvertShaderToMaterial(pcHelper,*shader); Q3Shader::ConvertShaderToMaterial(pcHelper,*shader);
} }
@ -1028,7 +1024,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
if (!shader || shader->cull == Q3Shader::CULL_CW) { if (!shader || shader->cull == Q3Shader::CULL_CW) {
std::swap(pcMesh->mFaces[i].mIndices[2],pcMesh->mFaces[i].mIndices[1]); std::swap(pcMesh->mFaces[i].mIndices[2],pcMesh->mFaces[i].mIndices[1]);
} }
pcTriangles++; ++pcTriangles;
} }
// Go to the next surface // Go to the next surface
@ -1044,8 +1040,9 @@ void MD3Importer::InternReadFile( const std::string& pFile,
} }
} }
if (!pScene->mNumMeshes) if (!pScene->mNumMeshes) {
throw DeadlyImportError( "MD3: File contains no valid mesh"); throw DeadlyImportError( "MD3: File contains no valid mesh");
}
pScene->mNumMaterials = iNumMaterials; pScene->mNumMaterials = iNumMaterials;
// Now we need to generate an empty node graph // Now we need to generate an empty node graph
@ -1059,7 +1056,6 @@ void MD3Importer::InternReadFile( const std::string& pFile,
pScene->mRootNode->mChildren = new aiNode*[pcHeader->NUM_TAGS]; pScene->mRootNode->mChildren = new aiNode*[pcHeader->NUM_TAGS];
for (unsigned int i = 0; i < pcHeader->NUM_TAGS; ++i, ++pcTags) { for (unsigned int i = 0; i < pcHeader->NUM_TAGS; ++i, ++pcTags) {
aiNode* nd = pScene->mRootNode->mChildren[i] = new aiNode(); aiNode* nd = pScene->mRootNode->mChildren[i] = new aiNode();
nd->mName.Set((const char*)pcTags->NAME); nd->mName.Set((const char*)pcTags->NAME);
nd->mParent = pScene->mRootNode; nd->mParent = pScene->mRootNode;
@ -1087,8 +1083,12 @@ void MD3Importer::InternReadFile( const std::string& pFile,
pScene->mRootNode->mMeshes[i] = i; pScene->mRootNode->mMeshes[i] = i;
// Now rotate the whole scene 90 degrees around the x axis to convert to internal coordinate system // 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, pScene->mRootNode->mTransformation = aiMatrix4x4(
0.f,0.f,1.f,0.f,0.f,-1.f,0.f,0.f,0.f,0.f,0.f,1.f); 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_MD3_IMPORTER #endif // !! ASSIMP_BUILD_NO_MD3_IMPORTER