MoltenEngine
MoltenEngine copied to clipboard
Static Sprite Batching
Add support for a static sprite-batching, which would avoid the cost of repopulating a sprite-batch buffer every time you want to draw large amount of sprites.
- Split draw and batching methods of
SpriteBatcherinto a base class - Add
StaticSpriteBatcher - Use a static vertex buffer instead of dynamic
- Add
StaticSpriteBatcher.Replace()for replacing existing sprites in the buffer without re-generating it all - Add
StaticSpriteBatcher.ReplaceRange()for replacing a range of sprites at once - During Render() call:
- If batch was changed, update vertex buffer via a staging buffer
- Draw in the same way that normal
SpriteBatcherdoes, but don't reset sprite data once finished
- Add
SpriteBatcher.FlushToStatic(StaticSpriteBatcher destination = null)to copy the current contents to a static sprite-batcher and flush without rendering