author | alfadur |
Tue, 13 Nov 2018 20:01:43 +0300 | |
changeset 14228 | bb2f301d4fe0 |
parent 14142 | 69db1d2e4cec |
child 15850 | 44b49f255e31 |
permissions | -rw-r--r-- |
14121 | 1 |
mod outline; |
14090 | 2 |
pub mod outline_template; |
14121 | 3 |
pub mod template_based; |
13929 | 4 |
|
14048 | 5 |
pub struct LandGenerationParameters<T> { |
14047 | 6 |
zero: T, |
7 |
basic: T, |
|
14121 | 8 |
distance_divisor: u32, |
14142 | 9 |
skip_distort: bool, |
10 |
skip_bezier: bool, |
|
14047 | 11 |
} |
12 |
||
14121 | 13 |
impl<T: Copy + PartialEq> LandGenerationParameters<T> { |
14142 | 14 |
pub fn new(zero: T, basic: T, distance_divisor: u32, skip_distort: bool, skip_bezier: bool) -> Self { |
14121 | 15 |
Self { |
16 |
zero, |
|
17 |
basic, |
|
14142 | 18 |
distance_divisor, |
19 |
skip_distort, |
|
20 |
skip_bezier, |
|
14121 | 21 |
} |
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
22 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
23 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
24 |
|
14048 | 25 |
pub trait LandGenerator { |
14047 | 26 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>( |
27 |
&self, |
|
14142 | 28 |
parameters: &LandGenerationParameters<T>, |
14047 | 29 |
random_numbers: &mut I, |
30 |
) -> land2d::Land2D<T>; |
|
31 |
} |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13929
diff
changeset
|
32 |
|
13929 | 33 |
#[cfg(test)] |
34 |
mod tests { |
|
35 |
#[test] |
|
36 |
fn it_works() { |
|
37 |
assert_eq!(2 + 2, 4); |
|
38 |
} |
|
39 |
} |