14037
|
1 |
use integral_geometry::{Point, Size};
|
14031
|
2 |
use land2d::Land2D;
|
|
3 |
use LandGenerationParameters;
|
|
4 |
use LandGenerator;
|
|
5 |
|
|
6 |
struct OutlineTemplate {
|
|
7 |
islands: Vec<Vec<Point>>,
|
|
8 |
fill_points: Vec<Point>,
|
14037
|
9 |
size: Size,
|
14031
|
10 |
can_flip: bool,
|
|
11 |
can_invert: bool,
|
|
12 |
can_mirror: bool,
|
|
13 |
is_negative: bool,
|
|
14 |
}
|
|
15 |
|
|
16 |
struct TemplatedLandGenerator {
|
|
17 |
outline_template: OutlineTemplate,
|
|
18 |
}
|
|
19 |
|
|
20 |
impl OutlineTemplate {}
|
|
21 |
|
|
22 |
impl TemplatedLandGenerator {
|
|
23 |
fn new(outline_template: OutlineTemplate) -> Self {
|
|
24 |
Self { outline_template }
|
|
25 |
}
|
|
26 |
}
|
|
27 |
|
|
28 |
impl LandGenerator for TemplatedLandGenerator {
|
|
29 |
fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>(
|
|
30 |
&self,
|
|
31 |
parameters: LandGenerationParameters<T>,
|
|
32 |
random_numbers: &mut I,
|
|
33 |
) -> Land2D<T> {
|
|
34 |
let mut pa = Vec::new();
|
|
35 |
|
|
36 |
for island in &self.outline_template.islands {
|
|
37 |
let mut island_points = Vec::new();
|
|
38 |
|
|
39 |
for p in island {
|
|
40 |
island_points.push(p);
|
|
41 |
}
|
|
42 |
|
|
43 |
pa.push(island_points);
|
|
44 |
}
|
|
45 |
|
|
46 |
let mut land = Land2D::new(
|
14037
|
47 |
self.outline_template.size,
|
14031
|
48 |
parameters.basic,
|
|
49 |
);
|
|
50 |
|
|
51 |
land
|
|
52 |
}
|
|
53 |
}
|