terrain_forge/algorithms/
mod.rs1mod agent;
4mod bsp;
5mod cellular;
6mod diamond_square;
7mod dla;
8mod drunkard;
9mod fractal;
10mod glass_seam;
11mod maze;
12mod noise_fill;
13mod percolation;
14mod prefab;
15mod room_accretion;
16mod rooms;
17mod voronoi;
18mod wfc;
19
20pub use agent::{AgentBased, AgentConfig};
21pub use bsp::{Bsp, BspConfig};
22pub use cellular::{CellularAutomata, CellularConfig};
23pub use diamond_square::{DiamondSquare, DiamondSquareConfig};
24pub use dla::{Dla, DlaConfig};
25pub use drunkard::{DrunkardConfig, DrunkardWalk};
26pub use fractal::{Fractal, FractalConfig, FractalType};
27pub use glass_seam::{GlassSeam, GlassSeamConfig};
28pub use maze::{Maze, MazeConfig};
29pub use noise_fill::{NoiseFill, NoiseFillConfig, NoiseType};
30pub use percolation::{Percolation, PercolationConfig};
31pub use prefab::{
32 Prefab, PrefabConfig, PrefabData, PrefabLegendEntry, PrefabLibrary, PrefabPlacementMode,
33 PrefabPlacer, PrefabTransform,
34};
35pub use room_accretion::{RoomAccretion, RoomAccretionConfig, RoomTemplate};
36pub use rooms::{SimpleRooms, SimpleRoomsConfig};
37pub use voronoi::{Voronoi, VoronoiConfig};
38pub use wfc::{Pattern, Wfc, WfcBacktracker, WfcConfig, WfcPatternExtractor};
39
40use crate::{Algorithm, Tile};
41
42#[must_use]
44pub fn get(name: &str) -> Option<Box<dyn Algorithm<Tile> + Send + Sync>> {
45 match name {
46 "bsp" => Some(Box::new(Bsp::default())),
47 "cellular" | "cellular_automata" => Some(Box::new(CellularAutomata::default())),
48 "drunkard" => Some(Box::new(DrunkardWalk::default())),
49 "maze" => Some(Box::new(Maze::default())),
50 "simple_rooms" | "rooms" => Some(Box::new(SimpleRooms::default())),
51 "voronoi" => Some(Box::new(Voronoi::default())),
52 "dla" => Some(Box::new(Dla::default())),
53 "wfc" | "wave_function_collapse" => Some(Box::new(Wfc::default())),
54 "percolation" => Some(Box::new(Percolation::default())),
55 "diamond_square" => Some(Box::new(DiamondSquare::default())),
56 "agent" => Some(Box::new(AgentBased::default())),
57 "fractal" => Some(Box::new(Fractal::default())),
58 "noise_fill" | "noise" => Some(Box::new(NoiseFill::default())),
59 "glass_seam" | "gsb" => Some(Box::new(GlassSeam::default())),
60 "room_accretion" | "accretion" => Some(Box::new(RoomAccretion::default())),
61 _ => None,
62 }
63}
64
65#[must_use]
67pub fn list() -> &'static [&'static str] {
68 &[
69 "bsp",
70 "cellular",
71 "drunkard",
72 "maze",
73 "rooms",
74 "voronoi",
75 "dla",
76 "wfc",
77 "percolation",
78 "diamond_square",
79 "agent",
80 "fractal",
81 "noise_fill",
82 "glass_seam",
83 "room_accretion",
84 ]
85}