@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,121 @@
|
|
|
1
|
+
import type { AmbientLight, DirectionalLight, PointLight, SpotLight } from '@luma.gl/shadertools';
|
|
2
|
+
/** An RGB contribution or position, copied at the adapter boundary. */
|
|
3
|
+
type Triple = readonly [number, number, number];
|
|
4
|
+
/** Tangram's normalized RGB/RGBA, CSS color, or scalar lighting contribution. */
|
|
5
|
+
export type TangramLightColor = number | string | Triple | readonly [number, number, number, number];
|
|
6
|
+
/** Optional Tangram shading controls layered on native luma.gl light definitions. */
|
|
7
|
+
export interface TangramLightExtensions {
|
|
8
|
+
/** Independent normalized ambient contribution; defaults to the native light contribution. */
|
|
9
|
+
ambient?: TangramLightColor;
|
|
10
|
+
/** Independent normalized diffuse contribution; defaults to the native light contribution. */
|
|
11
|
+
diffuse?: TangramLightColor;
|
|
12
|
+
/** Independent normalized specular contribution; defaults to the native light contribution. */
|
|
13
|
+
specular?: TangramLightColor;
|
|
14
|
+
/** Suppress this light without removing its authored definition. */
|
|
15
|
+
visible?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Optional positional falloff and coordinate controls; native coefficients remain `attenuation`. */
|
|
18
|
+
export interface TangramPositionalLightExtensions extends TangramLightExtensions {
|
|
19
|
+
/** Legacy exponent falloff, multiplied by the native polynomial attenuation. */
|
|
20
|
+
attenuationExponent?: number;
|
|
21
|
+
/** Legacy outer radius, or [inner, outer] radii, accepting Tangram meter/pixel units. */
|
|
22
|
+
radius?: number | string | readonly [number | string | null, number | string];
|
|
23
|
+
/** Optional legacy position interpretation; omitted means projected common-space coordinates. */
|
|
24
|
+
origin?: 'world' | 'ground' | 'camera';
|
|
25
|
+
/** Interpret native position as longitude/latitude/altitude rather than projected common coordinates. */
|
|
26
|
+
positionSpace?: 'common' | 'geographic';
|
|
27
|
+
/** Geographic spotlight orientation; defaults to ENU when positionSpace is geographic. */
|
|
28
|
+
directionSpace?: 'common' | 'enu';
|
|
29
|
+
}
|
|
30
|
+
/** Native ambient light with optional independent Tangram color contributions. */
|
|
31
|
+
export type TangramAmbientLight = AmbientLight & TangramLightExtensions;
|
|
32
|
+
/** Native directional light with optional independent Tangram color contributions. */
|
|
33
|
+
export type TangramDirectionalLight = DirectionalLight & TangramLightExtensions;
|
|
34
|
+
/** Native point light with optional Tangram color, falloff, and coordinate controls. */
|
|
35
|
+
export type TangramPointLight = PointLight & TangramPositionalLightExtensions;
|
|
36
|
+
/** Native spotlight with optional Tangram falloff inside its native radian cone. */
|
|
37
|
+
export type TangramSpotLight = SpotLight & TangramPositionalLightExtensions & {
|
|
38
|
+
/** Legacy cosine falloff exponent, multiplied by the native cone transition; defaults to zero. */
|
|
39
|
+
spotExponent?: number;
|
|
40
|
+
};
|
|
41
|
+
/** Every native luma.gl Light is assignable; all Tangram additions are optional. */
|
|
42
|
+
export type TangramLight = TangramAmbientLight | TangramDirectionalLight | TangramPointLight | TangramSpotLight;
|
|
43
|
+
/** Native descriptors after defaults, vectors, attenuation and spot cones have been validated. */
|
|
44
|
+
export type NormalizedTangramLight = (Omit<TangramAmbientLight, 'color' | 'intensity'> | Omit<TangramDirectionalLight, 'color' | 'intensity'> | (Omit<TangramPointLight, 'color' | 'intensity' | 'attenuation'> & {
|
|
45
|
+
attenuation: Triple;
|
|
46
|
+
}) | (Omit<TangramSpotLight, 'color' | 'intensity' | 'attenuation' | 'innerConeAngle' | 'outerConeAngle'> & {
|
|
47
|
+
attenuation: Triple;
|
|
48
|
+
innerConeAngle: number;
|
|
49
|
+
outerConeAngle: number;
|
|
50
|
+
})) & {
|
|
51
|
+
color: Triple;
|
|
52
|
+
intensity: number;
|
|
53
|
+
};
|
|
54
|
+
/** Resolved Tangram light values, after color, unit and camera conversion. */
|
|
55
|
+
export interface ResolvedTangramLight {
|
|
56
|
+
/** Tangram's spotlight discriminator differs from luma.gl's `spot`. */
|
|
57
|
+
type: 'ambient' | 'directional' | 'point' | 'spotlight';
|
|
58
|
+
/** Linear RGB ambient contribution. */
|
|
59
|
+
ambient: Triple;
|
|
60
|
+
/** Linear RGB diffuse contribution. */
|
|
61
|
+
diffuse: Triple;
|
|
62
|
+
/** Linear RGB specular contribution. */
|
|
63
|
+
specular: Triple;
|
|
64
|
+
/** Position in the same eye-relative lighting space as the rendered surface. */
|
|
65
|
+
position?: Triple;
|
|
66
|
+
/** Incoming direction in the surface normal's lighting space. */
|
|
67
|
+
direction?: Triple;
|
|
68
|
+
/** Tangram's distance exponent, not luma.gl's polynomial coefficients. */
|
|
69
|
+
attenuation?: number;
|
|
70
|
+
/** Tangram's resolved inner/outer radii, in lighting-space units. */
|
|
71
|
+
radius?: readonly [number | null, number];
|
|
72
|
+
/** Tangram spotlight cutoff in degrees. */
|
|
73
|
+
angle?: number;
|
|
74
|
+
/** Tangram spotlight falloff exponent. */
|
|
75
|
+
exponent?: number;
|
|
76
|
+
}
|
|
77
|
+
/** A luma.gl light plus the Tangram-only data required for lossless shading. */
|
|
78
|
+
export interface TangramLightMapping {
|
|
79
|
+
/** Luma.gl-compatible byte RGB and resolved coordinates, with optional Tangram controls. */
|
|
80
|
+
light: TangramLight;
|
|
81
|
+
/** Positions are resolved lighting coordinates, not geographic longitude/latitude. */
|
|
82
|
+
coordinateSpace: 'tangram-lighting';
|
|
83
|
+
/** Exact legacy contributions and falloff; consumers must not silently discard them. */
|
|
84
|
+
tangram: ResolvedTangramLight;
|
|
85
|
+
}
|
|
86
|
+
/** Configuration produced for Tangram's existing shader composer from a native luma.gl light. */
|
|
87
|
+
export interface LumaLightConfig {
|
|
88
|
+
/** Tangram shader discriminator. */
|
|
89
|
+
type: ResolvedTangramLight['type'];
|
|
90
|
+
/** Linear ambient RGB. */
|
|
91
|
+
ambient: TangramLightColor;
|
|
92
|
+
/** Linear diffuse RGB. */
|
|
93
|
+
diffuse: TangramLightColor;
|
|
94
|
+
/** Linear specular RGB. */
|
|
95
|
+
specular: TangramLightColor;
|
|
96
|
+
/** Independent copy of the native light, used for native falloff and coordinates. */
|
|
97
|
+
lumaLight: NormalizedTangramLight;
|
|
98
|
+
/** Native common space by default, or an explicitly selected legacy position interpretation. */
|
|
99
|
+
origin: 'luma' | 'world' | 'ground' | 'camera';
|
|
100
|
+
/** Native projected position. */
|
|
101
|
+
position?: Triple;
|
|
102
|
+
/** Native incoming direction. */
|
|
103
|
+
direction?: Triple;
|
|
104
|
+
/** Tangram exponent, kept separate from the native polynomial coefficient vector. */
|
|
105
|
+
attenuation?: number;
|
|
106
|
+
/** Copied legacy radius configuration for the existing unit resolver. */
|
|
107
|
+
radius?: TangramPositionalLightExtensions['radius'];
|
|
108
|
+
/** Tangram spotlight exponent. */
|
|
109
|
+
exponent?: number;
|
|
110
|
+
}
|
|
111
|
+
/** Convert resolved Tangram data without pretending legacy falloff or separate colors are equivalent. */
|
|
112
|
+
export declare function mapTangramLight(resolved: Omit<ResolvedTangramLight, 'ambient' | 'diffuse' | 'specular'> & {
|
|
113
|
+
ambient: readonly number[];
|
|
114
|
+
diffuse: readonly number[];
|
|
115
|
+
specular: readonly number[];
|
|
116
|
+
}): TangramLightMapping;
|
|
117
|
+
/** Translate a native luma.gl light while retaining its polynomial attenuation and radian cones. */
|
|
118
|
+
export declare function convertLumaLight(input: TangramLight): LumaLightConfig;
|
|
119
|
+
/** Wrap native arrays without validation so scene globals resolve before Light.create converts them. */
|
|
120
|
+
export declare function normalizeSceneLights(lights: unknown): unknown;
|
|
121
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Immutable worker query channels; no scene, GPU, provider or query-index ownership. */
|
|
2
|
+
interface DrapedTerrainBoundsInput {
|
|
3
|
+
/** Absolute Mercator XYZ, with authored offsets in meters. */
|
|
4
|
+
positions: Float64Array;
|
|
5
|
+
/** Current/previous physical DEM heights, interleaved per vertex. */
|
|
6
|
+
heights: Float32Array;
|
|
7
|
+
/** Optional current/previous affine globe bases and relief vectors, twelve channels per vertex. */
|
|
8
|
+
globeBasis?: Float32Array;
|
|
9
|
+
/** Actual rendered triangle indices. */
|
|
10
|
+
indices: Uint16Array | Uint32Array;
|
|
11
|
+
/** Optional trusted worker summary of these exact immutable channels. */
|
|
12
|
+
boundsSummary?: DrapedTerrainBoundsSummary;
|
|
13
|
+
}
|
|
14
|
+
/** Independent channel extrema enclose every convex rendered triangle throughout its height morph. */
|
|
15
|
+
export interface DrapedTerrainBoundsSummary {
|
|
16
|
+
/** Radius-one globe directions of indexed vertices, not geographic rectangle corners. */
|
|
17
|
+
directions: {
|
|
18
|
+
minimum: [number, number, number];
|
|
19
|
+
maximum: [number, number, number];
|
|
20
|
+
};
|
|
21
|
+
/** Authored meter offsets, independent of relief exaggeration. */
|
|
22
|
+
offsets: readonly [number, number];
|
|
23
|
+
/** Physical current/previous DEM endpoints, conservatively enclosing all morph fractions. */
|
|
24
|
+
heights: readonly [number, number];
|
|
25
|
+
/** Affine globe channels enclose canonical face cuts without projecting them back onto the sphere. */
|
|
26
|
+
globe?: {
|
|
27
|
+
/** Zero-relief common-space endpoint extrema. */
|
|
28
|
+
base: {
|
|
29
|
+
minimum: number[];
|
|
30
|
+
maximum: number[];
|
|
31
|
+
};
|
|
32
|
+
/** Common-space displacement per unit exaggeration. */
|
|
33
|
+
relief: {
|
|
34
|
+
minimum: number[];
|
|
35
|
+
maximum: number[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Compute bounds from the actual indexed vertices so long globe chords and unwrapped tiles remain enclosed. */
|
|
40
|
+
export declare function summarizeDrapedTerrainBounds(mesh: DrapedTerrainBoundsInput): DrapedTerrainBoundsSummary;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { type GlobeTerrainMeshTemplate } from "./globe-terrain.js";
|
|
2
|
+
import type { TerrainHeightGrid } from "./terrain-data.js";
|
|
3
|
+
import type { TerrainResourceBudget } from "./terrain-resource-budget.js";
|
|
4
|
+
/** Complete, immutable neighborhood generation; only library-produced handles can resolve templates. */
|
|
5
|
+
export interface GlobeTerrainPreparationSnapshot {
|
|
6
|
+
/** Ordered immutable source identities; applications must not mutate their samples. */
|
|
7
|
+
readonly grids: readonly TerrainHeightGrid[];
|
|
8
|
+
/** Uniform curved-cell resolution for all stitched tiles. */
|
|
9
|
+
readonly resolution: number;
|
|
10
|
+
/** Owned prepared typed arrays, excluding source, display/query buffers and GPU allocations. */
|
|
11
|
+
readonly byteLength: number;
|
|
12
|
+
}
|
|
13
|
+
/** Validate library ownership, including empty snapshots whose templates cannot be looked up. */
|
|
14
|
+
export declare function assertGlobeTerrainPreparationSnapshot(snapshot: GlobeTerrainPreparationSnapshot): void;
|
|
15
|
+
/** Resolve only a source identity belonging to a completed preparation generation. */
|
|
16
|
+
export declare function getPreparedGlobeTerrainTemplate(snapshot: GlobeTerrainPreparationSnapshot, grid: TerrainHeightGrid): GlobeTerrainMeshTemplate;
|
|
17
|
+
/** Detached cooperative-work diagnostics, not a frame-time or whole-process memory measurement. */
|
|
18
|
+
export interface GlobeTerrainPreparationStatistics {
|
|
19
|
+
/** Tiles still awaiting preparation in the latest request. */
|
|
20
|
+
pending: number;
|
|
21
|
+
/** Unique current and staged template storage; shared templates count once. */
|
|
22
|
+
retainedBytes: number;
|
|
23
|
+
/** Maximum retained template bytes permitted by this owner. */
|
|
24
|
+
byteLimit: number;
|
|
25
|
+
/** Fully published generations. */
|
|
26
|
+
committed: number;
|
|
27
|
+
/** Requests replaced before completion. */
|
|
28
|
+
cancelled: number;
|
|
29
|
+
/** New templates admitted by the latest generation. */
|
|
30
|
+
prepared: number;
|
|
31
|
+
/** Templates reused by the latest generation. */
|
|
32
|
+
reused: number;
|
|
33
|
+
/** Cooperative CPU slices in the latest generation. */
|
|
34
|
+
slices: number;
|
|
35
|
+
/** Last slice's elapsed time; an indivisible step may exceed its target. */
|
|
36
|
+
lastSliceMs: number;
|
|
37
|
+
/** Largest observed slice in the latest generation. */
|
|
38
|
+
maxSliceMs: number;
|
|
39
|
+
/** CPU slice elapsed sum, excluding time yielded back to the host. */
|
|
40
|
+
workMs: number;
|
|
41
|
+
/** Largest current-plus-candidate typed-template requirement observed before allocation. */
|
|
42
|
+
requiredPeakBytes: number;
|
|
43
|
+
/** Last preparation/admission failure; retry is explicit. */
|
|
44
|
+
error?: string;
|
|
45
|
+
}
|
|
46
|
+
/** Latest-request-wins preparation driven by the host, with atomic stitched snapshots and bounded retention. */
|
|
47
|
+
export declare class GlobeTerrainPreparation {
|
|
48
|
+
private current?;
|
|
49
|
+
private target?;
|
|
50
|
+
private iterator?;
|
|
51
|
+
private staged;
|
|
52
|
+
private disposed;
|
|
53
|
+
private readonly statistics;
|
|
54
|
+
/** Leases cover this owner's current/staged templates, not external snapshots or scratch. */
|
|
55
|
+
private readonly leases;
|
|
56
|
+
/** Optional shared admission with sources, display preparation and renderer owners. */
|
|
57
|
+
private readonly resourceBudget?;
|
|
58
|
+
/** Retention includes the currently displayed and partially prepared generations, but not transient scratch arrays. */
|
|
59
|
+
constructor(maxRetainedBytes?: number, options?: {
|
|
60
|
+
/** Shared registered-allocation budget; independent local limits still apply. */
|
|
61
|
+
resourceBudget?: TerrainResourceBudget;
|
|
62
|
+
});
|
|
63
|
+
/** Replace obsolete staged work; unchanged requests and failed generations do not restart automatically. */
|
|
64
|
+
request(grids: readonly TerrainHeightGrid[], resolution?: number): boolean;
|
|
65
|
+
/** Run at least one bounded step, then yield after the elapsed target; true means a complete generation was committed. */
|
|
66
|
+
advance(budgetMs?: number, now?: () => number): boolean;
|
|
67
|
+
/** Retry a failed immutable request without resetting the displayed snapshot. */
|
|
68
|
+
retry(): boolean;
|
|
69
|
+
/** Completed snapshot only; partial generations are never exposed for rendering or picking. */
|
|
70
|
+
getSnapshot(): GlobeTerrainPreparationSnapshot | undefined;
|
|
71
|
+
/** Detached diagnostic snapshot, including unique current/staged template backing storage. */
|
|
72
|
+
getStatistics(): GlobeTerrainPreparationStatistics;
|
|
73
|
+
/** True until the latest generation commits, fails or is cancelled by teardown. */
|
|
74
|
+
isPending(): boolean;
|
|
75
|
+
/** Cancel pending work and release its reservations without discarding the displayed snapshot. */
|
|
76
|
+
cancel(): boolean;
|
|
77
|
+
/** Release references to current, staged and source data; safe to repeat. */
|
|
78
|
+
destroy(): void;
|
|
79
|
+
/** Count shared template handles once across visible and candidate generations. */
|
|
80
|
+
private getRetainedBytes;
|
|
81
|
+
/** Release only templates no longer retained by this owner; external snapshot ownership is separate. */
|
|
82
|
+
private releaseUnusedLeases;
|
|
83
|
+
/** Preserve unaffected immutable neighborhoods; commit every stitched tile together only after admission succeeds. */
|
|
84
|
+
private prepare;
|
|
85
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { TerrainHeightGrid } from "./terrain-data.js";
|
|
2
|
+
/** Detached render/query buffers; original height grids are never exaggerated or modified. */
|
|
3
|
+
export interface GlobeTerrainMesh {
|
|
4
|
+
/** Longitude/latitude degrees and displayed elevation meters for deck.gl projection. */
|
|
5
|
+
geographicPositions: Float32Array;
|
|
6
|
+
/** Radius-256 spherical XYZ matching those packed geographic vertices. */
|
|
7
|
+
positions: Float64Array;
|
|
8
|
+
/** Physical source elevation per vertex, independent of exaggeration and chord error. */
|
|
9
|
+
physicalHeights: Float32Array;
|
|
10
|
+
/** Outward triangle topology; cells touching no-data samples are omitted. */
|
|
11
|
+
indices: Uint32Array;
|
|
12
|
+
/** RGB relief colors with baked common-space lighting, independent of backend. */
|
|
13
|
+
colors: Float32Array;
|
|
14
|
+
}
|
|
15
|
+
/** Opaque immutable sampling/topology snapshot; keep it to rescale without reading source grids again. */
|
|
16
|
+
export interface GlobeTerrainMeshTemplate {
|
|
17
|
+
/** Number of regular and stitched vertices in this snapshot. */
|
|
18
|
+
readonly vertexCount: number;
|
|
19
|
+
/** Number of outward triangles, excluding no-data cells. */
|
|
20
|
+
readonly triangleCount: number;
|
|
21
|
+
/** Owned typed-array backing storage; excludes source grids and temporary JavaScript arrays. */
|
|
22
|
+
readonly byteLength: number;
|
|
23
|
+
}
|
|
24
|
+
/** Attenuate exaggerated relief to flat after one diameter doubling; explicit physical/subphysical settings stay fixed. */
|
|
25
|
+
export declare function getGlobeTerrainExaggeration(globeScreenRatio: number, maximum?: number): number;
|
|
26
|
+
/** Resample a Mercator DEM onto curved triangles; neighbors reconcile matching tile edges. */
|
|
27
|
+
export declare function buildGlobeTerrainMesh(grid: TerrainHeightGrid, options?: {
|
|
28
|
+
/** Effective display multiplier, not the zoom-independent maximum. */
|
|
29
|
+
exaggeration?: number;
|
|
30
|
+
/** Cells along each tile axis, bounded to keep allocations predictable; defaults to 64. */
|
|
31
|
+
resolution?: number;
|
|
32
|
+
/** Same-datum, non-overlapping neighbors with balanced 2:1 edges and the same cell resolution. */
|
|
33
|
+
neighbors?: readonly TerrainHeightGrid[];
|
|
34
|
+
}): GlobeTerrainMesh;
|
|
35
|
+
/** Snapshot source sampling, no-data, edge stitching and physical slopes once per immutable neighborhood. */
|
|
36
|
+
export declare function prepareGlobeTerrainMesh(grid: TerrainHeightGrid, options?: {
|
|
37
|
+
/** Uniform cells per tile axis, integer [2, 256]; defaults to 64. */
|
|
38
|
+
resolution?: number;
|
|
39
|
+
/** Same-datum non-overlapping neighbors with balanced 2:1 edges. */
|
|
40
|
+
neighbors?: readonly TerrainHeightGrid[];
|
|
41
|
+
}): GlobeTerrainMeshTemplate;
|
|
42
|
+
/** Cooperatively prepare identical topology; each yield releases control between bounded sampling chunks. */
|
|
43
|
+
export declare function prepareGlobeTerrainMeshSteps(grid: TerrainHeightGrid, options?: {
|
|
44
|
+
/** Uniform cells per tile axis, integer [2, 256]; defaults to 64. */
|
|
45
|
+
resolution?: number;
|
|
46
|
+
/** Same-datum non-overlapping neighbors with balanced 2:1 edges. */
|
|
47
|
+
neighbors?: readonly TerrainHeightGrid[];
|
|
48
|
+
/** Exact final typed-array admission fence; scratch is excluded. The identity is not a usable template until completion. */
|
|
49
|
+
onAllocate?: (bytes: number, allocation: GlobeTerrainMeshTemplate) => void;
|
|
50
|
+
}): Generator<void, GlobeTerrainMeshTemplate, void>;
|
|
51
|
+
/** Rebuild detached display/query buffers without resampling or restitching the immutable template. */
|
|
52
|
+
export declare function scaleGlobeTerrainMesh(template: GlobeTerrainMeshTemplate, exaggeration?: number): GlobeTerrainMesh;
|
|
53
|
+
/** Cooperatively rescale identical packed vertices/lighting; yields every 128 vertices without resampling. */
|
|
54
|
+
export declare function scaleGlobeTerrainMeshSteps(template: GlobeTerrainMeshTemplate, exaggeration?: number): Generator<void, GlobeTerrainMesh, void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { resolveLabelPlacement } from "./label-placement.js";
|
|
2
|
+
export type { ScreenLabelCandidate, LabelPlacementOptions } from "./label-placement.js";
|
|
3
|
+
export { areGeographicLabelCopies } from "./label-identity.js";
|
|
4
|
+
export type { GeographicLabelAnchor, GeographicLabelIdentityOptions } from "./label-identity.js";
|
|
5
|
+
export { intersectsScreenBounds, unionScreenBounds, getScreenBoundsCells } from "./screen-bounds.js";
|
|
6
|
+
export type { ScreenBounds, LabelViewport } from "./screen-bounds.js";
|
|
7
|
+
export { default as TileBuildQueue } from "./tile-build-queue.js";
|
|
8
|
+
export type { TileBuildTask } from "./tile-build-queue.js";
|
|
9
|
+
export { TileResidency } from "./tile-residency.js";
|
|
10
|
+
export { TileCachePolicy } from "./tile-cache-policy.js";
|
|
11
|
+
export type { TileCacheRecord, TileCacheOptions, TileCacheStatistics } from "./tile-cache-policy.js";
|
|
12
|
+
export { TERRARIUM_DECODER, TERRAIN_RGB_DECODER, decodeTerrainHeightGrid, sampleTerrainHeight } from "./terrain-data.js";
|
|
13
|
+
export { sampleTerrainNeighborhood, resampleTerrainNodes } from "./terrain-neighborhood.js";
|
|
14
|
+
export { TerrainHeightField } from "./terrain-height-field.js";
|
|
15
|
+
export { TerrainResourceBudget } from "./terrain-resource-budget.js";
|
|
16
|
+
export type { TerrainResourceDomain, TerrainResourceLease, TerrainResourceRequest } from "./terrain-resource-budget.js";
|
|
17
|
+
export { measureTerrainError, boundTerrainMeshError, selectTerrainMeshResolution, boundProjectedDisplacement } from "./terrain-error.js";
|
|
18
|
+
export type { TerrainErrorEnvelope } from "./terrain-error.js";
|
|
19
|
+
export { guardTerrainMotion } from "./terrain-navigation.js";
|
|
20
|
+
export type { TerrainMotionResult } from "./terrain-navigation.js";
|
|
21
|
+
export type { TerrainFieldBounds, TerrainHeightFieldOptions, TerrainHeightFieldStatistics } from "./terrain-height-field.js";
|
|
22
|
+
export { createTerrainGroundTopology } from "./terrain-ground-topology.js";
|
|
23
|
+
export type { TerrainGroundTopology } from "./terrain-ground-topology.js";
|
|
24
|
+
export type { ElevationDecoder, TerrainGridOptions, TerrainHeightGrid } from "./terrain-data.js";
|
|
25
|
+
export { TriangleQueryIndex } from "./triangle-query-index.js";
|
|
26
|
+
export { adaptTerrainQuerySource } from "./terrain-query.js";
|
|
27
|
+
export type { TerrainQuerySource, TerrainQueryHit } from "./terrain-query.js";
|
|
28
|
+
export type { TerrainSurface, TerrainSurfaceBounds, TerrainRay, TerrainSurfaceHit } from "../selection/terrain_surface.js";
|
|
29
|
+
export type { IndexedTriangleHit, TriangleQueryResult, TriangleQueryIndexOptions } from "./triangle-query-index.js";
|
|
30
|
+
export { buildGlobeTerrainMesh, prepareGlobeTerrainMesh, prepareGlobeTerrainMeshSteps, scaleGlobeTerrainMesh, scaleGlobeTerrainMeshSteps, getGlobeTerrainExaggeration } from "./globe-terrain.js";
|
|
31
|
+
export type { GlobeTerrainMesh, GlobeTerrainMeshTemplate } from "./globe-terrain.js";
|
|
32
|
+
export { GlobeTerrainPreparation, getPreparedGlobeTerrainTemplate, assertGlobeTerrainPreparationSnapshot } from "./globe-terrain-preparation.js";
|
|
33
|
+
export type { GlobeTerrainPreparationSnapshot, GlobeTerrainPreparationStatistics } from "./globe-terrain-preparation.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Geographic identity retained independently of rendered geometry and cameras. */
|
|
2
|
+
export interface GeographicLabelAnchor {
|
|
3
|
+
/** Source/style/feature/text identity; absent identities cannot deduplicate. */
|
|
4
|
+
readonly identity?: string;
|
|
5
|
+
/** Tile identity; multiple mesh parts of the same tile are not buffered copies. */
|
|
6
|
+
readonly sourceTileIdentity: object | string;
|
|
7
|
+
/** Absolute projected XY in the same units as the world width. */
|
|
8
|
+
readonly anchor: readonly [number, number];
|
|
9
|
+
/** Quantized physical elevation; distinct elevations remain separate labels. */
|
|
10
|
+
readonly height: number;
|
|
11
|
+
/** Source detail used for coordinate quantization, independent of style zoom. */
|
|
12
|
+
readonly sourceZoom: number;
|
|
13
|
+
}
|
|
14
|
+
/** Explicit coordinate conventions; no renderer projection or Earth radius is assumed. */
|
|
15
|
+
export interface GeographicLabelIdentityOptions {
|
|
16
|
+
/** Width of a complete projected world in anchor units. */
|
|
17
|
+
readonly worldWidth: number;
|
|
18
|
+
/** Treat horizontally wrapped copies as the same surface, as on a globe. */
|
|
19
|
+
readonly wrapHorizontal: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Match buffered copies within two 4096-unit source-tile quantization steps. */
|
|
22
|
+
export declare function areGeographicLabelCopies(candidate: GeographicLabelAnchor, previous: GeographicLabelAnchor, options: GeographicLabelIdentityOptions): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ScreenBounds, LabelViewport } from "./screen-bounds.js";
|
|
2
|
+
/** Renderer-independent candidate, already projected and ordered by the caller. */
|
|
3
|
+
export interface ScreenLabelCandidate {
|
|
4
|
+
/** Unique ID within this invocation; also identifies linked candidates. */
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** Visible, padded local CSS-pixel bounds per named view. Empty means hidden. */
|
|
7
|
+
readonly boxes: ReadonlyMap<string, ScreenBounds>;
|
|
8
|
+
/** False skips overlap rejection but retains repeat and identity rules. */
|
|
9
|
+
readonly collide?: boolean;
|
|
10
|
+
/** Optional dependency; reciprocal links form an atomic pair. */
|
|
11
|
+
readonly linkedId?: string;
|
|
12
|
+
/** Key used to compare candidate copies via the supplied identity policy. */
|
|
13
|
+
readonly identity?: string;
|
|
14
|
+
/** Optional repeat group shared by labels representing the same content. */
|
|
15
|
+
readonly repeatGroup?: string;
|
|
16
|
+
/** Minimum CSS-pixel separation between box centers in every shared view. */
|
|
17
|
+
readonly repeatDistance?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Geometry and identity policy supplied by the host, not owned by this algorithm. */
|
|
20
|
+
export interface LabelPlacementOptions<Candidate extends ScreenLabelCandidate> {
|
|
21
|
+
/** Dimensions for every view named by candidate bounds. */
|
|
22
|
+
readonly viewports: ReadonlyMap<string, LabelViewport>;
|
|
23
|
+
/** Optional buffered-copy policy; called only within matching identity groups. */
|
|
24
|
+
readonly isDuplicate?: (candidate: Candidate, previous: Candidate) => boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolve one visibility mask across all views in caller-supplied priority order.
|
|
28
|
+
* Inputs must have unique IDs and finite, ordered, already clipped/padded bounds.
|
|
29
|
+
* No input mutation, global state, camera, tile, worker, DOM or GPU dependency.
|
|
30
|
+
* Reciprocal links are placed atomically; optional children may overlap their parent.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveLabelPlacement<Candidate extends ScreenLabelCandidate>(ordered: readonly Candidate[], options: LabelPlacementOptions<Candidate>): ReadonlyMap<Candidate, boolean>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Axis-aligned CSS-pixel bounds: minimum X/Y followed by maximum X/Y. */
|
|
2
|
+
export type ScreenBounds = readonly [number, number, number, number];
|
|
3
|
+
/** Local viewport dimensions; bounds do not include a canvas/eye origin. */
|
|
4
|
+
export interface LabelViewport {
|
|
5
|
+
/** Local CSS-pixel width. */
|
|
6
|
+
readonly width: number;
|
|
7
|
+
/** Local CSS-pixel height. */
|
|
8
|
+
readonly height: number;
|
|
9
|
+
}
|
|
10
|
+
/** Strict rectangle overlap; touching padded edges do not collide. */
|
|
11
|
+
export declare function intersectsScreenBounds(left: ScreenBounds, right: ScreenBounds): boolean;
|
|
12
|
+
/** Combine parts of one annotation without modifying either input. */
|
|
13
|
+
export declare function unionScreenBounds(left: ScreenBounds | undefined, right: ScreenBounds): ScreenBounds;
|
|
14
|
+
/** Enumerate 64-pixel spatial-index cells, clipped to the visible viewport. */
|
|
15
|
+
export declare function getScreenBoundsCells(box: ScreenBounds, viewport: LabelViewport): Generator<string>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Affine coefficients applied to byte-valued linear RGB, with output in meters. */
|
|
2
|
+
export interface ElevationDecoder {
|
|
3
|
+
/** Red channel multiplier. */
|
|
4
|
+
readonly rScaler: number;
|
|
5
|
+
/** Green channel multiplier. */
|
|
6
|
+
readonly gScaler: number;
|
|
7
|
+
/** Blue channel multiplier. */
|
|
8
|
+
readonly bScaler: number;
|
|
9
|
+
/** Meter offset after channel scaling. */
|
|
10
|
+
readonly offset: number;
|
|
11
|
+
}
|
|
12
|
+
/** Terrarium encoding used by Mapterhorn; compatible with loaders.gl terrain options. */
|
|
13
|
+
export declare const TERRARIUM_DECODER: ElevationDecoder;
|
|
14
|
+
/** Mapbox Terrain-RGB encoding, independent of the tile service. */
|
|
15
|
+
export declare const TERRAIN_RGB_DECODER: ElevationDecoder;
|
|
16
|
+
/** Explicit raster georeferencing; row zero is north and column zero is west. */
|
|
17
|
+
export interface TerrainGridOptions {
|
|
18
|
+
/** Number of columns, at least two. */
|
|
19
|
+
width: number;
|
|
20
|
+
/** Number of rows, at least two. */
|
|
21
|
+
height: number;
|
|
22
|
+
/** Interleaved RGBA bytes, not sRGB-converted samples. */
|
|
23
|
+
pixels: Uint8Array | Uint8ClampedArray;
|
|
24
|
+
/** Decoder shared with loaders.gl. */
|
|
25
|
+
decoder: ElevationDecoder;
|
|
26
|
+
/** [west, south, east, north] in absolute EPSG:3857 meters. */
|
|
27
|
+
bounds: readonly [number, number, number, number];
|
|
28
|
+
/** Explicit vertical reference; do not infer a datum from the provider name. */
|
|
29
|
+
verticalDatum: 'ellipsoidal' | 'orthometric' | 'unknown';
|
|
30
|
+
/** Pixel-aligned validity mask; zero means no data. Alpha is not implicitly interpreted. */
|
|
31
|
+
valid?: Uint8Array;
|
|
32
|
+
/** Raster pixel centers, or samples including both grid edges. */
|
|
33
|
+
registration: 'pixel-center' | 'grid-node';
|
|
34
|
+
}
|
|
35
|
+
/** Detached decoded elevation data; meters are physical heights, never exaggerated. */
|
|
36
|
+
export interface TerrainHeightGrid {
|
|
37
|
+
/** Number of columns. */
|
|
38
|
+
readonly width: number;
|
|
39
|
+
/** Number of rows. */
|
|
40
|
+
readonly height: number;
|
|
41
|
+
/** North-to-south, west-to-east row-major elevation values in meters. */
|
|
42
|
+
readonly heights: Float32Array;
|
|
43
|
+
/** Detached validity mask; invalid heights are NaN. */
|
|
44
|
+
readonly valid: Uint8Array;
|
|
45
|
+
/** Absolute Mercator footprint in meters. */
|
|
46
|
+
readonly bounds: readonly [number, number, number, number];
|
|
47
|
+
/** Vertical reference, without implicit conversions. */
|
|
48
|
+
readonly verticalDatum: TerrainGridOptions['verticalDatum'];
|
|
49
|
+
/** Sampling convention of the decoded pixels. */
|
|
50
|
+
readonly registration: TerrainGridOptions['registration'];
|
|
51
|
+
}
|
|
52
|
+
/** Decode identical byte coefficients to loaders.gl; preserve no-data explicitly. */
|
|
53
|
+
export declare function decodeTerrainHeightGrid(options: TerrainGridOptions): TerrainHeightGrid;
|
|
54
|
+
/** Bilinear height lookup; outside footprints and no-data neighborhoods return null. */
|
|
55
|
+
export declare function sampleTerrainHeight(grid: TerrainHeightGrid, position: readonly [number, number]): number | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { TerrainHeightGrid } from "./terrain-data.js";
|
|
2
|
+
/** Immutable DEM-derived envelope; it says nothing about unloaded finer source detail. */
|
|
3
|
+
export interface TerrainErrorEnvelope {
|
|
4
|
+
/** Lowest and highest valid physical source elevations. */
|
|
5
|
+
readonly minimumHeight: number;
|
|
6
|
+
readonly maximumHeight: number;
|
|
7
|
+
/** Conservative directional bilinear gradient bounds per Mercator meter. */
|
|
8
|
+
readonly eastSlope: number;
|
|
9
|
+
readonly northSlope: number;
|
|
10
|
+
/** Mercator footprint width and height. */
|
|
11
|
+
readonly width: number;
|
|
12
|
+
readonly height: number;
|
|
13
|
+
/** Invalid samples prevent certification of the complete footprint. */
|
|
14
|
+
readonly complete: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Conservative CSS-pixel Lipschitz bound for a projective transform over an
|
|
18
|
+
* absolute XYZ box. Null means the box crosses the eye plane: never substitute
|
|
19
|
+
* a center-only derivative and call it a bounded screen error.
|
|
20
|
+
*/
|
|
21
|
+
export declare function boundProjectedDisplacement(matrix: readonly number[], minimum: readonly [number, number, number], maximum: readonly [number, number, number], viewport: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
}): number | null;
|
|
25
|
+
/** Measure source extrema and adjacent gradients once, retaining no additional sample arrays. */
|
|
26
|
+
export declare function measureTerrainError(grid: TerrainHeightGrid): TerrainErrorEnvelope;
|
|
27
|
+
/**
|
|
28
|
+
* Bound vertical interpolation error by the bilinear field's Lipschitz envelope.
|
|
29
|
+
* Deliberately conservative on ramps: this is not a fitted/sample-only RMSE.
|
|
30
|
+
* A separate spherical sagitta covers surface curvature, in globe-radius units.
|
|
31
|
+
*/
|
|
32
|
+
export declare function boundTerrainMeshError(envelope: TerrainErrorEnvelope, resolution: number): {
|
|
33
|
+
heightError: number;
|
|
34
|
+
globeCurvatureError: number;
|
|
35
|
+
};
|
|
36
|
+
/** Select a dyadic resolution with hysteresis from a caller's conservative pixels-per-unit bounds. */
|
|
37
|
+
export declare function selectTerrainMeshResolution(grids: readonly TerrainHeightGrid[], options: {
|
|
38
|
+
/** Maximum acceptable interpolation-plus-curvature error, CSS pixels; default 2. */
|
|
39
|
+
targetPixels?: number;
|
|
40
|
+
/** Upper bound on projected displacement per physical vertical meter, including exaggeration. */
|
|
41
|
+
pixelsPerMeter: number;
|
|
42
|
+
/** Upper bound on projected displacement per radius-256 globe unit; zero for a planar view. */
|
|
43
|
+
pixelsPerGlobeUnit?: number;
|
|
44
|
+
/** Prior dyadic resolution supplies a 20% coarsening deadband. */
|
|
45
|
+
previousResolution?: number;
|
|
46
|
+
}): {
|
|
47
|
+
resolution: number;
|
|
48
|
+
projectedError: number;
|
|
49
|
+
limited: boolean;
|
|
50
|
+
complete: boolean;
|
|
51
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TerrainHeightGrid } from "./terrain-data.js";
|
|
2
|
+
import type { TerrainFieldBounds } from "./terrain-height-field.js";
|
|
3
|
+
/** Source-independent triangles; tile ownership is clipped after projection, never by moving boundary nodes. */
|
|
4
|
+
export interface TerrainGroundTopology {
|
|
5
|
+
/** Absolute unwrapped EPSG:3857 XY, two components per vertex. */
|
|
6
|
+
positions: Float64Array;
|
|
7
|
+
/** Exact dyadic world fractions: X from the western world edge, Y southward from the northern edge. */
|
|
8
|
+
normalizedPositions: Float64Array;
|
|
9
|
+
/** Exact periodic sampling XY before whole-world translation; may share the positions array in world zero. */
|
|
10
|
+
samplePositions: Float64Array;
|
|
11
|
+
/** Counterclockwise top triangles, including conforming coarse/fine edge nodes. */
|
|
12
|
+
indices: Uint32Array;
|
|
13
|
+
/** Subtract this whole-world X offset before sampling the periodic DEM neighborhood. */
|
|
14
|
+
sampleOffset: number;
|
|
15
|
+
}
|
|
16
|
+
/** Include every touching neighbor's edge knots on a patch boundary, preserving traversal order. */
|
|
17
|
+
export declare function getTerrainEdgeNodes(bounds: TerrainFieldBounds, neighbors: readonly TerrainFieldBounds[], resolution: number, start: readonly [number, number], end: readonly [number, number]): [number, number][];
|
|
18
|
+
/** Quadtree copies shift to the sampling world; optional generic previous fields retain their absolute domain. */
|
|
19
|
+
export declare function wrapTerrainGroundGrids(grids: readonly TerrainHeightGrid[], requireQuadtree?: boolean, samplingWorldOffset?: number): TerrainHeightGrid[];
|
|
20
|
+
/**
|
|
21
|
+
* Build complete DEM-owned cells intersecting a source tile. Do not clip triangles
|
|
22
|
+
* at source/fallback edges: both owners must submit the same curved triangle there.
|
|
23
|
+
* Fragment/query half-open clips select ownership. Current fields must have balanced
|
|
24
|
+
* 2:1 quadtree edges; unsupported fields and exhausted budgets reject, never truncate.
|
|
25
|
+
*/
|
|
26
|
+
export declare function createTerrainGroundTopology(grids: readonly TerrainHeightGrid[], bounds: TerrainFieldBounds, resolution?: number, maxVertices?: number): TerrainGroundTopology;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type TerrainHeightGrid } from "./terrain-data.js";
|
|
2
|
+
/** Absolute EPSG:3857 [west, south, east, north], including zero-width probe bounds. */
|
|
3
|
+
export type TerrainFieldBounds = readonly [number, number, number, number];
|
|
4
|
+
/** Retained mask admission; geometry, source arrays and JavaScript metadata are separate. */
|
|
5
|
+
export interface TerrainHeightFieldOptions {
|
|
6
|
+
/** Maximum retained summed-area mask bytes; default 8 MiB. Zero uses exact sample scans. */
|
|
7
|
+
maxMaskBytes?: number;
|
|
8
|
+
}
|
|
9
|
+
/** Detached operation counts, suitable for deterministic performance tests rather than FPS estimates. */
|
|
10
|
+
export interface TerrainHeightFieldStatistics {
|
|
11
|
+
/** Number of retained immutable source references. */
|
|
12
|
+
grids: number;
|
|
13
|
+
/** Retained summed-area mask bytes, excluding source arrays and tree metadata. */
|
|
14
|
+
maskBytes: number;
|
|
15
|
+
/** Admitted mask constructions, each built at most once per grid. */
|
|
16
|
+
maskBuilds: number;
|
|
17
|
+
/** Validity samples read during mask construction or exact fallback scans. */
|
|
18
|
+
maskSamples: number;
|
|
19
|
+
/** Spatial tree envelopes tested by sampling and coverage queries. */
|
|
20
|
+
boundsTests: number;
|
|
21
|
+
/** Candidate grid footprints visited after tree pruning. */
|
|
22
|
+
candidateGrids: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Immutable-source physical height sampling and conservative footprint admission.
|
|
26
|
+
* Snapshots membership/bounds, not height arrays: do not mutate shared grids.
|
|
27
|
+
* No provider, worker, deck view, GPU resource or implicit longitude wrapping is owned.
|
|
28
|
+
*/
|
|
29
|
+
export declare class TerrainHeightField {
|
|
30
|
+
/** Original order for small-field direct sampling, avoiding tree/sort overhead. */
|
|
31
|
+
private readonly entries;
|
|
32
|
+
/** Immutable spatial tree built once per admitted field. */
|
|
33
|
+
private readonly root;
|
|
34
|
+
/** Fixed retained summed-area mask admission limit. */
|
|
35
|
+
private readonly maxMaskBytes;
|
|
36
|
+
/** Mutable counters never exposed by reference. */
|
|
37
|
+
private readonly statistics;
|
|
38
|
+
/** Retain structurally valid decoded grids with one datum; overlaps preserve ordered sample averaging. */
|
|
39
|
+
constructor(grids: readonly TerrainHeightGrid[], options?: TerrainHeightFieldOptions);
|
|
40
|
+
/** Same ordered bilinear arithmetic, touching-edge tolerance and no-data rule as sampleTerrainNeighborhood. */
|
|
41
|
+
sampleHeight(position: readonly [number, number]): number | null;
|
|
42
|
+
/** Require complete rectangular footprint coverage and no invalid bilinear-support sample; not an exact triangle mask. */
|
|
43
|
+
coversBounds(bounds: TerrainFieldBounds): boolean;
|
|
44
|
+
/** Scalar counters only; callers cannot mutate cache ownership through diagnostics. */
|
|
45
|
+
getStatistics(): TerrainHeightFieldStatistics;
|
|
46
|
+
/**
|
|
47
|
+
* Physical extrema over bilinear cell rectangles in a fully covered probe.
|
|
48
|
+
* A missing footprint or invalid sample returns null, not a clearance
|
|
49
|
+
* certificate. Overlapping grids use a conservative per-grid envelope.
|
|
50
|
+
*/
|
|
51
|
+
getHeightRange(bounds: TerrainFieldBounds): {
|
|
52
|
+
minimum: number;
|
|
53
|
+
maximum: number;
|
|
54
|
+
} | null;
|
|
55
|
+
/** Traverse closed envelopes, then preserve original source order for floating-point accumulation. */
|
|
56
|
+
private findEntries;
|
|
57
|
+
/** Admit a lazy reusable prefix or scan the same support rectangle exactly when it does not fit. */
|
|
58
|
+
private hasMissingSamples;
|
|
59
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TerrainHeightField } from "./terrain-height-field.js";
|
|
2
|
+
/** Conservative swept square-footprint guard; it is not a rigid-body physics solver. */
|
|
3
|
+
export interface TerrainMotionResult {
|
|
4
|
+
/** True only when every admitted path rectangle has valid source coverage. */
|
|
5
|
+
readonly available: boolean;
|
|
6
|
+
/** No translation should be published when true; orientation can still change. */
|
|
7
|
+
readonly blocked: boolean;
|
|
8
|
+
/** Explicit distinction between an obstacle, no-data and a bounded-work refusal. */
|
|
9
|
+
readonly reason: 'clear' | 'terrain' | 'missing' | 'budget';
|
|
10
|
+
/** Exact rectangle queries performed, useful for deterministic work-budget tests. */
|
|
11
|
+
readonly probes: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Guard all intermediate XY coverage and the entire body footprint, not just
|
|
15
|
+
* endpoint/centerline rays. XY and radius are EPSG:3857 meters; Z/clearance are
|
|
16
|
+
* physical vertical meters. A square conservatively contains a circular avatar.
|
|
17
|
+
*/
|
|
18
|
+
export declare function guardTerrainMotion(field: TerrainHeightField, start: readonly [number, number, number], end: readonly [number, number, number], options: {
|
|
19
|
+
/** Half-width of the conservative horizontal footprint in Mercator meters. */
|
|
20
|
+
radius: number;
|
|
21
|
+
/** Required physical eye-to-ground distance. */
|
|
22
|
+
clearance: number;
|
|
23
|
+
/** Maximum horizontal travel per query rectangle, default 2 Mercator meters. */
|
|
24
|
+
maxStep?: number;
|
|
25
|
+
/** Hard rectangle-query cap, default 128. Excessive movement holds translation. */
|
|
26
|
+
maxProbes?: number;
|
|
27
|
+
}): TerrainMotionResult;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type TerrainHeightGrid } from "./terrain-data.js";
|
|
2
|
+
/** Sample touching footprints with shared-edge averaging; callers validate datum and topology. */
|
|
3
|
+
export declare function sampleTerrainNeighborhood(grids: readonly TerrainHeightGrid[], position: readonly [number, number]): number | null;
|
|
4
|
+
/** Reconstruct explicit boundary nodes from pixel-center data and adjacent tiles. */
|
|
5
|
+
export declare function resampleTerrainNodes(grid: TerrainHeightGrid, neighbors?: readonly TerrainHeightGrid[]): TerrainHeightGrid;
|