@tomtom-org/maps-sdk-plugin-landmarks-3d 0.2.0 → 0.3.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/dist/index.d.ts CHANGED
@@ -1,203 +1,139 @@
1
- import { KnobConfigOf, KnobEntry, KnobRange, KnobValueOf, TomTomMap } from "@tomtom-org/maps-sdk/map";
1
+ import { _ as Buildings3DKnobValueOf, c as LandmarkTextureUse, d as Landmarks3DKnobValueOf, g as Buildings3DKnobId, n as GLSurfacesKnobId, r as GLSurfacesKnobValueOf, u as Landmarks3DKnobId, w as PaletteMode } from "./surfacesKnobCatalogue-B1prY4bG.js";
2
+ import { BeforeLayerConfig, CustomLayer, EventState, KnobConfigOf, TomTomMap } from "@tomtom-org/maps-sdk/map";
3
+ import { AmbientLight, Camera, DataTexture, DirectionalLight, Group, IUniform, Mesh, Object3D, Scene, ShaderMaterial, Texture, Vector3, Vector4, WebGLRenderer } from "three";
2
4
  import { CustomLayerInterface, CustomRenderMethodInput, Map } from "maplibre-gl";
3
- import { AmbientLight, Camera, DirectionalLight, Group, IUniform, Mesh, Object3D, Scene, ShaderMaterial, Texture, Vector3, WebGLRenderer } from "three";
4
- //#region src/buildings/buildingsKnobCatalogue.d.ts
5
+ //#region src/highlights.d.ts
6
+ type HighlightLooks = Readonly<Record<`${'hover' | 'click'}.color`, string> & Record<`${'hover' | 'click'}.intensity`, number>>;
5
7
  /**
6
- * How the windows of a facade are laid out. `mixed` picks one per building, by its height: punched
7
- * windows on low ones, office bands from about six storeys and glass curtain walls on towers.
8
+ * A building of a {@link Buildings3D} or a landmark of a {@link Landmarks3D}, as their user events report it.
8
9
  *
9
- * @group Buildings 3D
10
- */
11
- export declare const facadePatterns: readonly ["mixed", "residential", "office", "glass", "plain"];
12
- /**
13
- * One of {@link facadePatterns}.
10
+ * @example
11
+ * ```typescript
12
+ * buildings.events.on('click', (building: BuildingHit) => console.log(building.id, building.properties.height));
13
+ * ```
14
14
  *
15
15
  * @group Buildings 3D
16
16
  */
17
- type FacadePattern = (typeof facadePatterns)[number];
17
+ type BuildingHit = {
18
+ /**
19
+ * A building's feature id in the map's vector tiles, the same in every tile and zoom level that
20
+ * holds it. The tiles split a building of several heights into parts, which the plugin draws,
21
+ * colours and lights up as one, under the id of the building's whole outline. A landmark's id is a
22
+ * number taken from its position, the same in every session.
23
+ */
24
+ id: number | string;
25
+ /**
26
+ * A building's feature properties, such as `height` and `group`, its whole outline's when it comes in
27
+ * parts. A landmark's `position`, as `[longitude, latitude]`.
28
+ */
29
+ properties: Record<string, unknown>;
30
+ };
18
31
  /**
19
- * The looks the unset knobs take: one per standard style, or `auto`, which follows the map's style.
20
- *
21
- * @group Buildings 3D
32
+ * The uniforms {@link HIGHLIGHT_GLSL} reads, which the materials of one layer share by reference.
33
+ * @ignore
22
34
  */
23
- export declare const buildingsPresets: readonly ["auto", "streetLight", "streetDark", "streetLightDriving", "streetDarkDriving", "monoLight", "monoDark", "streetSatellite"];
35
+ type HighlightUniforms = Record<'objectColors', IUniform<DataTexture>> & Record<'hoveredObject' | 'clickedObject', IUniform<number>> & Record<'hoverHighlight' | 'clickHighlight', IUniform<Vector4>>;
24
36
  /**
25
- * One of {@link buildingsPresets}.
26
- *
27
- * @group Buildings 3D
37
+ * The buildings or landmarks of one layer as its shaders highlight them: a compact index for each, by the
38
+ * id it has in the map's data, the colour an app gives it, and which one is hovered and which clicked.
39
+ * @ignore
28
40
  */
29
- type BuildingsPreset = (typeof buildingsPresets)[number];
30
- declare const buildingsKnobDefinitions: {
31
- readonly visible: {
32
- readonly kind: "toggle";
33
- readonly description: "The 3D buildings.";
34
- readonly default: true;
35
- };
36
- readonly preset: {
37
- readonly kind: "enum";
38
- readonly description: "Look every unset knob takes: a standard style's, or auto, which follows the map's standard style.";
39
- readonly options: readonly ["auto", "streetLight", "streetDark", "streetLightDriving", "streetDarkDriving", "monoLight", "monoDark", "streetSatellite"];
40
- readonly default: "auto";
41
- };
42
- readonly opacity: {
43
- readonly kind: "number";
44
- readonly description: "Opacity of the buildings, and of the landmarks left unset among them, 0 to 1.";
45
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
46
- };
47
- readonly minZoom: {
48
- readonly kind: "number";
49
- readonly description: "Lowest zoom the buildings are drawn at, and the landmarks left unset among them.";
50
- readonly range: {
51
- readonly min: 13;
52
- readonly max: 22;
53
- readonly step: 1;
54
- readonly bounds: "hard";
55
- };
56
- };
57
- readonly 'facade.pattern': {
58
- readonly kind: "enum";
59
- readonly description: "How windows are laid out: mixed (by building height), residential, office, glass (curtain walls) or plain (no windows).";
60
- readonly options: readonly ["mixed", "residential", "office", "glass", "plain"];
61
- };
62
- readonly 'facade.intensity': {
63
- readonly kind: "number";
64
- readonly description: "How strongly the windows show on the walls, and the landmarks' own texture among the buildings while their texture is detail, 0 (plain walls) to 1.";
65
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
66
- };
67
- readonly 'facade.floorHeightMeters': {
68
- readonly kind: "number";
69
- readonly description: "Height of one storey, which spaces the rows of windows. The ground floor is a third taller.";
70
- readonly range: {
71
- readonly min: 2.5;
72
- readonly max: 6;
73
- readonly step: 0.1;
74
- readonly bounds: "hard-min";
75
- };
76
- };
77
- readonly 'walls.color': {
78
- readonly kind: "color";
79
- readonly description: "Colour of the walls. Unset: the map style's 3D building colour of each kind of building, following the map colours that restyle them, and the colour of the buildings of no named kind is the one reported. Landmarks left unset among the buildings take it too.";
80
- };
81
- readonly 'roofs.color': {
82
- readonly kind: "color";
83
- readonly description: "Colour of the roofs. Unset: a shade darker than the walls of each building, and the colour reported is the walls' one.";
84
- };
85
- readonly 'windows.color': {
86
- readonly kind: "color";
87
- readonly description: "Colour of the window glass.";
88
- };
89
- readonly 'reflections.intensity': {
90
- readonly kind: "number";
91
- readonly description: "How much the window glass mirrors the street, the facades across it and the sky, and catches the sun, 0 (matte) to 1. Glass curtain walls reflect the most, landmarks a little; the sky's colour is the ambient light's.";
92
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
93
- };
94
- readonly 'litWindows.color': {
95
- readonly kind: "color";
96
- readonly description: "Colour of the windows lit from inside.";
97
- };
98
- readonly 'litWindows.fraction': {
99
- readonly kind: "number";
100
- readonly description: "Share of the windows lit from inside, 0 to 1. The dark presets light some.";
101
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
102
- };
103
- readonly 'litWindows.intensity': {
104
- readonly kind: "number";
105
- readonly description: "Brightness of the lit windows, 0 to 1. Pair it with the map effects bloom for a night glow.";
106
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
107
- };
108
- readonly 'light.direction': {
109
- readonly kind: "number";
110
- readonly description: "Direction the light comes from, in degrees clockwise from north. Shadows fall the opposite way.";
111
- readonly range: {
112
- readonly min: 0;
113
- readonly max: 359;
114
- readonly step: 1;
115
- readonly bounds: "hard";
116
- };
117
- };
118
- readonly 'light.altitude': {
119
- readonly kind: "number";
120
- readonly description: "Height of the light above the horizon, in degrees (90 = overhead); lower casts longer shadows.";
121
- readonly range: {
122
- readonly min: 5;
123
- readonly max: 90;
124
- readonly step: 1;
125
- readonly bounds: "hard";
126
- };
127
- };
128
- readonly 'light.color': {
129
- readonly kind: "color";
130
- readonly description: "Colour of the light: the sun on light presets, the moon on dark ones.";
131
- };
132
- readonly 'light.intensity': {
133
- readonly kind: "number";
134
- readonly description: "Strength of the light, 0 to 1.";
135
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
136
- };
137
- readonly 'ambientLight.color': {
138
- readonly kind: "color";
139
- readonly description: "Colour of the light from the sky, which also tints the reflections in the glass.";
140
- };
141
- readonly 'ambientLight.intensity': {
142
- readonly kind: "number";
143
- readonly description: "Strength of the light from the sky, 0 to 1, which lights the walls in shade.";
144
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
145
- };
146
- readonly 'shadows.visible': {
147
- readonly kind: "toggle";
148
- readonly description: "Shadows the buildings and the landmarks among them cast, on each other and on the ground.";
149
- };
150
- readonly 'shadows.intensity': {
151
- readonly kind: "number";
152
- readonly description: "Darkness of the shadows, 0 to 1.";
153
- readonly range: import("@tomtom-org/maps-sdk/map").KnobRange;
154
- };
155
- readonly 'roadLabels.occluded': {
156
- readonly kind: "toggle";
157
- readonly description: "Road names draw under the buildings: hidden wherever a building covers them, they give way to the labels above them.";
158
- };
159
- readonly 'pois.occluded': {
160
- readonly kind: "toggle";
161
- readonly description: "The style's POIs draw under the buildings: hidden wherever a building covers them, still keeping other labels off, they give way to the labels above them.";
162
- };
163
- };
41
+ declare class ObjectHighlights {
42
+ readonly uniforms: HighlightUniforms;
43
+ private readonly indices;
44
+ private readonly objects;
45
+ private readonly states;
46
+ private colors;
47
+ /** The index of the object with this id, registered on first sight; later properties replace earlier ones. */
48
+ indexOf(id: number | string, properties?: Record<string, unknown>): number;
49
+ /** The object at an index, as user events report it. */
50
+ objectAt(index: number): BuildingHit | undefined;
51
+ /** Gives the objects with these ids their colour, and every other one its own back. */
52
+ setColors(colors: Readonly<Record<string, string>>): void;
53
+ /** The colours {@link setColors} gave, by id. */
54
+ getColors(): Record<string, string>;
55
+ /** Sets how the hovered and the clicked object show. */
56
+ setLook(look: HighlightLooks): void;
57
+ /** Takes an object's event state, as the SDK hands it to a custom layer. */
58
+ setState(id: number | string, state: EventState | undefined): void;
59
+ private get table();
60
+ private indexOfKey;
61
+ private writeColor;
62
+ private growTable;
63
+ }
64
+ //#endregion
65
+ //#region src/knobConfigured.d.ts
164
66
  /**
165
- * The id of a buildings knob, as accepted by the SDK's `setKnob` and as a path into {@link Buildings3DConfig}.
67
+ * A feature configured by knobs, as {@link Buildings3D} and {@link GLSurfaces} are: it holds the
68
+ * knobs set, hands them out as a copy, merges a partial set into them, unsets them, and reads and
69
+ * writes them by id for the SDK's `getKnob`, `setKnobs` and `resetKnob`. The feature supplies
70
+ * {@link applyConfig}, which puts a whole configuration into effect, and {@link _knobValue}.
166
71
  *
167
- * @group Buildings 3D
72
+ * It mirrors the SDK's own `AbstractMapModule`, which gives the map's modules this same shape.
73
+ * @ignore
168
74
  */
169
- type Buildings3DKnobId = keyof typeof buildingsKnobDefinitions;
170
- type KindOf<ID extends Buildings3DKnobId> = (typeof buildingsKnobDefinitions)[ID]['kind'];
75
+ declare abstract class KnobConfigured<CONFIG extends {
76
+ visible?: boolean;
77
+ }> {
78
+ protected config: CONFIG;
79
+ protected constructor(config: CONFIG);
80
+ /** Puts a whole configuration into effect, the feature's own way. */
81
+ abstract applyConfig(config: CONFIG): void;
82
+ /** @ignore */
83
+ abstract _knobValue(id: string): unknown;
84
+ /** Returns the knobs set, as a plain serializable copy. */
85
+ getConfig(): CONFIG;
86
+ /** Changes the given knobs and keeps the others, one level deep. */
87
+ updateConfig(partial: CONFIG): void;
88
+ /** Unsets every knob. */
89
+ resetConfig(): void;
90
+ /** Whether the feature is set to be shown: the `visible` knob, `true` unless set. */
91
+ isVisible(): boolean;
92
+ /** Shows or hides the feature. Stored as `visible` in the configuration. */
93
+ setVisible(visible: boolean): void;
94
+ /** @ignore */
95
+ _setKnobValues(values: Readonly<Record<string, unknown>>): void;
96
+ /** @ignore */
97
+ _resetKnobValue(id: string): void;
98
+ /**
99
+ * A knob's value from a resolved look. The map's light turns with the bearing by fractions of a
100
+ * degree, which the features draw with; the knob reports whole degrees, a value `setKnob` takes back.
101
+ */
102
+ protected lookValue(look: Record<string, unknown>, id: string): unknown;
103
+ }
104
+ //#endregion
105
+ //#region src/palette.d.ts
171
106
  /**
172
- * The value type a buildings knob takes.
173
- *
174
- * @group Buildings 3D
107
+ * A palette as the buildings or the landmarks draw with it, every colour resolved.
108
+ * @ignore
175
109
  */
176
- type Buildings3DKnobValueOf<ID extends Buildings3DKnobId> = ID extends 'preset' ? BuildingsPreset : ID extends 'facade.pattern' ? FacadePattern : KnobValueOf<KindOf<ID>>;
110
+ type PaletteChoice = {
111
+ colors: readonly string[];
112
+ mode: PaletteMode;
113
+ intensity: number;
114
+ };
177
115
  /**
178
- * One entry of {@link buildings3DKnobCatalogue}, with what a UI or a coding agent needs to offer the
179
- * knob and validate a value for it. The SDK's `getKnob` reads the value in force.
180
- *
181
- * @group Buildings 3D
116
+ * How the buildings or the landmarks vary their colour from one to the next.
117
+ * @ignore
182
118
  */
183
- type Buildings3DKnob = KnobEntry<Buildings3DKnobId>;
119
+ type PaletteLook = PaletteChoice & {
120
+ variation: number;
121
+ };
184
122
  /**
185
- * Every buildings knob with its kind, description, range or options and, for `visible` and `preset`,
186
- * its default. It's static data, readable without a map.
187
- *
188
- * @remarks
189
- * A knob is a plain value in {@link Buildings3DConfig}, at its id's path. Every knob but `visible` and
190
- * `preset` takes the preset's value while unset, which the SDK's `getKnob` reports.
191
- *
192
- * @group Buildings 3D
123
+ * The uniforms {@link PALETTE_GLSL} reads.
124
+ * @ignore
193
125
  */
194
- export declare const buildings3DKnobCatalogue: readonly Buildings3DKnob[];
126
+ type PaletteUniforms = Record<'paletteColors', IUniform<Vector3[]>> & Record<'paletteCount' | 'paletteBlend' | 'paletteIntensity' | 'colorVariation', IUniform<number>>;
127
+ //#endregion
128
+ //#region src/utils.d.ts
195
129
  /**
196
- * Every buildings knob id, in catalogue order.
197
- *
198
- * @group Buildings 3D
130
+ * Where a plugin's sun stands, by its light knobs, in degrees.
131
+ * @ignore
199
132
  */
200
- export declare const buildings3DKnobIds: readonly Buildings3DKnobId[];
133
+ type LightKnobs = {
134
+ 'light.direction': number;
135
+ 'light.altitude': number;
136
+ };
201
137
  //#endregion
202
138
  //#region src/buildings/buildingsLook.d.ts
203
139
  /**
@@ -215,12 +151,15 @@ type Buildings3DConfig = KnobConfigOf<{ [ID in Buildings3DKnobId]: Buildings3DKn
215
151
  type Values = { [ID in Buildings3DKnobId]: Buildings3DKnobValueOf<ID>; };
216
152
  /**
217
153
  * Every knob resolved to the value the buildings are drawn with, plus the per-kind wall colours the
218
- * walls take while `walls.color` is unset.
154
+ * walls take while `walls.color` is unset, and the wall palette with its map colours read.
219
155
  * @ignore
220
156
  */
221
157
  type Buildings3DLook = Values & {
222
158
  wallColorsByGroup: GroupColors;
223
159
  roofsFollowWalls: boolean;
160
+ roofColorSet: boolean;
161
+ wallPalette: PaletteLook;
162
+ roofPalette: PaletteChoice;
224
163
  };
225
164
  //#endregion
226
165
  //#region src/buildings/glass.d.ts
@@ -232,6 +171,20 @@ type Buildings3DLook = Values & {
232
171
  */
233
172
  type GlassUniforms = Record<'eyePosition' | 'sunDirection' | 'sunColor' | 'skyColor', IUniform<Vector3>> & Record<'skyIntensity' | 'reflectivity', IUniform<number>>;
234
173
  //#endregion
174
+ //#region src/scenePicking.d.ts
175
+ /**
176
+ * What lies first under a point of the map: a building, by its highlight index, or a landmark mesh, and
177
+ * how far along the ray from the eye, in scene metres.
178
+ * @ignore
179
+ */
180
+ type ScenePick = {
181
+ building: number;
182
+ distance: number;
183
+ } | {
184
+ landmark: Mesh;
185
+ distance: number;
186
+ };
187
+ //#endregion
235
188
  //#region src/basemapBuildings.d.ts
236
189
  /**
237
190
  * One colour per kind of {@link BUILDING_GROUPS}, in that order, then the one of every other building.
@@ -294,12 +247,20 @@ declare class BuildingsLayer implements CustomLayerInterface {
294
247
  id: string;
295
248
  layer: string;
296
249
  };
250
+ /**
251
+ * The buildings as user events report them, the colours an app gives them, and the hovered and clicked one.
252
+ * @ignore
253
+ */
254
+ readonly highlights: ObjectHighlights;
297
255
  private map?;
298
256
  private renderer?;
299
257
  private look?;
300
258
  private filter;
301
259
  private origin?;
302
260
  private frame;
261
+ private lastPick?;
262
+ private shadowsDrawnFrom;
263
+ private sceneVersion;
303
264
  private readonly scene;
304
265
  private readonly camera;
305
266
  private readonly buildings;
@@ -314,29 +275,50 @@ declare class BuildingsLayer implements CustomLayerInterface {
314
275
  private readonly tiles;
315
276
  private pending;
316
277
  private extrusion;
278
+ private readonly groundKeys;
279
+ private readonly shadowFromMercator;
280
+ private drawn;
317
281
  /**
318
282
  * @param landmarksOf - The landmarks to draw among the buildings, asked every frame. The buildings
319
283
  * they replace stay out in the frames that draw them.
320
284
  */
321
285
  constructor(id: string, landmarksOf?: () => LandmarksForBuildings | undefined);
286
+ /** Moves the sun alone, the rest of the look as it was. */
287
+ setSun(sun: LightKnobs): void;
322
288
  /** Draws the buildings with this look, from the next frame. */
323
289
  setLook(look: Buildings3DLook): void;
324
290
  onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
291
+ onRemove(map: Map): void;
325
292
  render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
293
+ private enableShadowMap;
294
+ private draw;
295
+ private shareShadows;
326
296
  private renderTranslucent;
297
+ private shadowsStale;
327
298
  private useBuildingsPass;
328
299
  private placeLandmarks;
329
300
  private toScene;
330
301
  private updateOrigin;
331
302
  private carryTiles;
332
303
  private updateTiles;
304
+ private sourceKey;
333
305
  private queueTiles;
334
306
  private startExtrusion;
307
+ /**
308
+ * What the last frame drew first under a point of the map, in CSS pixels from its top left: one of
309
+ * its buildings, or one of the landmarks it drew among them.
310
+ * @ignore
311
+ */
312
+ pick(point: {
313
+ x: number;
314
+ y: number;
315
+ }): ScenePick | undefined;
335
316
  private addTileMesh;
336
317
  private removeTileMesh;
337
318
  private evictStaleTiles;
338
319
  private eyePosition;
339
320
  private groundMaterial;
321
+ private groundCornersInView;
340
322
  private updateSun;
341
323
  }
342
324
  //#endregion
@@ -352,16 +334,25 @@ declare class BuildingsLayer implements CustomLayerInterface {
352
334
  * - While it shows, it takes the place of the style's own 3D buildings, which it filters out of the
353
335
  * `3D - Building` layer. It draws whether or not the `buildings3D` group of the `BaseMapModule` shows.
354
336
  * - Its look is a set of knobs, listed in {@link buildings3DKnobCatalogue}. Each one you leave unset
355
- * takes the preset's value. The `auto` preset follows the map style: the dark street and mono styles
356
- * light windows from inside under a moon, the others get a sun and glass that mirrors the street and the sky.
337
+ * takes the preset's value, but the hover and click colours, which take the map's accent, else blue,
338
+ * and the light's direction and altitude, below. The `auto` preset follows the map style: the dark
339
+ * street and mono styles light windows from inside under a moon, the others get a sun and glass that
340
+ * mirrors the street and the sky.
357
341
  * - Walls take the style's 3D building colour of each kind of building until you set `walls.color`,
358
- * following the map colours that restyle them.
342
+ * following the map colours that restyle them. `walls.palette`, an array of colours of your own, gives
343
+ * each building one of them, and `walls.variation` a shade of its own. Roofs follow the walls, palette
344
+ * included, until you set `roofs.color` or a `roofs.palette` of their own.
345
+ * - Its sun is the map's light once one is placed, such as through the styling module's
346
+ * `view.light` knobs: `light.direction` and `light.altitude` each follow it while unset.
347
+ * `GLSurfaces` follows the same light, so the shadows and the textured ground agree.
359
348
  * - On a map with a {@link Landmarks3D}, it leaves out the buildings a landmark replaces and draws the
360
349
  * landmarks among its buildings, under its sun and in its shadows, which they cast too. They take its
361
- * wall colour, opacity and `minZoom` for their unset knobs.
350
+ * wall colour, opacity, `minZoom`, palette knobs, `walls.variation` and hover and click looks for their
351
+ * unset knobs.
362
352
  * Unless their `texture` knob says otherwise, their own textures show as facade detail, as strong as
363
- * `facade.intensity`. They mirror a little of the street and the sky, as much as `reflections.intensity` sets.
364
- * - It draws at sea level, so on a 3D terrain hills cover the buildings' lower floors.
353
+ * `facade.intensity`, and in their own colours over satellite imagery. They mirror a little of the street and the sky, as much as `reflections.intensity` sets.
354
+ * - On a 3D terrain, each building stands on the lowest ground under it, and the streets' shadows,
355
+ * which fall on a flat plane, are left out.
365
356
  * - With `roadLabels.occluded` or `pois.occluded`, it moves those style layers under its own, so a
366
357
  * building drawn over a label hides it. A hidden POI still keeps other labels off its place, and
367
358
  * the moved labels give way to the labels above them where they collide.
@@ -376,11 +367,12 @@ declare class BuildingsLayer implements CustomLayerInterface {
376
367
  *
377
368
  * @group Buildings 3D
378
369
  */
379
- export declare class Buildings3D {
370
+ export declare class Buildings3D extends KnobConfigured<Buildings3DConfig> {
380
371
  private readonly map;
381
372
  private readonly buildingsLayer;
382
- private config;
373
+ private readonly customLayer;
383
374
  private renderedLook;
375
+ private followedLight;
384
376
  private styling;
385
377
  private readonly occludedLabels;
386
378
  private styleOrder;
@@ -396,153 +388,71 @@ export declare class Buildings3D {
396
388
  */
397
389
  get layer(): BuildingsLayer;
398
390
  /**
399
- * Returns the knobs set, as a plain serializable copy. The SDK's `getKnob` reads a knob's value
400
- * in force, the preset's one when unset.
401
- */
402
- getConfig(): Buildings3DConfig;
403
- /**
404
- * Replaces the whole configuration. An empty object has every knob take the `auto` preset's value.
391
+ * The user events of the buildings: a handler gets the building under the pointer, with its
392
+ * feature id and properties.
405
393
  *
406
394
  * @remarks
407
- * Use it, and {@link updateConfig}, for a look your code writes: the type is the check, and the
408
- * values are not checked again. For values held as data, the SDK's `setKnobs` checks each against
409
- * {@link buildings3DKnobCatalogue} and sets them by id.
410
- */
411
- applyConfig(config: Buildings3DConfig): void;
412
- /**
413
- * Changes the given knobs and keeps the others, one level deep: a part you pass, such as `light`,
414
- * replaces that part's values.
395
+ * - While a handler listens, the hovered building turns towards `hover.color` and the clicked one
396
+ * towards `click.color`, until the next click lands elsewhere.
397
+ * - A building takes the pointer only where no landmark stands in front of it, and the reverse.
415
398
  *
416
399
  * @example
417
400
  * ```typescript
418
- * buildings.updateConfig({ preset: 'streetDark', litWindows: { fraction: 0.6 } });
401
+ * buildings.events.on('click', (building) => console.log(building.id, building.properties.height));
419
402
  * ```
420
403
  */
421
- updateConfig(partial: Buildings3DConfig): void;
404
+ get events(): CustomLayer<BuildingHit>['events'];
422
405
  /**
423
- * Unsets every knob, so the buildings show with the look of the map's style.
406
+ * Gives the buildings with these feature ids a colour of their own, in place of their wall
407
+ * colour, and every other one its own colour back. An empty object clears them.
408
+ *
409
+ * @remarks
410
+ * The ids are the ones {@link events} report, which stay the same across tiles and zoom levels,
411
+ * so you can colour a building before it loads. Its roof takes the colour too, and so does every
412
+ * part of a building the map data splits into parts, by the id of its whole outline.
413
+ *
414
+ * @example
415
+ * ```typescript
416
+ * buildings.setBuildingColors({ 6183703601: '#e4572e', 6183703602: '#29335c' });
417
+ * ```
424
418
  */
425
- resetConfig(): void;
419
+ setBuildingColors(colors: Readonly<Record<string, string>>): void;
426
420
  /**
427
- * Whether the buildings are set to be shown: the `visible` knob, `true` unless set.
421
+ * The colours {@link setBuildingColors} gave, by feature id.
428
422
  */
429
- isVisible(): boolean;
423
+ getBuildingColors(): Record<string, string>;
430
424
  /**
431
- * Shows or hides the buildings. Stored as `visible` in the configuration. Hidden, they give the
432
- * style's own 3D buildings their place back.
425
+ * Replaces the whole configuration. An empty object has every knob take the `auto` preset's value.
426
+ *
427
+ * @remarks
428
+ * Use it, and `updateConfig`, for a look your code writes: the type is the check, and the values
429
+ * are not checked again. For values held as data, the SDK's `setKnobs` checks each against
430
+ * {@link buildings3DKnobCatalogue} and sets them by id, and its `getKnob` reads a knob's value in
431
+ * force, the preset's one when unset. `light.direction` and `light.altitude` read the map's light
432
+ * when unset, once one is placed.
433
+ *
434
+ * `updateConfig` merges one level deep: a part you pass, such as `light`, replaces that part's values.
435
+ *
436
+ * @example
437
+ * ```typescript
438
+ * buildings.updateConfig({ preset: 'streetDark', litWindows: { fraction: 0.6 } });
439
+ * ```
433
440
  */
434
- setVisible(visible: boolean): void;
441
+ applyConfig(config: Buildings3DConfig): void;
435
442
  /**
436
443
  * @ignore
437
444
  */
438
445
  _knobValue(id: string): unknown;
439
- /**
440
- * @ignore
441
- */
442
- _setKnobValues(values: Readonly<Record<string, unknown>>): void;
443
- /**
444
- * @ignore
445
- */
446
- _resetKnobValue(id: string): void;
447
446
  private install;
447
+ private hitsAt;
448
448
  private look;
449
+ private followMapLight;
449
450
  private render;
450
451
  private placeLabels;
451
452
  private restoreLabels;
452
453
  private occludeLabels;
453
454
  }
454
455
  //#endregion
455
- //#region src/knobCatalogue.d.ts
456
- /**
457
- * What a landmark's own texture gives its look, besides carving its silhouette:
458
- *
459
- * - `mask`: nothing more; the landmark is shaded in its `color`.
460
- * - `detail`: its light and shade, over the `color`, as facade detail.
461
- * - `color`: its colours, in place of the `color`.
462
- *
463
- * Whatever the use, the map's light shades the landmark.
464
- *
465
- * @group Landmarks 3D
466
- */
467
- export declare const landmarkTextureUses: readonly ["mask", "detail", "color"];
468
- /**
469
- * One of {@link landmarkTextureUses}.
470
- *
471
- * @group Landmarks 3D
472
- */
473
- type LandmarkTextureUse = (typeof landmarkTextureUses)[number];
474
- declare const landmarks3DKnobDefinitions: {
475
- readonly visible: {
476
- readonly kind: "toggle";
477
- readonly description: "The landmark models.";
478
- readonly default: true;
479
- };
480
- readonly color: {
481
- readonly kind: "color";
482
- readonly description: "Colour the landmarks are shaded in. Unset: the base map's 3D buildings' colour, following the map colours that restyle them.";
483
- };
484
- readonly texture: {
485
- readonly kind: "enum";
486
- readonly description: "What the landmarks' textures add to their silhouette: mask (nothing), detail (their light and shade over the color) or color (their own colours, in place of the color). Unset: mask, or detail while a Buildings3D draws.";
487
- readonly options: readonly ["mask", "detail", "color"];
488
- };
489
- readonly opacity: {
490
- readonly kind: "number";
491
- readonly description: "Opacity of the landmarks, 0 to 1. Unset: the base map's 3D buildings' opacity.";
492
- readonly range: KnobRange;
493
- };
494
- readonly verticalGradient: {
495
- readonly kind: "toggle";
496
- readonly description: "Whether the landmarks' walls darken towards the ground. Unset: as the base map's 3D buildings do. No effect while a Buildings3D draws, whose walls have no gradient.";
497
- };
498
- readonly minZoom: {
499
- readonly kind: "number";
500
- readonly description: "Lowest zoom the landmarks are drawn at. Unset: the base map's 3D buildings' one.";
501
- readonly range: KnobRange;
502
- };
503
- readonly maxZoom: {
504
- readonly kind: "number";
505
- readonly description: "Highest whole zoom level the landmarks are drawn at, up to the next one. Unset: the base map's 3D buildings' one, or 22 while a Buildings3D draws.";
506
- readonly range: KnobRange;
507
- };
508
- };
509
- /**
510
- * The id of a landmarks knob, as accepted by the SDK's `setKnob` and as a key of {@link Landmarks3DConfig}.
511
- *
512
- * @group Landmarks 3D
513
- */
514
- type Landmarks3DKnobId = keyof typeof landmarks3DKnobDefinitions;
515
- /**
516
- * The value type a landmarks knob takes.
517
- *
518
- * @group Landmarks 3D
519
- */
520
- type Landmarks3DKnobValueOf<ID extends Landmarks3DKnobId> = ID extends 'texture' ? LandmarkTextureUse : KnobValueOf<(typeof landmarks3DKnobDefinitions)[ID]['kind']>;
521
- /**
522
- * One entry of {@link landmarks3DKnobCatalogue}, with what a UI or a coding agent needs to offer the knob
523
- * and validate a value for it. The SDK's `getKnob` reads the value in force.
524
- *
525
- * @group Landmarks 3D
526
- */
527
- type Landmarks3DKnob = KnobEntry<Landmarks3DKnobId>;
528
- /**
529
- * Every landmarks knob with its kind, description, range or options and, for `visible`, its default.
530
- * It's static data, readable without a map.
531
- *
532
- * @remarks
533
- * A knob is a plain value in {@link Landmarks3DConfig}, under its id. Every knob but `visible`
534
- * follows the base map's 3D buildings while unset, which the SDK's `getKnob` reports.
535
- *
536
- * @group Landmarks 3D
537
- */
538
- export declare const landmarks3DKnobCatalogue: readonly Landmarks3DKnob[];
539
- /**
540
- * Every landmarks knob id, in catalogue order.
541
- *
542
- * @group Landmarks 3D
543
- */
544
- export declare const landmarks3DKnobIds: readonly Landmarks3DKnobId[];
545
- //#endregion
546
456
  //#region src/FillExtrusionMaterial.d.ts
547
457
  /**
548
458
  * Alpha mask carried over from a landmark mesh's as-authored texture.
@@ -574,10 +484,16 @@ type FillExtrusionAlphaMask = {
574
484
  * @group Landmarks 3D
575
485
  */
576
486
  declare class FillExtrusionMaterial extends ShaderMaterial {
577
- constructor(alphaMask?: FillExtrusionAlphaMask);
487
+ /**
488
+ * @param alphaMask - The landmark mesh's authored base colour texture, whose alpha carves its silhouette.
489
+ * @param highlights - The uniforms of the layer's highlights, which its materials share.
490
+ * @param palette - The uniforms of the layer's palette, in sRGB, which its materials share.
491
+ */
492
+ constructor(alphaMask: FillExtrusionAlphaMask | undefined, highlights: HighlightUniforms, palette: PaletteUniforms);
578
493
  /**
579
494
  * Copies the shading uniforms (colour, texture use, light, layer opacity, vertical gradient) from
580
- * another instance, bringing a freshly created alpha-masked variant up to date with the shared material.
495
+ * another instance, bringing a freshly created alpha-masked variant up to date with the shared
496
+ * material. The palette's and the highlights' are shared already.
581
497
  */
582
498
  copyShadingFrom(source: FillExtrusionMaterial): void;
583
499
  /**
@@ -670,8 +586,9 @@ interface ModelsSourceSpecification {
670
586
  /**
671
587
  * Source of tiled glTF/GLB models for a {@link ModelsLayer}.
672
588
  *
673
- * Tracks the tiles covering the current viewport, fetches each tile's models once
674
- * and keeps them in a Three.js {@link Group} that the owning layer renders.
589
+ * Tracks the tiles covering the current viewport, fetches each tile's models once, or again after a failure that
590
+ * clears on its own or the KTX2 transcoder failed to load, and keeps them in a Three.js {@link Group} that the
591
+ * owning layer renders.
675
592
  *
676
593
  * @group Landmarks 3D
677
594
  */
@@ -684,7 +601,7 @@ export declare class ModelsSource {
684
601
  tiles: Array<string>;
685
602
  scene: Group;
686
603
  loadedTiles: Set<string>;
687
- /** Whether a tile came back 403 for want of Orbis 3D Landmarks access, so the key loads none. */
604
+ /** Whether a tile came back `401` or `403`, so the key loads none and the source fetches no more. */
688
605
  accessDenied: boolean;
689
606
  /**
690
607
  * EPSG:3857 origin subtracted from all mesh positions, because absolute coordinates (~6·10⁶ m)
@@ -703,12 +620,14 @@ export declare class ModelsSource {
703
620
  private readonly specification;
704
621
  private readonly withCredentials;
705
622
  private coveringTileKeys;
623
+ private readonly retries;
706
624
  constructor(id: string, options: ModelsSourceSpecification);
707
625
  onAdd(map: Map, renderer: WebGLRenderer): void;
708
626
  updateTiles(): void;
709
627
  private showCoveringTilesOnly;
710
628
  private coveringTiles;
711
629
  private loadTile;
630
+ private reportTileError;
712
631
  private rebaseToSceneOrigin;
713
632
  private fetchTile;
714
633
  }
@@ -749,6 +668,13 @@ export declare class ModelsLayer implements CustomLayerInterface {
749
668
  maxzoom: number;
750
669
  visible: boolean;
751
670
  diffuseColor: string;
671
+ /**
672
+ * The landmarks as user events report them, the colours an app gives them, and the hovered and clicked one.
673
+ * @ignore
674
+ */
675
+ readonly highlights: ObjectHighlights;
676
+ private readonly fillPalette;
677
+ private readonly facadePalette;
752
678
  private readonly fillExtrusionMaterial;
753
679
  private readonly depthPrepassMaterial;
754
680
  private readonly maskedFillExtrusionMaterials;
@@ -757,14 +683,30 @@ export declare class ModelsLayer implements CustomLayerInterface {
757
683
  private glass;
758
684
  private opacity;
759
685
  private textureUse;
686
+ private drawn;
760
687
  private readonly tilesMainMatrix;
761
688
  private tilesStale;
689
+ private terrainVersion;
762
690
  private readonly markTilesStale;
763
691
  constructor(options: ModelsLayerSpecification, source: ModelsSourceSpecification);
764
692
  updateProperties(options: ModelsLayerSpecification): void;
765
693
  setDirectionalLight(radius: number, phi: number, theta: number): void;
766
694
  onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
767
- render(_gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
695
+ render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
696
+ /**
697
+ * The landmark the last frame drawn here shows first under a point of the map, in CSS pixels from
698
+ * its top left. None while a `Buildings3D` draws the landmarks, whose own pick finds them.
699
+ * @ignore
700
+ */
701
+ pick(point: {
702
+ x: number;
703
+ y: number;
704
+ }): ScenePick | undefined;
705
+ /**
706
+ * A landmark mesh as user events report it.
707
+ * @ignore
708
+ */
709
+ hitOf(mesh: Mesh): BuildingHit | undefined;
768
710
  /**
769
711
  * Readies the landmark tiles for a `Buildings3D` to draw in its scene this frame.
770
712
  * @returns Where they are, `undefined` while they don't show, the key has no access to them, or no
@@ -785,7 +727,6 @@ export declare class ModelsLayer implements CustomLayerInterface {
785
727
  private terrainSamplePoints;
786
728
  private alignCameraToMap;
787
729
  private get sceneOrigin();
788
- private needsTranslucentPrepass;
789
730
  setOpacity(value: number): void;
790
731
  /**
791
732
  * Hands the landmarks to a `Buildings3D`, which draws them in its scene under its sun and in its
@@ -794,6 +735,12 @@ export declare class ModelsLayer implements CustomLayerInterface {
794
735
  * @ignore
795
736
  */
796
737
  setBuildingsLight(light: BuildingsLight | undefined): void;
738
+ /**
739
+ * Sets the palette each landmark takes its colour from, over `diffuseColor`, and how much each
740
+ * one's shade varies, here and under a `Buildings3D`.
741
+ * @ignore
742
+ */
743
+ setPalette(palette: PaletteLook): void;
797
744
  /** Mirrors the basemap's fill-extrusion-vertical-gradient on the landmark shading. */
798
745
  setVerticalGradient(enabled: boolean): void;
799
746
  /**
@@ -807,22 +754,28 @@ export declare class ModelsLayer implements CustomLayerInterface {
807
754
  private forEachFillExtrusionMaterial;
808
755
  private syncLighting;
809
756
  private applyMaterials;
757
+ private bakeHighlightIndex;
810
758
  private facadeMaterialOf;
811
759
  }
812
760
  //#endregion
813
761
  //#region src/Landmarks3D.d.ts
814
762
  /**
815
763
  * The landmark knobs an app sets, as {@link Landmarks3D.getConfig} returns them. Each knob id is its
816
- * key in here, and it's plain JSON.
764
+ * path in here, and it's plain JSON.
817
765
  *
818
- * - Every knob but `visible` follows the base map's 3D buildings while unset.
766
+ * - `color`, `opacity`, `verticalGradient`, `minZoom` and `maxZoom` follow the base map's 3D buildings
767
+ * while unset, and `hover.color` and `click.color` the map's accent, else blue.
819
768
  * - While a {@link Buildings3D} draws, the landmarks follow its buildings instead: `texture` is `detail`,
820
769
  * there's no wall gradient, which `verticalGradient` can't turn on, and every zoom up to `maxZoom`.
770
+ * Their palette and variation are the walls' ones, the palette only while `color` is unset.
771
+ * - On `streetSatellite`, `texture` is `color` while unset, with or without a {@link Buildings3D}: the
772
+ * landmarks show their own colours over the imagery.
821
773
  *
822
774
  * @example
823
775
  * ```typescript
824
776
  * const config: Landmarks3DConfig = { color: '#c8b28a', opacity: 0.9 };
825
777
  * const authored: Landmarks3DConfig = { texture: 'color' }; // the landmarks' own colours
778
+ * const varied: Landmarks3DConfig = { palette: ['#efe4cf', '#cdb07f', '#b96c48'], variation: 0.3 };
826
779
  * ```
827
780
  *
828
781
  * @group Landmarks 3D
@@ -854,11 +807,13 @@ type Landmarks3DOptions = Landmarks3DConfig & Pick<ModelsSourceSpecification, 't
854
807
  * across map style changes.
855
808
  *
856
809
  * @remarks
810
+ * **[Private Preview](https://docs.tomtom.com/legal/private-preview)** until the plugin's 1.0.0 release.
811
+ *
857
812
  * It requires an API key with Orbis 3D Landmarks entitlements. Its look is a set of knobs, listed in
858
813
  * {@link landmarks3DKnobCatalogue}.
859
814
  *
860
- * - Each knob you leave unset follows the base map's 3D buildings, through style changes and
861
- * anything that restyles them, falling back to the `streetLight` style's look.
815
+ * - The colour, opacity, gradient and zoom range you leave unset follow the base map's 3D buildings,
816
+ * through style changes and anything that restyles them, falling back to the `streetLight` style's look.
862
817
  * - Whether those buildings show is the `buildings3D` group of the `BaseMapModule`, hidden in most
863
818
  * standard styles; the plugin leaves it as it is.
864
819
  * - A visible {@link Buildings3D} on the same map takes their place: the landmarks then follow its
@@ -881,8 +836,10 @@ export declare class Landmarks3D {
881
836
  private readonly layerID;
882
837
  private readonly basemapBuildingLayerID;
883
838
  private readonly modelsLayer;
839
+ private readonly customLayer;
884
840
  private config;
885
841
  private renderedLook;
842
+ private styling;
886
843
  /**
887
844
  * Creates the plugin bound to a TomTom map and starts rendering landmarks
888
845
  * as soon as the map is ready.
@@ -895,13 +852,49 @@ export declare class Landmarks3D {
895
852
  * The underlying MapLibre custom layer, for advanced use beyond this facade.
896
853
  */
897
854
  get layer(): ModelsLayer;
855
+ /**
856
+ * The user events of the landmarks: a handler gets the landmark under the pointer, with its id and
857
+ * its `position` as `[longitude, latitude]`.
858
+ *
859
+ * @remarks
860
+ * - While a handler listens, the hovered landmark turns towards `hover.color` and the clicked one
861
+ * towards `click.color`, until the next click lands elsewhere.
862
+ * - Among the buildings of a {@link Buildings3D}, a landmark takes the pointer only where no building
863
+ * stands in front of it. Over the style's own 3D buildings, it takes it wherever it shows.
864
+ *
865
+ * @example
866
+ * ```typescript
867
+ * landmarks.events.on('click', (landmark) => console.log(landmark.id, landmark.properties.position));
868
+ * ```
869
+ */
870
+ get events(): CustomLayer<BuildingHit>['events'];
871
+ /**
872
+ * Gives the landmarks with these ids a colour of their own, in place of their `color` and palette
873
+ * colour, and every other one its own colour back. An empty object clears them.
874
+ *
875
+ * @remarks
876
+ * The ids are the ones {@link events} report, which stay the same in every session, so you can
877
+ * colour a landmark before it loads. Under `texture: 'color'`, a landmark you colour draws as under
878
+ * `detail`: your colour, with its texture's light and shade over it.
879
+ *
880
+ * @example
881
+ * ```typescript
882
+ * landmarks.setLandmarkColors({ [landmark.id]: '#e4572e' });
883
+ * ```
884
+ */
885
+ setLandmarkColors(colors: Readonly<Record<string, string>>): void;
886
+ /**
887
+ * The colours {@link setLandmarkColors} gave, by id.
888
+ */
889
+ getLandmarkColors(): Record<string, string>;
898
890
  /**
899
891
  * Returns the knobs set, as a plain serializable copy. The SDK's `getKnob` reads a knob's value
900
- * in force, the base map's one when unset.
892
+ * in force: when unset, the base map's, or the knob's own default.
901
893
  */
902
894
  getConfig(): Landmarks3DConfig;
903
895
  /**
904
- * Replaces the whole configuration. An empty object has every knob follow the base map's 3D buildings.
896
+ * Replaces the whole configuration. An empty object unsets every knob, back to the base map's 3D
897
+ * buildings or the knob's own default.
905
898
  *
906
899
  * @remarks
907
900
  * Use it, and {@link updateConfig}, for a look your code writes: as on a map module, the type is
@@ -915,7 +908,8 @@ export declare class Landmarks3D {
915
908
  */
916
909
  applyConfig(config: Landmarks3DConfig): void;
917
910
  /**
918
- * Changes the given knobs and keeps the others.
911
+ * Changes the given knobs and keeps the others, one level deep: a part you pass, such as `hover`,
912
+ * replaces that part's values.
919
913
  *
920
914
  * @example
921
915
  * ```typescript
@@ -924,7 +918,8 @@ export declare class Landmarks3D {
924
918
  */
925
919
  updateConfig(partial: Landmarks3DConfig): void;
926
920
  /**
927
- * Unsets every knob, so the landmarks are shown and look like the base map's 3D buildings.
921
+ * Unsets every knob, so the landmarks are shown and look like the base map's 3D buildings, with each
922
+ * other knob at its own default.
928
923
  */
929
924
  resetConfig(): void;
930
925
  /**
@@ -949,6 +944,7 @@ export declare class Landmarks3D {
949
944
  * @ignore
950
945
  */
951
946
  _resetKnobValue(id: string): void;
947
+ private hitsAt;
952
948
  private install;
953
949
  private excludeLandmarkBuildingsFromBasemap;
954
950
  private readBuildingsLook;
@@ -968,4 +964,146 @@ export declare class Landmarks3D {
968
964
  */
969
965
  export declare const buildLandmarksTileURL: () => string;
970
966
  //#endregion
971
- export type { Buildings3DConfig, Buildings3DKnob, Buildings3DKnobId, Buildings3DKnobValueOf, BuildingsLayer, BuildingsPreset, FacadePattern, LandmarkTextureUse, Landmarks3DConfig, Landmarks3DKnob, Landmarks3DKnobId, Landmarks3DKnobValueOf, Landmarks3DOptions, ModelsLayerSpecification, ModelsSourceSpecification };
967
+ //#region src/surfaces/surfacesLook.d.ts
968
+ /**
969
+ * The surfaces' configuration: each knob of {@link glSurfacesKnobCatalogue} at its id's path, all
970
+ * optional, and where the 3D trees go in the layer stack.
971
+ *
972
+ * @example
973
+ * ```typescript
974
+ * const config: GLSurfacesConfig = {
975
+ * surfaces: { water: { glint: { intensity: 0.5 } }, roads: { intensity: 0 } },
976
+ * wind: { direction: 270, speedFactor: 2 },
977
+ * beforeLayerConfig: 'lowest3D',
978
+ * };
979
+ * ```
980
+ *
981
+ * @group GL Surfaces
982
+ */
983
+ type GLSurfacesConfig = KnobConfigOf<{ [ID in GLSurfacesKnobId]: GLSurfacesKnobValueOf<ID>; }> & {
984
+ /**
985
+ * Where the 3D trees go in the map's layer stack: below the style layer it names, or on top, as a
986
+ * map module's `beforeLayerConfig` places its layers, on top where the style lacks that layer and
987
+ * under the POIs where it lacks `lowest3D`. They also go below every layer a module or your app put
988
+ * right under that one, so a route or a place drawn there stays over the trees, whichever was added
989
+ * first. The textures stay right after the layers they texture. Not a knob: it moves layers rather
990
+ * than restyling them.
991
+ *
992
+ * @defaultValue `'lowestLabel'`
993
+ */
994
+ beforeLayerConfig?: BeforeLayerConfig;
995
+ };
996
+ //#endregion
997
+ //#region src/surfaces/GLSurfaces.d.ts
998
+ /**
999
+ * Textures the surfaces of the map's style with WebGL materials, and grows 3D trees on its green:
1000
+ * water that ripples in the wind, mirrors the sky and rolls in onto open shores, glaciers, tree crowns
1001
+ * lit by the sun over forests, lawns, meadows and scrub, field parcels over farmland, dunes, mud
1002
+ * flats, shingle, bare rock, paving, built-up ground and asphalt.
1003
+ *
1004
+ * @remarks
1005
+ * **[Public Preview](https://docs.tomtom.com/legal/public-preview)** until the plugin's 1.0.0 release.
1006
+ *
1007
+ * - It draws inside the style, right after the layers it textures, so labels, bridges, buildings
1008
+ * and everything your app adds above them stay on top, untouched.
1009
+ * - It textures the standard styles' land cover, land use, water, paved areas and road layers, each
1010
+ * kind of surface listed in {@link surfaceKinds}, in the style's own colours,
1011
+ * which every material varies rather than replaces. A restyle or a style switch carries over.
1012
+ * Over satellite imagery, it textures the water and the roads and grows the trees, in the
1013
+ * imagery's colours.
1014
+ * - Each surface and the trees are coloured for a season, the `season` knob, from the style's
1015
+ * colours. A colour knob set for one shade of a surface, such as the cereal fields, replaces it.
1016
+ * - The trees are broadleaf, conifers, bushes, columnar and umbrella trees, in the mix each kind of
1017
+ * ground and its latitude grow, which a `trees.species.<kind>.shareFactor` knob scales. They keep off the
1018
+ * roads, paths, railways and streams through a wood, which show over the crowns in front of them.
1019
+ * - Every texture is anchored to the ground and fades its details out before they shrink below
1020
+ * a few pixels, so it stays still and calm while you pan and zoom.
1021
+ * - Its look is a set of knobs, listed in {@link glSurfacesKnobCatalogue}. The sky the water mirrors
1022
+ * is the map's own where the style sets one, else a day or a night sky by the style's theme, and a
1023
+ * day sky over satellite imagery.
1024
+ * - Its sun is the map's light once one is placed, such as through the styling module's
1025
+ * `view.light` knobs, so it lights the crowns, the trees and the dunes from where the 3D
1026
+ * buildings are lit. Until then, it is the style's theme's sun, 215°/30° by day and the moon at
1027
+ * 135°/35° by night, and the day sun of the 3D buildings, 215°/35°, over satellite imagery.
1028
+ * - While the water, the grass or the trees show and the wind blows, the map draws a frame every
1029
+ * display frame. Set `wind.speedFactor` to 0 to hold them still and let the map rest.
1030
+ * - Over a 3D terrain, the textures and the trees follow the ground the terrain raises.
1031
+ * - It needs WebGL2.
1032
+ *
1033
+ * @example
1034
+ * ```typescript
1035
+ * import { GLSurfaces } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';
1036
+ *
1037
+ * const surfaces = new GLSurfaces(map);
1038
+ * surfaces.updateConfig({ wind: { direction: 270, speedFactor: 2 } }); // a brisk westerly
1039
+ * ```
1040
+ *
1041
+ * @group GL Surfaces
1042
+ */
1043
+ export declare class GLSurfaces extends KnobConfigured<GLSurfacesConfig> {
1044
+ private readonly map;
1045
+ private readonly renderer;
1046
+ private installedLayerIds;
1047
+ private readonly installedMasks;
1048
+ private standIns;
1049
+ private styleColors;
1050
+ private resolvedUniforms?;
1051
+ private readonly removeStyleChangeHandler;
1052
+ private removed;
1053
+ private readonly onStyleData;
1054
+ /**
1055
+ * Creates the surfaces on a map, drawn as soon as the map is ready.
1056
+ *
1057
+ * @param map - The map to texture.
1058
+ * @param config - The knobs to start with.
1059
+ */
1060
+ constructor(map: TomTomMap, config?: GLSurfacesConfig);
1061
+ /**
1062
+ * Replaces the whole configuration. An empty object has every knob take its default.
1063
+ *
1064
+ * @remarks
1065
+ * Use it, and `updateConfig`, for a look your code writes: the type is the check, and the values
1066
+ * are not checked again. For values held as data, the SDK's `setKnobs` checks each against
1067
+ * {@link glSurfacesKnobCatalogue} and sets them by id, and its `getKnob` reads a knob's value in
1068
+ * force, the map's own or the default when unset.
1069
+ *
1070
+ * `updateConfig` merges one level deep, and every surface sits in the one part `surfaces`, so
1071
+ * passing `surfaces` replaces the knobs of every surface:
1072
+ * `updateConfig({ surfaces: { roads: { intensity: 0 } } })` also unsets those of the water, the
1073
+ * forest and the others. To change some knobs and keep the others, use the SDK's `setKnobs`:
1074
+ * `setKnobs(surfaces, glSurfacesKnobCatalogue, { 'surfaces.roads.intensity': 0 })`.
1075
+ *
1076
+ * @example
1077
+ * ```typescript
1078
+ * surfaces.updateConfig({ light: { direction: 260, altitude: 12 } }); // a low evening sun
1079
+ * ```
1080
+ */
1081
+ applyConfig(config: GLSurfacesConfig): void;
1082
+ /**
1083
+ * Takes the surfaces and the trees off the map: removes their layers, with the WebGL resources
1084
+ * they hold, and stops following the map's style. Call it when your app drops the surfaces but
1085
+ * keeps the map. A removed `GLSurfaces` can't be shown again; create a new one instead.
1086
+ */
1087
+ remove(): void;
1088
+ /**
1089
+ * @ignore
1090
+ */
1091
+ _knobValue(id: string): unknown;
1092
+ private get mapLibreMap();
1093
+ private context;
1094
+ private look;
1095
+ private uniforms;
1096
+ private readStyleColors;
1097
+ private install;
1098
+ private treesBeforeOf;
1099
+ private isAddedOnTop;
1100
+ private removeLayers;
1101
+ private installMaterialRuns;
1102
+ private addRun;
1103
+ private originalOf;
1104
+ private syncMasks;
1105
+ private syncRunLayers;
1106
+ private followShape;
1107
+ }
1108
+ //#endregion
1109
+ export type { BuildingHit, Buildings3DConfig, BuildingsLayer, GLSurfacesConfig, Landmarks3DConfig, Landmarks3DOptions, ModelsLayerSpecification, ModelsSourceSpecification };