1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//! Procedural terrain generation using noise functions.
//!
//! Provides heightmap-based terrain with configurable noise algorithms:
//!
//! - [`TerrainConfig`]: Size, resolution, height scale, and noise settings
//! - [`NoiseConfig`]: Seed, frequency, octaves, and noise type
//! - [`NoiseType`]: Perlin, Simplex, Billow, or RidgedMulti
//!
//! Requires the `terrain` feature flag.
//!
//! # Basic Terrain
//!
//! ```ignore
//! let config = TerrainConfig::new(100.0, 100.0, 64, 64)
//! .with_height_scale(10.0)
//! .with_seed(42);
//!
//! spawn_terrain(world, config, Vec3::zeros());
//! ```
//!
//! # Terrain with Custom Material
//!
//! ```ignore
//! spawn_terrain_with_material(
//! world,
//! config,
//! Vec3::zeros(),
//! "grass_material",
//! );
//! ```
//!
//! # Noise Configuration
//!
//! Fine-tune terrain appearance with noise parameters:
//!
//! ```ignore
//! let noise = NoiseConfig {
//! seed: 12345,
//! noise_type: NoiseType::RidgedMulti, // Sharp mountain ridges
//! frequency: 0.03, // Lower = larger features
//! octaves: 6, // More = more detail
//! lacunarity: 2.0, // Frequency multiplier per octave
//! persistence: 0.5, // Amplitude multiplier per octave
//! };
//!
//! let config = TerrainConfig::new(200.0, 200.0, 128, 128)
//! .with_height_scale(30.0)
//! .with_noise(noise)
//! .with_uv_scale([4.0, 4.0]); // Tile texture 4x
//! ```
//!
//! # Sampling Terrain Height
//!
//! Query the height at any world position:
//!
//! ```ignore
//! if let Some(height) = sample_terrain_height(world, terrain_entity, x, z) {
//! // Place object on terrain
//! let position = Vec3::new(x, height, z);
//! }
//! ```
//!
//! # Noise Types
//!
//! | Type | Description |
//! |------|-------------|
//! | `Perlin` | Classic smooth noise |
//! | `Simplex` | Faster, fewer artifacts |
//! | `Billow` | Rounded, cloud-like |
//! | `RidgedMulti` | Sharp ridges, mountain-like |
//!
//! [`TerrainConfig`]: components::TerrainConfig
//! [`NoiseConfig`]: components::NoiseConfig
//! [`NoiseType`]: components::NoiseType
pub mod commands;
pub mod components;
pub mod generation;
pub use commands::*;
pub use components::*;
pub use generation::*;