Function veloren_world::sim::util::map_edge_factor

source ยท
pub fn map_edge_factor(map_size_lg: MapSizeLg, posi: usize) -> f32
Expand description

Calculates the smallest distance along an axis (x, y) from an edge of the world. This value is maximal at map_size_lg.chunks() / 2 and minimized at the extremes (0 or map_size_lg.chunks() on one or more axes). It then divides the quantity by cell_size, so the final result is 1 when we are not in a cell along the edge of the world, and ranges between 0 and 1 otherwise (lower when the chunk is closer to the edge).