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};
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
42pub fn get(name: &str) -> Option<Box<dyn Algorithm<Tile>>> {
44 match name {
45 "bsp" => Some(Box::new(Bsp::default())),
46 "cellular" | "cellular_automata" => Some(Box::new(CellularAutomata::default())),
47 "drunkard" => Some(Box::new(DrunkardWalk::default())),
48 "maze" => Some(Box::new(Maze::default())),
49 "simple_rooms" | "rooms" => Some(Box::new(SimpleRooms::default())),
50 "voronoi" => Some(Box::new(Voronoi::default())),
51 "dla" => Some(Box::new(Dla::default())),
52 "wfc" | "wave_function_collapse" => Some(Box::new(Wfc::default())),
53 "percolation" => Some(Box::new(Percolation::default())),
54 "diamond_square" => Some(Box::new(DiamondSquare::default())),
55 "agent" => Some(Box::new(AgentBased::default())),
56 "fractal" => Some(Box::new(Fractal::default())),
57 "noise_fill" | "noise" => Some(Box::new(NoiseFill::default())),
58 "glass_seam" | "gsb" => Some(Box::new(GlassSeam::default())),
59 "room_accretion" | "accretion" => Some(Box::new(RoomAccretion::default())),
60 _ => None,
61 }
62}
63
64pub fn list() -> &'static [&'static str] {
66 &[
67 "bsp",
68 "cellular",
69 "drunkard",
70 "maze",
71 "rooms",
72 "voronoi",
73 "dla",
74 "wfc",
75 "percolation",
76 "diamond_square",
77 "agent",
78 "fractal",
79 "noise_fill",
80 "glass_seam",
81 "room_accretion",
82 ]
83}