Formatting

pull/1524/head
Daniel Hritzkiv 2017-10-31 15:18:08 -04:00
parent cc4531459f
commit e52e44ea07
No known key found for this signature in database
GPG Key ID: D1D19875679D5CBF
1 changed files with 8 additions and 6 deletions

View File

@ -339,27 +339,28 @@ void FindInvalidDataProcess::ProcessAnimationChannel (aiNodeAnim* anim)
int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh) int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
{ {
bool ret = false; bool ret = false;
std::vector<bool> dirtyMask(pMesh->mNumVertices,(pMesh->mNumFaces ? true : false)); std::vector<bool> dirtyMask(pMesh->mNumVertices, pMesh->mNumFaces);
// Ignore elements that are not referenced by vertices. // Ignore elements that are not referenced by vertices.
// (they are, for example, caused by the FindDegenerates step) // (they are, for example, caused by the FindDegenerates step)
for (unsigned int m = 0; m < pMesh->mNumFaces;++m) { for (unsigned int m = 0; m < pMesh->mNumFaces; ++m) {
const aiFace& f = pMesh->mFaces[m]; const aiFace& f = pMesh->mFaces[m];
for (unsigned int i = 0; i < f.mNumIndices;++i) { for (unsigned int i = 0; i < f.mNumIndices; ++i) {
dirtyMask[f.mIndices[i]] = false; dirtyMask[f.mIndices[i]] = false;
} }
} }
// Process vertex positions // Process vertex positions
if(pMesh->mVertices && ProcessArray(pMesh->mVertices,pMesh->mNumVertices,"positions",dirtyMask)) { if (pMesh->mVertices && ProcessArray(pMesh->mVertices, pMesh->mNumVertices, "positions", dirtyMask)) {
DefaultLogger::get()->error("Deleting mesh: Unable to continue without vertex positions"); DefaultLogger::get()->error("Deleting mesh: Unable to continue without vertex positions");
return 2; return 2;
} }
// process texture coordinates // process texture coordinates
for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS && pMesh->mTextureCoords[i];++i) { for (unsigned int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS && pMesh->mTextureCoords[i]; ++i) {
if (ProcessArray(pMesh->mTextureCoords[i],pMesh->mNumVertices,"uvcoords",dirtyMask)) { if (ProcessArray(pMesh->mTextureCoords[i], pMesh->mNumVertices, "uvcoords", dirtyMask)) {
pMesh->mNumUVComponents[i] = 0; pMesh->mNumUVComponents[i] = 0;
// delete all subsequent texture coordinate sets. // delete all subsequent texture coordinate sets.
@ -368,6 +369,7 @@ int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
pMesh->mTextureCoords[a] = NULL; pMesh->mTextureCoords[a] = NULL;
pMesh->mNumUVComponents[a] = 0; pMesh->mNumUVComponents[a] = 0;
} }
ret = true; ret = true;
} }
} }