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/Obiome— Climate simulation and biome classificationvegetation— Tree, grass, and rock placement with LODstreaming— Async-style chunk loading, caching, and prefetchingmod_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§
- Terrain
Collider - Height-field collision query interface.
- Terrain
Diff - Stores the per-cell difference between two snapshots for compact undo.
- Terrain
Event Queue - Simple single-producer/single-consumer event queue for terrain events.
- Terrain
Heightmap Builder - A builder for compositing multiple terrain generation steps.
- Terrain
Layer - A single material layer on terrain (e.g., grass, rock, snow).
- Terrain
LodParams - Parameters for heightmap LOD (level-of-detail) scaling.
- Terrain
Manager - Top-level terrain system coordinator.
- Terrain
Material - Material properties for terrain rendering.
- Terrain
Metadata - Metadata about a generated terrain world.
- Terrain
Painter - A brush tool for real-time terrain sculpting.
- Terrain
Presets - Named presets for common terrain configurations.
- Terrain
Query - High-level query API for sampling terrain properties at world positions.
- Terrain
Raycast System - System for batched terrain raycasts.
- Terrain
Snapshot - Immutable snapshot of a heightmap for undo/redo support.
- Terrain
Undo Stack - Stack-based undo/redo manager for terrain edits.
- Terrain
Water - Represents bodies of water on the terrain.
- Terrain
World Stats - Runtime statistics for a full terrain world.
Enums§
- Brush
Falloff - Brush falloff shape.
- Paint
Mode - What operation the terrain painter performs.
- Terrain
Event - Discrete events that the terrain system can emit during simulation.