import type { Cs2Placements } from './placements'; import { type Cs2MeshDirectory } from './csm2'; import { type Cs2MaterialBundle } from './materials'; import { type BuildingColors, type ColorSet } from './convert/buildingColors'; export declare const CS2_HARBOUR_SCHEMA: "helix.cs2-harbour/1"; export type HarbourKind = 'containers' | 'crane'; /** Container stacks (the game's pile props, small to large, low to high) and the cargo cranes of a harbour. Single loose containers stay out. */ export declare const HARBOUR_PREFAB: RegExp; /** Reads the model name (`basePrefab`), so a static `Prop_` placement of a stack or crane is the same harbour piece. */ export declare function harbourKind(prefab: string): HarbourKind | null; /** A harbour group is admitted when the camera comes this close to its bounds, metres (the harbour-aerial shot sits 470 to 720 m out). */ export declare const HARBOUR_ACTIVATION_M = 1000; /** ...and kept until it is this much further away (the schema's most, `SCENE_ACTIVATION_MAX_EXIT_M`). */ export declare const HARBOUR_EXIT_MARGIN_M = 8; /** Instances are merged per square of this size, by origin: one GLB, one node, one group each. */ export declare const HARBOUR_CELL_M = 1024; /** Simplifier error per kind, metres: a container's corrugation and door bars go, its box stays; a crane keeps its girders. */ export declare const HARBOUR_ERROR_M: Readonly>; /** Triangles one harbour group may hold (a placement prototype's finest level is capped at 50,000). */ export declare const HARBOUR_MAX_TRIANGLES = 120000; /** Edge the colour and control maps are box-filtered to before sampling, so a vertex reads its face's colour, not the lettering. */ export declare const HARBOUR_TEXEL_EDGE = 64; /** * Container ColorSets (sRGB, the game's mask channels R, G, B): the liveries a port is stacked with, rust red, navy, green, orange, * teal, white, maroon and yellow. The capture holds no ColorSet for a prop, so each stack takes one of these by its position. */ export declare const CONTAINER_COLOUR_SETS: readonly ColorSet[]; export interface HarbourInstance { prefab: string; kind: HarbourKind; /** Scene frame: x, y above the sea, z. */ position: [number, number, number]; quaternion: [number, number, number, number]; /** The building that owns it (`rootOwnerEntityId`), 0 for a free prop. */ owner: number; } /** Pure: the harbour pieces of a capture, from its props and attached objects, exact repeats dropped. */ export declare function selectHarbour(placements: Cs2Placements, seaLevelMetres: number, hasMesh: (prefab: string) => boolean): { instances: HarbourInstance[]; noMesh: number; duplicates: number; }; /** The ColorSet an instance wears: its owning building's for a crane, a container livery by position for a stack. */ export declare function harbourColourSet(instance: HarbourInstance, colors: BuildingColors | null): ColorSet; /** * One prefab, simplified once in its own frame: positions, the triangles left, and per vertex the base map's LINEAR colour (the capture * stores colour maps linear, `capturedLinearToSrgb`) and the control mask's three weights. */ export interface HarbourPrototype { positions: Float32Array; indices: Uint32Array; albedo: Float32Array; mask: Float32Array; trianglesBefore: number; } /** Bilinear, wrapping (CS2 atlases tile), on straight RGBA bytes; UVs are top-left (the capture's, unflipped). */ export declare function sampleRgba(image: { data: Uint8Array; width: number; height: number; }, u: number, v: number, out: number[]): void; /** * Welds vertices that share a position (the capture splits them by normal and UV island, which this flat-shaded layer does not carry; * a welded vertex takes the mean of their colours) and simplifies at an absolute error, as far as that error allows. Welding by colour * as well kept every stencilled letter as a seam: a 32,612-triangle stack stalled at 12,000. */ export declare function weldAndSimplifyColoured(positions: Float32Array, albedo: Float32Array, mask: Float32Array, indices: Uint32Array, errorM: number, cap?: { triangles: number; maxErrorM: number; }): Promise<{ positions: Float32Array; albedo: Float32Array; mask: Float32Array; indices: Uint32Array; }>; /** Reads, samples and simplifies one harbour prefab. Decal groups (painted ground grids, stencils) are left out: they sit on other surfaces. */ export declare function buildHarbourPrototype(prefab: string, kind: HarbourKind, meshes: Cs2MeshDirectory, materials: Cs2MaterialBundle, materialsDir: string, images?: Map>): Promise; /** * Any prefab as a flat-shaded, vertex-coloured prototype simplified at `errorM` (the harbour layer and the street-furniture layer, * `streetFurniture.ts`). Colour maps are box-filtered to `texelEdge` first; decal groups are left out. */ export declare function buildColouredPrototype(prefab: string, errorM: number, meshes: Cs2MeshDirectory, materials: Cs2MaterialBundle, materialsDir: string, images?: Map>, texelEdge?: number, cap?: { triangles: number; maxErrorM: number; }): Promise; /** The game's tint on one linear base colour: `gain = 1 + sum(w_i * (set_i - 1))` per channel (`tintAlbedo`), in linear light. */ export declare function tintLinear(albedo: readonly number[], mask: readonly number[], linearSet: ReadonlyArray, out: number[]): void; /** Instances of the prototypes merged into one world-space mesh with per-vertex linear colour. */ export declare function mergeHarbour(instances: ReadonlyArray<{ prototype: HarbourPrototype; position: readonly number[]; quaternion: readonly number[]; set: ColorSet; }>): { positions: Float32Array; colours: Float32Array; indices: Uint32Array; }; export interface Cs2HarbourGroup { id: string; /** Relative to the objects folder. */ file: string; bounds: { min: [number, number, number]; max: [number, number, number]; }; triangles: number; instances: number; } export interface Cs2HarbourLayer { schema: typeof CS2_HARBOUR_SCHEMA; activationM: number; exitMarginM: number; groups: Cs2HarbourGroup[]; prefabs: Array<{ prefab: string; kind: HarbourKind; instances: number; trianglesBefore: number; triangles: number; }>; } /** * A cell's id, safe as a Scene v2 id segment (lower case, no leading sign): `w5.n0` is the cell 5 squares west of the origin, 0 north. * Pacifica's first convert refused `-5.0` (a segment may not start with a dash). */ export declare function harbourCellId(cx: number, cz: number): string; /** Builds `/harbour/.glb` for a capture's harbour pieces; null when it has none. */ export declare function buildCs2Harbour(out: string, instances: readonly HarbourInstance[], shared: { meshes: Cs2MeshDirectory; materials: Cs2MaterialBundle; materialsDir: string; colors: BuildingColors | null; }): Promise;