@spacexr/3d-tiles-runtime 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +93 -2
  3. package/dist/chunk-AI6NWGCA.js +316 -0
  4. package/dist/chunk-AI6NWGCA.js.map +1 -0
  5. package/dist/chunk-G7YVZYMR.js +24 -0
  6. package/dist/chunk-G7YVZYMR.js.map +1 -0
  7. package/dist/chunk-PJIVVIOF.js +205 -0
  8. package/dist/chunk-PJIVVIOF.js.map +1 -0
  9. package/dist/chunk-Q2AL6LWU.js +3 -0
  10. package/dist/chunk-Q2AL6LWU.js.map +1 -0
  11. package/dist/chunk-Q35HKP5V.js +249 -0
  12. package/dist/chunk-Q35HKP5V.js.map +1 -0
  13. package/dist/chunk-URZDM4BH.js +488 -0
  14. package/dist/chunk-URZDM4BH.js.map +1 -0
  15. package/dist/implicit/index.d.ts +64 -0
  16. package/dist/implicit/index.js +4 -0
  17. package/dist/implicit/index.js.map +1 -0
  18. package/dist/index-CNnPRQZc.d.ts +350 -0
  19. package/dist/index.d.ts +713 -0
  20. package/dist/index.js +3074 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/metadata/index.d.ts +12 -0
  23. package/dist/metadata/index.js +3 -0
  24. package/dist/metadata/index.js.map +1 -0
  25. package/dist/pipeline/index.d.ts +5 -0
  26. package/dist/pipeline/index.js +3 -0
  27. package/dist/pipeline/index.js.map +1 -0
  28. package/dist/ports/index.d.ts +62 -0
  29. package/dist/ports/index.js +4 -0
  30. package/dist/ports/index.js.map +1 -0
  31. package/dist/resource-DH72MRMN.d.ts +34 -0
  32. package/dist/spatial/index.d.ts +402 -0
  33. package/dist/spatial/index.js +3 -0
  34. package/dist/spatial/index.js.map +1 -0
  35. package/dist/spatial-3IDPbyv4.d.ts +28 -0
  36. package/dist/types-Dn5i8Uqg.d.ts +78 -0
  37. package/dist/types-ri64XfSE.d.ts +237 -0
  38. package/package.json +102 -5
  39. package/src/implicit/availability.ts +55 -0
  40. package/src/implicit/coordinates.ts +193 -0
  41. package/src/implicit/dense-subtree-loader.ts +23 -0
  42. package/src/implicit/index.ts +6 -0
  43. package/src/implicit/standard-subtree-loader.ts +71 -0
  44. package/src/implicit/tile-data-source.ts +120 -0
  45. package/src/implicit/types.ts +156 -0
  46. package/src/index.ts +6 -0
  47. package/src/metadata/index.ts +2 -0
  48. package/src/metadata/metadata-resolver.ts +308 -0
  49. package/src/metadata/types.ts +91 -0
  50. package/src/pipeline/index.ts +4 -0
  51. package/src/pipeline/metadata-store.ts +44 -0
  52. package/src/pipeline/ports.ts +62 -0
  53. package/src/pipeline/states.ts +56 -0
  54. package/src/pipeline/tile-3d.ts +165 -0
  55. package/src/ports/camera.ts +12 -0
  56. package/src/ports/content.ts +71 -0
  57. package/src/ports/glyph.ts +13 -0
  58. package/src/ports/index.ts +32 -0
  59. package/src/ports/resource.ts +54 -0
  60. package/src/ports/spatial.ts +28 -0
  61. package/src/ports/telemetry.ts +44 -0
  62. package/src/runtime/cache.ts +112 -0
  63. package/src/runtime/contracts.ts +77 -0
  64. package/src/runtime/events.ts +57 -0
  65. package/src/runtime/hooks.ts +99 -0
  66. package/src/runtime/index.ts +7 -0
  67. package/src/runtime/instrumentation.ts +163 -0
  68. package/src/runtime/priority-scheduler.ts +88 -0
  69. package/src/runtime/quadtree-balance.ts +215 -0
  70. package/src/runtime/tile-runtime.ts +3508 -0
  71. package/src/spatial/bounding-volumes.ts +159 -0
  72. package/src/spatial/ecef-types.ts +110 -0
  73. package/src/spatial/ecef.ts +196 -0
  74. package/src/spatial/index.ts +6 -0
  75. package/src/spatial/utm-bounds.ts +151 -0
  76. package/src/spatial/utm-types.ts +83 -0
  77. package/src/spatial/vertical-scale.ts +125 -0
  78. package/src/spatial/view-metrics.ts +132 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/spatial/bounding-volumes.ts","../src/spatial/utm-boun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AI,MAAA,CAAO,QAAQ,MAAA,CAAO,OAAO,CAAA,GAC5F,IAAA,CAAK,GAAA,CAAIA,UAAAA,CAAW,OAAO,MAAA,CAAO,QAAQ,CAAA,EAAG,MAAA,CAAO,OAAO,CAAA;AACjE,IAAA,MAAM,QAAA,GAAW,cAAA,CAAe,MAAA,EAAQ,QAAA,EAAU,KAAK,kBAAkB,CAAA;AACzE,IAAA,IAAI,EAAE,QAAA,GAAW,CAAA,CAAA,EAAI,OAAO,MAAA,CAAO,iBAAA;AACnC,IAAA,OAAO,OAAA,CAAQ,QAAQ,cAAA,GAAiB,QAAA;AAAA,EAC5C;AACJ","file":"chunk-URZDM4BH.js","sourcesContent":["import type { Box, Region, Sphere } from \"@spacexr/3d-tiles-core\";\nimport type { GeodeticSystem } from \"@spacexr/geodesy\";\nimport { cartesian3, matrix4 } from \"@spacexr/geometry\";\n\nimport type { IAxisAlignedBox, IBoundingSphere3, IEcefSpatialState, IVector3 } from \"./ecef-types\";\n\nexport type EcefBounds = Pick<IEcefSpatialState, \"boundingBox\" | \"boundingSphere\">;\n\nexport function boundsFromBox(box: Box, matrix: Float64Array): EcefBounds {\n const center = matrix4.transformPoint(matrix, { x: box[0], y: box[1], z: box[2] });\n const axes = [\n matrix4.transformDirection(matrix, { x: box[3], y: box[4], z: box[5] }),\n matrix4.transformDirection(matrix, { x: box[6], y: box[7], z: box[8] }),\n matrix4.transformDirection(matrix, { x: box[9], y: box[10], z: box[11] }),\n ];\n const extent = {\n x: Math.abs(axes[0]!.x) + Math.abs(axes[1]!.x) + Math.abs(axes[2]!.x),\n y: Math.abs(axes[0]!.y) + Math.abs(axes[1]!.y) + Math.abs(axes[2]!.y),\n z: Math.abs(axes[0]!.z) + Math.abs(axes[1]!.z) + Math.abs(axes[2]!.z),\n };\n let radius = 0;\n for (const xSign of [-1, 1]) {\n for (const ySign of [-1, 1]) {\n for (const zSign of [-1, 1]) {\n radius = Math.max(\n radius,\n cartesian3.length({\n x: xSign * axes[0]!.x + ySign * axes[1]!.x + zSign * axes[2]!.x,\n y: xSign * axes[0]!.y + ySign * axes[1]!.y + zSign * axes[2]!.y,\n z: xSign * axes[0]!.z + ySign * axes[1]!.z + zSign * axes[2]!.z,\n }),\n );\n }\n }\n }\n return {\n boundingBox: {\n min: { x: center.x - extent.x, y: center.y - extent.y, z: center.z - extent.z },\n max: { x: center.x + extent.x, y: center.y + extent.y, z: center.z + extent.z },\n },\n boundingSphere: { center, radius },\n };\n}\n\nexport function boundsFromSphere(sphere: Sphere, matrix: Float64Array): EcefBounds {\n const center = matrix4.transformPoint(matrix, { x: sphere[0], y: sphere[1], z: sphere[2] });\n const radius = sphere[3] * matrix4.maximumScale(matrix);\n return {\n boundingSphere: { center, radius },\n boundingBox: {\n min: { x: center.x - radius, y: center.y - radius, z: center.z - radius },\n max: { x: center.x + radius, y: center.y + radius, z: center.z + radius },\n },\n };\n}\n\nfunction angleWithin(angle: number, west: number, east: number): boolean {\n const fullTurn = Math.PI * 2;\n const normalized = ((angle % fullTurn) + fullTurn) % fullTurn;\n const normalizedWest = ((west % fullTurn) + fullTurn) % fullTurn;\n let normalizedEast = ((east % fullTurn) + fullTurn) % fullTurn;\n if (normalizedEast < normalizedWest) normalizedEast += fullTurn;\n const candidate = normalized < normalizedWest ? normalized + fullTurn : normalized;\n return candidate >= normalizedWest && candidate <= normalizedEast;\n}\n\nfunction regionSamples(region: Region): Array<readonly [number, number, number]> {\n const [west, south, east, north, minimumHeight, maximumHeight] = region;\n const longitudes = new Set([west, east, (west + (east < west ? east + Math.PI * 2 : east)) / 2]);\n for (const candidate of [-Math.PI, -Math.PI / 2, 0, Math.PI / 2, Math.PI]) {\n if (angleWithin(candidate, west, east)) longitudes.add(candidate);\n }\n const latitudes = new Set([south, north, (south + north) / 2]);\n if (south <= 0 && north >= 0) latitudes.add(0);\n const samples: Array<readonly [number, number, number]> = [];\n for (const longitude of longitudes) {\n for (const latitude of latitudes) {\n samples.push([longitude, latitude, minimumHeight], [longitude, latitude, maximumHeight]);\n }\n }\n return samples;\n}\n\nexport function boundsFromRegion(region: Region, system: GeodeticSystem): EcefBounds {\n return boundsFromPoints(\n regionSamples(region).map(([longitude, latitude, height]) => system.geodeticRadiansToEcef(latitude, longitude, height)),\n );\n}\n\n/** Axis-aligned box and enclosing sphere of a set of ECEF sample points. */\nexport function boundsFromPoints(points: readonly IVector3[]): EcefBounds {\n const min = { x: Number.POSITIVE_INFINITY, y: Number.POSITIVE_INFINITY, z: Number.POSITIVE_INFINITY };\n const max = { x: Number.NEGATIVE_INFINITY, y: Number.NEGATIVE_INFINITY, z: Number.NEGATIVE_INFINITY };\n for (const point of points) {\n min.x = Math.min(min.x, point.x);\n min.y = Math.min(min.y, point.y);\n min.z = Math.min(min.z, point.z);\n max.x = Math.max(max.x, point.x);\n max.y = Math.max(max.y, point.y);\n max.z = Math.max(max.z, point.z);\n }\n const center = { x: (min.x + max.x) / 2, y: (min.y + max.y) / 2, z: (min.z + max.z) / 2 };\n const radius = points.reduce((current, point) => Math.max(current, cartesian3.distance(point, center)), 0);\n return { boundingBox: { min, max }, boundingSphere: { center, radius } };\n}\n\nexport function boxesIntersect(left: IAxisAlignedBox, right: IAxisAlignedBox): boolean {\n return !(\n left.max.x < right.min.x ||\n left.min.x > right.max.x ||\n left.max.y < right.min.y ||\n left.min.y > right.max.y ||\n left.max.z < right.min.z ||\n left.min.z > right.max.z\n );\n}\n\nexport function sphereOutsidePlane(sphere: IBoundingSphere3, plane: { x: number; y: number; z: number; w: number }): boolean {\n return cartesian3.dot(plane, sphere.center) + plane.w < -sphere.radius;\n}\n\n/**\n * Whether a tile lies beyond the horizon of a spherical body, from the true formula: a point at distance `p` from the\n * centre is hidden from a camera at distance `c` by a sphere of radius `r` when their angle exceeds\n * `acos(r / c) + acos(r / p)`, the horizons of the camera and of the point. The test takes the highest point of the tile.\n *\n * The sphere must be solid: a sight line may pass over any basin between the camera and the tile, so it lies below the\n * lowest terrain of the body, not only of the tile. A tile without known heights uses the extent of its bounding sphere.\n *\n * @param bodyRadius - Radius of the reference surface of the body, in metres.\n * @param lowestHeight - Lowest terrain of the body over that surface, in metres.\n * @param heightRange - Lowest and highest heights of the tile over that surface, in metres.\n */\nexport function isSphereBeyondHorizon(\n sphere: IBoundingSphere3,\n cameraPosition: IVector3,\n bodyRadius: number,\n lowestHeight: number,\n heightRange?: readonly [number, number],\n): boolean {\n const centreDistance = cartesian3.length(sphere.center);\n if (sphere.radius >= centreDistance) return false;\n const cameraDistance = cartesian3.length(cameraPosition);\n const lowest = heightRange ? bodyRadius + heightRange[0] : centreDistance - sphere.radius;\n const highest = heightRange ? bodyRadius + heightRange[1] : centreDistance + sphere.radius;\n const occluder = Math.min(bodyRadius + Math.min(0, lowestHeight), lowest);\n if (occluder <= 0 || cameraDistance <= occluder) return false;\n const cosine = cartesian3.dot(sphere.center, cameraPosition) / (centreDistance * cameraDistance);\n const angle = Math.acos(Math.max(-1, Math.min(1, cosine)));\n const extent = Math.asin(sphere.radius / centreDistance);\n return angle - extent > Math.acos(occluder / cameraDistance) + Math.acos(occluder / Math.max(occluder, highest));\n}\n\nexport function isSphereBelowConservativeHorizon(sphere: IBoundingSphere3, cameraPosition: IVector3, occluderRadius: number): boolean {\n const cameraDistance = cartesian3.length(cameraPosition);\n if (cameraDistance <= occluderRadius) return false;\n const centreDotCamera = cartesian3.dot(sphere.center, cameraPosition);\n return centreDotCamera + sphere.radius * cameraDistance < occluderRadius * occluderRadius;\n}\n","import { resolveUtmProjection, type IUtmBoundingVolume, type IUtmProjection, type IVerticalExtent } from \"@spacexr/3d-tiles-core\";\nimport { UtmProjection, type GeodeticSystem } from \"@spacexr/geodesy\";\n\nimport { boundsFromPoints, type EcefBounds } from \"./bounding-volumes\";\nimport type { IVector3 } from \"./ecef-types\";\nimport type { IHorizontalDatumTransformation, IUtmPlacement, IUtmPlacementOptions, UtmVerticalOrigin } from \"./utm-types\";\n\n/** Horizontal sample count per axis. */\nconst SAMPLES_PER_AXIS = 3;\n\n/** No datum transformation is assumed without an application policy. */\nexport function defaultHorizontalDatumResolver(_projection: IUtmProjection): IHorizontalDatumTransformation | undefined {\n return undefined;\n}\n\nfunction explicitGeoidMargin(options: IUtmPlacementOptions): number {\n const margin = options.geoidUndulationMargin;\n if (margin === undefined || !Number.isFinite(margin) || margin < 0)\n throw new RangeError(\"An explicit nonnegative geoid margin or geoid model is required.\");\n return margin;\n}\n\ninterface IVerticalModel {\n origin: UtmVerticalOrigin;\n /** Height interval in metres, ellipsoidal or orthometric depending on `orthometric`. */\n range: [number, number];\n orthometric: boolean;\n}\n\n/** Converts signed vertical values to an interval measured upward from the vertical origin. */\nfunction upwardInterval(vertical: IVerticalExtent): [number, number] {\n return vertical.direction === \"DOWN\" ? [-vertical.maximum, -vertical.minimum] : [vertical.minimum, vertical.maximum];\n}\n\nfunction verticalModel(vertical: IVerticalExtent, options: IUtmPlacementOptions): IVerticalModel {\n const [lower, upper] = upwardInterval(vertical);\n switch (vertical.reference) {\n case \"ELLIPSOID\":\n return { origin: \"ellipsoid\", range: [lower, upper], orthometric: false };\n case \"GEOID\":\n return { origin: \"geoid\", range: [lower, upper], orthometric: true };\n case \"GROUND\":\n if (vertical.groundElevation !== undefined) {\n return {\n origin: \"ground-elevation\",\n range: [vertical.groundElevation + lower, vertical.groundElevation + upper],\n orthometric: true,\n };\n }\n break;\n }\n return {\n origin: \"assumed-terrain\",\n range: (() => {\n const range = options.unknownGroundHeightRange;\n if (!range || !range.every(Number.isFinite) || range[0] > range[1])\n throw new RangeError(\"An explicit valid terrain height envelope is required.\");\n return [range[0] + lower, range[1] + upper];\n })(),\n orthometric: false,\n };\n}\n\n/**\n * Derives the ellipsoidal height interval of a vertical extent without a geoid model.\n *\n * Orthometric and ground-anchored values use the caller-supplied margin. Ground values\n * without `groundElevation` and `LOCAL` values require an explicit height envelope.\n *\n * @param vertical - Vertical extent of a UTM bounding volume.\n * @returns Minimum and maximum ellipsoidal heights in metres.\n */\nexport function ellipsoidalHeightRange(vertical: IVerticalExtent, options: IUtmPlacementOptions): [number, number] {\n const model = verticalModel(vertical, options);\n return model.orthometric ? [model.range[0] - explicitGeoidMargin(options), model.range[1] + explicitGeoidMargin(options)] : model.range;\n}\n\n/** ECEF bounds of a UTM extent together with the report of how they were derived. */\nexport interface IUtmBounds extends EcefBounds {\n placement: IUtmPlacement;\n}\n\nfunction widen(bounds: EcefBounds, margin: number): EcefBounds {\n if (margin <= 0 || !bounds.boundingBox || !bounds.boundingSphere) return bounds;\n const { min, max } = bounds.boundingBox;\n return {\n boundingBox: {\n min: { x: min.x - margin, y: min.y - margin, z: min.z - margin },\n max: { x: max.x + margin, y: max.y + margin, z: max.z + margin },\n },\n boundingSphere: { center: bounds.boundingSphere.center, radius: bounds.boundingSphere.radius + margin },\n };\n}\n\n/**\n * Derives ECEF bounds from a `SPACEXR_bounding_volume_utm` extent.\n *\n * 1. The zone, hemisphere and datum are resolved from the EPSG code or the explicit zone.\n * 2. The UTM grid is inverted on the ellipsoid of the datum.\n * 3. The datum transformation is applied, and the bounds are widened by its accuracy.\n * 4. Heights are converted to ellipsoidal heights with the geoid model, or widened by a geoid margin.\n * 5. A 3 x 3 grid of the extent at both heights is converted to ECEF with `system`.\n *\n * Every step is reported in `placement`. When the projection or the datum cannot be resolved, no bounds are derived.\n *\n * @param extent - UTM extent.\n * @param system - Geodetic system of the ECEF frame.\n * @param options - Datum resolver and geoid model.\n * @returns ECEF bounds and the placement report.\n */\nexport function boundsFromUtm(extent: IUtmBoundingVolume, system: GeodeticSystem, options: IUtmPlacementOptions = {}): IUtmBounds {\n const projection = resolveUtmProjection(extent);\n if (!projection) return { placement: { status: \"unresolved-projection\", horizontalMargin: 0, verticalMargin: 0 } };\n\n const datumTransformation = (options.datumResolver ?? defaultHorizontalDatumResolver)(projection);\n if (!datumTransformation) return { placement: { status: \"unresolved-datum\", projection, horizontalMargin: 0, verticalMargin: 0 } };\n\n const vertical = verticalModel(extent.vertical, options);\n const geoid = vertical.orthometric ? (options.geoidUndulation ? \"model\" : \"margin\") : undefined;\n const verticalMargin = geoid === \"margin\" ? explicitGeoidMargin(options) : 0;\n const minimumHeight = vertical.range[0] - verticalMargin;\n const maximumHeight = vertical.range[1] + verticalMargin;\n\n const ellipsoid = datumTransformation.sourceEllipsoid ?? system.ellipsoid;\n const utm = new UtmProjection(projection.zone, projection.hemisphere, ellipsoid);\n const points: IVector3[] = [];\n const geodetic = { latitude: 0, longitude: 0, height: 0 };\n for (let i = 0; i < SAMPLES_PER_AXIS; i++) {\n const easting = extent.minEasting + ((extent.maxEasting - extent.minEasting) * i) / (SAMPLES_PER_AXIS - 1);\n for (let j = 0; j < SAMPLES_PER_AXIS; j++) {\n const northing = extent.minNorthing + ((extent.maxNorthing - extent.minNorthing) * j) / (SAMPLES_PER_AXIS - 1);\n utm.projectedToGeodeticRadians(easting, northing, 0, geodetic);\n datumTransformation.transform?.(geodetic);\n const undulation = geoid === \"model\" ? options.geoidUndulation!(geodetic.latitude, geodetic.longitude) : 0;\n points.push(system.geodeticRadiansToEcef(geodetic.latitude, geodetic.longitude, minimumHeight + undulation));\n points.push(system.geodeticRadiansToEcef(geodetic.latitude, geodetic.longitude, maximumHeight + undulation));\n }\n }\n\n const placement: IUtmPlacement = {\n status: \"placed\",\n projection,\n datumTransformation: { name: datumTransformation.name, accuracy: datumTransformation.accuracy },\n horizontalMargin: datumTransformation.accuracy,\n verticalOrigin: vertical.origin,\n verticalMargin,\n heightRange: [minimumHeight, maximumHeight],\n };\n if (geoid) placement.geoid = geoid;\n return { ...widen(boundsFromPoints(points), datumTransformation.accuracy), placement };\n}\n","import type { GeodeticSystem } from \"@spacexr/geodesy\";\nimport { cartesian3, matrix4 } from \"@spacexr/geometry\";\nimport type { ReferenceSurface } from \"@spacexr/tiles\";\n\nimport type { IEcefSpatialState, IVector3 } from \"./ecef-types\";\n\n/**\n * The vertical exaggeration of a scene. Terrain, picking, tile bounds, the camera and objects read this one value, so\n * that they cannot disagree: changing it changes all of them.\n */\nexport class VerticalScale {\n private current: number;\n private readonly listeners = new Set<(value: number) => void>();\n\n /** @throws RangeError When the value is negative or not finite. */\n public constructor(value = 1) {\n this.current = VerticalScale.checked(value);\n }\n\n public get value(): number {\n return this.current;\n }\n\n /** Changes the scale and notifies the listeners when it differs. @throws RangeError When the value is negative or not finite. */\n public set(value: number): void {\n const next = VerticalScale.checked(value);\n if (next === this.current) return;\n this.current = next;\n for (const listener of [...this.listeners]) listener(next);\n }\n\n /** @returns The function that stops the notifications. */\n public subscribe(listener: (value: number) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private static checked(value: number): number {\n if (!Number.isFinite(value) || value < 0) throw new RangeError(\"The vertical scale must be non-negative and finite.\");\n return value;\n }\n}\n\n/** What a height means on a body: the same as for the terrain under the objects. */\nexport interface IVerticalFrame {\n /** Height of a point in metres, over the surface the heights of the terrain refer to. */\n height(point: Readonly<IVector3>): number;\n /** Unit direction along which that height is measured at a point. */\n up(point: Readonly<IVector3>): IVector3;\n}\n\n/** Radial heights over a reference surface, as within the pyramid root: `P = (r_ref(d) + h) d`. */\nexport function radialVerticalFrame(reference: Pick<ReferenceSurface, \"height\">): IVerticalFrame {\n return {\n height: (point) => reference.height(point),\n up: (point) => cartesian3.normalize(point),\n };\n}\n\n/** Heights along the normal of an ellipsoid, as on the Web Mercator grid. */\nexport function geodeticVerticalFrame(system: GeodeticSystem): IVerticalFrame {\n return {\n height: (point) => system.ecefToGeodeticRadians(point).height,\n up: (point) => {\n const { latitude, longitude } = system.ecefToGeodeticRadians(point);\n const cosine = Math.cos(latitude);\n return { x: cosine * Math.cos(longitude), y: cosine * Math.sin(longitude), z: Math.sin(latitude) };\n },\n };\n}\n\n/** How objects follow the vertical scale of their scene. */\nexport interface IVerticalPlacement {\n scale: VerticalScale;\n frame: IVerticalFrame;\n}\n\n/**\n * How far the vertical scale moves an anchor: `h (s - 1)` along its up direction. A point of the terrain at height `h` is\n * moved exactly as far, so an object placed on the terrain stays on it. The object itself is moved, never stretched.\n */\nexport function verticalDisplacement(anchor: Readonly<IVector3> | undefined, placement: IVerticalPlacement): IVector3 {\n const factor = placement.scale.value - 1;\n // The centre of the body has no height: a volume around it does not move, it only grows.\n if (factor === 0 || !anchor || (anchor.x === 0 && anchor.y === 0 && anchor.z === 0)) return { x: 0, y: 0, z: 0 };\n const distance = placement.frame.height(anchor) * factor;\n return cartesian3.scale(placement.frame.up(anchor), distance);\n}\n\n/**\n * The bounds of a tile under the vertical scale.\n *\n * The first tile with a position, from the root down, is an object: it moves by the height of its origin, and its\n * descendants move with it whatever their transforms, so that an object never comes apart. A tile above any object moves\n * with the centre of its volume. It may hold objects of other heights, whose origins differ from that height by at most its\n * radius: it grows by `r |s - 1|` to keep them inside. The transform stays as it was: children compose from the original\n * placement.\n */\nexport function placeVertically<TState extends IEcefSpatialState>(\n state: TState,\n placement: IVerticalPlacement,\n parent?: Readonly<IEcefSpatialState>,\n): TState {\n const origin = matrix4.translation(state.worldTransform);\n const object = parent?.verticalObject ?? (cartesian3.length(origin) > 0 ? origin : undefined);\n const sphere = state.boundingSphere;\n const anchor = object ?? (sphere && cartesian3.copy(sphere.center));\n const placed: TState = { ...state, ...(object ? { verticalObject: object } : {}), ...(anchor ? { verticalAnchor: anchor } : {}) };\n const factor = placement.scale.value - 1;\n if (factor === 0 || !sphere) return placed;\n const moved = verticalDisplacement(anchor, placement);\n const margin = object ? 0 : sphere.radius * Math.abs(factor);\n placed.boundingSphere = {\n center: cartesian3.add(sphere.center, moved),\n radius: sphere.radius + margin,\n };\n if (state.boundingBox) {\n const { min, max } = state.boundingBox;\n placed.boundingBox = {\n min: { x: min.x + moved.x - margin, y: min.y + moved.y - margin, z: min.z + moved.z - margin },\n max: { x: max.x + moved.x + margin, y: max.y + moved.y + margin, z: max.z + moved.z + margin },\n };\n }\n return placed;\n}\n","import { cartesian3 } from \"@spacexr/geometry\";\n\nimport type { IEcefCameraFrame, IVector3 } from \"./ecef-types\";\nimport type { IVerticalFrame } from \"./vertical-scale\";\n\n/** Viewport height and field of view used when a camera frame does not give them. */\nexport interface IProjectionFallback {\n /** Viewport height in physical pixels. */\n viewportHeight: number;\n /** Vertical field of view in radians. */\n verticalFovRadians: number;\n}\n\n/**\n * Length on the ground covered by one pixel of the viewport, at a distance from the camera, along a direction facing it.\n * It is the factor of the screen-space error: a geometric error `e` at that distance spans `e / metresPerPixel` pixels.\n *\n * @param camera - Camera frame giving the viewport height and the vertical field of view.\n * @param distance - Distance from the camera, in metres.\n * @param fallback - Values used when the frame gives no viewport height or field of view.\n * @returns Metres per pixel, or `NaN` when the field of view is not in (0, PI).\n */\nexport function metresPerPixel(camera: Readonly<IEcefCameraFrame>, distance: number, fallback: Readonly<IProjectionFallback>): number {\n const viewportHeight = camera.viewportHeight > 0 ? camera.viewportHeight : fallback.viewportHeight;\n const tanHalfVerticalFov = camera.tanHalfVerticalFov ?? Math.tan((camera.verticalFovRadians ?? fallback.verticalFovRadians) / 2);\n if (!Number.isFinite(tanHalfVerticalFov) || tanHalfVerticalFov <= 0) return Number.NaN;\n return (2 * tanHalfVerticalFov * distance) / viewportHeight;\n}\n\n/** Inputs of {@link describeView} known to the renderer or the application rather than the camera frame. */\nexport interface IViewMetricsOptions {\n /** What a height means on the body: the frame of the terrain heights. */\n vertical: IVerticalFrame;\n /** Values used when the frame gives no viewport height or field of view. */\n fallback: Readonly<IProjectionFallback>;\n /**\n * Height of the drawn terrain below the camera, over the same surface, vertical scale included. Without it the altitude\n * over the ground is unknown and the view centre is sought on the reference surface.\n */\n groundHeight?: number;\n /**\n * Distance from the camera to the point at the centre of the view, when the renderer knows it, such as the radius of an\n * orbiting camera or a depth read. Otherwise the centre ray is intersected with the sphere through the ground below the\n * camera.\n */\n targetDistance?: number;\n}\n\n/** What a camera sees, for a scale and altitude display. Angles in degrees, lengths in metres. */\nexport interface IViewMetrics {\n /** Latitude of the camera, along the up direction of the vertical frame: geodetic or planetocentric. */\n latitude: number;\n /** East longitude of the camera, in (-180, 180]. */\n longitude: number;\n /** Height of the camera over the reference surface. */\n height: number;\n /** Height of the camera over the drawn terrain, when its height below the camera is known. */\n altitude?: number;\n /** Direction of the view from north, clockwise, in [0, 360). Undefined when the camera looks straight up or down. */\n heading?: number;\n /** Angle of the view over the horizon: 0 level, -90 straight down. Undefined without a forward direction. */\n pitch?: number;\n /** Distance from the camera to the point at the centre of the view. Undefined when the view misses the body. */\n targetDistance?: number;\n /** Ground length covered by one pixel at the centre of the view; the screen-space error factor there. */\n metresPerPixel?: number;\n}\n\nconst DEGREES = 180 / Math.PI;\n\nconst { cross, dot } = cartesian3;\n\n/** Unit vector of the same direction, undefined for a vector without length. */\nfunction normalized(vector: Readonly<IVector3>): IVector3 | undefined {\n return cartesian3.length(vector) > 0 ? cartesian3.normalize(vector) : undefined;\n}\n\n/** Distance along a unit ray from `origin` to the near side of a sphere centred on the body, if the ray meets it. */\nfunction raySphereDistance(origin: Readonly<IVector3>, direction: Readonly<IVector3>, radius: number): number | undefined {\n const b = dot(origin, direction);\n const c = dot(origin, origin) - radius * radius;\n const discriminant = b * b - c;\n if (discriminant < 0) return undefined;\n const root = Math.sqrt(discriminant);\n const near = -b - root;\n if (near >= 0) return near;\n const far = -b + root;\n return far >= 0 ? far : undefined;\n}\n\n/**\n * Position, orientation and scale of a camera over a body, from its renderer-neutral frame.\n *\n * North is the body axis, ECEF +Z, projected on the plane normal to the up direction of the vertical frame. The scale is\n * {@link metresPerPixel} at the distance of the view centre: the same factor the screen-space error divides by.\n */\nexport function describeView(camera: Readonly<IEcefCameraFrame>, options: Readonly<IViewMetricsOptions>): IViewMetrics {\n const position = camera.position;\n const up = options.vertical.up(position);\n const height = options.vertical.height(position);\n const metrics: IViewMetrics = {\n latitude: Math.asin(Math.max(-1, Math.min(1, up.z))) * DEGREES,\n longitude: Math.atan2(up.y, up.x) * DEGREES,\n height,\n };\n const ground = options.groundHeight;\n if (ground !== undefined && Number.isFinite(ground)) metrics.altitude = height - ground;\n\n const forward = camera.forward && normalized(camera.forward);\n if (!forward) return metrics;\n const vertical = dot(forward, up);\n metrics.pitch = Math.asin(Math.max(-1, Math.min(1, vertical))) * DEGREES;\n // At a pole, north is undefined: the heading is measured from the meridian of longitude 0.\n const north = normalized({ x: -up.z * up.x, y: -up.z * up.y, z: 1 - up.z * up.z }) ?? normalized({ x: -Math.sign(up.z), y: 0, z: 0 });\n const level = normalized({ x: forward.x - vertical * up.x, y: forward.y - vertical * up.y, z: forward.z - vertical * up.z });\n if (north && level) {\n const east = cross(north, up);\n const heading = Math.atan2(dot(level, east), dot(level, north)) * DEGREES;\n metrics.heading = heading < 0 ? heading + 360 : heading;\n }\n\n // The point of the ground below the camera, or of the reference surface without the ground height.\n const drop = metrics.altitude ?? height;\n const below = { x: position.x - drop * up.x, y: position.y - drop * up.y, z: position.z - drop * up.z };\n const distance = options.targetDistance ?? raySphereDistance(position, forward, cartesian3.length(below));\n if (distance !== undefined && Number.isFinite(distance) && distance > 0) {\n metrics.targetDistance = distance;\n const perPixel = metresPerPixel(camera, distance, options.fallback);\n if (perPixel > 0) metrics.metresPerPixel = perPixel;\n }\n return metrics;\n}\n","import { getUtmBoundingVolume } from \"@spacexr/3d-tiles-core\";\nimport type { GeodeticSystem } from \"@spacexr/geodesy\";\nimport { cartesian3, matrix4 } from \"@spacexr/geometry\";\n\nimport type { IScreenSpaceErrorContext, ISpatialDerivationContext, ISpatialMetric } from \"../ports/spatial\";\nimport {\n boundsFromBox,\n boundsFromRegion,\n boundsFromSphere,\n boxesIntersect,\n isSphereBelowConservativeHorizon,\n isSphereBeyondHorizon,\n sphereOutsidePlane,\n} from \"./bounding-volumes\";\nimport type { IEcefCameraFrame, IEcefSpatialMetricOptions, IEcefSpatialState } from \"./ecef-types\";\nimport { boundsFromUtm } from \"./utm-bounds\";\nimport type { IUtmPlacementOptions } from \"./utm-types\";\nimport { placeVertically, type IVerticalPlacement } from \"./vertical-scale\";\nimport { metresPerPixel, type IProjectionFallback } from \"./view-metrics\";\n\nconst DEFAULT_VIEWPORT_HEIGHT = 1080;\nconst DEFAULT_VERTICAL_FOV_RADIANS = Math.PI / 3;\n\n/**\n * Renderer-neutral 3D Tiles spatial metric operating in ECEF metres.\n *\n * The class owns 3D Tiles concerns such as transform composition, bounding\n * volume derivation, visibility and screen-space error. Ellipsoid and\n * coordinate-system mathematics are delegated to `@spacexr/geodesy`.\n */\nexport class EcefSpatialMetric implements ISpatialMetric<IEcefCameraFrame, IEcefSpatialState> {\n private readonly system: GeodeticSystem;\n private readonly horizonCulling: boolean;\n private readonly horizon: \"plane\" | \"tile-heights\";\n /** Lowest terrain measured on any tile so far, over the reference surface, in metres. */\n /** Lowest terrain measured, without the vertical scale, which may change later. */\n private lowestUnscaledHeight = 0;\n private readonly defaultViewportHeight: number;\n private readonly defaultVerticalFovRadians: number;\n /** Viewport height and field of view used when a camera frame does not give them. */\n public readonly projectionFallback: Readonly<IProjectionFallback>;\n private readonly utmOptions: IUtmPlacementOptions;\n private readonly vertical: IVerticalPlacement | undefined;\n\n /**\n * Creates an ECEF spatial metric.\n *\n * @param options - Geodetic system and camera fallbacks.\n */\n public constructor(options: IEcefSpatialMetricOptions) {\n if (!options?.geodeticSystem) throw new TypeError(\"An explicit geodetic system is required.\");\n this.system = options.geodeticSystem;\n this.horizonCulling = options.horizonCulling ?? true;\n this.horizon = options.horizon ?? \"plane\";\n this.defaultViewportHeight = options.defaultViewportHeight ?? DEFAULT_VIEWPORT_HEIGHT;\n this.defaultVerticalFovRadians = options.defaultVerticalFovRadians ?? DEFAULT_VERTICAL_FOV_RADIANS;\n this.utmOptions = options.utm ?? {};\n this.vertical = options.vertical;\n this.projectionFallback = { viewportHeight: this.defaultViewportHeight, verticalFovRadians: this.defaultVerticalFovRadians };\n\n if (!Number.isFinite(this.defaultViewportHeight) || this.defaultViewportHeight <= 0) {\n throw new RangeError(\"The default viewport height must be a positive finite number.\");\n }\n if (\n !Number.isFinite(this.defaultVerticalFovRadians) ||\n this.defaultVerticalFovRadians <= 0 ||\n this.defaultVerticalFovRadians >= Math.PI\n ) {\n throw new RangeError(\"The default vertical field of view must be in the interval (0, PI).\");\n }\n }\n\n /** Geodetic reference system used for regions and horizon culling. */\n public get geodeticSystem(): GeodeticSystem {\n return this.system;\n }\n\n /**\n * Derives world-space state for a tile.\n *\n * Box and sphere volumes receive the accumulated tile transform. A region\n * is already expressed in the tileset geodetic reference system and is not\n * transformed, as required by 3D Tiles. A `SPACEXR_bounding_volume_utm`\n * extent is likewise absolute: it takes precedence over any standard\n * fallback volume and ignores the tile transform. Its datum\n * transformation, geoid handling and margins are reported in\n * `utmPlacement`. When it cannot be placed, the standard volume is used\n * if present; otherwise the state has no bounds and the tile is never culled.\n *\n * @param context - Source tile and optional parent spatial state.\n * @returns Spatial state expressed in ECEF metres.\n */\n public derive(context: ISpatialDerivationContext<IEcefSpatialState>): IEcefSpatialState {\n const unscaled = this.deriveUnscaled(context);\n const state = context.heightRange ? { ...unscaled, heightRange: context.heightRange } : unscaled;\n if (context.heightRange) {\n const scale = this.vertical?.scale.value ?? 1;\n if (scale > 0) this.lowestUnscaledHeight = Math.min(this.lowestUnscaledHeight, context.heightRange[0] / scale);\n }\n return this.vertical ? placeVertically(state, this.vertical, context.parent) : state;\n }\n\n private deriveUnscaled(context: ISpatialDerivationContext<IEcefSpatialState>): IEcefSpatialState {\n const worldTransform = matrix4.create();\n matrix4.from(context.tile.transform, worldTransform);\n if (context.parent) matrix4.multiply(context.parent.worldTransform, worldTransform, worldTransform);\n const scale = matrix4.maximumScale(worldTransform);\n const volume = context.tile.boundingVolume;\n const utm = getUtmBoundingVolume(volume);\n const utmBounds = utm ? boundsFromUtm(utm, this.system, this.utmOptions) : undefined;\n const standardBounds = volume.box\n ? boundsFromBox(volume.box, worldTransform)\n : volume.sphere\n ? boundsFromSphere(volume.sphere, worldTransform)\n : volume.region\n ? boundsFromRegion(volume.region, this.system)\n : {};\n\n if (utmBounds) {\n const { placement, ...placedBounds } = utmBounds;\n // An extent that cannot be placed falls back to the standard volume, if any; the report states why.\n const bounds = placement.status === \"placed\" ? placedBounds : standardBounds;\n return { worldTransform, ...bounds, geometricError: context.tile.geometricError * scale, utmPlacement: placement };\n }\n return {\n worldTransform,\n ...standardBounds,\n geometricError: context.tile.geometricError * scale,\n };\n }\n\n /**\n * Evaluates coarse clip bounds, conservative horizon culling and frustum planes.\n *\n * @param spatial - Derived tile state.\n * @param camera - Camera expressed in ECEF metres.\n * @returns `true` when the tile may contribute to the current view.\n */\n public isVisible(spatial: IEcefSpatialState, camera: IEcefCameraFrame): boolean {\n return this.isInside(spatial, camera, camera.frustumPlanes);\n }\n\n /**\n * Whether a tile is inside the wider planes around the view, with the same bounds and horizon as {@link isVisible}.\n *\n * @param spatial - Derived tile state.\n * @param camera - Camera expressed in ECEF metres.\n * @returns `true` when the camera has such planes and the tile may lie inside them.\n */\n public isInPeriphery(spatial: IEcefSpatialState, camera: IEcefCameraFrame): boolean {\n return camera.peripheryFrustumPlanes !== undefined && this.isInside(spatial, camera, camera.peripheryFrustumPlanes);\n }\n\n private isInside(spatial: IEcefSpatialState, camera: IEcefCameraFrame, planes: IEcefCameraFrame[\"frustumPlanes\"]): boolean {\n if (camera.clipBounds && spatial.boundingBox && !boxesIntersect(spatial.boundingBox, camera.clipBounds)) return false;\n if (!spatial.boundingSphere) return true;\n if (this.horizonCulling) {\n const radius = this.system.ellipsoid.minimumRadius;\n const hidden =\n this.horizon === \"tile-heights\"\n ? isSphereBeyondHorizon(\n spatial.boundingSphere,\n camera.position,\n radius,\n this.lowestUnscaledHeight * (this.vertical?.scale.value ?? 1),\n spatial.heightRange,\n )\n : isSphereBelowConservativeHorizon(spatial.boundingSphere, camera.position, radius);\n if (hidden) return false;\n }\n if (planes?.some((plane) => sphereOutsidePlane(spatial.boundingSphere!, plane))) return false;\n return true;\n }\n\n /**\n * Computes projected geometric error in physical pixels.\n *\n * Distance is measured from the camera to the enclosing sphere surface,\n * not merely to its centre. This prevents premature refinement changes\n * near large tiles.\n *\n * @param context - Camera, tile and derived spatial state.\n * @returns Screen-space error in physical pixels.\n */\n public screenSpaceError(context: IScreenSpaceErrorContext<IEcefCameraFrame, IEcefSpatialState>): number {\n if (context.spatial.geometricError <= 0) return 0;\n const camera = context.camera;\n const sphere = context.spatial.boundingSphere;\n const distance = sphere\n ? Math.max(cartesian3.distance(camera.position, sphere.center) - sphere.radius, Number.EPSILON)\n : Math.max(cartesian3.length(camera.position), Number.EPSILON);\n const perPixel = metresPerPixel(camera, distance, this.projectionFallback);\n if (!(perPixel > 0)) return Number.POSITIVE_INFINITY;\n return context.spatial.geometricError / perPixel;\n }\n}\n"]}
@@ -0,0 +1,64 @@
1
+ import { IImplicitTiling, ITile, IContent, IBoundingVolume } from '@spacexr/3d-tiles-core';
2
+ import { q as ISubtreeAvailability, d as ILoadedImplicitSubtree, f as IImplicitCoordinates, I as IImplicitSubtreeLoader, j as IImplicitSubtreeLoadRequest } from '../types-ri64XfSE.js';
3
+ export { g as IImplicitMetadataDecodeRequest, h as IImplicitMetadataDecodeResult, b as IImplicitMetadataDecoder, i as IImplicitSubtreeGraft, k as IImplicitTileAddressContext, l as IImplicitTileOverride, m as IImplicitTileResolveContext, a as IImplicitTileResolver, n as IImplicitTilesetDecoratorOptions, o as IRuntimeImplicitContext, c as IRuntimeImplicitSubtree, p as IRuntimeImplicitTile, e as ITileAddress, r as ITileDataSource, s as ITileDataSourceTile, t as ImplicitSubtreeStatus, u as ImplicitTilesetDecorator } from '../types-ri64XfSE.js';
4
+ import { b as IRuntimeUriResolver } from '../resource-DH72MRMN.js';
5
+ import '@spacexr/tiles';
6
+
7
+ declare class SubtreeAvailabilityError extends Error {
8
+ constructor(message: string);
9
+ }
10
+ declare class LoadedSubtreeAvailability implements ISubtreeAvailability {
11
+ private readonly loaded;
12
+ private readonly tiling;
13
+ constructor(loaded: ILoadedImplicitSubtree, tiling: IImplicitTiling);
14
+ isTileAvailable(coordinates: IImplicitCoordinates): boolean;
15
+ isContentAvailable(contentIndex: number, coordinates: IImplicitCoordinates): boolean;
16
+ isChildSubtreeAvailable(coordinates: IImplicitCoordinates): boolean;
17
+ private read;
18
+ private bufferView;
19
+ }
20
+
21
+ declare function implicitBranchingFactor(tiling: IImplicitTiling): 4 | 8;
22
+ declare function implicitMortonIndex(coordinates: IImplicitCoordinates, scheme: IImplicitTiling["subdivisionScheme"]): number;
23
+ declare function implicitLevelOffset(level: number, branchingFactor: 4 | 8): number;
24
+ declare function implicitAvailabilityIndex(coordinates: IImplicitCoordinates, tiling: IImplicitTiling): number;
25
+ declare function expandImplicitTemplate(template: string, coordinates: IImplicitCoordinates): string;
26
+ declare function implicitChildCoordinates(parent: IImplicitCoordinates, childIndex: number, scheme: IImplicitTiling["subdivisionScheme"]): IImplicitCoordinates;
27
+ declare function implicitLocalCoordinates(global: IImplicitCoordinates, subtreeRoot: IImplicitCoordinates): IImplicitCoordinates;
28
+ declare function subdivideImplicitBoundingVolume(root: IBoundingVolume, scheme: IImplicitTiling["subdivisionScheme"], coordinates: IImplicitCoordinates): IBoundingVolume;
29
+ declare function computeImplicitTile(rootTile: ITile, tiling: IImplicitTiling, coordinates: IImplicitCoordinates): Pick<ITile, "boundingVolume" | "geometricError"> & {
30
+ contents: readonly IContent[];
31
+ };
32
+
33
+ /** Virtual dense availability for regular Web Map and DEM pyramids. */
34
+ declare class DenseImplicitSubtreeLoader implements IImplicitSubtreeLoader {
35
+ load(request: IImplicitSubtreeLoadRequest): Promise<ILoadedImplicitSubtree>;
36
+ }
37
+
38
+ interface IByteResourceLoadRequest {
39
+ uri: string;
40
+ signal: AbortSignal;
41
+ }
42
+ interface IByteResourceLoader {
43
+ load(request: IByteResourceLoadRequest): Promise<Uint8Array>;
44
+ }
45
+ type FetchFunction = (input: string, init?: RequestInit) => Promise<Response>;
46
+ declare class FetchByteResourceLoader implements IByteResourceLoader {
47
+ private readonly fetcher;
48
+ constructor(fetcher?: FetchFunction);
49
+ load(request: IByteResourceLoadRequest): Promise<Uint8Array>;
50
+ }
51
+ interface IStandardImplicitSubtreeLoaderOptions {
52
+ resources: IByteResourceLoader;
53
+ uri?: IRuntimeUriResolver;
54
+ }
55
+ /** Loads standard JSON and binary subtree files, including external buffers. */
56
+ declare class StandardImplicitSubtreeLoader implements IImplicitSubtreeLoader {
57
+ private readonly resources;
58
+ private readonly uri;
59
+ private readonly codec;
60
+ constructor(options: IStandardImplicitSubtreeLoaderOptions);
61
+ load(request: IImplicitSubtreeLoadRequest): Promise<ILoadedImplicitSubtree>;
62
+ }
63
+
64
+ export { DenseImplicitSubtreeLoader, FetchByteResourceLoader, type FetchFunction, type IByteResourceLoadRequest, type IByteResourceLoader, IImplicitCoordinates, IImplicitSubtreeLoadRequest, IImplicitSubtreeLoader, ILoadedImplicitSubtree, type IStandardImplicitSubtreeLoaderOptions, ISubtreeAvailability, LoadedSubtreeAvailability, StandardImplicitSubtreeLoader, SubtreeAvailabilityError, computeImplicitTile, expandImplicitTemplate, implicitAvailabilityIndex, implicitBranchingFactor, implicitChildCoordinates, implicitLevelOffset, implicitLocalCoordinates, implicitMortonIndex, subdivideImplicitBoundingVolume };
@@ -0,0 +1,4 @@
1
+ export { DenseImplicitSubtreeLoader, FetchByteResourceLoader, ImplicitTilesetDecorator, LoadedSubtreeAvailability, StandardImplicitSubtreeLoader, SubtreeAvailabilityError, computeImplicitTile, expandImplicitTemplate, implicitAvailabilityIndex, implicitBranchingFactor, implicitChildCoordinates, implicitLevelOffset, implicitLocalCoordinates, implicitMortonIndex, subdivideImplicitBoundingVolume } from '../chunk-AI6NWGCA.js';
2
+ import '../chunk-G7YVZYMR.js';
3
+ //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,350 @@
1
+ import { I as IMetadataSnapshot, g as IRuntimeFeatureMetadata, c as IMetadataDocumentContext } from './types-Dn5i8Uqg.js';
2
+ import { M as MetadataHandle, p as IRuntimeImplicitTile, y as TileRefinementMode, x as TileReadinessState, T as TileContentKind, z as TileSelectionState, w as TilePresentationState, v as TileMetadataState, f as IImplicitCoordinates } from './types-ri64XfSE.js';
3
+ import { ITile, IBoundingVolume, IContent, ITileset } from '@spacexr/3d-tiles-core';
4
+
5
+ interface IMetadataStore {
6
+ readonly size: number;
7
+ register(snapshot: IMetadataSnapshot): MetadataHandle;
8
+ get(handle: MetadataHandle): IMetadataSnapshot;
9
+ tryGet(handle: MetadataHandle): IMetadataSnapshot | undefined;
10
+ release(handle: MetadataHandle): void;
11
+ clear(): void;
12
+ }
13
+ /** Compact handle store shared by tiles, contents and renderer adapters. */
14
+ declare class RuntimeMetadataStore implements IMetadataStore {
15
+ private readonly snapshots;
16
+ get size(): number;
17
+ register(snapshot: IMetadataSnapshot): MetadataHandle;
18
+ get(handle: MetadataHandle): IMetadataSnapshot;
19
+ tryGet(handle: MetadataHandle): IMetadataSnapshot | undefined;
20
+ release(handle: MetadataHandle): void;
21
+ clear(): void;
22
+ }
23
+
24
+ interface IRuntimeResourceCost {
25
+ cpuBytes?: number;
26
+ gpuBytes?: number;
27
+ networkBytes?: number;
28
+ }
29
+ interface IRuntimeCacheOptions {
30
+ enabled?: boolean;
31
+ maxMaterializedTiles?: number;
32
+ maxContentEntries?: number;
33
+ /**
34
+ * Makes the budgets of entries and tiles adaptive: they grow to this many times what the current view uses, the
35
+ * selected tiles for `maxContentEntries` and the tiles visited by the traversal for `maxMaterializedTiles`, and come
36
+ * back as the view needs less. Budgets close to the view make a moving camera evict and load the same tiles again and
37
+ * again. Byte budgets stay fixed: they bound the memory. Defaults to 0, fixed budgets.
38
+ */
39
+ workingSetFactor?: number;
40
+ maxContentCpuBytes?: number;
41
+ maxContentGpuBytes?: number;
42
+ maxSubtreeEntries?: number;
43
+ maxSubtreeBytes?: number;
44
+ /**
45
+ * Time an inactive resource stays cached, in milliseconds: a renderable, a subtree payload or a materialized
46
+ * implicit branch unused for longer is evicted at the next frame. Defaults to 60 000.
47
+ */
48
+ unusedRetentionMilliseconds?: number;
49
+ /**
50
+ * Number of runtime frames an inactive resource stays cached, in place of `unusedRetentionMilliseconds`.
51
+ *
52
+ * @deprecated Runtime frames only run while the camera moves or loads settle, so a frame count is a short time
53
+ * while the camera turns and an endless one while it rests. Use `unusedRetentionMilliseconds`.
54
+ */
55
+ unusedFrameRetention?: number;
56
+ }
57
+ interface IResolvedRuntimeCacheOptions {
58
+ enabled: boolean;
59
+ maxMaterializedTiles: number;
60
+ maxContentEntries: number;
61
+ workingSetFactor: number;
62
+ maxContentCpuBytes: number;
63
+ maxContentGpuBytes: number;
64
+ maxSubtreeEntries: number;
65
+ maxSubtreeBytes: number;
66
+ unusedRetentionMilliseconds: number;
67
+ /** Deprecated frame count, applied instead of the time when an application sets it. */
68
+ unusedFrameRetention?: number;
69
+ }
70
+ type RuntimeCacheResourceKind = "content" | "subtree" | "implicit-branch";
71
+ type RuntimeCacheEvictionReason = "stale" | "entry-budget" | "cpu-budget" | "gpu-budget" | "byte-budget" | "node-budget";
72
+ interface IRuntimeCacheEviction {
73
+ kind: RuntimeCacheResourceKind;
74
+ reason: RuntimeCacheEvictionReason;
75
+ tileId: string;
76
+ resourceId?: string;
77
+ releasedCpuBytes: number;
78
+ releasedGpuBytes: number;
79
+ releasedEntries: number;
80
+ }
81
+ interface IRuntimeCacheCounters {
82
+ sweeps: number;
83
+ contentEvictions: number;
84
+ subtreeEvictions: number;
85
+ implicitBranchPrunes: number;
86
+ prunedNodes: number;
87
+ releasedCpuBytes: number;
88
+ releasedGpuBytes: number;
89
+ }
90
+ declare const DEFAULT_RUNTIME_CACHE_OPTIONS: IResolvedRuntimeCacheOptions;
91
+ declare function resolveRuntimeCacheOptions(options: IRuntimeCacheOptions | false | undefined): IResolvedRuntimeCacheOptions;
92
+
93
+ declare class Tile3DContent<TRenderHandle> {
94
+ readonly id: string;
95
+ readonly descriptor: IContent;
96
+ readonly uri: string;
97
+ status: TileReadinessState;
98
+ kind: TileContentKind;
99
+ attempts: number;
100
+ attached: boolean;
101
+ lastTouchedFrame: number;
102
+ readyFrame: number;
103
+ handle?: TRenderHandle;
104
+ featureMetadata?: readonly IRuntimeFeatureMetadata[];
105
+ cacheKey?: string;
106
+ cost?: IRuntimeResourceCost;
107
+ error?: unknown;
108
+ metadataHandle: MetadataHandle;
109
+ featureMetadataHandle: MetadataHandle;
110
+ /**
111
+ * Invalidated by `TileRuntime.invalidate`: the handle is still presented, and is replaced once its reload is
112
+ * ready.
113
+ */
114
+ stale: boolean;
115
+ constructor(id: string, descriptor: IContent, uri: string, frame: number);
116
+ get ready(): boolean;
117
+ }
118
+ interface ITile3DInitialization<TSpatial, TRenderHandle, TGlyphHandle> {
119
+ id: string;
120
+ source: ITile;
121
+ document: IRuntimeTilesetDocument;
122
+ parent?: Tile3D<TSpatial, TRenderHandle, TGlyphHandle>;
123
+ implicit?: IRuntimeImplicitTile;
124
+ depth: number;
125
+ refinementMode: TileRefinementMode;
126
+ spatial: TSpatial;
127
+ contents: Array<Tile3DContent<TRenderHandle>>;
128
+ frame: number;
129
+ }
130
+ /** Renderer-neutral runtime tile with compact numeric pipeline state. */
131
+ declare class Tile3D<TSpatial, TRenderHandle = unknown, TGlyphHandle = unknown> {
132
+ readonly id: string;
133
+ readonly source: ITile;
134
+ readonly document: IRuntimeTilesetDocument;
135
+ readonly parent: Tile3D<TSpatial, TRenderHandle, TGlyphHandle> | undefined;
136
+ readonly implicit: IRuntimeImplicitTile | undefined;
137
+ children: Array<Tile3D<TSpatial, TRenderHandle, TGlyphHandle>>;
138
+ readonly depth: number;
139
+ readonly refinementMode: TileRefinementMode;
140
+ /** Derived spatial state. Replaced when loaded content reports a tighter tile bounding volume. */
141
+ spatial: TSpatial;
142
+ /** True once the tile own content reported its measured bounding volume; parent refreshes no longer apply. */
143
+ contentBoundsRefined: boolean;
144
+ /** The volume measured on the content, when it reported one. */
145
+ contentBounds: (() => IBoundingVolume) | undefined;
146
+ /** Heights measured on the content, kept with its bounding volume. */
147
+ contentHeights: (() => readonly [number, number]) | undefined;
148
+ readonly contents: Array<Tile3DContent<TRenderHandle>>;
149
+ /** In the view of the camera. A visible tile is always active. */
150
+ visible: boolean;
151
+ /** Kept by the selection: visible, in the periphery of the view, or a neighbour of a visible tile. */
152
+ active: boolean;
153
+ screenSpaceError: number;
154
+ priority: number;
155
+ activationId: number;
156
+ glyphHandles: Array<TGlyphHandle>;
157
+ metadataSnapshots: readonly IMetadataSnapshot[];
158
+ metadataHandle: MetadataHandle;
159
+ lastTouchedFrame: number;
160
+ private stateBits;
161
+ constructor(initialization: ITile3DInitialization<TSpatial, TRenderHandle, TGlyphHandle>);
162
+ get selectionState(): TileSelectionState;
163
+ set selectionState(state: TileSelectionState);
164
+ get readinessState(): TileReadinessState;
165
+ set readinessState(state: TileReadinessState);
166
+ get presentationState(): TilePresentationState;
167
+ set presentationState(state: TilePresentationState);
168
+ get metadataState(): TileMetadataState;
169
+ set metadataState(state: TileMetadataState);
170
+ /** Compatibility view for the currently presented cut. */
171
+ get selected(): boolean;
172
+ set selected(selected: boolean);
173
+ get readyToRender(): boolean;
174
+ }
175
+
176
+ type RuntimeContentStatus = TileReadinessState;
177
+ type RuntimeContentKind = TileContentKind;
178
+ interface IRuntimeTilesetDocument {
179
+ id: string;
180
+ uri: string;
181
+ baseUri: string;
182
+ tileset: ITileset;
183
+ metadata: IMetadataDocumentContext;
184
+ }
185
+ interface IRuntimeContent<TContentHandle> {
186
+ id: string;
187
+ descriptor: IContent;
188
+ uri: string;
189
+ status: RuntimeContentStatus;
190
+ kind: RuntimeContentKind;
191
+ attempts: number;
192
+ handle?: TContentHandle;
193
+ featureMetadata?: readonly IRuntimeFeatureMetadata[];
194
+ cacheKey?: string;
195
+ cost?: IRuntimeResourceCost;
196
+ error?: unknown;
197
+ attached: boolean;
198
+ lastTouchedFrame: number;
199
+ readyFrame: number;
200
+ metadataHandle: MetadataHandle;
201
+ featureMetadataHandle: MetadataHandle;
202
+ /** Invalidated: the handle stays presented until its reload replaces it. */
203
+ stale: boolean;
204
+ readonly ready: boolean;
205
+ }
206
+ type IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle> = Tile3D<TSpatial, TContentHandle, TGlyphHandle>;
207
+ interface ITileContext<TSpatial> {
208
+ runtimeId: string;
209
+ tileId: string;
210
+ depth: number;
211
+ tile: ITile;
212
+ document: IRuntimeTilesetDocument;
213
+ spatial: TSpatial;
214
+ implicitCoordinates?: IImplicitCoordinates;
215
+ }
216
+ /** Tiles whose loaded contents `TileRuntime.invalidate` marks as stale. */
217
+ type RuntimeTilePredicate<TSpatial, TContentHandle, TGlyphHandle> = (tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>) => boolean;
218
+ /** A selected tile displayed next to a tile coarser than `maxLevelDifference` allows, despite the quadtree balance. */
219
+ interface IRuntimeQuadtreeImbalance<TSpatial, TContentHandle, TGlyphHandle> {
220
+ /** The finer tile. */
221
+ tile: IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>;
222
+ /** Level of detail of its coarsest edge neighbour, in the quadtree pyramid. */
223
+ coarseLod: number;
224
+ }
225
+ interface IRuntimeFrameResult<TSpatial, TContentHandle, TGlyphHandle> {
226
+ frame: number;
227
+ selected: readonly IRuntimeTile<TSpatial, TContentHandle, TGlyphHandle>[];
228
+ requested: readonly IRuntimeContent<TContentHandle>[];
229
+ pendingLoads: number;
230
+ /**
231
+ * Edges the quadtree balance could not keep within one level this frame, because neither the coarse neighbour's
232
+ * children nor an ancestor of the fine tile were ready. Empty without `quadtreeBalance`.
233
+ */
234
+ unbalanced: readonly IRuntimeQuadtreeImbalance<TSpatial, TContentHandle, TGlyphHandle>[];
235
+ }
236
+
237
+ interface IContentLoadContext<TSpatial> extends ITileContext<TSpatial> {
238
+ contentId: string;
239
+ content: IContent;
240
+ uri: string;
241
+ }
242
+ type ContentLoadResult<TContentHandle> = {
243
+ kind: "renderable";
244
+ handle: TContentHandle;
245
+ mediaType?: string;
246
+ featureMetadata?: readonly IRuntimeFeatureMetadata[];
247
+ /** Stable adapter cache identity when several tiles share a renderable resource. */
248
+ cacheKey?: string;
249
+ /** Adapter-reported footprint used by the runtime cache budgets and statistics. */
250
+ cost?: IRuntimeResourceCost;
251
+ /**
252
+ * Bounding volume of the whole tile measured from the loaded content, for example the
253
+ * height range of a DEM tile. The runtime re-derives the tile spatial state from it, so
254
+ * culling and refinement use the measured extent instead of the declared one. The
255
+ * serialized tile is not modified. A tile with several contents must report a volume
256
+ * enclosing all of them.
257
+ */
258
+ /** A volume measured on the content. A function is evaluated again when the vertical scale changes. */
259
+ tileBoundingVolume?: IBoundingVolume | (() => IBoundingVolume);
260
+ /**
261
+ * Lowest and highest heights measured on the content, such as a DEM tile, over the reference surface, in metres.
262
+ * Evaluated again when the vertical scale changes, whose factor it includes.
263
+ */
264
+ tileHeightRange?: () => readonly [number, number];
265
+ /**
266
+ * The content stands in for the content of the tile, built from data already in memory, such as the deepest
267
+ * DEM tile loaded above it. The runtime presents it and refines through it like any ready content, so that a
268
+ * descent does not wait for each level. It reloads it, through the activation adapter with `refresh` set,
269
+ * only once the tile is a leaf of the cut, and keeps it presented until the reload is ready. A tile that
270
+ * refines again stops its reload.
271
+ */
272
+ provisional?: boolean;
273
+ } | {
274
+ kind: "external-tileset";
275
+ tileset: ITileset;
276
+ documentUri?: string;
277
+ baseUri?: string;
278
+ } | {
279
+ kind: "empty";
280
+ };
281
+ interface IContentPresentationContext<TSpatial, TContentHandle> extends IContentLoadContext<TSpatial> {
282
+ handle: TContentHandle;
283
+ metadata: IMetadataSnapshot;
284
+ }
285
+ /**
286
+ * Renderer adaptation port. A Babylon adapter may return AssetContainer, a
287
+ * Three.js adapter may return Object3D, and another adapter may publish a GPU
288
+ * resource handle. Content probing and glTF decoding stay outside the runtime.
289
+ * Implicit coordinates and spatial state are present in the load context, so
290
+ * terrain adapters may instance a shared grid and bind a DEM texture or shader.
291
+ */
292
+ interface ITileContentAdapter<TSpatial, TContentHandle> {
293
+ load(context: IContentLoadContext<TSpatial>, signal: AbortSignal): Promise<ContentLoadResult<TContentHandle>>;
294
+ attach(context: IContentPresentationContext<TSpatial, TContentHandle>): void | Promise<void>;
295
+ detach(context: IContentPresentationContext<TSpatial, TContentHandle>): void | Promise<void>;
296
+ dispose?(context: IContentPresentationContext<TSpatial, TContentHandle>): void | Promise<void>;
297
+ }
298
+
299
+ interface ITileReadinessPort<TRenderHandle> {
300
+ readonly tileId: string;
301
+ readonly activationId: number;
302
+ readonly signal: AbortSignal;
303
+ ready(contentId: string, result: ContentLoadResult<TRenderHandle>): Promise<boolean>;
304
+ failed(contentId: string, error: unknown): Promise<void>;
305
+ cancelled(contentId: string): Promise<void>;
306
+ }
307
+ interface ITileActivationContext<TSpatial, TRenderHandle, TGlyphHandle> {
308
+ runtimeId: string;
309
+ tile: Tile3D<TSpatial, TRenderHandle, TGlyphHandle>;
310
+ pendingContents: readonly IRuntimeContent<TRenderHandle>[];
311
+ priority: number;
312
+ activationId: number;
313
+ signal: AbortSignal;
314
+ readiness: ITileReadinessPort<TRenderHandle>;
315
+ /**
316
+ * True when the contents are ready, possibly presented, and were invalidated by `TileRuntime.invalidate`: each
317
+ * keeps its current `handle` while it reloads. Report a new handle, which replaces the old one between two frames,
318
+ * or the same handle once the adapter refreshed it in place. An adapter that does not support refreshing reports
319
+ * the same handle at once.
320
+ */
321
+ refresh?: boolean;
322
+ }
323
+ interface ITileDeactivationContext<TSpatial, TRenderHandle, TGlyphHandle> {
324
+ runtimeId: string;
325
+ tile: Tile3D<TSpatial, TRenderHandle, TGlyphHandle>;
326
+ activationId: number;
327
+ }
328
+ interface ITileActivationAdapter<TSpatial, TRenderHandle, TGlyphHandle = unknown> {
329
+ activate(context: ITileActivationContext<TSpatial, TRenderHandle, TGlyphHandle>): void | Promise<void>;
330
+ deactivate(context: ITileDeactivationContext<TSpatial, TRenderHandle, TGlyphHandle>): void | Promise<void>;
331
+ }
332
+ interface ITilePresentationResource<TRenderHandle> {
333
+ content: IRuntimeContent<TRenderHandle>;
334
+ handle: TRenderHandle;
335
+ metadataHandle: MetadataHandle;
336
+ }
337
+ interface ITilePresentationContext<TSpatial, TRenderHandle, TGlyphHandle> {
338
+ runtimeId: string;
339
+ tile: Tile3D<TSpatial, TRenderHandle, TGlyphHandle>;
340
+ resources: readonly ITilePresentationResource<TRenderHandle>[];
341
+ tileMetadataHandle: MetadataHandle;
342
+ metadataStore: IMetadataStore;
343
+ }
344
+ interface ITilePresentationAdapter<TSpatial, TRenderHandle, TGlyphHandle = unknown> {
345
+ present(context: ITilePresentationContext<TSpatial, TRenderHandle, TGlyphHandle>): void | Promise<void>;
346
+ hide(context: ITilePresentationContext<TSpatial, TRenderHandle, TGlyphHandle>): void | Promise<void>;
347
+ release?(context: ITilePresentationContext<TSpatial, TRenderHandle, TGlyphHandle>): void | Promise<void>;
348
+ }
349
+
350
+ export { type RuntimeContentStatus as A, Tile3DContent as B, type ContentLoadResult as C, DEFAULT_RUNTIME_CACHE_OPTIONS as D, resolveRuntimeCacheOptions as E, type ITileContext as I, RuntimeMetadataStore as R, Tile3D as T, type ITileContentAdapter as a, type ITileActivationAdapter as b, type ITilePresentationAdapter as c, type IContentLoadContext as d, type IContentPresentationContext as e, type IRuntimeTilesetDocument as f, type IRuntimeFrameResult as g, type IRuntimeTile as h, type IRuntimeContent as i, type IRuntimeCacheEviction as j, type IRuntimeQuadtreeImbalance as k, type IRuntimeCacheCounters as l, type IResolvedRuntimeCacheOptions as m, type IRuntimeCacheOptions as n, type RuntimeTilePredicate as o, type IMetadataStore as p, type IRuntimeResourceCost as q, type ITile3DInitialization as r, type ITileActivationContext as s, type ITileDeactivationContext as t, type ITilePresentationContext as u, type ITilePresentationResource as v, type ITileReadinessPort as w, type RuntimeCacheEvictionReason as x, type RuntimeCacheResourceKind as y, type RuntimeContentKind as z };