Преглед на файлове

Update MD3Loader.cpp

Fix typo.
Kim Kulling преди 6 години
родител
ревизия
64a7a46406
променени са 1 файла, в които са добавени 13 реда и са изтрити 13 реда
  1. 13 13
      code/MD3Loader.cpp

+ 13 - 13
code/MD3Loader.cpp

@@ -718,9 +718,7 @@ void MD3Importer::ConvertPath(const char* texture_name, const char* header_name,
 
 // ------------------------------------------------------------------------------------------------
 // Imports the given file into the given scene structure.
-void MD3Importer::InternReadFile( const std::string& pFile,
-    aiScene* pScene, IOSystem* pIOHandler)
-{
+void MD3Importer::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler) {
     mFile = pFile;
     mScene = pScene;
     mIOHandler = pIOHandler;
@@ -912,7 +910,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
                 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);
             if (dit != shaders.blocks.end()) {
                 // We made it!
@@ -947,8 +945,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
             aiString szString;
             if (convertedPath.length()) {
                 szString.Set(convertedPath);
-            }
-            else    {
+            } else    {
                 ASSIMP_LOG_WARN("Texture file name has zero length. Using default name");
                 szString.Set("dummy_texture.bmp");
             }
@@ -957,8 +954,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
             // prevent transparency by default
             int no_alpha = aiTextureFlags_IgnoreAlpha;
             pcHelper->AddProperty(&no_alpha,1,AI_MATKEY_TEXFLAGS_DIFFUSE(0));
-        }
-        else {
+        } else {
             Q3Shader::ConvertShaderToMaterial(pcHelper,*shader);
         }
 
@@ -1028,7 +1024,7 @@ void MD3Importer::InternReadFile( const std::string& pFile,
             if (!shader || shader->cull == Q3Shader::CULL_CW) {
                 std::swap(pcMesh->mFaces[i].mIndices[2],pcMesh->mFaces[i].mIndices[1]);
             }
-            pcTriangles++;
+            ++pcTriangles;
         }
 
         // 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");
+    }
     pScene->mNumMaterials = iNumMaterials;
 
     // 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];
 
         for (unsigned int i = 0; i < pcHeader->NUM_TAGS; ++i, ++pcTags) {
-
             aiNode* nd = pScene->mRootNode->mChildren[i] = new aiNode();
             nd->mName.Set((const char*)pcTags->NAME);
             nd->mParent = pScene->mRootNode;
@@ -1087,8 +1083,12 @@ void MD3Importer::InternReadFile( const std::string& pFile,
         pScene->mRootNode->mMeshes[i] = i;
 
     // 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);
+    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_MD3_IMPORTER