SpriteRenderingSystem Class
Definition
Namespace: Brine2D.Systems.Rendering
System that renders all entities with SpriteComponent. Uses batching for optimal performance on both Legacy and GPU renderers. Includes frustum culling to only render visible sprites. Sprites with an unloaded TexturePath are lazily loaded \(and cached\) the first time they are rendered; LoadTexturesAsync\(IEntityWorld, CancellationToken\) remains available as an optional preload/warm-cache call to avoid a load hitch on first appearance.
Inheritance System.Object → RenderSystemBase → SpriteRenderingSystem
| Methods | |
|---|---|
| Dispose() | Disposes all cached textures. |
| GetBatchStats() | Gets batching statistics for performance monitoring. Returns \(rendered sprites, batch/draw call count\). |
| GetTotalSpriteCount() | Gets the total sprite count \(before culling\). |
| LoadTexturesAsync\(IEntityWorld, CancellationToken\) | Loads textures for all sprites that need them. |
| Render\(IEntityWorld, IRenderer, GameTime\) | Renders all entities with SpriteComponent using batching. Automatically culls off-screen sprites when a camera is present. |
| ResolveTexture\(SpriteComponent\) | Resolves a sprite's texture from its TexturePath if it isn't already loaded, reusing a shared cache keyed by path so identical paths are only loaded once. |