@tomtom-org/maps-sdk-plugin-landmarks-3d 0.1.0 → 0.2.1

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,7 +1,476 @@
1
1
  import { KnobConfigOf, KnobEntry, KnobRange, KnobValueOf, TomTomMap } from "@tomtom-org/maps-sdk/map";
2
2
  import { CustomLayerInterface, CustomRenderMethodInput, Map } from "maplibre-gl";
3
- import { AmbientLight, Camera, DirectionalLight, Group, Mesh, Scene, ShaderMaterial, Texture, WebGLRenderer } from "three";
3
+ import { AmbientLight, Camera, DirectionalLight, Group, IUniform, Mesh, Object3D, Scene, ShaderMaterial, Texture, Vector3, WebGLRenderer } from "three";
4
+ //#region src/buildings/buildingsKnobCatalogue.d.ts
5
+ /**
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
+ *
9
+ * @group Buildings 3D
10
+ */
11
+ export declare const facadePatterns: readonly ["mixed", "residential", "office", "glass", "plain"];
12
+ /**
13
+ * One of {@link facadePatterns}.
14
+ *
15
+ * @group Buildings 3D
16
+ */
17
+ type FacadePattern = (typeof facadePatterns)[number];
18
+ /**
19
+ * The looks the unset knobs take: one per standard style, or `auto`, which follows the map's style.
20
+ *
21
+ * @group Buildings 3D
22
+ */
23
+ export declare const buildingsPresets: readonly ["auto", "streetLight", "streetDark", "streetLightDriving", "streetDarkDriving", "monoLight", "monoDark", "streetSatellite"];
24
+ /**
25
+ * One of {@link buildingsPresets}.
26
+ *
27
+ * @group Buildings 3D
28
+ */
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
+ };
164
+ /**
165
+ * The id of a buildings knob, as accepted by the SDK's `setKnob` and as a path into {@link Buildings3DConfig}.
166
+ *
167
+ * @group Buildings 3D
168
+ */
169
+ type Buildings3DKnobId = keyof typeof buildingsKnobDefinitions;
170
+ type KindOf<ID extends Buildings3DKnobId> = (typeof buildingsKnobDefinitions)[ID]['kind'];
171
+ /**
172
+ * The value type a buildings knob takes.
173
+ *
174
+ * @group Buildings 3D
175
+ */
176
+ type Buildings3DKnobValueOf<ID extends Buildings3DKnobId> = ID extends 'preset' ? BuildingsPreset : ID extends 'facade.pattern' ? FacadePattern : KnobValueOf<KindOf<ID>>;
177
+ /**
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
182
+ */
183
+ type Buildings3DKnob = KnobEntry<Buildings3DKnobId>;
184
+ /**
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
193
+ */
194
+ export declare const buildings3DKnobCatalogue: readonly Buildings3DKnob[];
195
+ /**
196
+ * Every buildings knob id, in catalogue order.
197
+ *
198
+ * @group Buildings 3D
199
+ */
200
+ export declare const buildings3DKnobIds: readonly Buildings3DKnobId[];
201
+ //#endregion
202
+ //#region src/buildings/buildingsLook.d.ts
203
+ /**
204
+ * The building knobs an app sets, as {@link Buildings3D.getConfig} returns them. Each knob id is its
205
+ * path in here, so `light.direction` is `config.light.direction`. It's plain JSON.
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * const config: Buildings3DConfig = { facade: { pattern: 'glass' }, shadows: { intensity: 0.6 } };
210
+ * ```
211
+ *
212
+ * @group Buildings 3D
213
+ */
214
+ type Buildings3DConfig = KnobConfigOf<{ [ID in Buildings3DKnobId]: Buildings3DKnobValueOf<ID>; }>;
215
+ type Values = { [ID in Buildings3DKnobId]: Buildings3DKnobValueOf<ID>; };
216
+ /**
217
+ * 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.
219
+ * @ignore
220
+ */
221
+ type Buildings3DLook = Values & {
222
+ wallColorsByGroup: GroupColors;
223
+ roofsFollowWalls: boolean;
224
+ };
225
+ //#endregion
226
+ //#region src/buildings/glass.d.ts
227
+ /**
228
+ * The scene's light as glass mirrors it, shared by the buildings' material and the landmarks' so both
229
+ * mirror one sky: `eyePosition` in scene metres, the sun's direction and colour, the sky's colour and
230
+ * intensity, and how much glass reflects.
231
+ * @ignore
232
+ */
233
+ type GlassUniforms = Record<'eyePosition' | 'sunDirection' | 'sunColor' | 'skyColor', IUniform<Vector3>> & Record<'skyIntensity' | 'reflectivity', IUniform<number>>;
234
+ //#endregion
235
+ //#region src/basemapBuildings.d.ts
236
+ /**
237
+ * One colour per kind of {@link BUILDING_GROUPS}, in that order, then the one of every other building.
238
+ * @ignore
239
+ */
240
+ type GroupColors = readonly string[];
241
+ /**
242
+ * Where the landmark tiles are, for a frame a `Buildings3D` draws them in.
243
+ * @ignore
244
+ */
245
+ type LandmarksFrame = {
246
+ /** The origin of the tiles, in EPSG:3857 metres: they lie in metres east and north of it, z up. */
247
+ origin: {
248
+ x: number;
249
+ y: number;
250
+ };
251
+ /** Whether the landmarks are translucent, and need a depth prepass. */
252
+ translucent: boolean;
253
+ };
254
+ /**
255
+ * A pass a `Buildings3D` draws the landmarks in: in colour, depth only for a depth prepass, or
256
+ * casting their shadows and drawing nothing.
257
+ * @ignore
258
+ */
259
+ type LandmarksPass = 'color' | 'depth' | 'shadows';
260
+ /**
261
+ * The landmarks of a `Landmarks3D`, as its map's `Buildings3D` draws them: in its own scene, so one
262
+ * sun lights both and each casts its shadows on the other.
263
+ * @ignore
264
+ */
265
+ type LandmarksForBuildings = {
266
+ /** The landmark tiles. */
267
+ readonly tiles: Object3D;
268
+ /**
269
+ * Readies the tiles for a frame drawn through `mainMatrix`, mirroring a little of the buildings'
270
+ * `glass` light; `undefined` while they don't show.
271
+ */
272
+ prepareForBuildings(mainMatrix: ArrayLike<number>, glass: GlassUniforms): LandmarksFrame | undefined;
273
+ /** Gives every landmark the materials of one pass. */
274
+ useMaterials(pass: LandmarksPass): void;
275
+ };
276
+ //#endregion
277
+ //#region src/buildings/BuildingsLayer.d.ts
278
+ /**
279
+ * MapLibre custom layer drawing the vector tiles' buildings with Three.js: extruded walls and roofs,
280
+ * procedural windows, a sun with soft shadows on the buildings and the ground, and sky light.
281
+ *
282
+ * It extrudes the buildings of the tiles MapLibre already loaded for the map, so it makes no requests
283
+ * of its own. After changing one of its fields yourself, call `triggerRepaint()` on the MapLibre map.
284
+ *
285
+ * @group Buildings 3D
286
+ */
287
+ declare class BuildingsLayer implements CustomLayerInterface {
288
+ private readonly landmarksOf;
289
+ readonly id: string;
290
+ readonly type: "custom";
291
+ readonly renderingMode: "3d";
292
+ /** The vector source and source layer the buildings come from. */
293
+ source: {
294
+ id: string;
295
+ layer: string;
296
+ };
297
+ private map?;
298
+ private renderer?;
299
+ private look?;
300
+ private filter;
301
+ private origin?;
302
+ private frame;
303
+ private readonly scene;
304
+ private readonly camera;
305
+ private readonly buildings;
306
+ private readonly landmarks;
307
+ private readonly material;
308
+ private readonly depthOnly;
309
+ private readonly shadowsOnly;
310
+ private readonly sun;
311
+ private readonly sky;
312
+ private readonly groundReach;
313
+ private readonly ground;
314
+ private readonly tiles;
315
+ private pending;
316
+ private extrusion;
317
+ /**
318
+ * @param landmarksOf - The landmarks to draw among the buildings, asked every frame. The buildings
319
+ * they replace stay out in the frames that draw them.
320
+ */
321
+ constructor(id: string, landmarksOf?: () => LandmarksForBuildings | undefined);
322
+ /** Draws the buildings with this look, from the next frame. */
323
+ setLook(look: Buildings3DLook): void;
324
+ onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
325
+ render(gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
326
+ private renderTranslucent;
327
+ private useBuildingsPass;
328
+ private placeLandmarks;
329
+ private toScene;
330
+ private updateOrigin;
331
+ private carryTiles;
332
+ private updateTiles;
333
+ private queueTiles;
334
+ private startExtrusion;
335
+ private addTileMesh;
336
+ private removeTileMesh;
337
+ private evictStaleTiles;
338
+ private eyePosition;
339
+ private groundMaterial;
340
+ private updateSun;
341
+ }
342
+ //#endregion
343
+ //#region src/buildings/Buildings3D.d.ts
344
+ /**
345
+ * Draws the base map's buildings in 3D with Three.js, with windows on their facades, a sun or moon
346
+ * that casts shadows on the buildings and the ground, and a look for every standard style.
347
+ *
348
+ * @remarks
349
+ * **[Public Preview](https://docs.tomtom.com/legal/public-preview)** until the plugin's 1.0.0 release.
350
+ *
351
+ * - It extrudes the buildings of the vector tiles the map already loads, and makes no requests of its own.
352
+ * - While it shows, it takes the place of the style's own 3D buildings, which it filters out of the
353
+ * `3D - Building` layer. It draws whether or not the `buildings3D` group of the `BaseMapModule` shows.
354
+ * - 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.
357
+ * - 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.
359
+ * - On a map with a {@link Landmarks3D}, it leaves out the buildings a landmark replaces and draws the
360
+ * 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.
362
+ * 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.
365
+ * - With `roadLabels.occluded` or `pois.occluded`, it moves those style layers under its own, so a
366
+ * building drawn over a label hides it. A hidden POI still keeps other labels off its place, and
367
+ * the moved labels give way to the labels above them where they collide.
368
+ *
369
+ * @example
370
+ * ```typescript
371
+ * import { Buildings3D } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';
372
+ *
373
+ * const buildings = new Buildings3D(map, { facade: { pattern: 'glass' } });
374
+ * buildings.updateConfig({ light: { direction: 260, altitude: 15 } }); // a low evening sun
375
+ * ```
376
+ *
377
+ * @group Buildings 3D
378
+ */
379
+ export declare class Buildings3D {
380
+ private readonly map;
381
+ private readonly buildingsLayer;
382
+ private config;
383
+ private renderedLook;
384
+ private styling;
385
+ private readonly occludedLabels;
386
+ private styleOrder;
387
+ /**
388
+ * Creates the buildings on a map, drawn as soon as the map is ready.
389
+ *
390
+ * @param map - The map to draw the buildings on.
391
+ * @param config - The knobs to start with.
392
+ */
393
+ constructor(map: TomTomMap, config?: Buildings3DConfig);
394
+ /**
395
+ * The underlying MapLibre custom layer, for advanced use beyond this facade.
396
+ */
397
+ get layer(): BuildingsLayer;
398
+ /**
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.
405
+ *
406
+ * @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.
415
+ *
416
+ * @example
417
+ * ```typescript
418
+ * buildings.updateConfig({ preset: 'streetDark', litWindows: { fraction: 0.6 } });
419
+ * ```
420
+ */
421
+ updateConfig(partial: Buildings3DConfig): void;
422
+ /**
423
+ * Unsets every knob, so the buildings show with the look of the map's style.
424
+ */
425
+ resetConfig(): void;
426
+ /**
427
+ * Whether the buildings are set to be shown: the `visible` knob, `true` unless set.
428
+ */
429
+ isVisible(): boolean;
430
+ /**
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.
433
+ */
434
+ setVisible(visible: boolean): void;
435
+ /**
436
+ * @ignore
437
+ */
438
+ _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
+ private install;
448
+ private look;
449
+ private render;
450
+ private placeLabels;
451
+ private restoreLabels;
452
+ private occludeLabels;
453
+ }
454
+ //#endregion
4
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];
5
474
  declare const landmarks3DKnobDefinitions: {
6
475
  readonly visible: {
7
476
  readonly kind: "toggle";
@@ -12,6 +481,11 @@ declare const landmarks3DKnobDefinitions: {
12
481
  readonly kind: "color";
13
482
  readonly description: "Colour the landmarks are shaded in. Unset: the base map's 3D buildings' colour, following the map colours that restyle them.";
14
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
+ };
15
489
  readonly opacity: {
16
490
  readonly kind: "number";
17
491
  readonly description: "Opacity of the landmarks, 0 to 1. Unset: the base map's 3D buildings' opacity.";
@@ -19,7 +493,7 @@ declare const landmarks3DKnobDefinitions: {
19
493
  };
20
494
  readonly verticalGradient: {
21
495
  readonly kind: "toggle";
22
- readonly description: "Whether the landmarks' walls darken towards the ground. Unset: as the base map's 3D buildings do.";
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.";
23
497
  };
24
498
  readonly minZoom: {
25
499
  readonly kind: "number";
@@ -28,7 +502,7 @@ declare const landmarks3DKnobDefinitions: {
28
502
  };
29
503
  readonly maxZoom: {
30
504
  readonly kind: "number";
31
- readonly description: "Highest whole zoom level the landmarks are drawn at, up to the next one. Unset: the base map's 3D buildings' one.";
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.";
32
506
  readonly range: KnobRange;
33
507
  };
34
508
  };
@@ -43,7 +517,7 @@ type Landmarks3DKnobId = keyof typeof landmarks3DKnobDefinitions;
43
517
  *
44
518
  * @group Landmarks 3D
45
519
  */
46
- type Landmarks3DKnobValueOf<ID extends Landmarks3DKnobId> = KnobValueOf<(typeof landmarks3DKnobDefinitions)[ID]['kind']>;
520
+ type Landmarks3DKnobValueOf<ID extends Landmarks3DKnobId> = ID extends 'texture' ? LandmarkTextureUse : KnobValueOf<(typeof landmarks3DKnobDefinitions)[ID]['kind']>;
47
521
  /**
48
522
  * One entry of {@link landmarks3DKnobCatalogue}, with what a UI or a coding agent needs to offer the knob
49
523
  * and validate a value for it. The SDK's `getKnob` reads the value in force.
@@ -52,8 +526,8 @@ type Landmarks3DKnobValueOf<ID extends Landmarks3DKnobId> = KnobValueOf<(typeof
52
526
  */
53
527
  type Landmarks3DKnob = KnobEntry<Landmarks3DKnobId>;
54
528
  /**
55
- * Every landmarks knob with its kind, description and, for `visible`, its default. It's static data,
56
- * readable without a map.
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.
57
531
  *
58
532
  * @remarks
59
533
  * A knob is a plain value in {@link Landmarks3DConfig}, under its id. Every knob but `visible`
@@ -74,7 +548,7 @@ export declare const landmarks3DKnobIds: readonly Landmarks3DKnobId[];
74
548
  * Alpha mask carried over from a landmark mesh's as-authored texture.
75
549
  *
76
550
  * Landmark meshes are coarse hulls (e.g. a wall is one rectangle) whose realistic
77
- * silhouette is carved out by the texture's alpha channel. Untextured shading must keep
551
+ * silhouette is carved out by the texture's alpha channel. The shading must keep
78
552
  * sampling that alpha and discard the carved-away fragments, otherwise the raw hull
79
553
  * shape gets coloured in.
80
554
  *
@@ -87,8 +561,9 @@ type FillExtrusionAlphaMask = {
87
561
  cutoff: number;
88
562
  };
89
563
  /**
90
- * Material that shades untextured landmark meshes exactly like maplibre-gl shades
91
- * `fill-extrusion` buildings, so they blend in with the basemap building layer.
564
+ * Material that shades landmark meshes exactly like maplibre-gl shades `fill-extrusion`
565
+ * buildings, so they blend in with the basemap building layer. A mesh given its texture
566
+ * can take that texture's detail or colours, as {@link FillExtrusionMaterial.setTextureUse} sets.
92
567
  *
93
568
  * Colour and opacity premultiply like maplibre's `v_color *= u_opacity`, paired with
94
569
  * (ONE, ONE_MINUS_SRC_ALPHA) blending. Backfaces are culled like maplibre's extrusion
@@ -101,10 +576,15 @@ type FillExtrusionAlphaMask = {
101
576
  declare class FillExtrusionMaterial extends ShaderMaterial {
102
577
  constructor(alphaMask?: FillExtrusionAlphaMask);
103
578
  /**
104
- * Copies the shading uniforms (colour, light, layer opacity, vertical gradient) from another
105
- * instance, bringing a freshly created alpha-masked variant up to date with the shared material.
579
+ * 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.
106
581
  */
107
582
  copyShadingFrom(source: FillExtrusionMaterial): void;
583
+ /**
584
+ * Sets what the mesh's texture gives its look besides its silhouette. Without a texture, the
585
+ * mesh takes the diffuse colour whatever the use.
586
+ */
587
+ setTextureUse(use: LandmarkTextureUse): void;
108
588
  /**
109
589
  * Sets the building colour from a CSS colour string, stored as raw sRGB
110
590
  * components, because maplibre shades paint colours in sRGB space, not linear.
@@ -171,8 +651,10 @@ interface ModelsSourceSpecification {
171
651
  attribution?: string;
172
652
  /**
173
653
  * Base path of the Basis Universal transcoder (`basis_transcoder.js` and
174
- * `basis_transcoder.wasm`) used to decode KTX2 textures. Defaults to the copy
175
- * bundled with the plugin. Set it to serve your own copy.
654
+ * `basis_transcoder.wasm`) that decodes KTX2 textures, ending in `/`, such as `'/basis/'`.
655
+ * Set it to serve the transcoder from your own host. By default, the plugin loads the two
656
+ * files it ships beside its bundle, which Vite and webpack 5 emit with your build. A bundler
657
+ * that doesn't emit the files a `new URL('./file', import.meta.url)` names needs this path.
176
658
  */
177
659
  transcoderPath?: string;
178
660
  /**
@@ -202,6 +684,8 @@ export declare class ModelsSource {
202
684
  tiles: Array<string>;
203
685
  scene: Group;
204
686
  loadedTiles: Set<string>;
687
+ /** Whether a tile came back 403 for want of Orbis 3D Landmarks access, so the key loads none. */
688
+ accessDenied: boolean;
205
689
  /**
206
690
  * EPSG:3857 origin subtracted from all mesh positions, because absolute coordinates (~6·10⁶ m)
207
691
  * exceed float32 precision (~0.5 m), making landmark edges tremble while zooming. `null`
@@ -230,6 +714,12 @@ export declare class ModelsSource {
230
714
  }
231
715
  //#endregion
232
716
  //#region src/ModelsLayer.d.ts
717
+ /**
718
+ * What the landmarks take from a `Buildings3D` on their map beside its sun and shadows: how strongly
719
+ * its facades show.
720
+ * @ignore
721
+ */
722
+ type BuildingsLight = Pick<Buildings3DLook, 'facade.intensity'>;
233
723
  /**
234
724
  * MapLibre custom layer that renders tiled glTF/GLB models with Three.js.
235
725
  *
@@ -262,6 +752,11 @@ export declare class ModelsLayer implements CustomLayerInterface {
262
752
  private readonly fillExtrusionMaterial;
263
753
  private readonly depthPrepassMaterial;
264
754
  private readonly maskedFillExtrusionMaterials;
755
+ private readonly facadeMaterials;
756
+ private buildingsLight;
757
+ private glass;
758
+ private opacity;
759
+ private textureUse;
265
760
  private readonly tilesMainMatrix;
266
761
  private tilesStale;
267
762
  private readonly markTilesStale;
@@ -270,6 +765,20 @@ export declare class ModelsLayer implements CustomLayerInterface {
270
765
  setDirectionalLight(radius: number, phi: number, theta: number): void;
271
766
  onAdd(map: Map, gl: WebGLRenderingContext | WebGL2RenderingContext): void;
272
767
  render(_gl: WebGLRenderingContext | WebGL2RenderingContext, options: CustomRenderMethodInput): void;
768
+ /**
769
+ * Readies the landmark tiles for a `Buildings3D` to draw in its scene this frame.
770
+ * @returns Where they are, `undefined` while they don't show, the key has no access to them, or no
771
+ * `Buildings3D` lights them.
772
+ * @ignore
773
+ */
774
+ prepareForBuildings(mainMatrix: ArrayLike<number>, glass: GlassUniforms): LandmarksFrame | undefined;
775
+ /**
776
+ * Gives every landmark the materials of one pass: its colour ones, its depth-only ones for the
777
+ * depth prepass of translucent shading, or its colour ones drawing nothing, to cast its shadows.
778
+ * @ignore
779
+ */
780
+ useMaterials(pass: LandmarksPass): void;
781
+ private prepareFrame;
273
782
  private updateTilesWhenStale;
274
783
  private groundLandmarksOnTerrain;
275
784
  private groundMeshOnTerrain;
@@ -277,36 +786,55 @@ export declare class ModelsLayer implements CustomLayerInterface {
277
786
  private alignCameraToMap;
278
787
  private get sceneOrigin();
279
788
  private needsTranslucentPrepass;
280
- private renderDepthPrepass;
281
789
  setOpacity(value: number): void;
790
+ /**
791
+ * Hands the landmarks to a `Buildings3D`, which draws them in its scene under its sun and in its
792
+ * shadows, their textures used as {@link ModelsLayer.setTextureUse} sets. `undefined` draws them here
793
+ * again, shaded like the style's 3D buildings.
794
+ * @ignore
795
+ */
796
+ setBuildingsLight(light: BuildingsLight | undefined): void;
282
797
  /** Mirrors the basemap's fill-extrusion-vertical-gradient on the landmark shading. */
283
798
  setVerticalGradient(enabled: boolean): void;
799
+ /**
800
+ * Sets what each landmark's own texture gives its look besides its silhouette, here and under a
801
+ * `Buildings3D`: nothing, its light and shade over `diffuseColor`, or its colours in place of it.
802
+ * The light shades it either way.
803
+ */
804
+ setTextureUse(use: LandmarkTextureUse): void;
284
805
  getMaterial(mesh: Mesh): FillExtrusionMaterial;
285
806
  private maskedFillExtrusionVariant;
286
807
  private forEachFillExtrusionMaterial;
287
808
  private syncLighting;
288
809
  private applyMaterials;
810
+ private facadeMaterialOf;
289
811
  }
290
812
  //#endregion
291
813
  //#region src/Landmarks3D.d.ts
292
814
  /**
293
815
  * The landmark knobs an app sets, as {@link Landmarks3D.getConfig} returns them. Each knob id is its
294
- * key in here. Every knob but `visible` follows the base map's 3D buildings while unset. It's plain JSON.
816
+ * key in here, and it's plain JSON.
817
+ *
818
+ * - Every knob but `visible` follows the base map's 3D buildings while unset.
819
+ * - While a {@link Buildings3D} draws, the landmarks follow its buildings instead: `texture` is `detail`,
820
+ * there's no wall gradient, which `verticalGradient` can't turn on, and every zoom up to `maxZoom`.
295
821
  *
296
822
  * @example
297
823
  * ```typescript
298
824
  * const config: Landmarks3DConfig = { color: '#c8b28a', opacity: 0.9 };
825
+ * const authored: Landmarks3DConfig = { texture: 'color' }; // the landmarks' own colours
299
826
  * ```
300
827
  *
301
828
  * @group Landmarks 3D
302
829
  */
303
830
  type Landmarks3DConfig = KnobConfigOf<{ [ID in Landmarks3DKnobId]: Landmarks3DKnobValueOf<ID>; }>;
304
831
  /**
305
- * What the {@link Landmarks3D} plugin starts with: its knobs, and how it requests tiles.
832
+ * What the {@link Landmarks3D} plugin starts with: its knobs, how it requests tiles, and where it
833
+ * loads the texture transcoder from.
306
834
  *
307
835
  * @group Landmarks 3D
308
836
  */
309
- type Landmarks3DOptions = Landmarks3DConfig & {
837
+ type Landmarks3DOptions = Landmarks3DConfig & Pick<ModelsSourceSpecification, 'transcoderPath'> & {
310
838
  /**
311
839
  * Whether each tile request sends `credentials: 'include'`, so a proxy session
312
840
  * cookie travels with it. By default, this tracks the SDK's proxy config,
@@ -327,10 +855,14 @@ type Landmarks3DOptions = Landmarks3DConfig & {
327
855
  *
328
856
  * @remarks
329
857
  * It requires an API key with Orbis 3D Landmarks entitlements. Its look is a set of knobs, listed in
330
- * {@link landmarks3DKnobCatalogue}. Each one you leave unset follows the base map's 3D buildings,
331
- * through style changes and anything that restyles them, falling back to the `streetLight` style's look.
332
- * Whether those buildings show is the `buildings3D` group of the `BaseMapModule`, hidden in most
333
- * standard styles; the plugin leaves it as it is.
858
+ * {@link landmarks3DKnobCatalogue}.
859
+ *
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.
862
+ * - Whether those buildings show is the `buildings3D` group of the `BaseMapModule`, hidden in most
863
+ * standard styles; the plugin leaves it as it is.
864
+ * - A visible {@link Buildings3D} on the same map takes their place: the landmarks then follow its
865
+ * look and its light instead.
334
866
  *
335
867
  * @example
336
868
  * ```typescript
@@ -356,10 +888,9 @@ export declare class Landmarks3D {
356
888
  * as soon as the map is ready.
357
889
  *
358
890
  * @param map - The TomTom map instance to render landmarks on.
359
- * @param options - The knobs to start with, and how to request tiles.
891
+ * @param options - The knobs to start with, how to request tiles, and where to load the texture transcoder from.
360
892
  */
361
- constructor(map: TomTomMap, { withCredentials, ...config }?: Landmarks3DOptions);
362
- private installWhenReady;
893
+ constructor(map: TomTomMap, { withCredentials, transcoderPath, ...config }?: Landmarks3DOptions);
363
894
  /**
364
895
  * The underlying MapLibre custom layer, for advanced use beyond this facade.
365
896
  */
@@ -419,9 +950,8 @@ export declare class Landmarks3D {
419
950
  */
420
951
  _resetKnobValue(id: string): void;
421
952
  private install;
422
- private landmarkInsertBeforeID;
423
953
  private excludeLandmarkBuildingsFromBasemap;
424
- private readBasemapBuildingsLook;
954
+ private readBuildingsLook;
425
955
  private look;
426
956
  private render;
427
957
  }
@@ -438,4 +968,4 @@ export declare class Landmarks3D {
438
968
  */
439
969
  export declare const buildLandmarksTileURL: () => string;
440
970
  //#endregion
441
- export type { Landmarks3DConfig, Landmarks3DKnob, Landmarks3DKnobId, Landmarks3DKnobValueOf, Landmarks3DOptions, ModelsLayerSpecification, ModelsSourceSpecification };
971
+ export type { Buildings3DConfig, Buildings3DKnob, Buildings3DKnobId, Buildings3DKnobValueOf, BuildingsLayer, BuildingsPreset, FacadePattern, LandmarkTextureUse, Landmarks3DConfig, Landmarks3DKnob, Landmarks3DKnobId, Landmarks3DKnobValueOf, Landmarks3DOptions, ModelsLayerSpecification, ModelsSourceSpecification };