vec3f newPosition[100];
vec3f newNormal[100];
vec2f newTexCoord[100];
uint newIndex[200];
uint nextAttrib = 0;
uint nextIndex = 0;
for each index tuple:
if index tuple has NOT occured before:
// append attributes referenced by index tuple to new attributes
newPosition[nextAttrib] = position[index.pos];
newNormal[nextAttrib] = normal[index.normal];
newTexCoord[nextAttrib] = texCoord[index.texCoord];
remember that index tuple is associated with nextAttrib
// store a single new index that references the same attributes
newIndex[nextIndex] = nextAttrib;
++nextIndex;
++nextAttrib;
else:
newIndex[nextIndex] = index associated with index tuple
++nextIndex;