author | alfadur |
Sat, 22 Feb 2025 19:39:31 +0300 | |
changeset 16120 | 5febd2bc5372 |
parent 16087 | de01be16df95 |
permissions | -rw-r--r-- |
16087
de01be16df95
Make slider below preview affect WFC generator by skewing tile probabilities
unC0Rr
parents:
16061
diff
changeset
|
1 |
use rand::Rng; |
de01be16df95
Make slider below preview affect WFC generator by skewing tile probabilities
unC0Rr
parents:
16061
diff
changeset
|
2 |
|
16061 | 3 |
pub mod maze; |
15951 | 4 |
pub mod outline_template_based; |
15942 | 5 |
pub mod wavefront_collapse; |
13929 | 6 |
|
15934
022ec6b916b7
Split generation and painting phases, paint by old engine, use template filters
unC0Rr
parents:
15932
diff
changeset
|
7 |
#[derive(Clone, Copy)] |
14048 | 8 |
pub struct LandGenerationParameters<T> { |
14047 | 9 |
zero: T, |
10 |
basic: T, |
|
14121 | 11 |
distance_divisor: u32, |
14142 | 12 |
skip_distort: bool, |
13 |
skip_bezier: bool, |
|
14047 | 14 |
} |
15 |
||
15942 | 16 |
impl<T: Copy + PartialEq + Default> LandGenerationParameters<T> { |
15850 | 17 |
pub fn new( |
18 |
zero: T, |
|
19 |
basic: T, |
|
20 |
distance_divisor: u32, |
|
21 |
skip_distort: bool, |
|
22 |
skip_bezier: bool, |
|
23 |
) -> Self { |
|
14121 | 24 |
Self { |
25 |
zero, |
|
26 |
basic, |
|
14142 | 27 |
distance_divisor, |
28 |
skip_distort, |
|
29 |
skip_bezier, |
|
14121 | 30 |
} |
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
31 |
} |
15932
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
32 |
|
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
33 |
pub fn zero(&self) -> T { |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
34 |
self.zero |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
35 |
} |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
36 |
|
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
37 |
pub fn basic(&self) -> T { |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
38 |
self.basic |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15850
diff
changeset
|
39 |
} |
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
40 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
41 |
|
14048 | 42 |
pub trait LandGenerator { |
16087
de01be16df95
Make slider below preview affect WFC generator by skewing tile probabilities
unC0Rr
parents:
16061
diff
changeset
|
43 |
fn generate_land<T: Copy + PartialEq + Default>( |
14047 | 44 |
&self, |
14142 | 45 |
parameters: &LandGenerationParameters<T>, |
16087
de01be16df95
Make slider below preview affect WFC generator by skewing tile probabilities
unC0Rr
parents:
16061
diff
changeset
|
46 |
prng: &mut impl Rng, |
14047 | 47 |
) -> land2d::Land2D<T>; |
48 |
} |