Bug when calling SetVerticesData on a unindexed Mesh

When an Indexed mesh is used, as soon as Mesh.setIndices is called, the global SubMesh is recreated with mesh._createGlobalSubMesh(true)

When unindexed Mesh is used, there is no call to Mesh.setIndices, we call Mesh.setVerticesData and in this case the global SubMesh is recreated only if the new vertexCount is lower than the previous one (because we call mesh._createGlobalSubMesh(false) in Geometry.setVerticesBuffer)

Buf for an unindexed Mesh, setting the vertexBuffer is the same as setting the index buffer of an indexed Mesh.

repro here : Babylon.js Playground

PR here : Force createGlobalSubmesh in Mesh.SetVerticesData if Mesh is Unindexed by barroij · Pull Request #12629 · BabylonJS/Babylon.js · GitHub

3 Likes