rust/landgen/src/lib.rs
author unc0rr
Sun, 04 Nov 2018 10:52:02 +0100
changeset 14151 ab280be4b617
parent 14142 69db1d2e4cec
child 14228 bb2f301d4fe0
permissions -rw-r--r--
- Fix land_dump always skipping bezierize step - Fix ix overflow too

mod outline;
pub mod outline_template;
pub mod template_based;

extern crate integral_geometry;
extern crate itertools;
extern crate land2d;

pub struct LandGenerationParameters<T> {
    zero: T,
    basic: T,
    distance_divisor: u32,
    skip_distort: bool,
    skip_bezier: bool,
}

impl<T: Copy + PartialEq> LandGenerationParameters<T> {
    pub fn new(zero: T, basic: T, distance_divisor: u32, skip_distort: bool, skip_bezier: bool) -> Self {
        Self {
            zero,
            basic,
            distance_divisor,
            skip_distort,
            skip_bezier,
        }
    }
}

pub trait LandGenerator {
    fn generate_land<T: Copy + PartialEq, I: Iterator<Item = u32>>(
        &self,
        parameters: &LandGenerationParameters<T>,
        random_numbers: &mut I,
    ) -> land2d::Land2D<T>;
}

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}