Merge pull request #1524 from Matter-and-Form/invalid-texture-coordinates-cleaning-fix
Invalid texture coordinates cleaning fixpull/1534/head
commit
c666a05e16
|
@ -339,7 +339,7 @@ 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)
|
||||||
|
@ -354,17 +354,22 @@ int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
|
||||||
// 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;
|
||||||
|
|
||||||
// delete all subsequent texture coordinate sets.
|
// delete all subsequent texture coordinate sets.
|
||||||
for (unsigned int a = i + 1; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
|
for (unsigned int a = i + 1; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) {
|
||||||
delete[] pMesh->mTextureCoords[a]; pMesh->mTextureCoords[a] = NULL;
|
delete[] pMesh->mTextureCoords[a];
|
||||||
|
pMesh->mTextureCoords[a] = NULL;
|
||||||
|
pMesh->mNumUVComponents[a] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue