#125 HasTextureCoords in for-loop


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))


  • Alexander Gessler

    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.

  • Alexander Gessler

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

    Marco Altomonte - 2013-04-10

    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.

  • Marco Altomonte

    Marco Altomonte - 2013-04-10
    • status: pending-wont-fix --> open-wont-fix

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks