author | unC0Rr |
Wed, 04 Jan 2023 10:40:40 +0100 | |
branch | transitional_engine |
changeset 15903 | 230dc46487ea |
parent 15828 | 44b49f255e31 |
child 15905 | 022ec6b916b7 |
permissions | -rw-r--r-- |
14100 | 1 |
mod outline; |
14069 | 2 |
pub mod outline_template; |
14100 | 3 |
pub mod template_based; |
13908 | 4 |
|
14027 | 5 |
pub struct LandGenerationParameters<T> { |
14026 | 6 |
zero: T, |
7 |
basic: T, |
|
14100 | 8 |
distance_divisor: u32, |
14121 | 9 |
skip_distort: bool, |
10 |
skip_bezier: bool, |
|
14026 | 11 |
} |
12 |
||
14100 | 13 |
impl<T: Copy + PartialEq> LandGenerationParameters<T> { |
15828 | 14 |
pub fn new( |
15 |
zero: T, |
|
16 |
basic: T, |
|
17 |
distance_divisor: u32, |
|
18 |
skip_distort: bool, |
|
19 |
skip_bezier: bool, |
|
20 |
) -> Self { |
|
14100 | 21 |
Self { |
22 |
zero, |
|
23 |
basic, |
|
14121 | 24 |
distance_divisor, |
25 |
skip_distort, |
|
26 |
skip_bezier, |
|
14100 | 27 |
} |
14054
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
28 |
} |
15903
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15828
diff
changeset
|
29 |
|
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15828
diff
changeset
|
30 |
pub fn zero(&self) -> T { |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15828
diff
changeset
|
31 |
self.zero |
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 |
|
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15828
diff
changeset
|
34 |
pub fn basic(&self) -> T { |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15828
diff
changeset
|
35 |
self.basic |
230dc46487ea
Update mapgen to take into account actual values for 'zero' and 'basic' colors
unC0Rr
parents:
15828
diff
changeset
|
36 |
} |
14054
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
37 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14051
diff
changeset
|
38 |
|
14027 | 39 |
pub trait LandGenerator { |
14026 | 40 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>( |
41 |
&self, |
|
14121 | 42 |
parameters: &LandGenerationParameters<T>, |
14026 | 43 |
random_numbers: &mut I, |
44 |
) -> land2d::Land2D<T>; |
|
45 |
} |
|
13938
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13908
diff
changeset
|
46 |
|
13908 | 47 |
#[cfg(test)] |
48 |
mod tests { |
|
49 |
#[test] |
|
50 |
fn it_works() { |
|
51 |
assert_eq!(2 + 2, 4); |
|
52 |
} |
|
53 |
} |