@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.
Files changed (321) hide show
  1. package/README.md +59 -2
  2. package/dist/core.js +36923 -0
  3. package/dist/core.js.map +6 -0
  4. package/dist/index.js +32 -0
  5. package/dist/loaders-gl-worker.js +82 -0
  6. package/dist/loaders-gl-worker.js.map +6 -0
  7. package/dist/map-logic.js +2 -0
  8. package/dist/map-logic.js.map +6 -0
  9. package/dist/projected-basemaps-worker.js +3 -0
  10. package/dist/projected-basemaps-worker.js.map +6 -0
  11. package/dist/shader-modules.js +141 -0
  12. package/dist/shader-modules.js.map +6 -0
  13. package/dist/style-schema.js +126 -0
  14. package/dist/style-schema.js.map +6 -0
  15. package/dist/tangram-style.schema.json +882 -0
  16. package/dist/tangram.debug.mjs +37139 -0
  17. package/dist/tangram.debug.mjs.map +6 -0
  18. package/dist/tangram.min.mjs +4950 -0
  19. package/dist/types/builders/earcut.d.ts +15 -0
  20. package/dist/types/core.d.ts +29 -0
  21. package/dist/types/gl/constants.d.ts +2 -0
  22. package/dist/types/gl/globe_mesh.d.ts +48 -0
  23. package/dist/types/gl/glsl.d.ts +17 -0
  24. package/dist/types/gl/vertex-constants.d.ts +4 -0
  25. package/dist/types/gl/vertex-types.d.ts +34 -0
  26. package/dist/types/gl/vertex_data.d.ts +32 -0
  27. package/dist/types/gl/vertex_elements.d.ts +8 -0
  28. package/dist/types/gl/vertex_layout.d.ts +32 -0
  29. package/dist/types/glsl.d.ts +14 -0
  30. package/dist/types/gpu/luma_device_renderer.d.ts +66 -0
  31. package/dist/types/gpu/resource_lifecycle.d.ts +4 -0
  32. package/dist/types/gpu/tangram_gpu_backend.d.ts +151 -0
  33. package/dist/types/index.d.ts +155 -0
  34. package/dist/types/lights/light-definitions.d.ts +121 -0
  35. package/dist/types/map-logic/draped-terrain-bounds.d.ts +41 -0
  36. package/dist/types/map-logic/globe-terrain-preparation.d.ts +85 -0
  37. package/dist/types/map-logic/globe-terrain.d.ts +54 -0
  38. package/dist/types/map-logic/index.d.ts +33 -0
  39. package/dist/types/map-logic/label-identity.d.ts +22 -0
  40. package/dist/types/map-logic/label-placement.d.ts +32 -0
  41. package/dist/types/map-logic/screen-bounds.d.ts +15 -0
  42. package/dist/types/map-logic/terrain-data.d.ts +55 -0
  43. package/dist/types/map-logic/terrain-error.d.ts +51 -0
  44. package/dist/types/map-logic/terrain-ground-topology.d.ts +26 -0
  45. package/dist/types/map-logic/terrain-height-field.d.ts +59 -0
  46. package/dist/types/map-logic/terrain-navigation.d.ts +27 -0
  47. package/dist/types/map-logic/terrain-neighborhood.d.ts +5 -0
  48. package/dist/types/map-logic/terrain-query.d.ts +33 -0
  49. package/dist/types/map-logic/terrain-resource-budget.d.ts +51 -0
  50. package/dist/types/map-logic/terrain-transition-topology.d.ts +23 -0
  51. package/dist/types/map-logic/tile-build-queue.d.ts +51 -0
  52. package/dist/types/map-logic/tile-cache-policy.d.ts +46 -0
  53. package/dist/types/map-logic/tile-residency.d.ts +17 -0
  54. package/dist/types/map-logic/triangle-query-index.d.ts +87 -0
  55. package/dist/types/procedures/js-yaml.d.ts +15 -0
  56. package/dist/types/procedures/mesh-projector.d.ts +107 -0
  57. package/dist/types/procedures/mvt-dependencies.d.ts +20 -0
  58. package/dist/types/procedures/projected-coordinate-transform.d.ts +27 -0
  59. package/dist/types/procedures/projection-batch-executor.d.ts +53 -0
  60. package/dist/types/procedures/scene-yaml-legacy.d.ts +6 -0
  61. package/dist/types/procedures/terrain-draping.d.ts +165 -0
  62. package/dist/types/procedures/terrain-globe.d.ts +6 -0
  63. package/dist/types/procedures/terrain-styled-topology.d.ts +34 -0
  64. package/dist/types/procedures/web-mercator-legacy.d.ts +4 -0
  65. package/dist/types/procedures/web-mercator-math.d.ts +4 -0
  66. package/dist/types/scene/globals.d.ts +11 -0
  67. package/dist/types/scene/ground_footprint.d.ts +16 -0
  68. package/dist/types/scene/host_frame.d.ts +54 -0
  69. package/dist/types/scene/projection_math.d.ts +52 -0
  70. package/dist/types/scene/scene-resource-types.d.ts +177 -0
  71. package/dist/types/scene/scene_bundle.d.ts +69 -0
  72. package/dist/types/scene/visibility_adapter.d.ts +106 -0
  73. package/dist/types/selection/draped-terrain-surface.d.ts +78 -0
  74. package/dist/types/selection/terrain_surface.d.ts +149 -0
  75. package/dist/types/shader-modules/globe-horizon.d.ts +15 -0
  76. package/dist/types/shader-modules/height-decode.d.ts +13 -0
  77. package/dist/types/shader-modules/hillshade.d.ts +13 -0
  78. package/dist/types/shader-modules/index.d.ts +6 -0
  79. package/dist/types/shader-modules/planar.d.ts +12 -0
  80. package/dist/types/shader-modules/sphere-map.d.ts +13 -0
  81. package/dist/types/shader-modules/triplanar.d.ts +15 -0
  82. package/dist/types/sources/decoded_tile_store.d.ts +95 -0
  83. package/dist/types/sources/tile_source_metadata.d.ts +32 -0
  84. package/dist/types/styles/text/fontfaceobserver.d.ts +10 -0
  85. package/dist/types/tile/tile_id.d.ts +37 -0
  86. package/dist/types/tile/tile_traversal_adapter.d.ts +63 -0
  87. package/dist/types/types.d.ts +293 -0
  88. package/dist/types/utils/geo.d.ts +57 -0
  89. package/dist/types/utils/hash.d.ts +1 -0
  90. package/dist/types/utils/log.d.ts +27 -0
  91. package/dist/types/utils/props.d.ts +6 -0
  92. package/dist/types/utils/subscribe.d.ts +10 -0
  93. package/dist/types/utils/thread.d.ts +6 -0
  94. package/dist/types/utils/urls.d.ts +26 -0
  95. package/dist/types/utils/utils.d.ts +26 -0
  96. package/dist/types/utils/version.d.ts +2 -0
  97. package/dist/types/utils/worker-types.d.ts +68 -0
  98. package/dist/types/utils/worker_broker.d.ts +3 -0
  99. package/package.json +103 -3
  100. package/src/builders/common.ts +41 -0
  101. package/src/builders/earcut.d.ts +15 -0
  102. package/src/builders/geometry-types.ts +60 -0
  103. package/src/builders/points.ts +115 -0
  104. package/src/builders/polygons.ts +225 -0
  105. package/src/builders/polylines.ts +682 -0
  106. package/src/builders/wireframe.ts +31 -0
  107. package/src/core.d.ts +29 -0
  108. package/src/core.ts +33 -0
  109. package/src/experimental/loaders-gl-worker.ts +19 -0
  110. package/src/experimental/projected-basemaps-worker.ts +13 -0
  111. package/src/experimental/projected-mesh-cache.ts +137 -0
  112. package/src/experimental/projected-mesh-domain.ts +110 -0
  113. package/src/experimental/projected-mesh-refinement.ts +193 -0
  114. package/src/experimental/projected-mesh.ts +399 -0
  115. package/src/experimental/projected-normal.ts +26 -0
  116. package/src/experimental/projected-symbol-mesh.ts +74 -0
  117. package/src/gl/constants.ts +18 -0
  118. package/src/gl/context.ts +103 -0
  119. package/src/gl/extensions.ts +30 -0
  120. package/src/gl/globe_mesh.ts +285 -0
  121. package/src/gl/glsl.ts +257 -0
  122. package/src/gl/mesh-types.ts +56 -0
  123. package/src/gl/render_state.ts +111 -0
  124. package/src/gl/shader_program.ts +1310 -0
  125. package/src/gl/texture.ts +814 -0
  126. package/src/gl/uniform_buffer.ts +340 -0
  127. package/src/gl/vao.ts +154 -0
  128. package/src/gl/vbo_mesh.ts +349 -0
  129. package/src/gl/vertex-constants.ts +19 -0
  130. package/src/gl/vertex-types.ts +35 -0
  131. package/src/gl/vertex_data.ts +126 -0
  132. package/src/gl/vertex_elements.ts +54 -0
  133. package/src/gl/vertex_layout.ts +241 -0
  134. package/src/glsl.d.ts +14 -0
  135. package/src/gpu/luma_device_renderer.ts +579 -0
  136. package/src/gpu/pixel_readback.ts +51 -0
  137. package/src/gpu/resource_lifecycle.ts +32 -0
  138. package/src/gpu/tangram_gpu_backend.ts +195 -0
  139. package/src/index.d.ts +155 -0
  140. package/src/index.ts +105 -0
  141. package/src/labels/collision-types.ts +94 -0
  142. package/src/labels/collision.ts +273 -0
  143. package/src/labels/collision_grid.ts +61 -0
  144. package/src/labels/intersect.ts +30 -0
  145. package/src/labels/label-types.ts +91 -0
  146. package/src/labels/label.ts +207 -0
  147. package/src/labels/label_line.ts +801 -0
  148. package/src/labels/label_point.ts +131 -0
  149. package/src/labels/main-pass-types.ts +73 -0
  150. package/src/labels/main_pass.ts +221 -0
  151. package/src/labels/point_anchor.ts +100 -0
  152. package/src/labels/point_placement.ts +150 -0
  153. package/src/labels/projected-pass.ts +259 -0
  154. package/src/labels/repeat_group.ts +72 -0
  155. package/src/lights/ambient_light.glsl +18 -0
  156. package/src/lights/directional_light.glsl +39 -0
  157. package/src/lights/geographic-lights.ts +21 -0
  158. package/src/lights/light-definitions.ts +285 -0
  159. package/src/lights/light.ts +590 -0
  160. package/src/lights/lighting-uniforms.ts +80 -0
  161. package/src/lights/lighting-wgsl.ts +116 -0
  162. package/src/lights/material.glsl +237 -0
  163. package/src/lights/material.ts +145 -0
  164. package/src/lights/native-falloff.ts +37 -0
  165. package/src/lights/point_light.glsl +96 -0
  166. package/src/lights/spot_light.glsl +111 -0
  167. package/src/map-logic/draped-terrain-bounds.ts +71 -0
  168. package/src/map-logic/globe-terrain-preparation.ts +217 -0
  169. package/src/map-logic/globe-terrain.ts +296 -0
  170. package/src/map-logic/index.ts +37 -0
  171. package/src/map-logic/label-identity.ts +36 -0
  172. package/src/map-logic/label-placement.ts +117 -0
  173. package/src/map-logic/screen-bounds.ts +34 -0
  174. package/src/map-logic/terrain-data.ts +107 -0
  175. package/src/map-logic/terrain-error.ts +134 -0
  176. package/src/map-logic/terrain-ground-topology.ts +164 -0
  177. package/src/map-logic/terrain-height-field.ts +254 -0
  178. package/src/map-logic/terrain-navigation.ts +50 -0
  179. package/src/map-logic/terrain-neighborhood.ts +43 -0
  180. package/src/map-logic/terrain-query.ts +51 -0
  181. package/src/map-logic/terrain-resource-budget.ts +124 -0
  182. package/src/map-logic/terrain-transition-topology.ts +164 -0
  183. package/src/map-logic/tile-build-queue.ts +110 -0
  184. package/src/map-logic/tile-cache-policy.ts +89 -0
  185. package/src/map-logic/tile-residency.ts +50 -0
  186. package/src/map-logic/triangle-query-index.ts +265 -0
  187. package/src/procedures/js-yaml.d.ts +15 -0
  188. package/src/procedures/mesh-projector.ts +191 -0
  189. package/src/procedures/mlt-loaders.ts +55 -0
  190. package/src/procedures/mvt-dependencies.d.ts +20 -0
  191. package/src/procedures/mvt-legacy.ts +150 -0
  192. package/src/procedures/mvt-loaders.ts +53 -0
  193. package/src/procedures/mvt-parser.ts +48 -0
  194. package/src/procedures/mvt-properties.ts +36 -0
  195. package/src/procedures/mvt-tile-provider.ts +72 -0
  196. package/src/procedures/pmtiles-loader.ts +75 -0
  197. package/src/procedures/projected-coordinate-transform.ts +79 -0
  198. package/src/procedures/projection-batch-executor.ts +140 -0
  199. package/src/procedures/scene-yaml-legacy.ts +16 -0
  200. package/src/procedures/scene-yaml-loaders.ts +10 -0
  201. package/src/procedures/terrain-draping.ts +713 -0
  202. package/src/procedures/terrain-globe.ts +32 -0
  203. package/src/procedures/terrain-styled-topology.ts +184 -0
  204. package/src/procedures/web-mercator-legacy.ts +24 -0
  205. package/src/procedures/web-mercator-math.ts +50 -0
  206. package/src/scene/camera.ts +298 -0
  207. package/src/scene/camera_base.ts +116 -0
  208. package/src/scene/classic_scene.ts +20 -0
  209. package/src/scene/external_camera.ts +101 -0
  210. package/src/scene/globals.ts +120 -0
  211. package/src/scene/ground_footprint.ts +139 -0
  212. package/src/scene/host_frame.ts +326 -0
  213. package/src/scene/projected_tile_lod.ts +125 -0
  214. package/src/scene/projection_math.ts +142 -0
  215. package/src/scene/projection_shaders.ts +183 -0
  216. package/src/scene/renderer.ts +516 -0
  217. package/src/scene/scene-resource-types.ts +174 -0
  218. package/src/scene/scene.ts +2378 -0
  219. package/src/scene/scene_bundle.ts +304 -0
  220. package/src/scene/scene_debug.ts +129 -0
  221. package/src/scene/scene_loader.ts +402 -0
  222. package/src/scene/scene_worker.ts +528 -0
  223. package/src/scene/view.ts +683 -0
  224. package/src/scene/visibility_adapter.ts +319 -0
  225. package/src/scene/worker_url.ts +15 -0
  226. package/src/selection/draped-terrain-surface.ts +377 -0
  227. package/src/selection/selection-types.ts +79 -0
  228. package/src/selection/selection.ts +542 -0
  229. package/src/selection/selection_fragment.glsl +18 -0
  230. package/src/selection/selection_globals.glsl +9 -0
  231. package/src/selection/selection_pixels.ts +59 -0
  232. package/src/selection/selection_vertex.glsl +15 -0
  233. package/src/selection/terrain_surface.ts +298 -0
  234. package/src/shader-modules/globe-horizon.ts +52 -0
  235. package/src/shader-modules/height-decode.ts +41 -0
  236. package/src/shader-modules/hillshade.ts +70 -0
  237. package/src/shader-modules/index.ts +10 -0
  238. package/src/shader-modules/planar.ts +24 -0
  239. package/src/shader-modules/sphere-map.ts +38 -0
  240. package/src/shader-modules/triplanar.ts +45 -0
  241. package/src/sources/aligned_tile_source.ts +122 -0
  242. package/src/sources/data_source.ts +655 -0
  243. package/src/sources/decoded_tile_store.ts +245 -0
  244. package/src/sources/geojson.ts +300 -0
  245. package/src/sources/mvt.ts +247 -0
  246. package/src/sources/raster.ts +341 -0
  247. package/src/sources/shared_tile_source_adapter.ts +117 -0
  248. package/src/sources/sources.ts +10 -0
  249. package/src/sources/tile_source_adapter.ts +84 -0
  250. package/src/sources/tile_source_metadata.ts +65 -0
  251. package/src/sources/tile_source_state.ts +112 -0
  252. package/src/sources/topojson.ts +90 -0
  253. package/src/styles/feature_annotations.ts +16 -0
  254. package/src/styles/filter.ts +190 -0
  255. package/src/styles/geometry-style-types.ts +209 -0
  256. package/src/styles/globe_visibility_wgsl.ts +22 -0
  257. package/src/styles/layer-types.ts +45 -0
  258. package/src/styles/layer.ts +586 -0
  259. package/src/styles/lines/dasharray.ts +49 -0
  260. package/src/styles/lines/lines.ts +707 -0
  261. package/src/styles/lines/lines_wgsl.ts +224 -0
  262. package/src/styles/points/point-runtime-types.ts +125 -0
  263. package/src/styles/points/points.ts +1079 -0
  264. package/src/styles/points/points_fragment.glsl +126 -0
  265. package/src/styles/points/points_vertex.glsl +230 -0
  266. package/src/styles/points/points_wgsl.ts +189 -0
  267. package/src/styles/polygons/polygons.ts +268 -0
  268. package/src/styles/polygons/polygons_fragment.glsl +173 -0
  269. package/src/styles/polygons/polygons_vertex.glsl +213 -0
  270. package/src/styles/polygons/polygons_wgsl.ts +127 -0
  271. package/src/styles/property-types.ts +125 -0
  272. package/src/styles/raster/raster.ts +33 -0
  273. package/src/styles/raster/raster_globals.glsl +46 -0
  274. package/src/styles/style-mixing-types.ts +101 -0
  275. package/src/styles/style-runtime-types.ts +220 -0
  276. package/src/styles/style-schema.ts +133 -0
  277. package/src/styles/style.ts +1033 -0
  278. package/src/styles/style_globals.glsl +69 -0
  279. package/src/styles/style_manager.ts +464 -0
  280. package/src/styles/style_parser.ts +620 -0
  281. package/src/styles/text/font_manager.ts +180 -0
  282. package/src/styles/text/fontfaceobserver.d.ts +10 -0
  283. package/src/styles/text/text-types.ts +220 -0
  284. package/src/styles/text/text.ts +378 -0
  285. package/src/styles/text/text_canvas.ts +773 -0
  286. package/src/styles/text/text_labels.ts +436 -0
  287. package/src/styles/text/text_segments.ts +142 -0
  288. package/src/styles/text/text_settings.ts +228 -0
  289. package/src/styles/text/text_wgsl.ts +159 -0
  290. package/src/styles/text/text_wrap.ts +194 -0
  291. package/src/tile/globe_tile_preload.ts +40 -0
  292. package/src/tile/tangram_tileset_2d.ts +108 -0
  293. package/src/tile/tile-build-types.ts +155 -0
  294. package/src/tile/tile.ts +807 -0
  295. package/src/tile/tile_id.ts +172 -0
  296. package/src/tile/tile_manager.ts +889 -0
  297. package/src/tile/tile_pyramid.ts +119 -0
  298. package/src/tile/tile_resource_cache.ts +91 -0
  299. package/src/tile/tile_traversal_adapter.ts +132 -0
  300. package/src/types.ts +332 -0
  301. package/src/utils/debounce.ts +17 -0
  302. package/src/utils/debug_settings.ts +43 -0
  303. package/src/utils/errors.ts +12 -0
  304. package/src/utils/functions.ts +95 -0
  305. package/src/utils/geo.ts +364 -0
  306. package/src/utils/hash.ts +14 -0
  307. package/src/utils/log.ts +108 -0
  308. package/src/utils/media_capture.ts +193 -0
  309. package/src/utils/merge.ts +44 -0
  310. package/src/utils/obb.ts +134 -0
  311. package/src/utils/props.ts +43 -0
  312. package/src/utils/slice.ts +14 -0
  313. package/src/utils/subscribe.ts +58 -0
  314. package/src/utils/task.ts +154 -0
  315. package/src/utils/thread.ts +26 -0
  316. package/src/utils/urls.ts +223 -0
  317. package/src/utils/utils.ts +310 -0
  318. package/src/utils/vector.ts +197 -0
  319. package/src/utils/version.ts +8 -0
  320. package/src/utils/worker-types.ts +79 -0
  321. package/src/utils/worker_broker.ts +523 -0
@@ -0,0 +1,195 @@
1
+ // tangram-layers
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {
6
+ Buffer,
7
+ BufferLayout,
8
+ Bindings,
9
+ Device,
10
+ ExternalImage,
11
+ RenderPass,
12
+ RenderPipelineParameters,
13
+ PrimitiveTopology,
14
+ Shader,
15
+ Texture,
16
+ UniformValue
17
+ } from '@luma.gl/core';
18
+
19
+ /** Shader languages supported by Tangram's portable GPU backend. */
20
+ export type TangramShaderLanguage = 'glsl' | 'wgsl';
21
+
22
+ /** Options used to allocate a Tangram uniform buffer. */
23
+ export type TangramUniformBufferOptions = {
24
+ id: string;
25
+ usage: 'uniform';
26
+ byteLength: number;
27
+ };
28
+
29
+ /** Options used to allocate a Tangram vertex or index buffer. */
30
+ export type TangramMeshBufferOptions = {
31
+ id: string;
32
+ usage: 'vertex' | 'index';
33
+ data: ArrayBuffer | ArrayBufferView;
34
+ indexType?: 'uint16' | 'uint32';
35
+ };
36
+
37
+ /** Options used to compile one stage of a Tangram shader program. */
38
+ export type TangramShaderOptions = {
39
+ id: string;
40
+ language?: TangramShaderLanguage;
41
+ stage: 'vertex' | 'fragment';
42
+ source: string;
43
+ entryPoint?: string;
44
+ };
45
+
46
+ /** Options used to validate a linked Tangram shader pair. */
47
+ export type TangramShaderProgramOptions = {
48
+ id: string;
49
+ vertexShader: Shader;
50
+ fragmentShader: Shader;
51
+ };
52
+
53
+ /** Options used to allocate and initialize a Tangram texture. */
54
+ export type TangramTextureOptions = {
55
+ id: string;
56
+ width: number;
57
+ height: number;
58
+ data?: ArrayBuffer | ArrayBufferView | ExternalImage;
59
+ filtering?: 'nearest' | 'linear' | 'mipmap';
60
+ repeat?: boolean;
61
+ flipY?: boolean;
62
+ premultipliedAlpha?: boolean;
63
+ };
64
+
65
+ /** Portable mesh submission passed from Tangram scene traversal to a GPU backend. */
66
+ export type TangramMeshDrawOptions = {
67
+ mesh: TangramDrawableMesh;
68
+ program: TangramDrawableProgram;
69
+ renderPass: RenderPass;
70
+ renderState?: RenderPipelineParameters;
71
+ visibleTime: number;
72
+ };
73
+
74
+ /** GPU resources and layout needed to submit one portable mesh. */
75
+ export type TangramMeshDrawDescriptor = {
76
+ topology: PrimitiveTopology;
77
+ vertexCount: number;
78
+ indexCount: number;
79
+ vertexBuffer: Buffer | null;
80
+ indexBuffer: Buffer | null;
81
+ bufferLayout: BufferLayout & {attributes: NonNullable<BufferLayout['attributes']>};
82
+ staticAttributes: {attribute: string; value: readonly number[]}[];
83
+ };
84
+
85
+ /** Scene-owned mesh state consumed by the device backend. */
86
+ export type TangramDrawableMesh = {
87
+ id: string | number;
88
+ vertex_layout: object;
89
+ uniforms?: Record<string, unknown>;
90
+ getDrawDescriptor(): TangramMeshDrawDescriptor;
91
+ };
92
+
93
+ /** Mutable uniform block whose contents can be snapshotted per encoded draw. */
94
+ export type TangramDrawableUniformBlock = {
95
+ snapshot_per_mesh: boolean;
96
+ data: ArrayBuffer | null;
97
+ byteLength: number;
98
+ };
99
+
100
+ /** Shader and uniform operations required by the device submission path. */
101
+ export type TangramDrawableProgram = {
102
+ id: string | number;
103
+ name?: string;
104
+ vertex_shader_resource: Shader | null | undefined;
105
+ fragment_shader_resource: Shader | null | undefined;
106
+ uniform_blocks?: Record<string, TangramDrawableUniformBlock>;
107
+ saveUniforms(uniforms: Record<string, unknown>): void;
108
+ setUniforms(uniforms: Record<string, unknown>, resetTextureUnit: boolean): void;
109
+ restoreUniforms(uniforms: Record<string, unknown>): void;
110
+ uniform(method: string, name: string, value: number): void;
111
+ getBindings(): Record<string, object>;
112
+ getUniformValues(): Record<string, UniformValue>;
113
+ };
114
+
115
+ /** Tangram blend modes accepted by the portable renderer. */
116
+ export type TangramBlendMode =
117
+ | false
118
+ | 'opaque'
119
+ | 'overlay'
120
+ | 'inlay'
121
+ | 'translucent'
122
+ | 'add'
123
+ | 'multiply';
124
+
125
+ /** Normalized Tangram state used to create a luma.gl render pipeline. */
126
+ export type TangramRenderStateOptions = {
127
+ depthTest: boolean;
128
+ depthWrite: boolean;
129
+ cullFace: boolean;
130
+ blend: TangramBlendMode;
131
+ };
132
+
133
+ /**
134
+ * Scene integration hooks supplied by a portable Tangram GPU backend.
135
+ *
136
+ * This compatibility shape keeps the current Scene and Style internals isolated
137
+ * while their individual resource wrappers are migrated to the backend contract.
138
+ */
139
+ export type TangramGPUSceneOptions = {
140
+ enableUniformBuffers: true;
141
+ deviceShaderCompilation: true;
142
+ shaderLanguage: TangramShaderLanguage;
143
+ uniformBufferFactory: (options: TangramUniformBufferOptions) => Buffer;
144
+ shaderFactory: (options: TangramShaderOptions) => Shader;
145
+ shaderProgramValidator: (options: TangramShaderProgramOptions) => void;
146
+ meshBufferFactory: (options: TangramMeshBufferOptions) => Buffer;
147
+ textureFactory: (options: TangramTextureOptions) => Texture;
148
+ maxTextureSize?: number;
149
+ meshRenderer: TangramGPUBackend;
150
+ };
151
+
152
+ /**
153
+ * Renderer-independent boundary for Tangram GPU resource ownership and drawing.
154
+ *
155
+ * `LumaDeviceRenderer` is the current and only implementation. It owns the
156
+ * resources it creates but does not own the host device or render pass. The
157
+ * interface intentionally contains no deck.gl types.
158
+ */
159
+ export interface TangramGPUBackend {
160
+ /** Host-owned luma.gl device used by this backend. */
161
+ readonly device: Device;
162
+
163
+ /** Shader language compiled by this backend. */
164
+ readonly shaderLanguage: TangramShaderLanguage;
165
+
166
+ /** Maximum supported two-dimensional texture dimension, when known. */
167
+ readonly maxTextureSize?: number;
168
+
169
+ /** Returns the compatibility hooks consumed by current Scene internals. */
170
+ getSceneOptions(): TangramGPUSceneOptions;
171
+
172
+ /** Allocates a uniform buffer. */
173
+ createUniformBuffer(options: TangramUniformBufferOptions): Buffer;
174
+
175
+ /** Allocates a vertex or index buffer. */
176
+ createMeshBuffer(options: TangramMeshBufferOptions): Buffer;
177
+
178
+ /** Compiles a shader stage. */
179
+ createShader(options: TangramShaderOptions): Shader;
180
+
181
+ /** Validates a linked shader pair. */
182
+ validateShaderProgram(options: TangramShaderProgramOptions): void;
183
+
184
+ /** Allocates and initializes a texture. */
185
+ createTexture(options: TangramTextureOptions): Texture;
186
+
187
+ /** Submits one mesh to a host-owned render pass. */
188
+ drawMesh(options: TangramMeshDrawOptions): boolean;
189
+
190
+ /** Translates Tangram state into luma.gl render-pipeline parameters. */
191
+ getRenderPipelineParameters(options: TangramRenderStateOptions): RenderPipelineParameters;
192
+
193
+ /** Releases resources owned by this backend. */
194
+ destroy(): void;
195
+ }
package/src/index.d.ts ADDED
@@ -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';
23
+ export {TerrainMeshSurface, TerrainSurfaceCollection, sampleTerrainElevation, resolveTerrainClearance, pickTerrainAt} from './selection/terrain_surface';
24
+ export type {TerrainSurface, TerrainSurfaceBounds, TerrainRay, TerrainSurfaceHit, TerrainMeshOptions, TerrainMeshStatistics, TerrainSurfaceEntry, TerrainCollectionHit, TerrainElevationProbe} from './selection/terrain_surface';
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';
56
+ import LumaDeviceRenderer from './gpu/luma_device_renderer.js';
57
+ export {HostFrame};
58
+ export {LumaDeviceRenderer};
59
+ export {calculatePlanarGroundBounds, calculatePlanarVolumeBounds} from './scene/ground_footprint';
60
+ export {convertLumaLight, mapTangramLight} from './lights/light-definitions';
61
+ export type {ResolvedTangramLight, TangramLightMapping, TangramLight, TangramAmbientLight,
62
+ TangramDirectionalLight, TangramPointLight, TangramSpotLight, TangramLightExtensions,
63
+ TangramPositionalLightExtensions, TangramLightColor, NormalizedTangramLight} from './lights/light-definitions';
64
+ export type {Light as LumaLight} from '@luma.gl/shadertools';
65
+ export type {TangramTileSourceMetadata} from './sources/tile_source_metadata';
66
+ export type {MeshProjectionStatistics} from './procedures/mesh-projector';
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').TangramTileSourceMetadata>>;
83
+ /** Detached decoded acquisition diagnostics from each current worker. */
84
+ getTileSourceStatistics(): Promise<import('./types').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').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').TerrainSurface,
100
+ options?: import('./types').FeatureSelectionOptions): import('./selection/terrain_surface').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').FeatureSelectionOptions): Promise<import('./types').FeatureSelectionResult | undefined>;
103
+ /** Reproject loaded meshes without replacing workers; rejects failed builds and permits subsequent recovery. */
104
+ setProjectedBasemapProjection(projection: import('./procedures/mesh-projector').ProjectedBasemapOptions): Promise<void>;
105
+ /** Rebuild worker terrain geometry while preserving vector source caches. */
106
+ setTerrain(options: import('./procedures/terrain-draping').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').DrapedTerrainSurfaceSnapshot | null;
111
+ /** Resident worker preparation cost, excluding GPU and transient copies. */
112
+ getTerrainDrapingStatistics(): import('./procedures/terrain-draping').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').TangramTileSourceMetadata>>;
127
+ /** Per-worker built-in source-procedure slots; separate from renderer mesh-build accounting. */
128
+ getTileSourceStatistics(): Promise<import('./types').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').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';
155
+ export type {ProjectionEngine, ProjectionEngineOptions, ProjectionEngineTransform} from './types.js';
package/src/index.ts ADDED
@@ -0,0 +1,105 @@
1
+ // Tangram
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) 2013-2016 Brett Camper and Mapzen
4
+ // Copyright (c) 2026 vis.gl contributors
5
+
6
+ /*jshint worker: true*/
7
+
8
+ import Scene from './scene/classic_scene';
9
+ import ClassicWebGLRenderer from './scene/renderer';
10
+ import HostFrame from './scene/host_frame';
11
+ export {TerrainMeshSurface, TerrainSurfaceCollection, sampleTerrainElevation, resolveTerrainClearance, pickTerrainAt} from './selection/terrain_surface';
12
+ export type {TerrainSurface, TerrainSurfaceBounds, TerrainRay, TerrainSurfaceHit, TerrainMeshOptions, TerrainMeshStatistics, TerrainSurfaceEntry, TerrainCollectionHit, TerrainElevationProbe} from './selection/terrain_surface';
13
+ import LumaDeviceRenderer from './gpu/luma_device_renderer';
14
+ export type {HostTileResourceOptions, TileResourceStatistics, TileSourceStatistics} from './types';
15
+ export type {MeshProjectionStatistics} from './procedures/mesh-projector';
16
+
17
+ // Additional modules are exposed for debugging
18
+ import version from './utils/version';
19
+ import log from './utils/log';
20
+ import Utils from './utils/utils';
21
+ import Geo from './utils/geo';
22
+ import Vector from './utils/vector';
23
+ import DataSource from './sources/data_source';
24
+ import GLSL from './gl/glsl';
25
+ import ShaderProgram from './gl/shader_program';
26
+ import UniformBuffer from './gl/uniform_buffer';
27
+ import VertexData from './gl/vertex_data';
28
+ import Texture from './gl/texture';
29
+ import Material from './lights/material';
30
+ import Light from './lights/light';
31
+ import WorkerBroker from './utils/worker_broker';
32
+ import Task from './utils/task';
33
+ import {StyleManager} from './styles/style_manager';
34
+ import StyleParser from './styles/style_parser';
35
+ import {TileID} from './tile/tile_id';
36
+ import Collision from './labels/collision';
37
+ import FeatureSelection from './selection/selection';
38
+ import TextCanvas from './styles/text/text_canvas';
39
+ import debugSettings from './utils/debug_settings';
40
+ import {
41
+ WebMercatorGlobeVisibilityAdapter,
42
+ WebMercatorVisibilityAdapter
43
+ } from './scene/visibility_adapter';
44
+
45
+ import yaml from 'js-yaml';
46
+
47
+ // Make some modules accessible for debugging
48
+ const debug = {
49
+ log,
50
+ yaml,
51
+ Utils,
52
+ Geo,
53
+ Vector,
54
+ DataSource,
55
+ GLSL,
56
+ ShaderProgram,
57
+ UniformBuffer,
58
+ VertexData,
59
+ Texture,
60
+ Material,
61
+ Light,
62
+ Scene,
63
+ ClassicWebGLRenderer,
64
+ HostFrame,
65
+ LumaDeviceRenderer,
66
+ WorkerBroker,
67
+ Task,
68
+ StyleManager,
69
+ StyleParser,
70
+ TileID,
71
+ Collision,
72
+ FeatureSelection,
73
+ TextCanvas,
74
+ debugSettings
75
+ };
76
+
77
+ const Tangram = {
78
+ Scene,
79
+ ClassicWebGLRenderer,
80
+ Renderer: ClassicWebGLRenderer,
81
+ HostFrame,
82
+ LumaDeviceRenderer,
83
+ debug,
84
+ version
85
+ };
86
+
87
+ export {WebMercatorGlobeVisibilityAdapter, WebMercatorVisibilityAdapter};
88
+ export {calculatePlanarGroundBounds, calculatePlanarVolumeBounds} from './scene/ground_footprint';
89
+ export {convertLumaLight, mapTangramLight} from './lights/light-definitions';
90
+ export type {ResolvedTangramLight, TangramLightMapping, TangramLight, TangramAmbientLight,
91
+ TangramDirectionalLight, TangramPointLight, TangramSpotLight, TangramLightExtensions,
92
+ TangramPositionalLightExtensions, TangramLightColor, NormalizedTangramLight} from './lights/light-definitions';
93
+ export type {Light as LumaLight} from '@luma.gl/shadertools';
94
+ export type {TangramTileSourceMetadata} from './sources/tile_source_metadata';
95
+ export type {
96
+ CalculatedViewBounds,
97
+ GlobeVisibilityLODAdapter,
98
+ GlobeVisibilityViewState,
99
+ VisibilityLODAdapter,
100
+ VisibilityViewState
101
+ } from './scene/visibility_adapter';
102
+
103
+ export default Tangram;
104
+ export type {TerrainDrapingOptions, TerrainDrapingStatistics} from './procedures/terrain-draping';
105
+ export {DrapedTerrainSurfaceSnapshot} from './selection/draped-terrain-surface';
@@ -0,0 +1,94 @@
1
+ // tangram-layers
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type OBB from '../utils/obb';
6
+
7
+ /** Parallel broad/narrow-phase bounds for labels already placed in a tile or grid cell. */
8
+ export interface CollisionBounds {
9
+ /** Axis-aligned boxes in placement order. */
10
+ aabb: number[][];
11
+ /** Oriented boxes corresponding to the axis-aligned boxes. */
12
+ obb: OBB[];
13
+ }
14
+
15
+ /** Layout controls consumed by collision and repeat culling, independent of rendering styles. */
16
+ export interface CollisionLayout {
17
+ /** Lower numeric values are considered first. */
18
+ priority: number;
19
+ /** Whether placed-label intersections can reject this label. */
20
+ collide?: boolean;
21
+ /** Minimum separation within a repeat group. */
22
+ repeat_distance?: number;
23
+ /** Optional repeat group identifier. */
24
+ repeat_group?: string;
25
+ /** Worker/main-pass distance scale, provided by layout normalization. */
26
+ repeat_scale: number;
27
+ }
28
+
29
+ /** Minimal mutable label contract shared by worker and main-pass collision. */
30
+ export interface CollisionLabel {
31
+ /** Collision and repeat rules. */
32
+ layout: CollisionLayout;
33
+ /** Position used by repeat culling. */
34
+ position: [number, number];
35
+ /** Single-box broad-phase extent, or null before bounds are built. */
36
+ aabb?: number[] | null;
37
+ /** Multi-box broad-phase extents. */
38
+ aabbs?: number[][];
39
+ /** Single-box narrow-phase bounds. */
40
+ obb?: OBB | null;
41
+ /** Multi-box narrow-phase bounds. */
42
+ obbs?: OBB[];
43
+ /** Placement outcome; null/undefined means not processed yet. */
44
+ placed?: boolean | null;
45
+ /** Grid cells containing this candidate. */
46
+ cells?: CollisionBounds[];
47
+ /** Whether this label crosses a tile boundary. */
48
+ breach?: boolean;
49
+ /** Whether main-pass repeat culling is still required. */
50
+ may_repeat_across_tiles?: boolean;
51
+ /** Test placed bounds while ignoring an explicitly linked label. */
52
+ discard(bounds: CollisionBounds, exclude: CollisionLabel | null | 0 | ''): boolean;
53
+ }
54
+
55
+ /** Placement container; callers can retain additional renderer-specific payload. */
56
+ export interface PendingCollisionObject {
57
+ /** Attached text acquires its label before the cross-style completion barrier is released. */
58
+ label?: CollisionLabel;
59
+ /** Optional linked queue entry, also prepared before placement begins. */
60
+ linked?: PendingCollisionObject | null | 0 | '';
61
+ /** Placement visibility after the shared barrier has completed. */
62
+ show?: boolean | null;
63
+ }
64
+
65
+ export interface CollisionObject extends PendingCollisionObject {
66
+ /** Mutable candidate label. */
67
+ label: CollisionLabel;
68
+ /** Optional placement dependency, considered as a pair; legacy falsy IDs are ignored. */
69
+ linked?: PendingCollisionObject | null | 0 | '';
70
+ /** Visibility assigned by the collision pass. */
71
+ show?: boolean | null;
72
+ }
73
+
74
+ /** Per-tile batching and resolution state. */
75
+ export interface CollisionTileState {
76
+ /** Accumulated placed bounds when no grid is used. */
77
+ bboxes: CollisionBounds;
78
+ /** Submitted objects grouped first by numeric priority, then by style. */
79
+ objects: Record<string, Record<string, CollisionObject[]>>;
80
+ /** Resolved visible/hidden objects grouped by style. */
81
+ labels: Record<string, CollisionObject[]>;
82
+ /** Styles that have not yet submitted their objects. */
83
+ styles: Record<string, boolean>;
84
+ /** Whether repeat culling is enabled for this tile. */
85
+ repeat: boolean;
86
+ /** Whether rejected objects are returned as hidden. */
87
+ return_hidden: boolean;
88
+ /** Completion barrier initialized by startTile before any submissions. */
89
+ complete?: Promise<void | CollisionObject[]>;
90
+ /** Complete normally or abort with an empty result. */
91
+ resolve?: ((result?: CollisionObject[]) => void) | null;
92
+ /** Rejection hook retained for compatibility with the existing state. */
93
+ reject?: (reason?: unknown) => void;
94
+ }