import type { Asset, TilesetAsset } from '@forgeax/engine-types'; import { AssetError } from '@forgeax/engine-types'; /** * Register-stage fail-fast for `kind: 'mesh'` payloads whose vertices buffer * does not match the geometry-owned attribute projection. * * Validation spec (plan-strategy D-3): * (a) asset.kind !== 'mesh' -> return null immediately * (b) vertices.length === 0 && indices.length === 0 -> return null (empty mesh legal) * (c) vertices.byteLength % projection.arrayStride !== 0 -> `AssetError` with * code='mesh-vertex-stride-mismatch', detail = { vertexCount: 0, * floatsPerVertex: vertices.length / projectedFloatsPerVertex } (non-integer) * (d) otherwise compute vertexCount from the same projection; * scan indices for maxIndex; * if maxIndex >= vertexCount -> same AssetError shape with * detail = { vertexCount: maxIndex + 1, floatsPerVertex: vertices.length / (maxIndex + 1) } * * Isomorphic with `validateMaterialPayload` — both are private module-level helpers, * both return `AssetError | null`, and both are called from `register()` at entry. * * Anchors: charter P3 (structured failure); plan-strategy D-2 (gate at register stage); * plan-strategy D-3 (three-branch validation: empty / non-divisible-12 / maxIndex mismatch); * plan-strategy D-5 (physical location co-located with validateMaterialPayload). */ export declare function validateMeshPayload(asset: Asset): AssetError | null; /** * Optional atlas extent for `validateTilesetPayload`. When omitted, the * region-rectangle bounds-check is skipped — only the * `tiles[].regionIndex` in `[0, regions.length)` invariant runs. */ export interface TilesetValidateOptions { readonly atlasWidth?: number; readonly atlasHeight?: number; } /** * Validate a `TilesetAsset` payload at register time (M0 baseline rebuild * + M1 schema extension). Returns `null` on success or an `AssetError` * carrying the first-error details (charter P3 fail-fast). R-6 ordering: * * 1. `atlases.length >= 1` -- 'tileset-tile-entry-malformed' .field='atlases'. * 2. Region rectangle escapes atlas extent (when extent is supplied) -- * M0 code 'tileset-region-index-out-of-range'. * 3. `regions[i].atlasIndex` in `[0, atlases.length)` -- 'tileset-tile-entry-malformed' * .field='atlasIndex'. * 4. `tiles[i].regionIndex` in `[0, regions.length)` -- M0 code. * 5. Per-tile-entry boundaries -- 'tileset-tile-entry-malformed' * .field=widthCells | heightCells | pivotX | pivotY | collider, * in that order, .scope='tile-entry' .tileEntryIndex=i. */ export declare function validateTilesetPayload(asset: TilesetAsset, opts?: TilesetValidateOptions): AssetError | null; /** * Compute the implicit atlas extent of a `TilesetAsset` from its grid metadata * (`columns * tileWidth` x `rows * tileHeight`). Used by the register-time * region-bounds check when the caller does not supply explicit extents. */ export declare function inferAtlasExtent(asset: TilesetAsset): { atlasWidth: number; atlasHeight: number; }; //# sourceMappingURL=payload-validate.d.ts.map