tileUv method

Vector2 tileUv(
  1. int index,
  2. double u,
  3. double v
)

Maps a within-tile coordinate (u, v, each in [0, 1] with (0, 0) at the tile's top-left) to an atlas UV for tile index.

Implementation

Vector2 tileUv(int index, double u, double v) {
  final bounds = tileBounds(index);
  return Vector2(
    bounds.x + (bounds.z - bounds.x) * u,
    bounds.y + (bounds.w - bounds.y) * v,
  );
}