• Runtimes
  • Get maximum amount of vertices used by skeleton

Related Discussions
...

Is there a way to figure out the maximum amount of vertices that a Spine skeleton/animation requires for drawing the frame with the most amount of vertices?

When loading the Spine data, I'd like to create a vertex buffer once and associate it with the skeleton so that I don't have to keep uploading vertex data during the animation. Then, each frame, I would modify the range of vertices need for that particular frame, knowing that there are enough vertices for any possible frame of animation.

You can iterate through all attachments in a skin and count the vertices and indices of each. For RegionAttachment, the vertex count is 4 and the index count is 6 (triangle list). For MeshAttachment, you can find the number of vertices via MeshAttachment::getWorldVerticesLength() and divide it by 2. The index count is given via MeshAttachment::getTriangles()::size().

That will give you a good approximation of the maximally possible number of vertices and indices. However, if you plan on batching across skeletons, I'd suggest you write a sprite batcher that will automatically grow the vertex buffer.