You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mourner In the README.md it is stated about the creation of indices:
Alternatively, you can get triangulation results in the form of flat index and vertex arrays by passing true as a second argument to earcut (convenient for uploading results directly to WebGL as buffers):
But the current implementation creates indices which are a multiple of the passed-in dimension. For the given 2D case it produces something like this: [2,0,4, 6,4,2]. And passing in 3D coords like this [[[10,0,0],[0,50,0],[60,60,0],[70,10,0]]] it produces something like this: [3,0,6, 9,6,3].
Is this a bug in the description or a bug in the implementation? If you want to be able to upload the produced indices directly into a WebGL index buffer, the implementation needs to be changed to follow the description given above. Right now, I need to divide each generated index by 2 or 3 (depending on the passed-in dimensionality of the passed-in vertices).
Sounds right! I didn't actually test out the indexed output in GL so missed this point. Thanks for the report! Should be fixed on the implementation side.
Activity
mourner commentedon Mar 9, 2015
Sounds right! I didn't actually test out the indexed output in GL so missed this point. Thanks for the report! Should be fixed on the implementation side.
Merge pull request #14 from Kosta-Github/Kosta/fix_index_creation