import { type HelixSceneV2, type SceneBounds, type SceneStreamGroup, type SceneTransform } from '@hypersoniclabs/helix-manifest'; import type { BuildingsManifest, CellEntry, FarEntry } from '../buildings'; import type { RoadCell } from '../roads'; import type { FarLayerResult } from '../../cs2/restyle/far'; import type { BundleFile, PackagedCityLibrary } from './materials'; import { type CityInlandWater, type CitySea } from './sea'; /** Decoded memory a road stream group may hold: a phone's budget must cover its eager groups plus the largest group streamed on top. */ export declare const ROAD_GROUP_TARGET_MIB = 8; /** Road stream groups a city may use before the target grows (the document allows 480 groups in all; terrain tiles, building clusters and landmarks hold about 330). */ export declare const ROAD_GROUP_BUDGET = 140; /** ...and the most the target grows to. */ export declare const ROAD_GROUP_TARGET_MAX_MIB = 12; /** The far road layer's 2,048 m cells are drawn as one node per block of this size (float positions: the cells do not share a uint16 frame). */ export declare const ROAD_FAR_MERGE_M = 4096; export declare const CITY_HLOD_LAYER = "buildings"; /** P10: terrain collision must reach this far where streets are drivable and walkable. */ export declare const ROAD_TERRAIN_COLLIDER_RADIUS_M = 256; /** The part of a road leaf that packing reads. */ export interface RoadPackUnit { groupId: string; bounds: SceneBounds; decoded: number; } /** * Packs each block's road leaves into stream groups (first-fit, largest first, a group within `targetMiB` decoded and ROAD_GROUP_SPAN_M wide). * A scene holds at most 480 stream groups (P13) and the roads share them with the terrain tiles, building clusters and landmark groups. When the * network packs into more than ROAD_GROUP_BUDGET groups at the default target (a capture with more bridges and ramps than the first), the target * grows by ROAD_GROUP_TARGET_STEP_MIB until it fits or reaches ROAD_GROUP_TARGET_MAX_MIB, so a denser network gets slightly larger patches of * street, never a refused document. */ export declare function packRoadBlocks(blocks: U[][], budget?: number): U[][][]; export interface ComposeInput { sceneId: string; title: string; /** Folder holding `terrain.json` (a terrain source folder). */ terrainDir: string; /** Folder holding `placements.json` (`helix placements bake`), when the city has vegetation or props. */ placementsDir?: string; /** The `helix city buildings build` output folder and its manifest. */ buildingsDir: string; buildings: BuildingsManifest; library: PackagedCityLibrary; /** The road generator's 1 km cells (render GLB and collider each), streamed in their own distance groups. */ roads?: RoadCell[]; /** The far road layer (`src/city/roads/far.ts`): the roads' driving surface in 2,048 m cells, one node each in one eager group `roadlod.far`. */ roadFar?: FarLayerResult | null; /** The terrain margin ring (`src/city/terrain/margin.ts`): one low-detail GLB around the bounds, resident from the start. */ margin?: { glb: Uint8Array; bounds: SceneBounds; triangles: number; }; /** A painted landmark bridge (`src/cs2/landmarks.ts`): one GLB in world space, one node in its own eager group, so it reads from across the bay. */ landmarks?: { glb: Uint8Array; bounds: SceneBounds; triangles: number; }; /** * The harbour's container stacks and cranes (`src/cs2/harbour.ts`): one GLB per square kilometre, each one node in its own portal group * admitted within `activationM` of its bounds (an activation volume), so a port reads from a kilometre out without joining the first playable. */ harbour?: { activationM: number; exitMarginM: number; groups: Array<{ id: string; glb: Uint8Array; bounds: SceneBounds; triangles: number; }>; }; /** The open sea the source declares (`citySeaFromWater`): one `water.sea` box over the terrain footprint and an apron. Absent: no sea node. */ sea?: CitySea; /** The ponds and lakes the source declares (`cityInlandWater`): one `water.volume` box each over its bounding box, resident from the start. */ inlandWater?: CityInlandWater[]; /** The look every inland water box carries (`CS2_INLAND_WATER` for a converted CS2 map). Absent: the engine's portable default. */ inlandWaterAppearance?: { color?: string; opacity?: number; }; memoryBudgetMiB: number; streamRadiusM: number; spawn: { position: [number, number, number]; rotationYDeg?: number; }; } export interface ComposeStats { buildingCells: number; roadCells: number; roadTriangles: number; roadBytes: number; roadFarCells: number; roadFarTriangles: number; roadFarBytes: number; colliderTriangles: number; hlodClusters: number; hlodTriangles: number; hlodBytes: number; nearBytes: number; colliderBytes: number; marginTriangles: number; marginBytes: number; landmarkTriangles: number; landmarkBytes: number; harbourGroups: number; harbourTriangles: number; harbourBytes: number; nodes: number; streamGroups: number; resources: number; documentBytes: number; } export interface ComposeResult { scene: HelixSceneV2; files: BundleFile[]; stats: ComposeStats; } /** Scene v2 schema (`streamActivation`): an activation reaches at most this far past its volumes, and keeps a group at most this much further. */ export declare const SCENE_ACTIVATION_MAX_DISTANCE_M = 256; export declare const SCENE_ACTIVATION_MAX_EXIT_M = 8; /** A harbour group's activation: within `reachM` of its bounds, as a 256 m trigger around the bounds grown by the rest of the reach. */ export declare function harbourActivation(bounds: SceneBounds, reachM: number, exitMarginM: number, transform: SceneTransform): NonNullable; /** The capability a Scene must require to author group activation volumes (`@hypersoniclabs/helix-manifest` scene-v2). */ export declare const SCENE_ACTIVATION_VOLUMES_CAPABILITY = "helix.scene-activation-volumes/1"; /** Scene v2 schema: a document carries at most 256 collision sets (a set may hold up to 4,096 colliders). */ export declare const MAX_COLLISION_SETS = 256; /** * How many building cells share one collider carrier. 1 (the carrier lives in the cell's own stream group) while the sets fit under * the schema cap; otherwise the smallest square block of cells (2 x 2, 3 x 3, ...) whose sets fit. Colliders are small next to the * render level (a few hundred KiB for a whole city), so streaming them in blocks costs memory only in the hundreds of KiB. */ export declare function colliderBlockSize(cells: ReadonlyArray<{ ix: number; iz: number; }>, budget: number): number; /** The most water boxes one root cell lists: the scene schema caps a cell at 1,024 nodes. */ export declare const ROOT_WATER_CELL_NODES = 512; /** The root group's water cells: the boxes in order, at most ROOT_WATER_CELL_NODES to a cell, each cell bounding its own boxes. */ export declare function rootWaterCells(boxes: ReadonlyArray<{ id: string; bounds: SceneBounds; }>): SceneStreamGroup['cells']; export declare function composeCityScene(input: ComposeInput): Promise; export type { CellEntry, FarEntry };