@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,15 @@
|
|
|
1
|
+
// tangram-layers
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
declare module 'earcut' {
|
|
6
|
+
type EarcutResult = number[];
|
|
7
|
+
|
|
8
|
+
interface EarcutFunction {
|
|
9
|
+
(vertices: number[], holes?: number[], dimensions?: number): EarcutResult;
|
|
10
|
+
flatten(data: number[][][]): {vertices: number[]; holes: number[]; dimensions: number};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const earcut: EarcutFunction;
|
|
14
|
+
export default earcut;
|
|
15
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// tangram-layers
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
export {ClassicWebGLRenderer as Renderer, HostFrame, LumaDeviceRenderer, WebMercatorGlobeVisibilityAdapter, WebMercatorVisibilityAdapter} from '@tangram.gl/tangram-renderer';
|
|
6
|
+
export {DrapedTerrainSurfaceSnapshot} from "./selection/draped-terrain-surface.js";
|
|
7
|
+
export type {TerrainDrapingOptions, TerrainDrapingStatistics} from "./procedures/terrain-draping.js";
|
|
8
|
+
export type {FeatureSelectionResult, FeatureSelectionOptions} from '@tangram.gl/tangram-renderer';
|
|
9
|
+
export {TerrainMeshSurface, TerrainSurfaceCollection, sampleTerrainElevation, resolveTerrainClearance, pickTerrainAt} from "./selection/terrain_surface.js";
|
|
10
|
+
export type {TerrainSurface, TerrainSurfaceBounds, TerrainRay, TerrainSurfaceHit, TerrainMeshOptions, TerrainMeshStatistics, TerrainSurfaceEntry, TerrainCollectionHit, TerrainElevationProbe} from "./selection/terrain_surface.js";
|
|
11
|
+
export {calculatePlanarGroundBounds, calculatePlanarVolumeBounds} from "./scene/ground_footprint.js";
|
|
12
|
+
export {validateProjectedLights} from "./procedures/mesh-projector.js";
|
|
13
|
+
export {normalizeProjectedBasemapOptions} from "./procedures/mesh-projector.js";
|
|
14
|
+
export {getProjectedRoadUnit} from "./procedures/mesh-projector.js";
|
|
15
|
+
export {countProjectedTileCoordinates, getTileGeographicBounds} from "./tile/tile_traversal_adapter.js";
|
|
16
|
+
export {getProjectedCoordinateOptions, PROJECTED_COMMON_SCALE} from "./procedures/projected-coordinate-transform.js";
|
|
17
|
+
export {ProjectionBatchExecutor} from './procedures/projection-batch-executor.js';
|
|
18
|
+
export type {ProjectionExecutionOptions, ProjectionExecutionStatistics, ProjectionBatchRequestOptions} from './procedures/projection-batch-executor.js';
|
|
19
|
+
export type {ProjectedBasemapOptions, MeshProjectionStatistics} from "./procedures/mesh-projector.js";
|
|
20
|
+
export {PROJECTION_CONSTANTS, projectGeographicPosition, projectGeographicVector, unprojectGlobePosition, getGeographicProjectionProcedure} from "./scene/projection_math.js";
|
|
21
|
+
export type {GeographicProjectionPosition, GeographicProjectionProcedure} from "./scene/projection_math.js";
|
|
22
|
+
export {convertLumaLight, mapTangramLight} from "./lights/light-definitions.js";
|
|
23
|
+
export type {ResolvedTangramLight, TangramLightMapping, TangramLight, TangramAmbientLight,
|
|
24
|
+
TangramDirectionalLight, TangramPointLight, TangramSpotLight, TangramLightExtensions,
|
|
25
|
+
TangramPositionalLightExtensions, TangramLightColor} from "./lights/light-definitions.js";
|
|
26
|
+
export type {Light as LumaLight} from '@luma.gl/shadertools';
|
|
27
|
+
export type {TangramTileSourceMetadata} from "./sources/tile_source_metadata.js";
|
|
28
|
+
export type {HostFrameOptions, HostRenderView, HostTileLODOptions, HostTileResourceOptions, TileResourceStatistics, TileSourceStatistics, HostCamera, HostProjection, GeographicAnchor, LegacyHostFrame, RendererOptions, RenderOptions, Viewport, SceneDefinition, SceneListeners, SceneLoadOptions, VisibilityLODAdapter, GlobeVisibilityLODAdapter, VisibilityViewState, GlobeVisibilityViewState, CalculatedViewBounds} from '@tangram.gl/tangram-renderer';
|
|
29
|
+
export type {ProjectionEngine, ProjectionEngineOptions, ProjectionEngineTransform} from './types.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type VertexLayout from "./vertex_layout.js";
|
|
2
|
+
type VertexAttribute = VertexLayout['dynamic_attribs'][number];
|
|
3
|
+
/** Packed triangle data after projection-aware refinement. */
|
|
4
|
+
export type GlobeMeshData = {
|
|
5
|
+
/** Interleaved vertices, with the original vertices retained at their original indices. */
|
|
6
|
+
vertices: Uint8Array;
|
|
7
|
+
/** Triangle indices, promoted to 32 bits when necessary. */
|
|
8
|
+
indices: Uint16Array | Uint32Array;
|
|
9
|
+
};
|
|
10
|
+
/** Limits for globe refinement in Tangram tile-local coordinates. */
|
|
11
|
+
export type GlobeMeshOptions = {
|
|
12
|
+
/** Actual source tile zoom, not the style zoom. */
|
|
13
|
+
tileZoom: number;
|
|
14
|
+
/** Tile-local units per tile edge. */
|
|
15
|
+
tileScale?: number;
|
|
16
|
+
/** Maximum Mercator angular edge span; conservatively bounds spherical span. */
|
|
17
|
+
maxAngularSpan?: number;
|
|
18
|
+
/** Maximum additional vertices; additional triangles are limited to twice this budget. */
|
|
19
|
+
maxAdditionalVertices?: number;
|
|
20
|
+
/** Optional expanded tile-space position for packed ribbons; never changes the preserved attributes. */
|
|
21
|
+
getPosition?: (vertex: DataView) => [number, number];
|
|
22
|
+
/** Optional packed height for topology checks on elevated surfaces; curvature still uses XY. */
|
|
23
|
+
getElevation?: (vertex: DataView) => number;
|
|
24
|
+
/** Optional additional edge decision; callers must use the same criterion across adjacent meshes. */
|
|
25
|
+
shouldSplitEdge?: (first: DataView, second: DataView) => boolean;
|
|
26
|
+
/** Fan partial-edge refinements around an interior vertex instead of introducing a long diagonal. */
|
|
27
|
+
splitRemainderInterior?: boolean;
|
|
28
|
+
/** Choose the shorter green-refinement diagonal; useful for floating terrain ribbons and thin MVT faces. */
|
|
29
|
+
splitRemainderShortest?: boolean;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Split long triangle edges before spherical projection. Shared indexed edges share
|
|
33
|
+
* midpoints; independent tile edges use the same quantized midpoint rule. Selection
|
|
34
|
+
* IDs and layer order remain flat. Unknown varying attributes are rejected rather
|
|
35
|
+
* than guessing their interpolation semantics. Camera state is deliberately absent.
|
|
36
|
+
*/
|
|
37
|
+
export declare function refineGlobeMesh(vertices: Uint8Array, indices: Uint16Array | Uint32Array | false, layout: {
|
|
38
|
+
stride: number;
|
|
39
|
+
dynamic_attribs: VertexAttribute[];
|
|
40
|
+
}, options: GlobeMeshOptions): GlobeMeshData;
|
|
41
|
+
/** Choose the dominant source-space plane so vertical walls retain the same packed-precision checks as roofs. */
|
|
42
|
+
export declare function selectTrianglePlane(points: readonly (readonly [number, number, number])[]): readonly [0 | 1 | 2, 0 | 1 | 2];
|
|
43
|
+
/** Preserve Tangram's packed interpolation and flat IDs at refinement or clipping intersections. */
|
|
44
|
+
export declare function interpolatePackedVertex(first: Uint8Array, second: Uint8Array, layout: {
|
|
45
|
+
stride: number;
|
|
46
|
+
dynamic_attribs: VertexAttribute[];
|
|
47
|
+
}, fraction: number): Uint8Array;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type UniformValue = number | string | boolean | number[] | string[] | number[][];
|
|
2
|
+
type ParsedUniform = {
|
|
3
|
+
type: string;
|
|
4
|
+
method: string;
|
|
5
|
+
name: string;
|
|
6
|
+
value: UniformValue;
|
|
7
|
+
path: (string | number)[];
|
|
8
|
+
};
|
|
9
|
+
interface GLSLNamespace {
|
|
10
|
+
parseUniforms(uniforms?: Record<string, unknown>): ParsedUniform[];
|
|
11
|
+
defineVariable(name: string, value: unknown): string | undefined;
|
|
12
|
+
defineUniform(name: string, value: unknown): string | undefined;
|
|
13
|
+
expandVec3(value: UniformValue, z?: number): number[] | undefined;
|
|
14
|
+
expandVec4(value: UniformValue, w?: number): number[] | undefined;
|
|
15
|
+
}
|
|
16
|
+
declare const GLSL: GLSLNamespace;
|
|
17
|
+
export default GLSL;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Packed signed-short height units per physical meter, shared by builders and optional projection workers. */
|
|
2
|
+
export declare const PACKED_HEIGHT_SCALE = 16;
|
|
3
|
+
/** Validate physical annotation meters before signed-short storage can silently wrap. */
|
|
4
|
+
export declare function packProjectedAnnotationHeight(height: unknown, allowElevation?: boolean): number;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { BufferLayout, VertexFormat } from '@luma.gl/core';
|
|
2
|
+
/** Numeric views used to pack Tangram's heterogeneous interleaved vertex data. */
|
|
3
|
+
export type VertexArray = Float32Array | Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array;
|
|
4
|
+
/** Views of the same backing allocation indexed by legacy GL component type. */
|
|
5
|
+
export type VertexBufferViews = Record<number, VertexArray>;
|
|
6
|
+
/** Generated writer preserving component offsets and packed conversion semantics. */
|
|
7
|
+
export type AddVertexFunction = (vertex: number[], views: VertexBufferViews, offset: number) => void;
|
|
8
|
+
/** Authored attribute plus the offsets populated by VertexLayout construction. */
|
|
9
|
+
export interface VertexAttribute {
|
|
10
|
+
name: string;
|
|
11
|
+
size: number;
|
|
12
|
+
type: number;
|
|
13
|
+
normalized?: boolean;
|
|
14
|
+
static?: number | number[] | null;
|
|
15
|
+
offset?: number;
|
|
16
|
+
byte_size?: number;
|
|
17
|
+
method?: `vertexAttrib${1 | 2 | 3 | 4}fv`;
|
|
18
|
+
}
|
|
19
|
+
/** Portable layout returned after all dynamic attribute offsets are assigned. */
|
|
20
|
+
export type VertexBufferLayout = BufferLayout & {
|
|
21
|
+
attributes: {
|
|
22
|
+
attribute: string;
|
|
23
|
+
format: VertexFormat;
|
|
24
|
+
byteOffset: number;
|
|
25
|
+
}[];
|
|
26
|
+
};
|
|
27
|
+
/** Shader-side attribute lookup consumed by the classic binding path. */
|
|
28
|
+
export interface VertexAttributeProgram {
|
|
29
|
+
attribute(name: string): {
|
|
30
|
+
location: number;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** Classic WebGL operations consumed by layouts; portable devices bypass this surface. */
|
|
34
|
+
export type VertexAttributeContext = Pick<WebGLRenderingContext, 'enableVertexAttribArray' | 'disableVertexAttribArray' | 'vertexAttribPointer'> & Partial<Record<`vertexAttrib${1 | 2 | 3 | 4}fv`, (location: number, value: number[]) => void>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import VertexElements from "./vertex_elements.js";
|
|
2
|
+
import type { VertexAttribute, AddVertexFunction, VertexBufferViews } from "./vertex-types.js";
|
|
3
|
+
type VertexLayoutLike = {
|
|
4
|
+
stride: number;
|
|
5
|
+
index: Record<string, number>;
|
|
6
|
+
dynamic_attribs: VertexAttribute[];
|
|
7
|
+
getAddVertexFunction(): AddVertexFunction;
|
|
8
|
+
};
|
|
9
|
+
export default class VertexData {
|
|
10
|
+
static array_pool: Uint8Array[];
|
|
11
|
+
vertex_layout: VertexLayoutLike;
|
|
12
|
+
vertex_elements: VertexElements;
|
|
13
|
+
stride: number;
|
|
14
|
+
vertex_buffer: Uint8Array;
|
|
15
|
+
element_buffer: Uint16Array | Uint32Array | false;
|
|
16
|
+
byte_length: number;
|
|
17
|
+
size: number;
|
|
18
|
+
offset: number;
|
|
19
|
+
vertex_count: number;
|
|
20
|
+
realloc_count: number;
|
|
21
|
+
views: VertexBufferViews;
|
|
22
|
+
vertexLayoutAddVertex: AddVertexFunction;
|
|
23
|
+
constructor(vertex_layout: VertexLayoutLike, { prealloc }?: {
|
|
24
|
+
prealloc?: number;
|
|
25
|
+
});
|
|
26
|
+
setBufferViews(): void;
|
|
27
|
+
checkBufferSize(): void;
|
|
28
|
+
setAddVertexFunction(): void;
|
|
29
|
+
addVertex(vertex: number[]): void;
|
|
30
|
+
end(): this;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import VertexData from "./vertex_data.js";
|
|
2
|
+
import type { VertexAttribute, AddVertexFunction, VertexAttributeProgram, VertexAttributeContext, VertexBufferLayout } from "./vertex-types.js";
|
|
3
|
+
type VertexComponent = {
|
|
4
|
+
type: number;
|
|
5
|
+
shift: number;
|
|
6
|
+
offset: number;
|
|
7
|
+
index: number;
|
|
8
|
+
};
|
|
9
|
+
export default class VertexLayout {
|
|
10
|
+
static enabled_attribs: Record<string, VertexAttributeProgram>;
|
|
11
|
+
static add_vertex_funcs: Record<number, AddVertexFunction>;
|
|
12
|
+
attribs: VertexAttribute[];
|
|
13
|
+
dynamic_attribs: VertexAttribute[];
|
|
14
|
+
static_attribs: VertexAttribute[];
|
|
15
|
+
components: VertexComponent[];
|
|
16
|
+
index: Record<string, number>;
|
|
17
|
+
offset: Record<string, number>;
|
|
18
|
+
stride: number;
|
|
19
|
+
addVertex?: AddVertexFunction;
|
|
20
|
+
constructor(attribs: VertexAttribute[]);
|
|
21
|
+
enableDynamicAttributes(gl: VertexAttributeContext, program: VertexAttributeProgram): void;
|
|
22
|
+
enableStaticAttributes(gl: VertexAttributeContext, program: VertexAttributeProgram): void;
|
|
23
|
+
createVertexData(): VertexData;
|
|
24
|
+
getBufferLayout(name?: string): VertexBufferLayout;
|
|
25
|
+
getStaticAttributes(): {
|
|
26
|
+
attribute: string;
|
|
27
|
+
value: number[];
|
|
28
|
+
}[];
|
|
29
|
+
getAddVertexFunction(): AddVertexFunction;
|
|
30
|
+
createAddVertexFunction(): void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// tangram-layers
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
declare module '*.glsl' {
|
|
6
|
+
const source: string;
|
|
7
|
+
export default source;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Vite raw shader assets used by the real-device conformance tests. */
|
|
11
|
+
declare module '*.glsl?raw' {
|
|
12
|
+
const source: string;
|
|
13
|
+
export default source;
|
|
14
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Buffer, Texture } from '@luma.gl/core';
|
|
2
|
+
import type { Device, RenderPipeline, RenderPipelineParameters, RenderPass, VertexArray } from '@luma.gl/core';
|
|
3
|
+
import type { TangramDrawableMesh, TangramDrawableProgram, TangramGPUBackend, TangramGPUSceneOptions, TangramMeshBufferOptions, TangramMeshDrawDescriptor, TangramMeshDrawOptions, TangramRenderStateOptions, TangramShaderOptions, TangramShaderProgramOptions, TangramTextureOptions, TangramUniformBufferOptions } from "./tangram_gpu_backend.js";
|
|
4
|
+
/**
|
|
5
|
+
* Portable Tangram GPU backend implemented exclusively with the luma.gl Device API.
|
|
6
|
+
*
|
|
7
|
+
* This class deliberately never reads `device.handle`. It owns resources and draw
|
|
8
|
+
* submission while Tangram continues to own tile building and scene traversal.
|
|
9
|
+
*
|
|
10
|
+
* @implements {import('./tangram_gpu_backend').TangramGPUBackend}
|
|
11
|
+
*/
|
|
12
|
+
export default class LumaDeviceRenderer implements TangramGPUBackend {
|
|
13
|
+
readonly device: Device;
|
|
14
|
+
/** Shader/layout/state cache; keys do not keep scene programs alive. */
|
|
15
|
+
private pipeline_cache;
|
|
16
|
+
/** Mesh/pipeline vertex-array cache. */
|
|
17
|
+
private mesh_resource_cache;
|
|
18
|
+
/** Live program generations; released on recompilation/destruction or backend teardown. */
|
|
19
|
+
private program_resources;
|
|
20
|
+
/** Live mesh resources; released on tile eviction or backend teardown. */
|
|
21
|
+
private mesh_resources;
|
|
22
|
+
/** A destroyed backend cannot reuse cached or host resources. */
|
|
23
|
+
private destroyed;
|
|
24
|
+
/** Restore native types at the capability-only wrapper boundary, without asserting a resource facade. */
|
|
25
|
+
private readonly bindingResources;
|
|
26
|
+
constructor(device: Device);
|
|
27
|
+
/** Shader language selected by the host device. */
|
|
28
|
+
get shaderLanguage(): "glsl" | "wgsl";
|
|
29
|
+
/** Maximum supported two-dimensional texture dimension. */
|
|
30
|
+
get maxTextureSize(): number;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the resource factories consumed by Tangram Scene and Style objects.
|
|
33
|
+
*/
|
|
34
|
+
getSceneOptions(): TangramGPUSceneOptions;
|
|
35
|
+
/** Creates a luma.gl uniform buffer. */
|
|
36
|
+
createUniformBuffer(options: TangramUniformBufferOptions): Buffer;
|
|
37
|
+
/** Creates a shader in the language supported by the active device. */
|
|
38
|
+
createShader(options: TangramShaderOptions): import("@luma.gl/core").Shader;
|
|
39
|
+
/** Validates a device-owned shader pair when the backend supports layout-free linking. */
|
|
40
|
+
validateShaderProgram({ id, vertexShader, fragmentShader }: TangramShaderProgramOptions): void;
|
|
41
|
+
/** Creates a luma.gl vertex or index buffer. */
|
|
42
|
+
createMeshBuffer(options: TangramMeshBufferOptions): Buffer;
|
|
43
|
+
/** Creates and initializes a luma.gl texture. */
|
|
44
|
+
createTexture(options: TangramTextureOptions): Texture;
|
|
45
|
+
/** Translates normalized Tangram state into luma.gl pipeline parameters. */
|
|
46
|
+
getRenderPipelineParameters({ depthTest, depthWrite, cullFace, blend }: TangramRenderStateOptions): RenderPipelineParameters;
|
|
47
|
+
/** Draws one Tangram mesh into a host-provided luma.gl RenderPass. */
|
|
48
|
+
drawMesh({ mesh, program, renderPass, renderState, visibleTime }: TangramMeshDrawOptions): boolean;
|
|
49
|
+
/** Destroys cached pipelines, vertex arrays and uniform snapshots, not the host device. */
|
|
50
|
+
destroy(): void;
|
|
51
|
+
/** Copies mutable uniform blocks into storage unique to the encoded mesh draw. */
|
|
52
|
+
snapshotMeshUniformBindings(mesh: TangramDrawableMesh, program: TangramDrawableProgram, bindings: Record<string, object>): void;
|
|
53
|
+
/** Cache pipelines by geometry, render state and the active pass's attachment formats. */
|
|
54
|
+
getPipeline(program: TangramDrawableProgram, vertex_layout: object, descriptor: TangramMeshDrawDescriptor, render_state?: RenderPipelineParameters, renderPass?: RenderPass): RenderPipeline;
|
|
55
|
+
getVertexArray(mesh: TangramDrawableMesh, pipeline: RenderPipeline, descriptor: TangramMeshDrawDescriptor): VertexArray;
|
|
56
|
+
/** Create one cleanup generation per program without retaining the owner in a callback. */
|
|
57
|
+
private getProgramResources;
|
|
58
|
+
/** Reuse live mesh storage, and observe only the resources belonging to that mesh. */
|
|
59
|
+
private getMeshResources;
|
|
60
|
+
/** Release a mesh's cached draw resources, leaving shared program pipelines alive. */
|
|
61
|
+
private disposeMeshResources;
|
|
62
|
+
/** Invalidate dependent vertex arrays before retiring one program generation's pipelines. */
|
|
63
|
+
private disposeProgramResources;
|
|
64
|
+
/** Prevent draw-time reuse after final backend teardown. */
|
|
65
|
+
private assertAlive;
|
|
66
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Register cache cleanup for a mesh retirement or shader-resource replacement. */
|
|
2
|
+
export declare function observeGPUResourceDisposal(owner: object, dispose: () => void): () => void;
|
|
3
|
+
/** Drain a generation's observers, even if one fails or registers a new generation. */
|
|
4
|
+
export declare function notifyGPUResourceDisposal(owner: object): void;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { Buffer, BufferLayout, Device, ExternalImage, RenderPass, RenderPipelineParameters, PrimitiveTopology, Shader, Texture, UniformValue } from '@luma.gl/core';
|
|
2
|
+
/** Shader languages supported by Tangram's portable GPU backend. */
|
|
3
|
+
export type TangramShaderLanguage = 'glsl' | 'wgsl';
|
|
4
|
+
/** Options used to allocate a Tangram uniform buffer. */
|
|
5
|
+
export type TangramUniformBufferOptions = {
|
|
6
|
+
id: string;
|
|
7
|
+
usage: 'uniform';
|
|
8
|
+
byteLength: number;
|
|
9
|
+
};
|
|
10
|
+
/** Options used to allocate a Tangram vertex or index buffer. */
|
|
11
|
+
export type TangramMeshBufferOptions = {
|
|
12
|
+
id: string;
|
|
13
|
+
usage: 'vertex' | 'index';
|
|
14
|
+
data: ArrayBuffer | ArrayBufferView;
|
|
15
|
+
indexType?: 'uint16' | 'uint32';
|
|
16
|
+
};
|
|
17
|
+
/** Options used to compile one stage of a Tangram shader program. */
|
|
18
|
+
export type TangramShaderOptions = {
|
|
19
|
+
id: string;
|
|
20
|
+
language?: TangramShaderLanguage;
|
|
21
|
+
stage: 'vertex' | 'fragment';
|
|
22
|
+
source: string;
|
|
23
|
+
entryPoint?: string;
|
|
24
|
+
};
|
|
25
|
+
/** Options used to validate a linked Tangram shader pair. */
|
|
26
|
+
export type TangramShaderProgramOptions = {
|
|
27
|
+
id: string;
|
|
28
|
+
vertexShader: Shader;
|
|
29
|
+
fragmentShader: Shader;
|
|
30
|
+
};
|
|
31
|
+
/** Options used to allocate and initialize a Tangram texture. */
|
|
32
|
+
export type TangramTextureOptions = {
|
|
33
|
+
id: string;
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
data?: ArrayBuffer | ArrayBufferView | ExternalImage;
|
|
37
|
+
filtering?: 'nearest' | 'linear' | 'mipmap';
|
|
38
|
+
repeat?: boolean;
|
|
39
|
+
flipY?: boolean;
|
|
40
|
+
premultipliedAlpha?: boolean;
|
|
41
|
+
};
|
|
42
|
+
/** Portable mesh submission passed from Tangram scene traversal to a GPU backend. */
|
|
43
|
+
export type TangramMeshDrawOptions = {
|
|
44
|
+
mesh: TangramDrawableMesh;
|
|
45
|
+
program: TangramDrawableProgram;
|
|
46
|
+
renderPass: RenderPass;
|
|
47
|
+
renderState?: RenderPipelineParameters;
|
|
48
|
+
visibleTime: number;
|
|
49
|
+
};
|
|
50
|
+
/** GPU resources and layout needed to submit one portable mesh. */
|
|
51
|
+
export type TangramMeshDrawDescriptor = {
|
|
52
|
+
topology: PrimitiveTopology;
|
|
53
|
+
vertexCount: number;
|
|
54
|
+
indexCount: number;
|
|
55
|
+
vertexBuffer: Buffer | null;
|
|
56
|
+
indexBuffer: Buffer | null;
|
|
57
|
+
bufferLayout: BufferLayout & {
|
|
58
|
+
attributes: NonNullable<BufferLayout['attributes']>;
|
|
59
|
+
};
|
|
60
|
+
staticAttributes: {
|
|
61
|
+
attribute: string;
|
|
62
|
+
value: readonly number[];
|
|
63
|
+
}[];
|
|
64
|
+
};
|
|
65
|
+
/** Scene-owned mesh state consumed by the device backend. */
|
|
66
|
+
export type TangramDrawableMesh = {
|
|
67
|
+
id: string | number;
|
|
68
|
+
vertex_layout: object;
|
|
69
|
+
uniforms?: Record<string, unknown>;
|
|
70
|
+
getDrawDescriptor(): TangramMeshDrawDescriptor;
|
|
71
|
+
};
|
|
72
|
+
/** Mutable uniform block whose contents can be snapshotted per encoded draw. */
|
|
73
|
+
export type TangramDrawableUniformBlock = {
|
|
74
|
+
snapshot_per_mesh: boolean;
|
|
75
|
+
data: ArrayBuffer | null;
|
|
76
|
+
byteLength: number;
|
|
77
|
+
};
|
|
78
|
+
/** Shader and uniform operations required by the device submission path. */
|
|
79
|
+
export type TangramDrawableProgram = {
|
|
80
|
+
id: string | number;
|
|
81
|
+
name?: string;
|
|
82
|
+
vertex_shader_resource: Shader | null | undefined;
|
|
83
|
+
fragment_shader_resource: Shader | null | undefined;
|
|
84
|
+
uniform_blocks?: Record<string, TangramDrawableUniformBlock>;
|
|
85
|
+
saveUniforms(uniforms: Record<string, unknown>): void;
|
|
86
|
+
setUniforms(uniforms: Record<string, unknown>, resetTextureUnit: boolean): void;
|
|
87
|
+
restoreUniforms(uniforms: Record<string, unknown>): void;
|
|
88
|
+
uniform(method: string, name: string, value: number): void;
|
|
89
|
+
getBindings(): Record<string, object>;
|
|
90
|
+
getUniformValues(): Record<string, UniformValue>;
|
|
91
|
+
};
|
|
92
|
+
/** Tangram blend modes accepted by the portable renderer. */
|
|
93
|
+
export type TangramBlendMode = false | 'opaque' | 'overlay' | 'inlay' | 'translucent' | 'add' | 'multiply';
|
|
94
|
+
/** Normalized Tangram state used to create a luma.gl render pipeline. */
|
|
95
|
+
export type TangramRenderStateOptions = {
|
|
96
|
+
depthTest: boolean;
|
|
97
|
+
depthWrite: boolean;
|
|
98
|
+
cullFace: boolean;
|
|
99
|
+
blend: TangramBlendMode;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Scene integration hooks supplied by a portable Tangram GPU backend.
|
|
103
|
+
*
|
|
104
|
+
* This compatibility shape keeps the current Scene and Style internals isolated
|
|
105
|
+
* while their individual resource wrappers are migrated to the backend contract.
|
|
106
|
+
*/
|
|
107
|
+
export type TangramGPUSceneOptions = {
|
|
108
|
+
enableUniformBuffers: true;
|
|
109
|
+
deviceShaderCompilation: true;
|
|
110
|
+
shaderLanguage: TangramShaderLanguage;
|
|
111
|
+
uniformBufferFactory: (options: TangramUniformBufferOptions) => Buffer;
|
|
112
|
+
shaderFactory: (options: TangramShaderOptions) => Shader;
|
|
113
|
+
shaderProgramValidator: (options: TangramShaderProgramOptions) => void;
|
|
114
|
+
meshBufferFactory: (options: TangramMeshBufferOptions) => Buffer;
|
|
115
|
+
textureFactory: (options: TangramTextureOptions) => Texture;
|
|
116
|
+
maxTextureSize?: number;
|
|
117
|
+
meshRenderer: TangramGPUBackend;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Renderer-independent boundary for Tangram GPU resource ownership and drawing.
|
|
121
|
+
*
|
|
122
|
+
* `LumaDeviceRenderer` is the current and only implementation. It owns the
|
|
123
|
+
* resources it creates but does not own the host device or render pass. The
|
|
124
|
+
* interface intentionally contains no deck.gl types.
|
|
125
|
+
*/
|
|
126
|
+
export interface TangramGPUBackend {
|
|
127
|
+
/** Host-owned luma.gl device used by this backend. */
|
|
128
|
+
readonly device: Device;
|
|
129
|
+
/** Shader language compiled by this backend. */
|
|
130
|
+
readonly shaderLanguage: TangramShaderLanguage;
|
|
131
|
+
/** Maximum supported two-dimensional texture dimension, when known. */
|
|
132
|
+
readonly maxTextureSize?: number;
|
|
133
|
+
/** Returns the compatibility hooks consumed by current Scene internals. */
|
|
134
|
+
getSceneOptions(): TangramGPUSceneOptions;
|
|
135
|
+
/** Allocates a uniform buffer. */
|
|
136
|
+
createUniformBuffer(options: TangramUniformBufferOptions): Buffer;
|
|
137
|
+
/** Allocates a vertex or index buffer. */
|
|
138
|
+
createMeshBuffer(options: TangramMeshBufferOptions): Buffer;
|
|
139
|
+
/** Compiles a shader stage. */
|
|
140
|
+
createShader(options: TangramShaderOptions): Shader;
|
|
141
|
+
/** Validates a linked shader pair. */
|
|
142
|
+
validateShaderProgram(options: TangramShaderProgramOptions): void;
|
|
143
|
+
/** Allocates and initializes a texture. */
|
|
144
|
+
createTexture(options: TangramTextureOptions): Texture;
|
|
145
|
+
/** Submits one mesh to a host-owned render pass. */
|
|
146
|
+
drawMesh(options: TangramMeshDrawOptions): boolean;
|
|
147
|
+
/** Translates Tangram state into luma.gl render-pipeline parameters. */
|
|
148
|
+
getRenderPipelineParameters(options: TangramRenderStateOptions): RenderPipelineParameters;
|
|
149
|
+
/** Releases resources owned by this backend. */
|
|
150
|
+
destroy(): void;
|
|
151
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// tangram-layers
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
HostFrameOptions,
|
|
7
|
+
HostRenderView,
|
|
8
|
+
LegacyHostFrame,
|
|
9
|
+
RendererOptions,
|
|
10
|
+
RenderOptions,
|
|
11
|
+
SceneDataSource,
|
|
12
|
+
SceneDefinition,
|
|
13
|
+
SceneListeners,
|
|
14
|
+
SceneLoadOptions,
|
|
15
|
+
SceneQueryOptions,
|
|
16
|
+
SceneScreenshot,
|
|
17
|
+
SceneFeature,
|
|
18
|
+
SceneUpdateOptions,
|
|
19
|
+
Viewport
|
|
20
|
+
} from './types.js';
|
|
21
|
+
export type {FeatureSelectionResult, FeatureSelectionOptions} from './types.js';
|
|
22
|
+
export {DrapedTerrainSurfaceSnapshot} from "./selection/draped-terrain-surface.js";
|
|
23
|
+
export {TerrainMeshSurface, TerrainSurfaceCollection, sampleTerrainElevation, resolveTerrainClearance, pickTerrainAt} from "./selection/terrain_surface.js";
|
|
24
|
+
export type {TerrainSurface, TerrainSurfaceBounds, TerrainRay, TerrainSurfaceHit, TerrainMeshOptions, TerrainMeshStatistics, TerrainSurfaceEntry, TerrainCollectionHit, TerrainElevationProbe} from "./selection/terrain_surface.js";
|
|
25
|
+
export type {
|
|
26
|
+
TangramGPUBackend,
|
|
27
|
+
TangramGPUSceneOptions,
|
|
28
|
+
TangramMeshBufferOptions,
|
|
29
|
+
TangramMeshDrawOptions,
|
|
30
|
+
TangramMeshDrawDescriptor,
|
|
31
|
+
TangramDrawableMesh,
|
|
32
|
+
TangramDrawableProgram,
|
|
33
|
+
TangramDrawableUniformBlock,
|
|
34
|
+
TangramRenderStateOptions,
|
|
35
|
+
TangramShaderLanguage,
|
|
36
|
+
TangramShaderOptions,
|
|
37
|
+
TangramShaderProgramOptions,
|
|
38
|
+
TangramTextureOptions,
|
|
39
|
+
TangramUniformBufferOptions
|
|
40
|
+
} from './gpu/tangram_gpu_backend.js';
|
|
41
|
+
|
|
42
|
+
export type {Matrix4, Vector3, SceneDefinition, Viewport, GeographicAnchor, HostProjection, HostCamera, HostRenderView, HostTileLODOptions, HostTileResourceOptions, TileResourceStatistics, TileSourceStatistics, HostFrameOptions, LegacyHostFrame, RendererOptions, SceneLoadOptions, SceneUpdateOptions, SceneDataSource, SceneFeature, SceneQueryOptions, SceneScreenshot, RenderOptions, SceneConfigEvent, SceneErrorEvent, SceneEventMap, SceneListener, SceneListeners, WorkerRequest, WorkerResponse, WorkerBrokerMessage} from './types.js';
|
|
43
|
+
export {
|
|
44
|
+
WebMercatorGlobeVisibilityAdapter,
|
|
45
|
+
WebMercatorVisibilityAdapter
|
|
46
|
+
} from './scene/visibility_adapter.js';
|
|
47
|
+
export type {
|
|
48
|
+
CalculatedViewBounds,
|
|
49
|
+
GlobeVisibilityLODAdapter,
|
|
50
|
+
GlobeVisibilityViewState,
|
|
51
|
+
VisibilityLODAdapter,
|
|
52
|
+
VisibilityViewState
|
|
53
|
+
} from './scene/visibility_adapter.js';
|
|
54
|
+
|
|
55
|
+
import HostFrame from "./scene/host_frame.js";
|
|
56
|
+
import LumaDeviceRenderer from './gpu/luma_device_renderer.js';
|
|
57
|
+
export {HostFrame};
|
|
58
|
+
export {LumaDeviceRenderer};
|
|
59
|
+
export {calculatePlanarGroundBounds, calculatePlanarVolumeBounds} from "./scene/ground_footprint.js";
|
|
60
|
+
export {convertLumaLight, mapTangramLight} from "./lights/light-definitions.js";
|
|
61
|
+
export type {ResolvedTangramLight, TangramLightMapping, TangramLight, TangramAmbientLight,
|
|
62
|
+
TangramDirectionalLight, TangramPointLight, TangramSpotLight, TangramLightExtensions,
|
|
63
|
+
TangramPositionalLightExtensions, TangramLightColor, NormalizedTangramLight} from "./lights/light-definitions.js";
|
|
64
|
+
export type {Light as LumaLight} from '@luma.gl/shadertools';
|
|
65
|
+
export type {TangramTileSourceMetadata} from "./sources/tile_source_metadata.js";
|
|
66
|
+
export type {MeshProjectionStatistics} from "./procedures/mesh-projector.js";
|
|
67
|
+
export type {ProjectionExecutionOptions, ProjectionExecutionStatistics} from './procedures/projection-batch-executor.js';
|
|
68
|
+
|
|
69
|
+
export declare class Scene {
|
|
70
|
+
/** Normalized animation policy read by host-driven layer integrations. */
|
|
71
|
+
config: {scene?: {animated?: boolean}} | null;
|
|
72
|
+
/** Run a synchronous operation inside the renderer's existing shared WebGL state scope. */
|
|
73
|
+
withWebGLContext<Value>(operation: () => Value): Value;
|
|
74
|
+
static create(config: SceneDefinition, options?: RendererOptions): Scene;
|
|
75
|
+
subscribe(listeners: SceneListeners): void;
|
|
76
|
+
unsubscribe(listeners: SceneListeners): void;
|
|
77
|
+
load(config?: SceneDefinition | null, options?: SceneLoadOptions): Promise<unknown>;
|
|
78
|
+
updateConfig(options?: SceneUpdateOptions): Promise<void>;
|
|
79
|
+
/** Deduplicated source/TileJSON credits; HTML must be sanitized by the displaying host. */
|
|
80
|
+
getAttributions(): Promise<string[]>;
|
|
81
|
+
/** Normalized TileJSON/archive capabilities, preserving authored source overrides. */
|
|
82
|
+
getSourceMetadata(): Promise<Record<string, import("./sources/tile_source_metadata.js").TangramTileSourceMetadata>>;
|
|
83
|
+
/** Detached decoded acquisition diagnostics from each current worker. */
|
|
84
|
+
getTileSourceStatistics(): Promise<import("./types.js").TileSourceStatistics[]>;
|
|
85
|
+
/** Detached cooperative host execution counters; absent for worker-local kernels. */
|
|
86
|
+
getProjectionEngineStatistics(): import('./procedures/projection-batch-executor.js').ProjectionExecutionStatistics | undefined;
|
|
87
|
+
/** Current-eye luma.gl definitions with exact Tangram-only shading extensions. */
|
|
88
|
+
getLumaLightDefinitions(): import("./lights/light-definitions.js").TangramLightMapping[];
|
|
89
|
+
setDataSource(name: string, config: SceneDataSource): Promise<unknown> | undefined;
|
|
90
|
+
queryFeatures(
|
|
91
|
+
options?: SceneQueryOptions
|
|
92
|
+
): Promise<SceneFeature[] | Record<string, SceneFeature[]>>;
|
|
93
|
+
screenshot(options?: {background?: string}): Promise<SceneScreenshot>;
|
|
94
|
+
destroy(): unknown;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export declare class ClassicWebGLRenderer {
|
|
98
|
+
/** Synchronous nearest hit on an explicit host-owned terrain mesh, in the selected eye. */
|
|
99
|
+
getTerrainAt(pixel: {x: number; y: number}, surface?: import("./selection/terrain_surface.js").TerrainSurface,
|
|
100
|
+
options?: import("./types.js").FeatureSelectionOptions): import("./selection/terrain_surface.js").TerrainSurfaceHit | null;
|
|
101
|
+
/** Async interactive-draw selection in active-view CSS pixels; host rendering must continue. */
|
|
102
|
+
getFeatureAt(pixel: {x: number; y: number}, options?: import("./types.js").FeatureSelectionOptions): Promise<import("./types.js").FeatureSelectionResult | undefined>;
|
|
103
|
+
/** Reproject loaded meshes without replacing workers; rejects failed builds and permits subsequent recovery. */
|
|
104
|
+
setProjectedBasemapProjection(projection: import("./procedures/mesh-projector.js").ProjectedBasemapOptions): Promise<void>;
|
|
105
|
+
/** Rebuild worker terrain geometry while preserving vector source caches. */
|
|
106
|
+
setTerrain(options: import("./procedures/terrain-draping.js").TerrainDrapingOptions): Promise<void>;
|
|
107
|
+
/** Adjust visual relief without resampling or rebuilding worker geometry. */
|
|
108
|
+
setTerrainExaggeration(value: number): void;
|
|
109
|
+
/** Exact admitted ground draw topology, temporal blend and physical query channels. */
|
|
110
|
+
getDrapedTerrainSurface(): import("./selection/draped-terrain-surface.js").DrapedTerrainSurfaceSnapshot | null;
|
|
111
|
+
/** Resident worker preparation cost, excluding GPU and transient copies. */
|
|
112
|
+
getTerrainDrapingStatistics(): import("./procedures/terrain-draping.js").TerrainDrapingStatistics;
|
|
113
|
+
constructor(config: SceneDefinition, options?: RendererOptions);
|
|
114
|
+
static create(config: SceneDefinition, options?: RendererOptions): ClassicWebGLRenderer;
|
|
115
|
+
readonly scene: Scene;
|
|
116
|
+
readonly gpuBackend: LumaDeviceRenderer | null;
|
|
117
|
+
setFrame(
|
|
118
|
+
frame: HostFrame | HostFrameOptions | LegacyHostFrame,
|
|
119
|
+
options?: {renderViewId?: string}
|
|
120
|
+
): HostFrame;
|
|
121
|
+
render(options?: RenderOptions): boolean;
|
|
122
|
+
load(config?: SceneDefinition | null, options?: SceneLoadOptions): Promise<unknown>;
|
|
123
|
+
/** Current source/TileJSON credits for the host's attribution UI. */
|
|
124
|
+
getAttributions(): Promise<string[]>;
|
|
125
|
+
/** Current source capabilities without exposing worker/archive ownership. */
|
|
126
|
+
getSourceMetadata(): Promise<Record<string, import("./sources/tile_source_metadata.js").TangramTileSourceMetadata>>;
|
|
127
|
+
/** Per-worker built-in source-procedure slots; separate from renderer mesh-build accounting. */
|
|
128
|
+
getTileSourceStatistics(): Promise<import("./types.js").TileSourceStatistics[]>;
|
|
129
|
+
/** Detached cooperative host execution counters; absent for worker-local kernels. */
|
|
130
|
+
getProjectionEngineStatistics(): import('./procedures/projection-batch-executor.js').ProjectionExecutionStatistics | undefined;
|
|
131
|
+
/** Current-eye luma.gl definitions with exact Tangram-only shading extensions. */
|
|
132
|
+
getLumaLightDefinitions(): import("./lights/light-definitions.js").TangramLightMapping[];
|
|
133
|
+
subscribe(listeners: SceneListeners): void;
|
|
134
|
+
/** Shared worker queue and completed-cache mesh bytes; excludes texture/CPU/driver memory. */
|
|
135
|
+
getTileResourceStatistics(): import('./types.js').TileResourceStatistics;
|
|
136
|
+
destroy(): unknown;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export declare const Renderer: typeof ClassicWebGLRenderer;
|
|
140
|
+
export declare const debug: Record<string, unknown>;
|
|
141
|
+
export declare const version: string;
|
|
142
|
+
|
|
143
|
+
declare const Tangram: {
|
|
144
|
+
Scene: typeof Scene;
|
|
145
|
+
ClassicWebGLRenderer: typeof ClassicWebGLRenderer;
|
|
146
|
+
Renderer: typeof ClassicWebGLRenderer;
|
|
147
|
+
HostFrame: typeof HostFrame;
|
|
148
|
+
LumaDeviceRenderer: typeof LumaDeviceRenderer;
|
|
149
|
+
debug: typeof debug;
|
|
150
|
+
version: string;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export default Tangram;
|
|
154
|
+
export type {TerrainDrapingOptions, TerrainDrapingStatistics} from "./procedures/terrain-draping.js";
|
|
155
|
+
export type {ProjectionEngine, ProjectionEngineOptions, ProjectionEngineTransform} from './types.js';
|