Skip to main content

Module terrain

Module terrain 

Source
Expand description

§Terrain System

A complete terrain rendering and simulation system for the Proof Engine.

§Architecture

The terrain system is organized into five submodules:

  • heightmap — Height field generation, erosion, analysis, and I/O
  • biome — Climate simulation and biome classification
  • vegetation — Tree, grass, and rock placement with LOD
  • streaming — Async-style chunk loading, caching, and prefetching
  • mod_types — Shared core data types (ChunkCoord, TerrainChunk, etc.)

§Quick Start

use proof_engine::terrain::*;

// Configure terrain generation
let config = TerrainConfig::new(64, 8, 4, 12345);

// Create the manager
let mut manager = TerrainManager::new(config);

// Update each frame with camera position
manager.update(glam::Vec3::new(0.0, 50.0, 0.0));

// Query terrain height
let h = manager.sample_height(100.0, 200.0);
println!("Height at (100, 200) = {h}");

Re-exports§

pub use mod_types::ChunkCoord;
pub use mod_types::ChunkState;
pub use mod_types::TerrainConfig;
pub use mod_types::TerrainChunk;
pub use heightmap::HeightMap;
pub use heightmap::DiamondSquare;
pub use heightmap::FractalNoise;
pub use heightmap::VoronoiPlates;
pub use heightmap::PerlinTerrain;
pub use heightmap::HydraulicErosion;
pub use heightmap::ThermalErosion;
pub use heightmap::WindErosion;
pub use biome::BiomeType;
pub use biome::BiomeParams;
pub use biome::BiomeClassifier;
pub use biome::BiomeMap;
pub use biome::ClimateMap;
pub use biome::ClimateSimulator;
pub use biome::VegetationDensity;
pub use biome::BiomeColor;
pub use biome::TransitionZone;
pub use biome::SeasonFactor;
pub use vegetation::VegetationSystem;
pub use vegetation::VegetationInstance;
pub use vegetation::VegetationKind;
pub use vegetation::VegetationLod;
pub use vegetation::TreeType;
pub use vegetation::TreeParams;
pub use vegetation::TreeSkeleton;
pub use vegetation::TreeSegment;
pub use vegetation::GrassCluster;
pub use vegetation::GrassField;
pub use vegetation::RockPlacement;
pub use vegetation::RockCluster;
pub use vegetation::VegetationPainter;
pub use vegetation::ImpostorBillboard;
pub use vegetation::generate_impostors;
pub use streaming::StreamingManager;
pub use streaming::ChunkCache;
pub use streaming::LoadQueue;
pub use streaming::ChunkGenerator;
pub use streaming::ChunkSerializer;
pub use streaming::StreamingStats;
pub use streaming::VisibilitySet;
pub use streaming::LodScheduler;
pub use streaming::Prefetcher;

Modules§

biome
Biome classification, climate simulation, and biome-driven parameters.
biomes
Biome placement and ecological simulation.
chunks
Chunked terrain streaming system.
heightmap
Heightmap generation, erosion, post-processing, and analysis.
mod_types
Shared terrain types used across submodules.
streaming
Terrain streaming — async chunk loading/unloading, LRU cache, priority queue.
vegetation
Vegetation system — tree/grass/rock placement, LOD, wind, seasonal changes.

Structs§

TerrainCollider
Height-field collision query interface.
TerrainDiff
Stores the per-cell difference between two snapshots for compact undo.
TerrainEventQueue
Simple single-producer/single-consumer event queue for terrain events.
TerrainHeightmapBuilder
A builder for compositing multiple terrain generation steps.
TerrainLayer
A single material layer on terrain (e.g., grass, rock, snow).
TerrainLodParams
Parameters for heightmap LOD (level-of-detail) scaling.
TerrainManager
Top-level terrain system coordinator.
TerrainMaterial
Material properties for terrain rendering.
TerrainMetadata
Metadata about a generated terrain world.
TerrainPainter
A brush tool for real-time terrain sculpting.
TerrainPresets
Named presets for common terrain configurations.
TerrainQuery
High-level query API for sampling terrain properties at world positions.
TerrainRaycastSystem
System for batched terrain raycasts.
TerrainSnapshot
Immutable snapshot of a heightmap for undo/redo support.
TerrainUndoStack
Stack-based undo/redo manager for terrain edits.
TerrainWater
Represents bodies of water on the terrain.
TerrainWorldStats
Runtime statistics for a full terrain world.

Enums§

BrushFalloff
Brush falloff shape.
PaintMode
What operation the terrain painter performs.
TerrainEvent
Discrete events that the terrain system can emit during simulation.