#125 HasTextureCoords in for-loop

open-wont-fix
nobody
None
5
2013-04-10
2013-04-10
Marco Altomonte
No

HasTextureCoords and HasVertexColors are used as for-loop termination condition.
Example (JoinVerticesProcess.cpp):
for( unsigned int a = 0; pMesh->HasTextureCoords(a); a++)

This works until a mesh has an empty uv slot. If a mesh has uv channel 0 and 2, the previous loop will terminate on index 1.
The right code should be:
for( unsigned int a = 0; AI_MAX_NUMBER_OF_TEXTURECOORDS; a++)
if (pMesh->HasTextureCoords(a))

Discussion

  • This may not be fully clear in the docs, but the intention is that there are no gaps in the channels - importers are simply not allowed to do this.

     
    • status: open --> pending-wont-fix
     
  • A gap inside channels may happen (due to artists material configuration) and is perfectly legal state that is correctly exported into FBXs and DAEs. Removing gaps (as ColladaLoader.cpp does) without logging an error will lead to a loaded asset different from the one stored in file.

     
    • status: pending-wont-fix --> open-wont-fix