rust/landgen/src/wavefront_collapse/tile_image.rs
author unC0Rr
Wed, 01 Feb 2023 10:58:45 +0100
branchtransitional_engine
changeset 15913 c5684cc62de8
child 15915 8f093b1b18bc
permissions -rw-r--r--
Switch to Vec2D in wavefront algorithm

use land2d::Land2D;
use std::rc::Rc;

pub struct TileImage {
    image: Rc<Land2D<u8>>,
    flip: bool,
    mirror: bool,
}

impl TileImage {
    pub fn new(flip: bool, mirror: bool) -> Self {
        Self {
            image: todo!(),
            flip,
            mirror,
        }
    }

    pub fn mirrored(&self) -> Self {
        Self {
            image: self.image.clone(),
            flip: self.flip,
            mirror: !self.mirror
        }
    }

    pub fn flipped(&self) -> Self {
        Self {
            image: self.image.clone(),
            flip: !self.flip,
            mirror: self.mirror
        }
    }
}