Expandable / growable mesh?

Hi everyone,

Current use case is dynamic level objects such as destruction debris. E.g. if I blow up a rock, I instantiate little fracture meshes, let Havok do its thing, and after some time I add the then resting fractures to an SPS like so

   this.sps.addShape(debrisMeshes[i], 1);

Is the SPS already the best choice? In the source code, I think, the expansive part is when you call setParticles(). But as long as the SPS is not pickable and is not called the first time, it takes a shortcut via VertexBuffer.updateDirectly. But there I lost it: it ends up making a _gl.bufferSubData call. What does that mean in terms of performance?

Ofc, if there is anything better than the SPS, I will take that instead :slight_smile:

Best wishes

@Evgeni_Popov will be the best person to answer :slight_smile:

bufferSubData will update the data on the GPU.

If the debris are static and won’t ever move afterwards, it’s probably better to just merge them using Mesh.MergeMeshes. The SPS does essentially the same thing, but the method that does it (setParticles) is more heavy-weight than Mesh.MergeMeshes.


Ok, sweet, MergeMeshes it is. Thanks :slight_smile: