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