Skip to content

tileToRegions

tileToRegions(cell, meta): NormalRegion[]

Defined in: packages/three-flatland/src/loaders/normalDescriptor.ts:245

Synthesize regions for a single tile cell given its custom data.

Cap geometry:

  • Each of tileCap{Top,Bottom,Left,Right} carves a cap strip off that edge (full width/height).
  • Each of tileCap{TopLeft,TopRight,BottomLeft,BottomRight} carves an N×N cap square at that corner — use when the tile art has a small flat patch in one corner and the wall face wraps around it in an L-shape (outer walls facing outward).
  • tileCap shorthand: tileCapTop when no per-edge field is set. The explicit per-edge / per-corner fields always win.
  • Cap rects compose by UNION — the cap region is everything any cap covers, and the face is the complement. Overlapping caps are harmless (duplicate rects get deduplicated by the baker’s per-texel write).

The face area — whatever the cell’s interior minus all cap rects — is decomposed into one or more non-overlapping rectangles, each tilted toward tileDir with tilePitch.

When tileDir is absent (or equals 'flat'), the entire cell emits as a single flat region and cap fields are ignored — a flat tile has no face to distinguish from its cap.

number

number

number

number

TileNormalCustomData | undefined

NormalRegion[]