Class WorldRenderer
Maintains chunk render caches and submits visible draw commands.
public sealed class WorldRenderer
- Inheritance
-
WorldRenderer
- Inherited Members
Remarks
This API is intended for engine infrastructure and advanced tooling. Prefer WorldRuntime as the stable gameplay-facing entry point.
Constructors
WorldRenderer(Camera2D, ChunkRenderCacheBuilder, WorldRenderSettings)
Creates a world renderer backed by the supplied camera, cache builder, and render settings.
public WorldRenderer(Camera2D camera, ChunkRenderCacheBuilder cacheBuilder, WorldRenderSettings settings)
Parameters
cameraCamera2DThe camera used to determine visibility and screen-space offsets.
cacheBuilderChunkRenderCacheBuilderThe builder used to create chunk render caches.
settingsWorldRenderSettingsThe shared render settings.
Properties
Camera
public Camera2D Camera { get; }
Property Value
Methods
Draw(WorldRuntime, IRenderContext)
Draws all currently visible chunk caches.
public void Draw(WorldRuntime runtime, IRenderContext renderContext)
Parameters
runtimeWorldRuntimeThe runtime that owns the render caches.
renderContextIRenderContextThe render context that receives visible draw commands.
GetVisibleChunkCoords()
Enumerates visible chunk coordinates in stable top-to-bottom, left-to-right order.
public IEnumerable<ChunkCoord> GetVisibleChunkCoords()
Returns
- IEnumerable<ChunkCoord>
An ordered sequence of visible chunk coordinates.
RebuildDirtyCaches(WorldRuntime)
Rebuilds render caches for chunks currently marked as render-dirty.
public void RebuildDirtyCaches(WorldRuntime runtime)
Parameters
runtimeWorldRuntimeThe runtime whose dirty chunks should be rebuilt.
TryGetChunkRenderCache(ChunkCoord, out ChunkRenderCache)
Attempts to resolve a previously built render cache for the supplied chunk.
public bool TryGetChunkRenderCache(ChunkCoord coord, out ChunkRenderCache cache)
Parameters
coordChunkCoordThe chunk coordinate to resolve.
cacheChunkRenderCacheThe resolved cache when present.