@tangram.gl/tangram-renderer 0.0.0-stage → 0.0.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.
- package/README.md +59 -2
- package/dist/core.js +36923 -0
- package/dist/core.js.map +6 -0
- package/dist/index.js +32 -0
- package/dist/loaders-gl-worker.js +82 -0
- package/dist/loaders-gl-worker.js.map +6 -0
- package/dist/map-logic.js +2 -0
- package/dist/map-logic.js.map +6 -0
- package/dist/projected-basemaps-worker.js +3 -0
- package/dist/projected-basemaps-worker.js.map +6 -0
- package/dist/shader-modules.js +141 -0
- package/dist/shader-modules.js.map +6 -0
- package/dist/style-schema.js +126 -0
- package/dist/style-schema.js.map +6 -0
- package/dist/tangram-style.schema.json +882 -0
- package/dist/tangram.debug.mjs +37139 -0
- package/dist/tangram.debug.mjs.map +6 -0
- package/dist/tangram.min.mjs +4950 -0
- package/dist/types/builders/earcut.d.ts +15 -0
- package/dist/types/core.d.ts +29 -0
- package/dist/types/gl/constants.d.ts +2 -0
- package/dist/types/gl/globe_mesh.d.ts +48 -0
- package/dist/types/gl/glsl.d.ts +17 -0
- package/dist/types/gl/vertex-constants.d.ts +4 -0
- package/dist/types/gl/vertex-types.d.ts +34 -0
- package/dist/types/gl/vertex_data.d.ts +32 -0
- package/dist/types/gl/vertex_elements.d.ts +8 -0
- package/dist/types/gl/vertex_layout.d.ts +32 -0
- package/dist/types/glsl.d.ts +14 -0
- package/dist/types/gpu/luma_device_renderer.d.ts +66 -0
- package/dist/types/gpu/resource_lifecycle.d.ts +4 -0
- package/dist/types/gpu/tangram_gpu_backend.d.ts +151 -0
- package/dist/types/index.d.ts +155 -0
- package/dist/types/lights/light-definitions.d.ts +121 -0
- package/dist/types/map-logic/draped-terrain-bounds.d.ts +41 -0
- package/dist/types/map-logic/globe-terrain-preparation.d.ts +85 -0
- package/dist/types/map-logic/globe-terrain.d.ts +54 -0
- package/dist/types/map-logic/index.d.ts +33 -0
- package/dist/types/map-logic/label-identity.d.ts +22 -0
- package/dist/types/map-logic/label-placement.d.ts +32 -0
- package/dist/types/map-logic/screen-bounds.d.ts +15 -0
- package/dist/types/map-logic/terrain-data.d.ts +55 -0
- package/dist/types/map-logic/terrain-error.d.ts +51 -0
- package/dist/types/map-logic/terrain-ground-topology.d.ts +26 -0
- package/dist/types/map-logic/terrain-height-field.d.ts +59 -0
- package/dist/types/map-logic/terrain-navigation.d.ts +27 -0
- package/dist/types/map-logic/terrain-neighborhood.d.ts +5 -0
- package/dist/types/map-logic/terrain-query.d.ts +33 -0
- package/dist/types/map-logic/terrain-resource-budget.d.ts +51 -0
- package/dist/types/map-logic/terrain-transition-topology.d.ts +23 -0
- package/dist/types/map-logic/tile-build-queue.d.ts +51 -0
- package/dist/types/map-logic/tile-cache-policy.d.ts +46 -0
- package/dist/types/map-logic/tile-residency.d.ts +17 -0
- package/dist/types/map-logic/triangle-query-index.d.ts +87 -0
- package/dist/types/procedures/js-yaml.d.ts +15 -0
- package/dist/types/procedures/mesh-projector.d.ts +107 -0
- package/dist/types/procedures/mvt-dependencies.d.ts +20 -0
- package/dist/types/procedures/projected-coordinate-transform.d.ts +27 -0
- package/dist/types/procedures/projection-batch-executor.d.ts +53 -0
- package/dist/types/procedures/scene-yaml-legacy.d.ts +6 -0
- package/dist/types/procedures/terrain-draping.d.ts +165 -0
- package/dist/types/procedures/terrain-globe.d.ts +6 -0
- package/dist/types/procedures/terrain-styled-topology.d.ts +34 -0
- package/dist/types/procedures/web-mercator-legacy.d.ts +4 -0
- package/dist/types/procedures/web-mercator-math.d.ts +4 -0
- package/dist/types/scene/globals.d.ts +11 -0
- package/dist/types/scene/ground_footprint.d.ts +16 -0
- package/dist/types/scene/host_frame.d.ts +54 -0
- package/dist/types/scene/projection_math.d.ts +52 -0
- package/dist/types/scene/scene-resource-types.d.ts +177 -0
- package/dist/types/scene/scene_bundle.d.ts +69 -0
- package/dist/types/scene/visibility_adapter.d.ts +106 -0
- package/dist/types/selection/draped-terrain-surface.d.ts +78 -0
- package/dist/types/selection/terrain_surface.d.ts +149 -0
- package/dist/types/shader-modules/globe-horizon.d.ts +15 -0
- package/dist/types/shader-modules/height-decode.d.ts +13 -0
- package/dist/types/shader-modules/hillshade.d.ts +13 -0
- package/dist/types/shader-modules/index.d.ts +6 -0
- package/dist/types/shader-modules/planar.d.ts +12 -0
- package/dist/types/shader-modules/sphere-map.d.ts +13 -0
- package/dist/types/shader-modules/triplanar.d.ts +15 -0
- package/dist/types/sources/decoded_tile_store.d.ts +95 -0
- package/dist/types/sources/tile_source_metadata.d.ts +32 -0
- package/dist/types/styles/text/fontfaceobserver.d.ts +10 -0
- package/dist/types/tile/tile_id.d.ts +37 -0
- package/dist/types/tile/tile_traversal_adapter.d.ts +63 -0
- package/dist/types/types.d.ts +293 -0
- package/dist/types/utils/geo.d.ts +57 -0
- package/dist/types/utils/hash.d.ts +1 -0
- package/dist/types/utils/log.d.ts +27 -0
- package/dist/types/utils/props.d.ts +6 -0
- package/dist/types/utils/subscribe.d.ts +10 -0
- package/dist/types/utils/thread.d.ts +6 -0
- package/dist/types/utils/urls.d.ts +26 -0
- package/dist/types/utils/utils.d.ts +26 -0
- package/dist/types/utils/version.d.ts +2 -0
- package/dist/types/utils/worker-types.d.ts +68 -0
- package/dist/types/utils/worker_broker.d.ts +3 -0
- package/package.json +103 -3
- package/src/builders/common.ts +41 -0
- package/src/builders/earcut.d.ts +15 -0
- package/src/builders/geometry-types.ts +60 -0
- package/src/builders/points.ts +115 -0
- package/src/builders/polygons.ts +225 -0
- package/src/builders/polylines.ts +682 -0
- package/src/builders/wireframe.ts +31 -0
- package/src/core.d.ts +29 -0
- package/src/core.ts +33 -0
- package/src/experimental/loaders-gl-worker.ts +19 -0
- package/src/experimental/projected-basemaps-worker.ts +13 -0
- package/src/experimental/projected-mesh-cache.ts +137 -0
- package/src/experimental/projected-mesh-domain.ts +110 -0
- package/src/experimental/projected-mesh-refinement.ts +193 -0
- package/src/experimental/projected-mesh.ts +399 -0
- package/src/experimental/projected-normal.ts +26 -0
- package/src/experimental/projected-symbol-mesh.ts +74 -0
- package/src/gl/constants.ts +18 -0
- package/src/gl/context.ts +103 -0
- package/src/gl/extensions.ts +30 -0
- package/src/gl/globe_mesh.ts +285 -0
- package/src/gl/glsl.ts +257 -0
- package/src/gl/mesh-types.ts +56 -0
- package/src/gl/render_state.ts +111 -0
- package/src/gl/shader_program.ts +1310 -0
- package/src/gl/texture.ts +814 -0
- package/src/gl/uniform_buffer.ts +340 -0
- package/src/gl/vao.ts +154 -0
- package/src/gl/vbo_mesh.ts +349 -0
- package/src/gl/vertex-constants.ts +19 -0
- package/src/gl/vertex-types.ts +35 -0
- package/src/gl/vertex_data.ts +126 -0
- package/src/gl/vertex_elements.ts +54 -0
- package/src/gl/vertex_layout.ts +241 -0
- package/src/glsl.d.ts +14 -0
- package/src/gpu/luma_device_renderer.ts +579 -0
- package/src/gpu/pixel_readback.ts +51 -0
- package/src/gpu/resource_lifecycle.ts +32 -0
- package/src/gpu/tangram_gpu_backend.ts +195 -0
- package/src/index.d.ts +155 -0
- package/src/index.ts +105 -0
- package/src/labels/collision-types.ts +94 -0
- package/src/labels/collision.ts +273 -0
- package/src/labels/collision_grid.ts +61 -0
- package/src/labels/intersect.ts +30 -0
- package/src/labels/label-types.ts +91 -0
- package/src/labels/label.ts +207 -0
- package/src/labels/label_line.ts +801 -0
- package/src/labels/label_point.ts +131 -0
- package/src/labels/main-pass-types.ts +73 -0
- package/src/labels/main_pass.ts +221 -0
- package/src/labels/point_anchor.ts +100 -0
- package/src/labels/point_placement.ts +150 -0
- package/src/labels/projected-pass.ts +259 -0
- package/src/labels/repeat_group.ts +72 -0
- package/src/lights/ambient_light.glsl +18 -0
- package/src/lights/directional_light.glsl +39 -0
- package/src/lights/geographic-lights.ts +21 -0
- package/src/lights/light-definitions.ts +285 -0
- package/src/lights/light.ts +590 -0
- package/src/lights/lighting-uniforms.ts +80 -0
- package/src/lights/lighting-wgsl.ts +116 -0
- package/src/lights/material.glsl +237 -0
- package/src/lights/material.ts +145 -0
- package/src/lights/native-falloff.ts +37 -0
- package/src/lights/point_light.glsl +96 -0
- package/src/lights/spot_light.glsl +111 -0
- package/src/map-logic/draped-terrain-bounds.ts +71 -0
- package/src/map-logic/globe-terrain-preparation.ts +217 -0
- package/src/map-logic/globe-terrain.ts +296 -0
- package/src/map-logic/index.ts +37 -0
- package/src/map-logic/label-identity.ts +36 -0
- package/src/map-logic/label-placement.ts +117 -0
- package/src/map-logic/screen-bounds.ts +34 -0
- package/src/map-logic/terrain-data.ts +107 -0
- package/src/map-logic/terrain-error.ts +134 -0
- package/src/map-logic/terrain-ground-topology.ts +164 -0
- package/src/map-logic/terrain-height-field.ts +254 -0
- package/src/map-logic/terrain-navigation.ts +50 -0
- package/src/map-logic/terrain-neighborhood.ts +43 -0
- package/src/map-logic/terrain-query.ts +51 -0
- package/src/map-logic/terrain-resource-budget.ts +124 -0
- package/src/map-logic/terrain-transition-topology.ts +164 -0
- package/src/map-logic/tile-build-queue.ts +110 -0
- package/src/map-logic/tile-cache-policy.ts +89 -0
- package/src/map-logic/tile-residency.ts +50 -0
- package/src/map-logic/triangle-query-index.ts +265 -0
- package/src/procedures/js-yaml.d.ts +15 -0
- package/src/procedures/mesh-projector.ts +191 -0
- package/src/procedures/mlt-loaders.ts +55 -0
- package/src/procedures/mvt-dependencies.d.ts +20 -0
- package/src/procedures/mvt-legacy.ts +150 -0
- package/src/procedures/mvt-loaders.ts +53 -0
- package/src/procedures/mvt-parser.ts +48 -0
- package/src/procedures/mvt-properties.ts +36 -0
- package/src/procedures/mvt-tile-provider.ts +72 -0
- package/src/procedures/pmtiles-loader.ts +75 -0
- package/src/procedures/projected-coordinate-transform.ts +79 -0
- package/src/procedures/projection-batch-executor.ts +140 -0
- package/src/procedures/scene-yaml-legacy.ts +16 -0
- package/src/procedures/scene-yaml-loaders.ts +10 -0
- package/src/procedures/terrain-draping.ts +713 -0
- package/src/procedures/terrain-globe.ts +32 -0
- package/src/procedures/terrain-styled-topology.ts +184 -0
- package/src/procedures/web-mercator-legacy.ts +24 -0
- package/src/procedures/web-mercator-math.ts +50 -0
- package/src/scene/camera.ts +298 -0
- package/src/scene/camera_base.ts +116 -0
- package/src/scene/classic_scene.ts +20 -0
- package/src/scene/external_camera.ts +101 -0
- package/src/scene/globals.ts +120 -0
- package/src/scene/ground_footprint.ts +139 -0
- package/src/scene/host_frame.ts +326 -0
- package/src/scene/projected_tile_lod.ts +125 -0
- package/src/scene/projection_math.ts +142 -0
- package/src/scene/projection_shaders.ts +183 -0
- package/src/scene/renderer.ts +516 -0
- package/src/scene/scene-resource-types.ts +174 -0
- package/src/scene/scene.ts +2378 -0
- package/src/scene/scene_bundle.ts +304 -0
- package/src/scene/scene_debug.ts +129 -0
- package/src/scene/scene_loader.ts +402 -0
- package/src/scene/scene_worker.ts +528 -0
- package/src/scene/view.ts +683 -0
- package/src/scene/visibility_adapter.ts +319 -0
- package/src/scene/worker_url.ts +15 -0
- package/src/selection/draped-terrain-surface.ts +377 -0
- package/src/selection/selection-types.ts +79 -0
- package/src/selection/selection.ts +542 -0
- package/src/selection/selection_fragment.glsl +18 -0
- package/src/selection/selection_globals.glsl +9 -0
- package/src/selection/selection_pixels.ts +59 -0
- package/src/selection/selection_vertex.glsl +15 -0
- package/src/selection/terrain_surface.ts +298 -0
- package/src/shader-modules/globe-horizon.ts +52 -0
- package/src/shader-modules/height-decode.ts +41 -0
- package/src/shader-modules/hillshade.ts +70 -0
- package/src/shader-modules/index.ts +10 -0
- package/src/shader-modules/planar.ts +24 -0
- package/src/shader-modules/sphere-map.ts +38 -0
- package/src/shader-modules/triplanar.ts +45 -0
- package/src/sources/aligned_tile_source.ts +122 -0
- package/src/sources/data_source.ts +655 -0
- package/src/sources/decoded_tile_store.ts +245 -0
- package/src/sources/geojson.ts +300 -0
- package/src/sources/mvt.ts +247 -0
- package/src/sources/raster.ts +341 -0
- package/src/sources/shared_tile_source_adapter.ts +117 -0
- package/src/sources/sources.ts +10 -0
- package/src/sources/tile_source_adapter.ts +84 -0
- package/src/sources/tile_source_metadata.ts +65 -0
- package/src/sources/tile_source_state.ts +112 -0
- package/src/sources/topojson.ts +90 -0
- package/src/styles/feature_annotations.ts +16 -0
- package/src/styles/filter.ts +190 -0
- package/src/styles/geometry-style-types.ts +209 -0
- package/src/styles/globe_visibility_wgsl.ts +22 -0
- package/src/styles/layer-types.ts +45 -0
- package/src/styles/layer.ts +586 -0
- package/src/styles/lines/dasharray.ts +49 -0
- package/src/styles/lines/lines.ts +707 -0
- package/src/styles/lines/lines_wgsl.ts +224 -0
- package/src/styles/points/point-runtime-types.ts +125 -0
- package/src/styles/points/points.ts +1079 -0
- package/src/styles/points/points_fragment.glsl +126 -0
- package/src/styles/points/points_vertex.glsl +230 -0
- package/src/styles/points/points_wgsl.ts +189 -0
- package/src/styles/polygons/polygons.ts +268 -0
- package/src/styles/polygons/polygons_fragment.glsl +173 -0
- package/src/styles/polygons/polygons_vertex.glsl +213 -0
- package/src/styles/polygons/polygons_wgsl.ts +127 -0
- package/src/styles/property-types.ts +125 -0
- package/src/styles/raster/raster.ts +33 -0
- package/src/styles/raster/raster_globals.glsl +46 -0
- package/src/styles/style-mixing-types.ts +101 -0
- package/src/styles/style-runtime-types.ts +220 -0
- package/src/styles/style-schema.ts +133 -0
- package/src/styles/style.ts +1033 -0
- package/src/styles/style_globals.glsl +69 -0
- package/src/styles/style_manager.ts +464 -0
- package/src/styles/style_parser.ts +620 -0
- package/src/styles/text/font_manager.ts +180 -0
- package/src/styles/text/fontfaceobserver.d.ts +10 -0
- package/src/styles/text/text-types.ts +220 -0
- package/src/styles/text/text.ts +378 -0
- package/src/styles/text/text_canvas.ts +773 -0
- package/src/styles/text/text_labels.ts +436 -0
- package/src/styles/text/text_segments.ts +142 -0
- package/src/styles/text/text_settings.ts +228 -0
- package/src/styles/text/text_wgsl.ts +159 -0
- package/src/styles/text/text_wrap.ts +194 -0
- package/src/tile/globe_tile_preload.ts +40 -0
- package/src/tile/tangram_tileset_2d.ts +108 -0
- package/src/tile/tile-build-types.ts +155 -0
- package/src/tile/tile.ts +807 -0
- package/src/tile/tile_id.ts +172 -0
- package/src/tile/tile_manager.ts +889 -0
- package/src/tile/tile_pyramid.ts +119 -0
- package/src/tile/tile_resource_cache.ts +91 -0
- package/src/tile/tile_traversal_adapter.ts +132 -0
- package/src/types.ts +332 -0
- package/src/utils/debounce.ts +17 -0
- package/src/utils/debug_settings.ts +43 -0
- package/src/utils/errors.ts +12 -0
- package/src/utils/functions.ts +95 -0
- package/src/utils/geo.ts +364 -0
- package/src/utils/hash.ts +14 -0
- package/src/utils/log.ts +108 -0
- package/src/utils/media_capture.ts +193 -0
- package/src/utils/merge.ts +44 -0
- package/src/utils/obb.ts +134 -0
- package/src/utils/props.ts +43 -0
- package/src/utils/slice.ts +14 -0
- package/src/utils/subscribe.ts +58 -0
- package/src/utils/task.ts +154 -0
- package/src/utils/thread.ts +26 -0
- package/src/utils/urls.ts +223 -0
- package/src/utils/utils.ts +310 -0
- package/src/utils/vector.ts +197 -0
- package/src/utils/version.ts +8 -0
- package/src/utils/worker-types.ts +79 -0
- package/src/utils/worker_broker.ts +523 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type Bounds, type Meters, type Tile } from "../utils/geo.js";
|
|
2
|
+
import { type TileCoordinate } from "../tile/tile_id.js";
|
|
3
|
+
import type { HostCamera } from "../types.js";
|
|
4
|
+
/** State consumed by a renderer-owned visibility and LOD adapter. */
|
|
5
|
+
export interface VisibilityViewState {
|
|
6
|
+
/** Optional host matrices for policies selecting a precise per-eye footprint. */
|
|
7
|
+
readonly camera?: HostCamera;
|
|
8
|
+
readonly center: {
|
|
9
|
+
readonly lng: number;
|
|
10
|
+
readonly lat: number;
|
|
11
|
+
};
|
|
12
|
+
/** Scene/style zoom used to calculate meter scale, independent of data detail. */
|
|
13
|
+
readonly zoom: number;
|
|
14
|
+
/** Requested data-tile level, before source normalization. */
|
|
15
|
+
readonly tile_zoom: number;
|
|
16
|
+
readonly size: {
|
|
17
|
+
readonly css: {
|
|
18
|
+
readonly width: number;
|
|
19
|
+
readonly height: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly bounds: Bounds | null;
|
|
23
|
+
readonly buffer: number;
|
|
24
|
+
readonly wrap: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** Bounds and LOD state calculated for a Tangram view. */
|
|
27
|
+
export interface CalculatedViewBounds {
|
|
28
|
+
/** Data-tile zoom selected for the current view. */
|
|
29
|
+
tileZoom: number;
|
|
30
|
+
metersPerPixel: number;
|
|
31
|
+
sizeMeters: Meters;
|
|
32
|
+
centerMeters: Meters;
|
|
33
|
+
centerTile: Tile;
|
|
34
|
+
bounds: Bounds;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Renderer-facing visibility and level-of-detail policy.
|
|
38
|
+
*
|
|
39
|
+
* Implementations consume Tangram geographic view state and return Tangram
|
|
40
|
+
* tile coordinates. They do not depend on deck.gl or a specific host camera.
|
|
41
|
+
*/
|
|
42
|
+
export interface VisibilityLODAdapter {
|
|
43
|
+
/** Calculates the current Web Mercator bounds and derived tile LOD state. */
|
|
44
|
+
calculateBounds(view: VisibilityViewState): CalculatedViewBounds;
|
|
45
|
+
/** Returns visible tiles for the current Web Mercator view. */
|
|
46
|
+
findVisibleTileCoordinates(view: VisibilityViewState): TileCoordinate[];
|
|
47
|
+
/** Conservative candidate visits before allocation; required only for automatic host LOD. */
|
|
48
|
+
countTileCoordinates?(view: VisibilityViewState): number;
|
|
49
|
+
}
|
|
50
|
+
/** Geographic state required to select tiles for a globe viewport. */
|
|
51
|
+
export interface GlobeVisibilityViewState {
|
|
52
|
+
/** Tile zoom selected for the current host view. */
|
|
53
|
+
readonly tile_zoom: number;
|
|
54
|
+
/** Number of neighboring tiles included around the geographic bounds. */
|
|
55
|
+
readonly buffer: number;
|
|
56
|
+
/** Host-visible geographic bounds in west, south, east, north order. */
|
|
57
|
+
readonly visibleBounds: readonly [number, number, number, number];
|
|
58
|
+
/** Camera position in the globe's common-space coordinates, when available. */
|
|
59
|
+
readonly cameraPosition?: readonly [number, number, number];
|
|
60
|
+
/** Maximum rendered elevation in geographic meters; omitted means unknown, not zero. */
|
|
61
|
+
readonly maxElevation?: number;
|
|
62
|
+
}
|
|
63
|
+
/** Projection-specific tile visibility policy for globe views. */
|
|
64
|
+
export interface GlobeVisibilityLODAdapter {
|
|
65
|
+
/** Returns visible tiles for the geographic bounds of a globe viewport. */
|
|
66
|
+
findVisibleTileCoordinates(view: GlobeVisibilityViewState): TileCoordinate[];
|
|
67
|
+
/** Candidate visits before deduplication/horizon rejection; required only for automatic host LOD. */
|
|
68
|
+
countTileCoordinates?(view: GlobeVisibilityViewState): number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Default visibility policy preserving Tangram's rectangular Web Mercator
|
|
72
|
+
* viewport bounds and buffered tile-range behavior.
|
|
73
|
+
*/
|
|
74
|
+
export declare class WebMercatorVisibilityAdapter implements VisibilityLODAdapter {
|
|
75
|
+
/**
|
|
76
|
+
* Calculates meter-space viewport bounds and the center tile.
|
|
77
|
+
* @param view Tangram's current geographic view state.
|
|
78
|
+
* @returns Bounds, center, and LOD state used by View.
|
|
79
|
+
*/
|
|
80
|
+
calculateBounds(view: VisibilityViewState): CalculatedViewBounds;
|
|
81
|
+
/**
|
|
82
|
+
* Selects the buffered tile rectangle intersecting the current view.
|
|
83
|
+
* @param view Tangram's current geographic view state.
|
|
84
|
+
* @returns Visible tile coordinates at the current tile zoom.
|
|
85
|
+
*/
|
|
86
|
+
findVisibleTileCoordinates(view: VisibilityViewState): TileCoordinate[];
|
|
87
|
+
/** Counts the same buffered range as enumeration without creating tile objects. */
|
|
88
|
+
countTileCoordinates(view: VisibilityViewState): number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Selects Web Mercator tiles intersecting geographic bounds on a globe.
|
|
92
|
+
* Antimeridian-crossing bounds are split into two ranges and duplicate tiles
|
|
93
|
+
* are removed while preserving traversal order. Horizon rejection requires both
|
|
94
|
+
* a host camera and an explicit conservative elevation bound. Geographic bounds
|
|
95
|
+
* must already enclose elevated content; this policy does not infer a frustum footprint.
|
|
96
|
+
*/
|
|
97
|
+
export declare class WebMercatorGlobeVisibilityAdapter implements GlobeVisibilityLODAdapter {
|
|
98
|
+
/**
|
|
99
|
+
* Returns buffered tiles intersecting host bounds and the visible globe hemisphere.
|
|
100
|
+
* @param view Tile zoom, buffer, geographic bounds, and optional camera position.
|
|
101
|
+
* @returns Visible tile coordinates.
|
|
102
|
+
*/
|
|
103
|
+
findVisibleTileCoordinates(view: GlobeVisibilityViewState): TileCoordinate[];
|
|
104
|
+
/** Bounds raw traversal work, not just the smaller visible/deduplicated result. */
|
|
105
|
+
countTileCoordinates(view: GlobeVisibilityViewState): number;
|
|
106
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { TerrainSurfaceCollection, type TerrainSurface } from "./terrain_surface.js";
|
|
2
|
+
import { type DrapedTerrainBoundsSummary } from "../map-logic/draped-terrain-bounds.js";
|
|
3
|
+
/** Measured CPU costs for one immutable terrain display, excluding other retained snapshots. */
|
|
4
|
+
export interface DrapedTerrainQueryStatistics {
|
|
5
|
+
/** Unique retained physical input bytes. */
|
|
6
|
+
inputBytes: number;
|
|
7
|
+
/** Lazily projected geometry bytes. */
|
|
8
|
+
projectedBytes: number;
|
|
9
|
+
/** Completed acceleration hierarchy bytes. */
|
|
10
|
+
queryIndexBytes: number;
|
|
11
|
+
/** Aggregate permitted hierarchy bytes for this snapshot. */
|
|
12
|
+
reservedQueryIndexBytes: number;
|
|
13
|
+
/** Number of queried draw entries, including repeated clip leases. */
|
|
14
|
+
preparedMeshes: number;
|
|
15
|
+
/** Projected owners allocated by this snapshot. */
|
|
16
|
+
projectionBuilds: number;
|
|
17
|
+
/** Projection and cooperative hierarchy CPU time, excluding suspended time. */
|
|
18
|
+
preparationMs: number;
|
|
19
|
+
/** Ray-query CPU time. */
|
|
20
|
+
queryMs: number;
|
|
21
|
+
/** Owners whose acceleration failed; their exact linear queries remain available. */
|
|
22
|
+
preparationFailures: number;
|
|
23
|
+
/** Demanded entries using bounded-memory exact triangle projection rather than retained copies. */
|
|
24
|
+
streamingMeshes: number;
|
|
25
|
+
}
|
|
26
|
+
/** Worker-owned query channels extracted from the final ground draw topology. */
|
|
27
|
+
export interface DrapedTerrainQueryMesh {
|
|
28
|
+
/** Absolute Mercator XYZ before terrain displacement; includes authored ground offsets. */
|
|
29
|
+
positions: Float64Array;
|
|
30
|
+
/** Current and previous physical height per vertex, interleaved in that order. */
|
|
31
|
+
heights: Float32Array;
|
|
32
|
+
/** Optional affine canonical globe channels: current base/relief, previous base/relief, three components each. */
|
|
33
|
+
globeBasis?: Float32Array;
|
|
34
|
+
/** Exact admitted draw triangles, excluding holes. */
|
|
35
|
+
indices: Uint16Array | Uint32Array;
|
|
36
|
+
/** Indexed XY footprint used to avoid allocating query geometry for unrelated vertical probes. */
|
|
37
|
+
bounds: readonly [number, number, number, number];
|
|
38
|
+
/** Worker-computed immutable extrema, avoiding vertex scans and projected allocations during the first host probe. */
|
|
39
|
+
boundsSummary?: DrapedTerrainBoundsSummary;
|
|
40
|
+
}
|
|
41
|
+
/** One admitted draw owner; callers never include pending worker generations. */
|
|
42
|
+
export interface DrapedTerrainQueryEntry {
|
|
43
|
+
/** Stable tile/style/variant identity. */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Final worker geometry retained independently of GPU buffers. */
|
|
46
|
+
mesh: DrapedTerrainQueryMesh;
|
|
47
|
+
/** Blend actually submitted for this draw generation. */
|
|
48
|
+
blend: number;
|
|
49
|
+
/** Optional absolute Mercator rectangles matching coarse globe fallback clipping. */
|
|
50
|
+
clips?: readonly (readonly [number, number, number, number])[];
|
|
51
|
+
/** Half-open interior ownership; terminal EPSG:3857 world edges stay closed for physical probes. Default false. */
|
|
52
|
+
halfOpenClips?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/** Immutable frame-specific surface, matching ground draw topology and temporal displacement. */
|
|
55
|
+
export declare class DrapedTerrainSurfaceSnapshot extends TerrainSurfaceCollection {
|
|
56
|
+
/** Lazy query owners and measured work for this snapshot, never global renderer/GPU ownership. */
|
|
57
|
+
private readonly queryOwners;
|
|
58
|
+
/** Scene mesh generation, not source-cache or provider revision. */
|
|
59
|
+
readonly generation: number;
|
|
60
|
+
/** Shared monotonic clock used for both eyes and the corresponding draw. */
|
|
61
|
+
readonly frameTime: number;
|
|
62
|
+
/** GPU relief multiplier captured with the snapshot. */
|
|
63
|
+
readonly exaggeration: number;
|
|
64
|
+
/** Retained physical query input arrays, including indices; excludes projected copies and GPU memory. */
|
|
65
|
+
readonly inputBytes: number;
|
|
66
|
+
/** Admitted membership, blend and exaggeration key for skipping repeated settled host probes. */
|
|
67
|
+
readonly displayKey: string;
|
|
68
|
+
/** Demand-admitted index bytes; unqueried display entries never reserve acceleration. */
|
|
69
|
+
get reservedQueryIndexBytes(): number;
|
|
70
|
+
/** Snapshot-local reservation state shared by repeated clip leases. */
|
|
71
|
+
private readonly indexBudget;
|
|
72
|
+
/** Capture displacement without copying/projecting every mesh until it is queried. */
|
|
73
|
+
constructor(projection: TerrainSurface['projection'], entries: readonly DrapedTerrainQueryEntry[], generation: number, frameTime: number, exaggeration: number, maxQueryIndexBytes?: number, maxProjectedQueryBytes?: number);
|
|
74
|
+
/** Fairly warm demanded settled owners; closing releases every partial hierarchy. */
|
|
75
|
+
prepareQueryIndexSteps(): Generator<void, void, void>;
|
|
76
|
+
/** Detached snapshot-local CPU query costs; excludes other retained host snapshots and GPU/transient storage. */
|
|
77
|
+
getStatistics(): DrapedTerrainQueryStatistics;
|
|
78
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type HostFrame from "../scene/host_frame.js";
|
|
2
|
+
import type { FeatureSelectionOptions } from "../types.js";
|
|
3
|
+
/** Detached conservative content-space bounds; null means the surface has no admitted triangles. */
|
|
4
|
+
export interface TerrainSurfaceBounds {
|
|
5
|
+
/** Closed lower corner in the same units as query rays. */
|
|
6
|
+
minimum: [number, number, number];
|
|
7
|
+
/** Closed upper corner in the same units as query rays. */
|
|
8
|
+
maximum: [number, number, number];
|
|
9
|
+
}
|
|
10
|
+
/** A ray in the same absolute content coordinates as the supplied terrain. */
|
|
11
|
+
export interface TerrainRay {
|
|
12
|
+
/** Absolute origin, before host view and room-placement transforms. */
|
|
13
|
+
origin: readonly [number, number, number];
|
|
14
|
+
/** Nonzero direction; the query normalizes its length. */
|
|
15
|
+
direction: readonly [number, number, number];
|
|
16
|
+
}
|
|
17
|
+
/** Nearest terrain triangle, not a worker feature ID or a GPU selection result. */
|
|
18
|
+
export interface TerrainSurfaceHit {
|
|
19
|
+
/** Absolute EPSG:3857 meters or radius-256 globe common coordinates. */
|
|
20
|
+
position: [number, number, number];
|
|
21
|
+
/** Longitude/latitude degrees and physical altitude meters. */
|
|
22
|
+
coordinate: [number, number, number];
|
|
23
|
+
/** Distance from the ray origin in the surface's coordinate units. */
|
|
24
|
+
distance: number;
|
|
25
|
+
/** Normal in the supplied mesh's coordinate system, following triangle winding. */
|
|
26
|
+
normal: [number, number, number];
|
|
27
|
+
/** Triangle offset in the supplied index list. */
|
|
28
|
+
triangleIndex: number;
|
|
29
|
+
/** Vertex weights in index order. */
|
|
30
|
+
barycentric: [number, number, number];
|
|
31
|
+
/** Eye used for a screen query; absent for a content-space ray. */
|
|
32
|
+
renderViewId?: string;
|
|
33
|
+
/** Caller collection identity; absent on an individual surface query. */
|
|
34
|
+
surfaceId?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Host-owned terrain query boundary; it does not load, render or displace a DEM. */
|
|
37
|
+
export interface TerrainSurface {
|
|
38
|
+
/** Coordinate convention of both the mesh and rays. */
|
|
39
|
+
readonly projection: 'web-mercator' | 'globe';
|
|
40
|
+
/** Return the nearest two-sided hit within the finite camera segment, or null. */
|
|
41
|
+
intersectRay(ray: TerrainRay, maxDistance?: number): TerrainSurfaceHit | null;
|
|
42
|
+
/** Optional cheap bounds for near-first collection queries; must contain every accepted triangle. */
|
|
43
|
+
getBounds?(): TerrainSurfaceBounds | null;
|
|
44
|
+
}
|
|
45
|
+
/** One stable caller-owned surface identity; collections snapshot membership, not geometry. */
|
|
46
|
+
export interface TerrainSurfaceEntry {
|
|
47
|
+
/** Unique nonempty identifier used to distinguish triangle offsets in different tiles. */
|
|
48
|
+
id: string;
|
|
49
|
+
/** Immutable terrain query owner, using the collection's projection. */
|
|
50
|
+
surface: TerrainSurface;
|
|
51
|
+
}
|
|
52
|
+
/** Nearest collection hit with the identity of its owning tile/surface. */
|
|
53
|
+
export interface TerrainCollectionHit extends TerrainSurfaceHit {
|
|
54
|
+
/** Original caller identity, unaffected by nearest-hit clipping. */
|
|
55
|
+
surfaceId: string;
|
|
56
|
+
}
|
|
57
|
+
/** Explicit geographic probe bracket; altitude values describe displayed geometry, not source elevation. */
|
|
58
|
+
export interface TerrainElevationProbe {
|
|
59
|
+
/** Lower geographic altitude in meters; must be strictly below maximumAltitude. */
|
|
60
|
+
minimumAltitude: number;
|
|
61
|
+
/** Upper geographic altitude in meters, above every surface that should be considered. */
|
|
62
|
+
maximumAltitude: number;
|
|
63
|
+
/** Optional Mercator longitude anchor for unwrapped tile coordinates. */
|
|
64
|
+
anchorLongitude?: number;
|
|
65
|
+
}
|
|
66
|
+
/** Snapshot tile membership and query nearest geometry without owning sources, views, buffers or resources. */
|
|
67
|
+
export declare class TerrainSurfaceCollection implements TerrainSurface {
|
|
68
|
+
/** Shared absolute coordinate convention; mixed projections reject at construction. */
|
|
69
|
+
readonly projection: TerrainSurface['projection'];
|
|
70
|
+
/** Snapshotted membership and caller identities, retaining owners without copying their geometry. */
|
|
71
|
+
private readonly entries;
|
|
72
|
+
/** Retain immutable surface references with unique IDs; caller membership changes do not affect this collection. */
|
|
73
|
+
constructor(projection: TerrainSurface['projection'], entries: readonly TerrainSurfaceEntry[]);
|
|
74
|
+
/** Clip farther tiles after an accepted hit; equal-distance ties retain original membership order. */
|
|
75
|
+
intersectRay(ray: TerrainRay, maxDistance?: number): TerrainCollectionHit | null;
|
|
76
|
+
/** Query a finite content-space sightline; misses mean no loaded triangle hit, not certified world visibility. */
|
|
77
|
+
intersectSegment(start: readonly [number, number, number], end: readonly [number, number, number], options?: {
|
|
78
|
+
/** Trim origin self-intersections, in mesh coordinate units; defaults to zero. */
|
|
79
|
+
startInset?: number;
|
|
80
|
+
/** Trim target self-intersections, in mesh coordinate units; defaults to zero. */
|
|
81
|
+
endInset?: number;
|
|
82
|
+
}): TerrainCollectionHit | null;
|
|
83
|
+
}
|
|
84
|
+
/** Probe loaded top triangles along geographic up; returned coordinate altitude retains physical source meters. */
|
|
85
|
+
export declare function sampleTerrainElevation(surface: TerrainSurface, coordinate: readonly [number, number], options: TerrainElevationProbe): TerrainSurfaceHit | null;
|
|
86
|
+
/** Resolve a Mercator camera/anchor floor; this is a point probe, not swept-volume collision or locomotion. */
|
|
87
|
+
export declare function resolveTerrainClearance(surface: TerrainSurface, coordinate: readonly [number, number, number], clearance: number, options: TerrainElevationProbe): {
|
|
88
|
+
/** Geographic position raised only when it lies below displayed terrain plus clearance. */
|
|
89
|
+
coordinate: [number, number, number];
|
|
90
|
+
/** Source elevation meters, independent of any caller-provided display displacement. */
|
|
91
|
+
physicalElevation: number;
|
|
92
|
+
/** True when the supplied altitude was raised. */
|
|
93
|
+
adjusted: boolean;
|
|
94
|
+
} | null;
|
|
95
|
+
/** Indexed content-space triangles; source buffers are copied at construction. */
|
|
96
|
+
export interface TerrainMeshOptions {
|
|
97
|
+
/** Coordinate convention, matching the HostFrame or XR placement. */
|
|
98
|
+
projection: TerrainSurface['projection'];
|
|
99
|
+
/** Interleaved absolute XYZ coordinates, not tile-local positions. */
|
|
100
|
+
positions: ArrayLike<number>;
|
|
101
|
+
/** Three zero-based vertex indices per triangle. */
|
|
102
|
+
indices: ArrayLike<number>;
|
|
103
|
+
/** Optional source meters per vertex, preserving physical queries on exaggerated display meshes. */
|
|
104
|
+
physicalHeights?: ArrayLike<number>;
|
|
105
|
+
/** Match an outward backface-culled draw pass; default false preserves two-sided queries. */
|
|
106
|
+
cullBackfaces?: boolean;
|
|
107
|
+
/** Lazy hierarchy typed-array limit; exact linear picking is used when acceleration does not fit. */
|
|
108
|
+
maxQueryIndexBytes?: number;
|
|
109
|
+
/** Keep queries exact and linear until an explicit cooperative warming pass completes. */
|
|
110
|
+
deferQueryIndexBuild?: boolean;
|
|
111
|
+
}
|
|
112
|
+
/** Detached retained-storage diagnostics; no GPU or JavaScript heap estimate is included. */
|
|
113
|
+
export interface TerrainMeshStatistics {
|
|
114
|
+
/** Owned immutable positions, topology and optional physical heights. */
|
|
115
|
+
geometryBytes: number;
|
|
116
|
+
/** Currently allocated packed hierarchy storage. */
|
|
117
|
+
queryIndexBytes: number;
|
|
118
|
+
/** Required acceleration bytes, even when linear picking is selected. */
|
|
119
|
+
requiredQueryIndexBytes: number;
|
|
120
|
+
}
|
|
121
|
+
/** Immutable physical terrain surface backed by the reusable CPU triangle hierarchy. */
|
|
122
|
+
export declare class TerrainMeshSurface implements TerrainSurface {
|
|
123
|
+
/** Mercator XY/physical Z meters, or already projected globe common coordinates. */
|
|
124
|
+
readonly projection: TerrainSurface['projection'];
|
|
125
|
+
/** Optional detached physical elevations; only indexed vertices must be finite. */
|
|
126
|
+
private readonly physicalHeights?;
|
|
127
|
+
/** Optional render-pass face convention; unrelated to geographic height units. */
|
|
128
|
+
private readonly cullBackfaces;
|
|
129
|
+
/** Projection-independent immutable triangle query index. */
|
|
130
|
+
private readonly queryIndex;
|
|
131
|
+
/** Copy a finite indexed triangle mesh; mutation of caller buffers cannot change queries. */
|
|
132
|
+
constructor(options: TerrainMeshOptions);
|
|
133
|
+
/** Exact retained typed arrays; snapshots cannot mutate query ownership. */
|
|
134
|
+
getStatistics(): TerrainMeshStatistics;
|
|
135
|
+
/** Cooperatively warm picking acceleration; queries during preparation remain exact linear queries. */
|
|
136
|
+
prepareQueryIndexSteps(): Generator<void, void, void>;
|
|
137
|
+
/** Detached conservative mesh bounds; no mutable geometry or acceleration buffers escape. */
|
|
138
|
+
getBounds(): {
|
|
139
|
+
minimum: [number, number, number];
|
|
140
|
+
maximum: [number, number, number];
|
|
141
|
+
} | null;
|
|
142
|
+
/** Indexed queries; an optional display clip rejects candidates before nearest-hit selection. */
|
|
143
|
+
intersectRay(ray: TerrainRay, maxDistance?: number, acceptPosition?: (position: readonly [number, number, number], triangleIndex: number, barycentric: readonly [number, number, number]) => boolean): TerrainSurfaceHit | null;
|
|
144
|
+
}
|
|
145
|
+
/** Route top-origin CSS pixels through the actual HostFrame eye and its near/far segment. */
|
|
146
|
+
export declare function pickTerrainAt(frame: HostFrame, pixel: {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
}, surface: TerrainSurface, options?: FeatureSelectionOptions, activeViewId?: string): TerrainSurfaceHit | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental binding-free sphere horizon occlusion adapted from Tangram label shaders.
|
|
3
|
+
* Position and eye are center-relative in the same orthonormal frame and linear units;
|
|
4
|
+
* radius must be positive. Missing/interior eyes have no exterior horizon (false).
|
|
5
|
+
* The finite eye-to-position segment, not an infinite ray, must enter the sphere by
|
|
6
|
+
* more than the squared-unit-radius 1e-6 tolerance. Elevated anchors are supported.
|
|
7
|
+
* getAnchor restores a nonzero direction's geographic radius using altitude and a
|
|
8
|
+
* positive earthRadius in identical units. Finite, f32-representable inputs required.
|
|
9
|
+
*/
|
|
10
|
+
export declare const globeHorizon: {
|
|
11
|
+
name: string;
|
|
12
|
+
vs: string;
|
|
13
|
+
fs: string;
|
|
14
|
+
source: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental binding-free RGB elevation decoding for normalized linear samples.
|
|
3
|
+
* Terrarium and Terrain-RGB return meters. Custom coefficients apply to byte-valued
|
|
4
|
+
* channels (normalized RGB multiplied by 255); custom output units are host-defined.
|
|
5
|
+
* No rounding, clamping, alpha/no-data interpretation or sampling is performed.
|
|
6
|
+
* Finite inputs are required; f32 precision limits apply, especially at large heights.
|
|
7
|
+
*/
|
|
8
|
+
export declare const heightDecode: {
|
|
9
|
+
name: string;
|
|
10
|
+
vs: string;
|
|
11
|
+
fs: string;
|
|
12
|
+
source: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental luma.gl ShaderModule with provider-independent hillshade functions.
|
|
3
|
+
* Hosts supply decoded, finite heights, positive finite neighbor spacing, and a
|
|
4
|
+
* local-frame light vector. Sampling, no-data handling, seam stitching, coordinate
|
|
5
|
+
* transforms, vertical exaggeration and color composition stay with the host.
|
|
6
|
+
* No uniforms, samplers, injection hooks, or runtime dependencies are introduced.
|
|
7
|
+
*/
|
|
8
|
+
export declare const hillshade: {
|
|
9
|
+
name: string;
|
|
10
|
+
vs: string;
|
|
11
|
+
fs: string;
|
|
12
|
+
source: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { hillshade } from "./hillshade.js";
|
|
2
|
+
export { triplanar } from "./triplanar.js";
|
|
3
|
+
export { planar } from "./planar.js";
|
|
4
|
+
export { sphereMap } from "./sphere-map.js";
|
|
5
|
+
export { heightDecode } from "./height-decode.js";
|
|
6
|
+
export { globeHorizon } from "./globe-horizon.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental binding-free planar mapping extracted from Tangram material GLSL.
|
|
3
|
+
* Frequency is repeats per position unit; finite inputs must retain f32 UV precision.
|
|
4
|
+
* Tangram's legacy vec2 scale uses only scale.x: pass that component here.
|
|
5
|
+
* The host owns textures, sampling, filtering and coordinate transforms.
|
|
6
|
+
*/
|
|
7
|
+
export declare const planar: {
|
|
8
|
+
name: string;
|
|
9
|
+
vs: string;
|
|
10
|
+
fs: string;
|
|
11
|
+
source: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental binding-free sphere-map reflection UVs for luma assemblers.
|
|
3
|
+
* Supply a nonzero camera-to-surface vector and unit surface normal in one frame.
|
|
4
|
+
* Inputs, their intermediate lengths and UVs must be finite. The back-facing
|
|
5
|
+
* reflection pole (0, 0, -1) and a zero post-skew eye are undefined, as in Tangram.
|
|
6
|
+
* This is environment mapping, not equirectangular mapping or GlobeView projection.
|
|
7
|
+
*/
|
|
8
|
+
export declare const sphereMap: {
|
|
9
|
+
name: string;
|
|
10
|
+
vs: string;
|
|
11
|
+
fs: string;
|
|
12
|
+
source: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Experimental Tangram-compatible triplanar UVs and RGBA blending for luma assemblers.
|
|
3
|
+
* Inputs must be finite and small enough for f32 normalization and UV precision.
|
|
4
|
+
* Normal components have a 1e-5 floor; a zero normal gives equal weights.
|
|
5
|
+
* Position and normal share a coordinate frame. Each scale component multiplies
|
|
6
|
+
* both UV coordinates of its projection plane, including negative frequencies.
|
|
7
|
+
* No sign-dependent UV mirroring or tangent-space normal reorientation is applied.
|
|
8
|
+
* Hosts own texture bindings, sampling, derivatives, color space and normal maps.
|
|
9
|
+
*/
|
|
10
|
+
export declare const triplanar: {
|
|
11
|
+
name: string;
|
|
12
|
+
vs: string;
|
|
13
|
+
fs: string;
|
|
14
|
+
source: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/** One consumer's interest in a decoded tile; releasing it cannot cancel another consumer. */
|
|
2
|
+
export interface DecodedTileLease<ValueT> {
|
|
3
|
+
/** Independent completion, rejected promptly when this lease is released before completion. */
|
|
4
|
+
readonly promise: Promise<ValueT>;
|
|
5
|
+
/** Whether this consumer still owns a lease, including after synchronous source invalidation. */
|
|
6
|
+
isActive(): boolean;
|
|
7
|
+
/** Idempotently release this consumer's residency and request ownership. */
|
|
8
|
+
release(): void;
|
|
9
|
+
}
|
|
10
|
+
/** Source revision and unwrapped normalized data identity, never a mesh/style key. */
|
|
11
|
+
export interface DecodedTileAcquisition<ValueT> {
|
|
12
|
+
/** Opaque source-instance revision, owned by the worker adapter. */
|
|
13
|
+
readonly source: object;
|
|
14
|
+
/** Normalized data coordinate key, preserving world-copy distinctions. */
|
|
15
|
+
readonly key: string;
|
|
16
|
+
/** Original acquisition/decode procedure; invoked once for compatible concurrent leases. */
|
|
17
|
+
load(signal: AbortSignal): Promise<ValueT>;
|
|
18
|
+
}
|
|
19
|
+
/** Detached diagnostics; missing allocation estimates never masquerade as zero decoded bytes. */
|
|
20
|
+
export interface DecodedTileStatistics {
|
|
21
|
+
/** Pending unique acquisitions, including queued work. */
|
|
22
|
+
loadingTiles: number;
|
|
23
|
+
/** Unique acquisitions waiting for a source-procedure slot. */
|
|
24
|
+
queuedTiles: number;
|
|
25
|
+
/** Running source procedures, including cancelled procedures that have not settled. */
|
|
26
|
+
activeAcquisitions: number;
|
|
27
|
+
/** Configured source-procedure limit; undefined means unlimited. */
|
|
28
|
+
maxConcurrentLoads: number | undefined;
|
|
29
|
+
/** Ready records protected by live leases; there is no unreferenced warm cache. */
|
|
30
|
+
readyTiles: number;
|
|
31
|
+
/** Live consumer leases across pending and ready records. */
|
|
32
|
+
consumers: number;
|
|
33
|
+
/** Actual acquisition attempts since store creation. */
|
|
34
|
+
acquisitions: number;
|
|
35
|
+
/** Acquisitions served by an existing pending or ready record. */
|
|
36
|
+
sharedAcquisitions: number;
|
|
37
|
+
/** Requests cancelled when their final lease or source revision was released. */
|
|
38
|
+
cancelledAcquisitions: number;
|
|
39
|
+
/** Rejected acquisition attempts, excluding invalidated late completions. */
|
|
40
|
+
failedAcquisitions: number;
|
|
41
|
+
/** Ready payload bytes, undefined if any live ready record has unknown size. */
|
|
42
|
+
decodedBytes: number | undefined;
|
|
43
|
+
}
|
|
44
|
+
/** Request capacity is independent of styled mesh-build scheduling and residency. */
|
|
45
|
+
export interface DecodedTileStoreOptions {
|
|
46
|
+
/** Positive safe integer; omission preserves unlimited acquisition. */
|
|
47
|
+
maxConcurrentLoads?: number;
|
|
48
|
+
}
|
|
49
|
+
/** Validate an optional load budget before creating resources or worker state. */
|
|
50
|
+
export declare function validateConcurrentTileLoads(value: unknown): number | undefined;
|
|
51
|
+
/** Portable cancellation error for leases, source invalidation, and stale publication. */
|
|
52
|
+
export declare function createTileLeaseAbortError(): Error;
|
|
53
|
+
/** Worker-local shared acquisition with source-instance revisions and zero warm retention. */
|
|
54
|
+
export default class DecodedTileStore<ValueT> {
|
|
55
|
+
/** Source revisions stay retained only while they have live records. */
|
|
56
|
+
private readonly sources;
|
|
57
|
+
/** Optional decoded allocation estimator; encoded network bytes are not a substitute. */
|
|
58
|
+
private readonly getByteLength;
|
|
59
|
+
/** FIFO unique-content queue; duplicate leases never consume another slot. */
|
|
60
|
+
private readonly queued;
|
|
61
|
+
/** Fixed worker-local source-procedure limit, unrelated to GPU mesh ownership. */
|
|
62
|
+
private readonly maxConcurrentLoads;
|
|
63
|
+
/** Settling an aborted but non-cooperative procedure still releases exactly one slot. */
|
|
64
|
+
private activeAcquisitions;
|
|
65
|
+
/** Batch synchronous leases and cancellation before starting their providers. */
|
|
66
|
+
private scheduled;
|
|
67
|
+
/** Actual unique acquisition attempts. */
|
|
68
|
+
private acquisitions;
|
|
69
|
+
/** Reused pending/ready acquisitions. */
|
|
70
|
+
private sharedAcquisitions;
|
|
71
|
+
/** Underlying requests cancelled at final release or invalidation. */
|
|
72
|
+
private cancelledAcquisitions;
|
|
73
|
+
/** Underlying acquisition failures. */
|
|
74
|
+
private failedAcquisitions;
|
|
75
|
+
/** Create an empty store without fetch, decode, traversal, or GPU dependencies. */
|
|
76
|
+
constructor(getByteLength?: (value: ValueT) => number | undefined, options?: DecodedTileStoreOptions);
|
|
77
|
+
/** Acquire one consumer lease, sharing only the exact source revision and data key. */
|
|
78
|
+
acquireTile(request: DecodedTileAcquisition<ValueT>): DecodedTileLease<ValueT>;
|
|
79
|
+
/** Release one obsolete source revision without touching a successor source instance. */
|
|
80
|
+
invalidateSource(source: object): void;
|
|
81
|
+
/** Return unique content and consumer counts without retaining or exposing internal records. */
|
|
82
|
+
getStatistics(): DecodedTileStatistics;
|
|
83
|
+
/** Cancel all pending work and release content; subsequent use starts from an empty store. */
|
|
84
|
+
finalize(): void;
|
|
85
|
+
/** Drain only when a source procedure settles, not when its styled mesh finishes. */
|
|
86
|
+
private scheduleAcquisitions;
|
|
87
|
+
/** A slot follows the original procedure even if all consumer leases are released early. */
|
|
88
|
+
private startAcquisition;
|
|
89
|
+
/** A late completion cannot publish over a replacement attempt for the same coordinate. */
|
|
90
|
+
private isCurrent;
|
|
91
|
+
/** Forget only the matching attempt and release empty source maps immediately. */
|
|
92
|
+
private forgetRecord;
|
|
93
|
+
/** Ready content has no pending request; cancellation is issued at most once. */
|
|
94
|
+
private cancelRecord;
|
|
95
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Source metadata subset structurally compatible with loaders.gl TileSourceMetadata. */
|
|
2
|
+
export interface TangramTileSourceMetadata {
|
|
3
|
+
/** Source/container format, not a promise to select a different parser. */
|
|
4
|
+
format?: string;
|
|
5
|
+
/** Encoded tile MIME type, separate from archive format and decoder selection. */
|
|
6
|
+
tileMIMEType?: string;
|
|
7
|
+
/** Human-readable source name. */
|
|
8
|
+
name?: string;
|
|
9
|
+
/** Provider credits; consumers must sanitize before rendering HTML. */
|
|
10
|
+
attributions?: string[];
|
|
11
|
+
/** Minimum advertised data level. */
|
|
12
|
+
minZoom?: number;
|
|
13
|
+
/** Maximum advertised data level. */
|
|
14
|
+
maxZoom?: number;
|
|
15
|
+
/** Geographic bounds, retaining antimeridian-crossing west/east ordering. */
|
|
16
|
+
boundingBox?: [[number, number], [number, number]];
|
|
17
|
+
}
|
|
18
|
+
/** Configuration plus discovered metadata, without depending on the DataSource implementation. */
|
|
19
|
+
export interface SourceMetadataInput {
|
|
20
|
+
/** Original scene source options. */
|
|
21
|
+
config: Record<string, unknown>;
|
|
22
|
+
/** Logical scene source name. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** Effective legacy data levels. */
|
|
25
|
+
zooms: readonly number[];
|
|
26
|
+
/** Effective legacy data ceiling. */
|
|
27
|
+
max_zoom: number;
|
|
28
|
+
/** Authored and discovered provider credits. */
|
|
29
|
+
getAttributions(): string[];
|
|
30
|
+
}
|
|
31
|
+
/** Normalize metadata for new consumers without changing legacy source layout or URL resolution. */
|
|
32
|
+
export declare function createTileSourceMetadata(source: SourceMetadataInput, discovered?: Record<string, unknown>): TangramTileSourceMetadata;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// tangram-layers
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
declare module 'fontfaceobserver' {
|
|
6
|
+
export default class FontFaceObserver {
|
|
7
|
+
constructor (family: string, options?: Record<string, unknown>);
|
|
8
|
+
load (): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type TileCoordinates = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
z: number;
|
|
5
|
+
};
|
|
6
|
+
export type TileCoordinate = TileCoordinates & {
|
|
7
|
+
key: string;
|
|
8
|
+
center_dist?: number;
|
|
9
|
+
};
|
|
10
|
+
export type TileSource = {
|
|
11
|
+
id: string | number;
|
|
12
|
+
name: string;
|
|
13
|
+
zoom_bias?: number;
|
|
14
|
+
zooms: number[];
|
|
15
|
+
};
|
|
16
|
+
export type TileReference = {
|
|
17
|
+
coords: TileCoordinates;
|
|
18
|
+
source: TileSource;
|
|
19
|
+
style_z: number;
|
|
20
|
+
key?: string;
|
|
21
|
+
};
|
|
22
|
+
type TileChildrenCache = Record<string, Record<string, TileReference[]>>;
|
|
23
|
+
type TileIdApi = {
|
|
24
|
+
coord(coordinates: TileCoordinates): TileCoordinate;
|
|
25
|
+
coordKey(coordinates: TileCoordinates): string;
|
|
26
|
+
key(coordinates: TileCoordinates, source: TileSource, styleZoom: number): string | undefined;
|
|
27
|
+
normalizedKey(coordinates: TileCoordinates, source: TileSource, styleZoom: number): string | undefined;
|
|
28
|
+
normalizedCoord(coordinates: TileCoordinates, source: TileSource): TileCoordinate;
|
|
29
|
+
coordAtZoom(coordinates: TileCoordinates, zoom: number): TileCoordinate;
|
|
30
|
+
coordForTileZooms(coordinates: TileCoordinates, zooms: number[]): TileCoordinate;
|
|
31
|
+
findZoomInRange(zoom: number, zooms: number[]): number;
|
|
32
|
+
isDescendant(parent: TileCoordinates, descendant: TileCoordinates): boolean;
|
|
33
|
+
parent(tile: TileReference): TileReference | null | undefined;
|
|
34
|
+
children(tile: TileReference, cache?: TileChildrenCache): TileReference[];
|
|
35
|
+
};
|
|
36
|
+
export declare const TileID: TileIdApi;
|
|
37
|
+
export {};
|