Table of Contents

Class WorldRenderer

Namespace
TileWorld.Engine.Render
Assembly
TileWorld.Engine.dll

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

camera Camera2D

The camera used to determine visibility and screen-space offsets.

cacheBuilder ChunkRenderCacheBuilder

The builder used to create chunk render caches.

settings WorldRenderSettings

The shared render settings.

Properties

Camera

public Camera2D Camera { get; }

Property Value

Camera2D

Methods

Draw(WorldRuntime, IRenderContext)

Draws all currently visible chunk caches.

public void Draw(WorldRuntime runtime, IRenderContext renderContext)

Parameters

runtime WorldRuntime

The runtime that owns the render caches.

renderContext IRenderContext

The 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

runtime WorldRuntime

The 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

coord ChunkCoord

The chunk coordinate to resolve.

cache ChunkRenderCache

The resolved cache when present.

Returns

bool

true when a built cache exists for the supplied chunk.