Skip to main content

TileSetAutoTileConstraint

Type Alias TileSetAutoTileConstraint 

Source
pub type TileSetAutoTileConstraint<'a, 'b> = AutoPatternConstraint<'a, 'b, Vector2<i32>, TileTerrainId, PatternBits>;
Expand description

A pair of a TileSetConstraintMap and a TileSetTerrainPatternMap.

  • The constraint map tells the auto-tiler which cells have undecided patterns, which cells have fixed patterns, and the terrain type of the undecided cells.
  • The terrain map tells the auto-tiler which patterns are available for each terrain type, and the order in which the patterns should be tried.

Aliased Type§

pub struct TileSetAutoTileConstraint<'a, 'b> {
    pub position_constraints: &'a HashConstraintMap<Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>, i8, PatternBits>,
    pub pattern_constraints: &'b HashMap<i8, Vec<PatternBits>, BuildHasherDefault<FxHasher>>,
}

Fields§

§position_constraints: &'a HashConstraintMap<Matrix<i32, Const<2>, Const<1>, ArrayStorage<i32, 2, 1>>, i8, PatternBits>

The position constraints define the specific problem for the autotiler to solve by giving it the constraints for each cell, including the cells whose tiles are already determined and the cells that are yet to be determined.

§pattern_constraints: &'b HashMap<i8, Vec<PatternBits>, BuildHasherDefault<FxHasher>>

The pattern contraints define the patterns that are available for each terrain. This will usually remain fixed across many calls to the autotiler, and so it may be reused so long as the set of tiles does not change. See AutoTileContext for a way to construct an AutoTerrainPatternMap.