import { NormalBump, NormalDirection, NormalRegion, NormalSourceDescriptor } from "@three-flatland/normals"; //#region src/loaders/normalDescriptor.d.ts /** * Shape the LDtk / Tiled loader extracts from per-tile custom data * when synthesizing regions. Authors populate these in the map * editor's tile-properties panel. * * All fields optional — an untagged tile emits a single flat region * for its cell. Cap thickness values are in pixels; legacy `*Px` * aliases are accepted for back-compat and map to the unsuffixed * canonical fields. */ interface TileNormalCustomData { /** Screen-space direction the face tilts. See `NormalDirection`. */ tileDir?: NormalDirection; /** Alias of `tileDir`. */ tileDirection?: NormalDirection; /** Tilt angle override in radians. Inherits descriptor pitch when absent. */ tilePitch?: number; /** Bump source override for the face region. */ tileBump?: NormalBump; /** Gradient strength override for the face region. */ tileStrength?: number; /** * Elevation of the tile's primary surface in [0, 1] (0 = ground * plane, 1 = top-of-wall): * * - Tiles with `tileDir` (wall faces): applies to the face region. * Caps always bake at 1.0 regardless. Default 0.5 (midway up). * - Flat tiles (no `tileDir` or `tileDir: 'flat'`): applies to the * whole cell. Use 1.0 for "all-cap" tiles (wall top viewed * dead-on, roof patches, pillar caps). Unset → descriptor default, * which defaults to 0 (ground plane = floor). */ tileElevation?: number; /** Cap thickness from the top edge in pixels. */ tileCapTop?: number; /** Cap thickness from the bottom edge in pixels. */ tileCapBottom?: number; /** Cap thickness from the left edge in pixels. */ tileCapLeft?: number; /** Cap thickness from the right edge in pixels. */ tileCapRight?: number; /** Shorthand — when no per-edge field is set, treated as `tileCapTop`. */ tileCap?: number; /** * Corner cap — N×N square flat cap at the top-left corner of the cell. * Use when the tile art shows a small flat patch at that corner with * the wall face wrapping around it in an L-shape (outer walls facing * outward). Composes with edge caps — union of all cap rects is cap, * complement is face. */ tileCapTopLeft?: number; /** N×N square flat cap at the top-right corner. */ tileCapTopRight?: number; /** N×N square flat cap at the bottom-left corner. */ tileCapBottomLeft?: number; /** N×N square flat cap at the bottom-right corner. */ tileCapBottomRight?: number; /** @deprecated alias of `tileCap`. */ tileCapPx?: number; /** @deprecated alias of `tileCapTop`. */ tileCapTopPx?: number; /** @deprecated alias of `tileCapBottom`. */ tileCapBottomPx?: number; /** @deprecated alias of `tileCapLeft`. */ tileCapLeftPx?: number; /** @deprecated alias of `tileCapRight`. */ tileCapRightPx?: number; } /** * Default elevation for a tile's face region — "midway up the wall." * Lighting treats this as the Z-axis coordinate of the face in world * space, so torches at `lightHeight = 0.75` above the ground see face * fragments at elevation 0.5 as slightly below themselves → natural * down-lighting onto the face. Override per-tile via `tileElevation`. */ declare const DEFAULT_FACE_ELEVATION = 0.5; interface SpriteFrameRect { x: number; y: number; w: number; h: number; } /** * Build one flat region per frame rect. Each region inherits * descriptor defaults — most sprite sheets don't need per-frame * direction, but individual frames can be overridden by the caller * merging custom regions in. * * Region-local alpha clamping (applied by the baker) is what keeps * adjacent frames from bleeding gradients into each other. */ declare function framesToRegions(frames: SpriteFrameRect[]): NormalRegion[]; /** Single region covering the whole texture. Used by `TextureLoader`. */ declare function wholeTextureRegion(width: number, height: number): NormalRegion[]; interface TilesetCell { /** Pixel x of the top-left of this cell within the tileset atlas. */ x: number; /** Pixel y of the top-left of this cell within the tileset atlas. */ y: number; /** Cell width in pixels. */ w: number; /** Cell height in pixels. */ h: number; /** Optional per-tile custom data. Untagged cells emit a single flat region. */ meta?: TileNormalCustomData; } interface TilesetGridOptions { imageWidth: number; imageHeight: number; tileWidth: number; tileHeight: number; spacing: number; padding: number; /** Authoritative exported column count, when the source format provides it. */ columns?: number; /** Authoritative exported row count, when the source format provides it. */ rows?: number; } interface TilesetGrid { columns: number; rows: number; cells: TilesetCell[]; } /** * Resolve a tile cell by its row-major index. Explicit source-format grid * dimensions win; atlas dimensions are used only as a compatibility fallback. */ declare function tilesetCellAt(tileId: number, options: TilesetGridOptions, meta?: TileNormalCustomData): TilesetCell; /** Build the logical tile grid shared by runtime loaders and offline bakers. */ declare function buildTilesetGrid(options: TilesetGridOptions, metaForTile?: (tileId: number) => TileNormalCustomData | undefined): TilesetGrid; /** * Build regions for a whole tileset. Each cell becomes one or more * regions depending on its custom data — untagged cells emit a single * flat region; cells with `tileDirection` + cap fields emit cap strips * plus a face region. */ declare function tilesetToRegions(cells: TilesetCell[]): NormalRegion[]; /** * 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. */ declare function tileToRegions(cell: { x: number; y: number; w: number; h: number; }, meta: TileNormalCustomData | undefined): NormalRegion[]; //#endregion export { DEFAULT_FACE_ELEVATION, type NormalBump, type NormalDirection, type NormalRegion, type NormalSourceDescriptor, SpriteFrameRect, TileNormalCustomData, TilesetCell, TilesetGrid, TilesetGridOptions, buildTilesetGrid, framesToRegions, tileToRegions, tilesetCellAt, tilesetToRegions, wholeTextureRegion }; //# sourceMappingURL=normalDescriptor.d.ts.map