export declare const BUILDING_COLORS_SCHEMA: "helix.cs2-building-colors/1"; export declare const COLORWAYS_SCHEMA: "helix.cs2-colorways/1"; export type Rgb = readonly [number, number, number]; /** The game's three colour channels (mask regions R, G, B), sRGB floats. */ export type ColorSet = readonly [Rgb, Rgb, Rgb]; export interface BuildingColorsFile { schema: typeof BUILDING_COLORS_SCHEMA; colorSpace: 'srgb'; palette: ColorSet[]; buildings: Record>; } export interface BuildingColors { file: BuildingColorsFile; /** The ColorSet instance `entity` wears on global mesh `meshIndex`, or undefined when the capture has none. */ setOf(entity: number | string, meshIndex: number): ColorSet | undefined; has(entity: number | string): boolean; /** Entities with colours. */ readonly size: number; } export declare const BUILDING_COLORS_PATH: readonly ["placements", "building-colors.json"]; export declare function buildingColorsFile(bundle: string): string; export declare function parseBuildingColors(file: BuildingColorsFile): BuildingColors; /** The bundle's colours, or null when the capture predates the colour export (the scheme stand-in then applies). */ export declare function readBuildingColors(bundle: string): BuildingColors | null; /** The three tint multipliers `tintAlbedo` takes: linear light, one per mask region. Values above 1 (HDR authoring) are kept to a sane gain. */ export declare function setLinear(set: ColorSet): [number, number, number][]; /** A stable short key of a ColorSet at texture precision (1/255 of sRGB), for the texture cache. */ export declare function setKey(set: ColorSet): string; /** One colourway of a prefab: the ColorSet worn on each global mesh index (meshes not listed wear `fallback`). */ export interface Colourway { byMesh: ReadonlyMap; fallback: ColorSet; /** Instances assigned to it. */ instances: number; } export interface Colourways { ways: Colourway[]; /** building id -> index into `ways`. Instances without colours are absent (they take way 0, the most worn). */ assignment: Map; } /** * Two instances whose colours differ by at most this much (root-mean-square over every channel value, sRGB 0..1) wear the same colourway. * The game jitters each instance's hue, saturation and value by up to its `ColorVariation` ranges (5 % by default), which this absorbs; two * authored colour sets (yellow brick against teal panels) differ by 0.2 or more. */ export declare const COLOURWAY_MERGE_RMS = 0.06; /** * Chooses at most `maxWays` colourways for a prefab from the instances that carry colours. `instances` are building ids with their cs2 * entity ids; `meshIndices` are the global mesh indices the prefab's CSM2 groups use. Leader clustering over the distinct colour signatures, * most worn first (a tie keeps the lexicographically first key, so the result never depends on iteration order); every instance is then * assigned to the nearest kept colourway, so a colour that did not make the cut still wears the closest one. */ export declare function chooseColourways(colors: BuildingColors, instances: ReadonlyArray<{ id: string; entity: number; }>, meshIndices: readonly number[], maxWays: number): Colourways | null; export interface ColorwaysFile { schema: typeof COLORWAYS_SCHEMA; /** building id -> colourway index of its prefab's prototype. */ assignments: Record; } export declare function colorwaysFile(assignments: ReadonlyMap): ColorwaysFile;