Skip to main content

Module chunks

Module chunks 

Source
Expand description

Chunked terrain streaming system.

Manages the loading, unloading, caching, and mesh generation of terrain chunks around a moving viewer. Provides:

  • ChunkCoord — integer 2D chunk address
  • ChunkState — lifecycle state machine (Unloaded/Loading/Loaded/Unloading)
  • Priority queue ordered by distance-to-viewer
  • Async-style load queue (single-threaded work queue, drain-per-frame)
  • Mesh cache with LRU eviction
  • Collision hull generation per chunk

Structs§

Aabb
Axis-aligned bounding box in world space.
ChunkCoord
Integer 2D address of a terrain chunk in chunk-space.
ChunkGenConfig
Configuration for chunk generation.
ChunkGenerator
Generates terrain chunk data synchronously.
ChunkSerializer
Simple in-memory serializer/deserializer for heightmaps. (In a real engine, this would write to disk.)
ChunkStreamingManager
The main terrain streaming manager.
CollisionHull
A simplified collision representation for a terrain chunk.
LoadQueue
Async-style load queue: accepts load requests, drains N per frame.
LodScheduler
Determines which LOD level a chunk should be rendered at.
MeshCache
LRU mesh cache for terrain chunks.
Prefetcher
Predicts where the viewer will be and pre-queues chunks.
StreamingConfig
Configuration for the streaming manager.
StreamingStats
Runtime statistics for the streaming system.
TerrainChunkData
All data for a single loaded terrain chunk.
TerrainMesh
A simple triangle mesh generated from a heightmap.
VisibilitySet
Tracks which chunks are visible this frame.

Enums§

ChunkState
Lifecycle state of a terrain chunk.