import type { HelixSceneV2, SceneBounds, SceneHlodCompleteBakeSettings, SceneHlodLayer, SceneNode } from '@hypersoniclabs/helix-manifest'; import { simplifyHlodSurface } from './geometry'; import type { HlodGeometry, HlodSurface } from './types'; export declare const COMPLETE_HLOD_BAKER_VERSION = 9; /** * An authored proxy shell (CS2's own LOD2, `HLOD_PROXY_EXTRA` in the bake source) is first simplified to this fraction of the layer's error (0.5 m * on the desktop layer's 2 m, 0.875 m on the phone's 3.5 m): it is already a clean low-detail building (flat walls, real roof shapes, closed), so an * edge collapse keeps its planes flat where the full error would round it off. */ export declare const PROXY_ERROR_FRACTION: number; /** The errors an authored shell is offered at, in multiples of the layer error (finest first). */ export declare const PROXY_ERROR_LADDER: readonly number[]; /** A candidate letting more than this fraction of the LOD2 shell's sight lines through reads as hollow at distance. */ export declare const PROXY_CLOSED_SEE_THROUGH = 0.05; /** * Buildings at least this tall (metres, instance scale applied) take the finest closed candidate instead of the cheapest: a skyline tower is * on screen from kilometres away and few instances exist, so its silhouette is worth the triangles (Pacifica: 256 such prototypes lift the * desktop HLOD from 435k to 588k instanced triangles, still under the 733k generic total). */ export declare const PROXY_FINE_HEIGHT_M = 25; type Shape = Awaited>; /** * The shape a prototype's distant level takes when the source carries an authored shell (CS2's own LOD2): the cheapest candidate that is still * closed against that shell. Candidates are the generic reconstruction (voxel exterior or simplified source) and the shell at every rung of * `PROXY_ERROR_LADDER`, all error-bounded. Measured on Pacifica (1858 prototypes): one shape rule for every building either costs 2.4x the * triangles (raw LOD2) or leaves small buildings hollow (LOD2 forced to the generic count: 514 see-through prototypes); choosing per prototype * keeps the triangles under the generic total and leaves 46 see-through prototypes instead of 202. When nothing is closed, the least see-through * candidate wins (fewest triangles on a tie). With `preferFinest` the finest closed rung of the shell wins instead (`PROXY_FINE_HEIGHT_M`). */ export declare function proxyShape(proxy: Pick, generic: Shape | undefined, limits: { maxErrorM: number; signal?: AbortSignal; }, preferFinest?: boolean): Promise<{ shape: Shape; authored: boolean; seeThrough: number; }>; export interface CompletePrototype { key: string; bounds: SceneBounds; geometry: HlodGeometry; baseColor: Uint8Array; normal: Uint8Array; orm: Uint8Array; emissive?: Uint8Array; metrics: { sourceTriangles: number; sourceDraws: number; triangles: number; method: string; sampled: number; projectionDistanceM: number; /** Exterior surface area of the simplified mesh in the prototype's own units (m2 before the instance scale). Area allocation reads it. */ areaM2?: number; }; } export interface PrototypeInput { key: string; scene: HelixSceneV2; node: SceneNode; layer: SceneHlodLayer; scale: number; settings: SceneHlodCompleteBakeSettings; /** `area`: bake every prototype at the largest tile so the atlas slot (see allocateTileSizes) can be chosen afterwards from the cached bake. */ allocation?: 'extent' | 'area'; } /** Sum of triangle areas of an indexed mesh. */ export declare function surfaceAreaM2(geometry: Pick): number; export declare function atomicHlodCache(file: string, text: string): Promise; export declare function encodeCompletePrototype(prototype: CompletePrototype): string; export declare function readCompletePrototype(cache: string, key: string): Promise; /** Bake immutable prototype appearance once; instance transforms are merged into spatial cells later. */ export declare function bakeCompletePrototype(input: PrototypeInput, root: string, cache: string, options: { force?: boolean; signal?: AbortSignal; }): Promise<{ prototype: CompletePrototype; cached: boolean; }>; export {};