Closed Crauzer closed 4 years ago
You don't, Indices are generated internally by Mesh and Primitive builders.
Given you have sourceVertices[] and sourceIndices[], you just do:
var a = sourceVertices[ sourceIndices[ idx0 ] ];
var b = sourceVertices[ sourceIndices[ idx1 ] ];
var c = sourceVertices[ sourceIndices[ idx2 ] ];
Builder.AddTriangle( a, b, c);
And the builder handles creating an internal collection of unique vertices and the corresponding index list.
Thanks for the help, I managed to convert the model geometry properly. 👍🏼
I'm converting a model to the glTF format but I can't seem to find how to pass vertex indices to a
PrimitiveBuilder
. TheAddXXXXX
functions return the indices of the added triangle/point/w.e which seems like a very weird design choice to me.