Fixed two critical bugs preventing multiple textured sprites from rendering correctly:
1. **setState consumed by submit**: Render state was set once at the beginning,
but bgfx consumes state at each submit(). Batches 2+ had no state → invisible.
FIX: Call setState() before EACH batch, not once globally.
2. **Buffer overwrite race condition**: updateBuffer() is immediate but submit()
is deferred. When batch 2 called updateBuffer(), it overwrote batch 1's data
BEFORE bgfx executed the draw calls. All batches used the last batch's data
→ all sprites rendered at the same position (superimposed).
FIX: Use transient buffers (one per batch, frame-local) instead of reusing
the same dynamic buffer. Each batch gets its own isolated memory.
Changes:
- SpritePass: setState before each batch + transient buffer allocation per batch
- UIRenderer: Retained mode rendering (render:sprite:add/update/remove)
- test_ui_showcase: Added 3 textured buttons demo section
- test_3buttons_minimal: Minimal test case for multi-texture debugging
Tested: 3 textured buttons now render at correct positions with correct textures.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Fix texture state management in BgfxDevice: defer setTexture until submit()
- Add transient instance buffer support for multi-batch rendering
- Add ParticlePass with fire, smoke and sparkle particle systems
- Load multiple textures from config (texture1..texture10)
- Visual test now demonstrates multi-texture sprites and multi-particle effects
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Add TextureLoader class using stb_image for PNG/JPG/etc loading
- Integrate TextureLoader with ResourceCache for cached texture loading
- Add SpritePass::setTexture() for binding textures to sprites
- Add "defaultTexture" config option to load texture at startup
- Create assets/textures folder structure
- Add 1f440.png (eyes emoji) test texture
Visual test confirms textured sprites render correctly.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>