TextureAtlas constructor

TextureAtlas({
  1. required int columns,
  2. required int rows,
  3. required int tileSize,
  4. int padding = 0,
  5. Texture2D? baseColor,
  6. Texture2D? metallicRoughness,
  7. Texture2D? normal,
  8. Texture2D? occlusion,
})

Creates an atlas of columns x rows tiles, each tileSize texels square, separated by padding texels of gutter. The PBR maps are optional so the UV math can be used (and unit tested) on its own.

Implementation

TextureAtlas({
  required this.columns,
  required this.rows,
  required this.tileSize,
  this.padding = 0,
  this.baseColor,
  this.metallicRoughness,
  this.normal,
  this.occlusion,
}) : assert(columns > 0),
     assert(rows > 0),
     assert(tileSize > 0),
     assert(padding >= 0);