Skip to main content

PatternSource

Trait PatternSource 

Source
pub trait PatternSource {
    type Position;
    type Terrain;
    type Pattern;

    // Required methods
    fn get(
        &self,
        position: &Self::Position,
    ) -> TileConstraint<Self::Terrain, Self::Pattern> ;
    fn get_terrain(&self, position: &Self::Position) -> Option<Self::Terrain>;
}
Expand description

Trait for objects that represent a constraining environment for the autotiler. Given any position, a PatternSource object can supply a TileConstraint for that position. While a TerrainSource object alone may be enough to tell the autotiler what positions it needs to fill with tiles, a PatternSource can provide information about the neighboring tiles, and thus give the autotiler a complete picture of the environment it is tiling.

Required Associated Types§

Source

type Position

The type of positions that need tiles.

Source

type Terrain

The type of the terrains that control which patterns are allowed at each position.

Source

type Pattern

The type of the patterns that the autotiler must choose for each position.

Required Methods§

Source

fn get( &self, position: &Self::Position, ) -> TileConstraint<Self::Terrain, Self::Pattern>

The contraint for the cell at the given position.

Source

fn get_terrain(&self, position: &Self::Position) -> Option<Self::Terrain>

The terrain of the pattern at the given position.

Implementors§