Correct/performant way to build my own mesh/geometry?

mesh.setVerticesData creates a new VertexBuffer each time it is called. So, if you have to update data each frame, it’s better to use mesh.updateVerticesDataDirectly instead.

Are you calling mesh.updateVerticesData with a true value as the 3rd parameter? If you do, you should pass false, or use mesh.updateVerticesDataDirectly instead, which never updates the bounding box and which executes a little less code than updateVerticesData.

The bounding box is still created/set at creation time: doNotSyncBoundingInfo applies only when the bounding info must be updated afterwards.

If you want to avoid the bounding box recalculation at creation time, you can do something like this (this is what the glTFLoader is doing):

1 Like