author | unc0rr |
Fri, 02 Nov 2018 20:30:22 +0100 | |
changeset 14116 | b2feb190e4bc |
parent 14090 | abb42ba345b6 |
child 14121 | 4d22be35cfa2 |
permissions | -rw-r--r-- |
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
1 |
pub mod template_based; |
14090 | 2 |
pub mod outline_template; |
3 |
mod outline; |
|
13929 | 4 |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13929
diff
changeset
|
5 |
extern crate integral_geometry; |
14047 | 6 |
extern crate land2d; |
14072
8a0d69c16cad
Implement OutlinePoints for land generators, some ground work for template based landgen
unc0rr
parents:
14048
diff
changeset
|
7 |
extern crate itertools; |
14047 | 8 |
|
14048 | 9 |
pub struct LandGenerationParameters<T> { |
14047 | 10 |
zero: T, |
11 |
basic: T, |
|
12 |
} |
|
13 |
||
14075
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
14 |
impl <T: Copy + PartialEq> LandGenerationParameters<T> { |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
15 |
pub fn new(zero: T, basic: T) -> Self { |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
16 |
Self { zero, basic } |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
17 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
18 |
} |
3185fb34f3b5
update theme editor to use new land generator implementation
alfadur
parents:
14072
diff
changeset
|
19 |
|
14048 | 20 |
pub trait LandGenerator { |
14047 | 21 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>( |
22 |
&self, |
|
23 |
parameters: LandGenerationParameters<T>, |
|
24 |
random_numbers: &mut I, |
|
25 |
) -> land2d::Land2D<T>; |
|
26 |
} |
|
13959
1fa905aa4cdb
move point struct into integral-geometry and use it to refactor a bit
alfadur
parents:
13929
diff
changeset
|
27 |
|
13929 | 28 |
#[cfg(test)] |
29 |
mod tests { |
|
30 |
#[test] |
|
31 |
fn it_works() { |
|
32 |
assert_eq!(2 + 2, 4); |
|
33 |
} |
|
34 |
} |