I think I found some clues:
Why do you need clone and makeUnique? Mesh.makeGeometryUnique takes different branches depending on whether I call it on the source or on the clone. I am guessing the branch in question is a reference counter.
Why is the buffer floatified? Tracing it back to Geometry.copy, it makes a call to Geometry.getVerticesData (the one, Alex pointed out earlier, always floatifies the buffer)! Replacing it with Geometry.getVertexBuffer makes the playground pass: https://playground.babylonjs.com/#88CB6A#186
But now, if you console log the clone’s geometry, all vertex buffers are ints (even the UVs)? How can this even render?
It gets worse though: while the playground passes, the change crashes my local project:
- First crash was when calling mesh.getVerticesData(VertexBuffer.ColorKind) with “RangeError: Offset is outside the bounds of the DataView”.
- Next crash with same error, when calling Mesh.MergeMeshes (cannot hotfix this, so full stop here
).