Raw: Use C++11 range-based for loop

pull/898/head
Turo Lamminen 2016-05-22 13:45:50 +03:00
parent 6c9c040419
commit d238597459
1 changed files with 12 additions and 15 deletions

View File

@ -183,12 +183,11 @@ void RAWImporter::InternReadFile( const std::string& pFile,
}
// search in the list of meshes whether we have one with this texture
for (std::vector< MeshInformation >::iterator it = (*curGroup).meshes.begin(),
end = (*curGroup).meshes.end(); it != end; ++it)
for (auto &mesh : (*curGroup).meshes)
{
if (length == (*it).name.length() && (length ? !::strcmp(sz,(*it).name.c_str()) : true))
if (length == mesh.name.length() && (length ? !::strcmp(sz, mesh.name.c_str()) : true))
{
output = &(*it);
output = &mesh;
break;
}
}
@ -223,13 +222,12 @@ void RAWImporter::InternReadFile( const std::string& pFile,
// count the number of valid groups
// (meshes can't be empty)
for (std::vector< GroupInformation >::iterator it = outGroups.begin(), end = outGroups.end();
it != end;++it)
for (auto & outGroup : outGroups)
{
if (!(*it).meshes.empty())
if (!outGroup.meshes.empty())
{
++pScene->mRootNode->mNumChildren;
pScene->mNumMeshes += (unsigned int)(*it).meshes.size();
pScene->mNumMeshes += (unsigned int) outGroup.meshes.size();
}
}
@ -251,10 +249,9 @@ void RAWImporter::InternReadFile( const std::string& pFile,
aiMaterial** mats = pScene->mMaterials = new aiMaterial*[pScene->mNumMaterials];
unsigned int meshIdx = 0;
for (std::vector< GroupInformation >::iterator it = outGroups.begin(), end = outGroups.end();
it != end;++it)
for (auto & outGroup : outGroups)
{
if ((*it).meshes.empty())continue;
if (outGroup.meshes.empty())continue;
aiNode* node;
if (pScene->mRootNode->mNumChildren)
@ -263,13 +260,13 @@ void RAWImporter::InternReadFile( const std::string& pFile,
node->mParent = pScene->mRootNode;
}
else node = *cc;++cc;
node->mName.Set((*it).name);
node->mName.Set(outGroup.name);
// add all meshes
node->mNumMeshes = (unsigned int)(*it).meshes.size();
node->mNumMeshes = (unsigned int) outGroup.meshes.size();
unsigned int* pi = node->mMeshes = new unsigned int[ node->mNumMeshes ];
for (std::vector< MeshInformation >::iterator it2 = (*it).meshes.begin(),
end2 = (*it).meshes.end(); it2 != end2; ++it2)
for (std::vector< MeshInformation >::iterator it2 = outGroup.meshes.begin(),
end2 = outGroup.meshes.end(); it2 != end2; ++it2)
{
ai_assert(!(*it2).vertices.empty());