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

3DS: Use C++11 range-based for loop

Turo Lamminen преди 9 години
родител
ревизия
b345f79d45
променени са 1 файла, в които са добавени 5 реда и са изтрити 6 реда
  1. 5 6
      code/3DSLoader.cpp

+ 5 - 6
code/3DSLoader.cpp

@@ -186,15 +186,14 @@ void Discreet3DSImporter::InternReadFile( const std::string& pFile,
     // internal verbose representation. Finally compute normal
     // internal verbose representation. Finally compute normal
     // vectors from the smoothing groups we read from the
     // vectors from the smoothing groups we read from the
     // file.
     // file.
-    for (std::vector<D3DS::Mesh>::iterator i = mScene->mMeshes.begin(),
-         end = mScene->mMeshes.end(); i != end;++i) {
-        if ((*i).mFaces.size() > 0 && (*i).mPositions.size() == 0)  {
+    for (auto &mesh : mScene->mMeshes) {
+        if (mesh.mFaces.size() > 0 && mesh.mPositions.size() == 0)  {
             delete mScene;
             delete mScene;
             throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile);
             throw DeadlyImportError("3DS file contains faces but no vertices: " + pFile);
         }
         }
-        CheckIndices(*i);
-        MakeUnique  (*i);
-        ComputeNormalsWithSmoothingsGroups<D3DS::Face>(*i);
+        CheckIndices(mesh);
+        MakeUnique  (mesh);
+        ComputeNormalsWithSmoothingsGroups<D3DS::Face>(mesh);
     }
     }
 
 
     // Replace all occurrences of the default material with a
     // Replace all occurrences of the default material with a