[SOLVED] pc.VertexIterator equivalent for IndexBuffer

I finally figured out how to get a mesh’s list of vertex positions by using pc.VertexIterator. I also need to get the triangles index which I think is in the IndexBuffer but I don’t know how to get information out of the IndexBuffer. Can anyone help?

Alright, I have figured it out. Here is how to access the information in the indexBuffer:

var indices = new Uint16Array(indexBuffer.lock());

I was not familiar with the concepts of buffers and buffer arrays in JavaScript. I’m guessing that many enthusiasts like me are also ignorant of Typed arrays and buffers. It could be useful to have a bit more information in the docs on the subject as it relates to VertexBuffer and IndexBuffer.

1 Like