diff -r bb2f4636787f -r 3b3d97ed2286 rust/landgen/src/template_based.rs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rust/landgen/src/template_based.rs Sun Oct 28 23:24:04 2018 +0100 @@ -0,0 +1,55 @@ +use integral_geometry::Point; +use land2d::Land2D; +use LandGenerationParameters; +use LandGenerator; + +struct OutlineTemplate { + islands: Vec>, + fill_points: Vec, + width: usize, + height: usize, + can_flip: bool, + can_invert: bool, + can_mirror: bool, + is_negative: bool, +} + +struct TemplatedLandGenerator { + outline_template: OutlineTemplate, +} + +impl OutlineTemplate {} + +impl TemplatedLandGenerator { + fn new(outline_template: OutlineTemplate) -> Self { + Self { outline_template } + } +} + +impl LandGenerator for TemplatedLandGenerator { + fn generate_land>( + &self, + parameters: LandGenerationParameters, + random_numbers: &mut I, + ) -> Land2D { + let mut pa = Vec::new(); + + for island in &self.outline_template.islands { + let mut island_points = Vec::new(); + + for p in island { + island_points.push(p); + } + + pa.push(island_points); + } + + let mut land = Land2D::new( + self.outline_template.width, + self.outline_template.height, + parameters.basic, + ); + + land + } +}