Skip to content

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.

C#
public class SpriteRenderingSystem : Brine2D.ECS.Systems.RenderSystemBase

Inheritance System.ObjectRenderSystemBase → 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\).
IsVisible\(Vector2, SpriteComponent, ICamera\) Checks if a sprite is visible within the camera frustum. Uses simple AABB \(Axis\-Aligned Bounding Box\) culling.
LoadTexturesAsync\(IEntityWorld, CancellationToken\) Loads textures for all sprites that need them.
Render\(IEntityWorld, IRenderer\) Renders all entities with SpriteComponent using batching. Automatically culls off-screen sprites when a camera is present.