@navaramap/three 0.0.4 → 0.0.5
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/assets/fontWorker-OwvKiQ8o.js +2 -0
- package/dist/assets/fontWorker-OwvKiQ8o.js.map +1 -0
- package/dist/assets/{index-ywHSGImj.js → index-TKhRxurv.js} +2 -2
- package/dist/assets/index-TKhRxurv.js.map +1 -0
- package/dist/assets/{navara_wasm_font_worker_bg-Du9nb2Pn.wasm → navara_wasm_font_worker_bg-Kk06ArRB.wasm} +0 -0
- package/dist/assets/{navara_wasm_worker_bg-Xadu67fw.wasm → navara_wasm_worker_bg-BZjLKf4i.wasm} +0 -0
- package/dist/index.d.ts +349 -282
- package/dist/index.js +5394 -5470
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +287 -235
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +12 -12
- package/src/atmosphere.test.ts +227 -28
- package/src/atmosphere.ts +219 -55
- package/src/constants/assets.ts +63 -13
- package/src/declutter/types.ts +1 -1
- package/src/evaluations/FeatureEvaluator.test.ts +152 -0
- package/src/evaluations/FeatureEvaluator.ts +73 -2
- package/src/event/features/billboard.ts +1 -0
- package/src/event/features/point.ts +1 -0
- package/src/index.ts +7 -9
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/index.ts +10 -7
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/mutates.test.ts +74 -81
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/mutates.ts +18 -85
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/shader.test.ts +77 -0
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/shader.ts +9 -1
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/state.test.ts +15 -19
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/state.ts +0 -13
- package/src/material/enhancer/sdfText/sdfTextBaseEnhancer/types.ts +46 -48
- package/src/mesh/constants.ts +22 -0
- package/src/mesh/index.ts +1 -1
- package/src/mesh/model.ts +6 -0
- package/src/mesh/polygon.ts +6 -0
- package/src/mesh/polyline.ts +6 -0
- package/src/mesh/sdfText/batchedSdfText.ts +1223 -0
- package/src/mesh/sdfText/glyphBuffers.ts +222 -0
- package/src/mesh/sdfText/glyphSlots.test.ts +151 -0
- package/src/mesh/sdfText/glyphSlots.ts +98 -0
- package/src/mesh/sdfText/index.ts +10 -0
- package/src/mesh/sdfText/labelData.test.ts +178 -0
- package/src/mesh/sdfText/labelData.ts +187 -0
- package/src/mesh/{sdfText.test.ts → sdfText/layout.test.ts} +1 -1
- package/src/mesh/sdfText/layout.ts +306 -0
- package/src/mesh/sprite/instancedSprite.ts +32 -0
- package/dist/assets/fontWorker-wz61edjR.js +0 -2
- package/dist/assets/fontWorker-wz61edjR.js.map +0 -1
- package/dist/assets/index-ywHSGImj.js.map +0 -1
- package/src/mesh/batchedSdfText.ts +0 -708
- package/src/mesh/sdfText.ts +0 -1189
- /package/dist/{draco_decoder.wasm → assets/draco_decoder-C32yEggz.wasm} +0 -0
- /package/dist/{draco_decoder2.wasm → assets/draco_decoder-Z1_iN-Ht.wasm} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ import { FontManager } from '@navaramap/font';
|
|
|
28
28
|
import { FontWorkerMemoryStats } from '@navaramap/font';
|
|
29
29
|
import { Geometry } from 'geojson';
|
|
30
30
|
import { Group } from 'three';
|
|
31
|
-
import { InstancedBufferGeometry } from 'three';
|
|
32
31
|
import { InstancedMesh as InstancedMesh_2 } from 'three';
|
|
33
32
|
import { Light as Light_2 } from 'three';
|
|
34
33
|
import { Line2 } from 'three-stdlib';
|
|
@@ -59,6 +58,7 @@ import { Scene } from 'three';
|
|
|
59
58
|
import { ShaderLibShader } from 'three';
|
|
60
59
|
import { ShaderMaterial } from 'three';
|
|
61
60
|
import { ShapedGlyph } from '@navaramap/font';
|
|
61
|
+
import { ShapeTextResult } from '@navaramap/font';
|
|
62
62
|
import { Sprite } from 'three';
|
|
63
63
|
import { Texture } from 'three';
|
|
64
64
|
import { TextureEventMap } from 'three';
|
|
@@ -141,10 +141,11 @@ export declare class Atmosphere extends EventHandler<AtmosphereEvents> {
|
|
|
141
141
|
*/
|
|
142
142
|
private rotationMatrix;
|
|
143
143
|
/**
|
|
144
|
-
* Precomputed atmosphere textures used for rendering.
|
|
145
|
-
*
|
|
144
|
+
* Precomputed atmosphere textures used for rendering. Each texture is
|
|
145
|
+
* loaded lazily when a consumer declares a need for it via
|
|
146
|
+
* {@link onTexturesReady}, so the object may hold any subset at a time.
|
|
146
147
|
*/
|
|
147
|
-
textures
|
|
148
|
+
textures: Partial<PrecomputedTextures>;
|
|
148
149
|
overlay: Observed<AtmosphereOverlay | null>;
|
|
149
150
|
shadow: Observed<AtmosphereShadow | null>;
|
|
150
151
|
shadowLength: Observed<AtmosphereShadowLength | null>;
|
|
@@ -162,11 +163,11 @@ export declare class Atmosphere extends EventHandler<AtmosphereEvents> {
|
|
|
162
163
|
*/
|
|
163
164
|
private _camera;
|
|
164
165
|
/**
|
|
165
|
-
* In-flight texture loading
|
|
166
|
-
*
|
|
166
|
+
* In-flight per-texture loading promises, shared across consumers so each
|
|
167
|
+
* asset is fetched only once.
|
|
167
168
|
* @private
|
|
168
169
|
*/
|
|
169
|
-
private
|
|
170
|
+
private texturePromises;
|
|
170
171
|
/**
|
|
171
172
|
* Creates a new Atmosphere instance.
|
|
172
173
|
* @param renderer - The WebGL renderer used for texture type detection.
|
|
@@ -180,24 +181,45 @@ export declare class Atmosphere extends EventHandler<AtmosphereEvents> {
|
|
|
180
181
|
*/
|
|
181
182
|
onUpdate: () => void;
|
|
182
183
|
/**
|
|
183
|
-
* Loads precomputed atmosphere textures asynchronously.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
184
|
+
* Loads all precomputed atmosphere textures asynchronously.
|
|
185
|
+
*
|
|
186
|
+
* Each texture loads automatically once a consumer declares a need for it
|
|
187
|
+
* via {@link onTexturesReady}; call this manually only to prefetch every
|
|
188
|
+
* texture ahead of time.
|
|
189
|
+
*
|
|
190
|
+
* @returns A promise that resolves when all textures are loaded.
|
|
186
191
|
*/
|
|
187
192
|
initTextures(): Promise<void>;
|
|
188
193
|
/**
|
|
194
|
+
* Loads a single precomputed texture, sharing in-flight loads and caching
|
|
195
|
+
* the result. A failed load is forgotten so the next request retries it.
|
|
189
196
|
* @private
|
|
190
197
|
*/
|
|
191
|
-
|
|
198
|
+
private loadTexture;
|
|
199
|
+
private fetchTexture;
|
|
192
200
|
/**
|
|
193
201
|
* @private
|
|
194
202
|
*/
|
|
195
203
|
_dispose(): void;
|
|
196
204
|
/**
|
|
197
|
-
* Invokes the callback
|
|
198
|
-
*
|
|
205
|
+
* Invokes the callback once every needed precomputed texture is loaded —
|
|
206
|
+
* immediately if they already are.
|
|
207
|
+
*
|
|
208
|
+
* Registering also starts loading the needed textures if they aren't loaded
|
|
209
|
+
* yet, so a texture is only fetched once something that needs it exists.
|
|
210
|
+
*
|
|
211
|
+
* @param callback - Receives the textures; the ones listed in `needs` are
|
|
212
|
+
* guaranteed to be present.
|
|
213
|
+
* @param needs - The textures the caller needs, e.g.
|
|
214
|
+
* `{ transmittance: true }`. Omit to load all of them.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* atmosphere.onTexturesReady(
|
|
218
|
+
* (t) => light.setTransmittanceTexture(t.transmittanceTexture),
|
|
219
|
+
* { transmittance: true },
|
|
220
|
+
* );
|
|
199
221
|
*/
|
|
200
|
-
onTexturesReady(callback: (textures:
|
|
222
|
+
onTexturesReady<N extends AtmosphereTextureNeeds = Record<AtmosphereTextureName, true>>(callback: (textures: LoadedAtmosphereTextures<N>) => void, needs?: N): void;
|
|
201
223
|
/**
|
|
202
224
|
* Returns a clone of the current sun direction vector.
|
|
203
225
|
* @returns A new Vector3 representing the sun direction in ECEF coordinates.
|
|
@@ -346,7 +368,22 @@ export declare class Atmosphere extends EventHandler<AtmosphereEvents> {
|
|
|
346
368
|
}): void;
|
|
347
369
|
}
|
|
348
370
|
|
|
349
|
-
export declare const
|
|
371
|
+
export declare const ATMOSPHERE_HIGHER_ORDER_SCATTERING_URL: string;
|
|
372
|
+
|
|
373
|
+
export declare const ATMOSPHERE_IRRADIANCE_URL: string;
|
|
374
|
+
|
|
375
|
+
export declare const ATMOSPHERE_SCATTERING_URL: string;
|
|
376
|
+
|
|
377
|
+
export declare const ATMOSPHERE_SINGLE_MIE_SCATTERING_URL: string;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Filenames requested by `PrecomputedTexturesLoader` mapped to their
|
|
381
|
+
* statically-resolved URLs. Used to remap directory-relative requests when
|
|
382
|
+
* loading the bundled default atmosphere assets.
|
|
383
|
+
*/
|
|
384
|
+
export declare const ATMOSPHERE_TEXTURE_URLS: Record<string, string>;
|
|
385
|
+
|
|
386
|
+
export declare const ATMOSPHERE_TRANSMITTANCE_URL: string;
|
|
350
387
|
|
|
351
388
|
/**
|
|
352
389
|
* Events emitted by the {@link Atmosphere} class.
|
|
@@ -354,7 +391,7 @@ export declare const ATMOSPHERE_ASSETS_URL: string;
|
|
|
354
391
|
declare type AtmosphereEvents = {
|
|
355
392
|
/** Emitted when the atmosphere needs to trigger a re-render. */
|
|
356
393
|
needsUpdate: () => void;
|
|
357
|
-
/** Emitted
|
|
394
|
+
/** Emitted each time a precomputed atmosphere texture finishes loading. */
|
|
358
395
|
textureLoaded: () => void;
|
|
359
396
|
/** Emitted when the atmosphere is disposed. */
|
|
360
397
|
disposed: () => void;
|
|
@@ -366,14 +403,31 @@ declare type AtmosphereEvents = {
|
|
|
366
403
|
* Configuration options for the {@link Atmosphere} class.
|
|
367
404
|
*/
|
|
368
405
|
export declare type AtmosphereOptions = {
|
|
369
|
-
/**
|
|
370
|
-
|
|
406
|
+
/**
|
|
407
|
+
* URL of a directory to load precomputed atmosphere textures from. The
|
|
408
|
+
* directory must keep the original filenames (`transmittance.exr` etc.).
|
|
409
|
+
* When omitted, the assets bundled with the package are used.
|
|
410
|
+
*/
|
|
411
|
+
atmosphereAssetsUrl?: string | undefined;
|
|
371
412
|
/** URL to load STBN (Spatio-Temporal Blue Noise) textures from. */
|
|
372
413
|
stbnUrl?: string;
|
|
373
414
|
/** Date used for calculating sun/moon positions. Defaults to current date. */
|
|
374
415
|
date?: Date;
|
|
375
416
|
};
|
|
376
417
|
|
|
418
|
+
/**
|
|
419
|
+
* Names of the precomputed atmosphere textures that can be loaded
|
|
420
|
+
* individually.
|
|
421
|
+
*/
|
|
422
|
+
declare type AtmosphereTextureName = "transmittance" | "scattering" | "irradiance" | "higherOrderScattering";
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Which precomputed textures a consumer needs, e.g.
|
|
426
|
+
* `{ transmittance: true }`. Only `true` is allowed as a value so that every
|
|
427
|
+
* listed texture is guaranteed to be loaded.
|
|
428
|
+
*/
|
|
429
|
+
declare type AtmosphereTextureNeeds = Partial<Record<AtmosphereTextureName, true>>;
|
|
430
|
+
|
|
377
431
|
declare type Attributes = BatchedFeatureAttributes<{
|
|
378
432
|
position?: BufferAttribute;
|
|
379
433
|
position_3d_high?: BufferAttribute;
|
|
@@ -897,13 +951,30 @@ export declare class BatchedFeatureMesh<Buf extends BufferGeometry<BatchedFeatur
|
|
|
897
951
|
clone(): this;
|
|
898
952
|
}
|
|
899
953
|
|
|
900
|
-
|
|
954
|
+
/**
|
|
955
|
+
* Every text label in a tile-layer, drawn in a single call.
|
|
956
|
+
*
|
|
957
|
+
* Instances are glyphs, not labels: each label owns a contiguous run of glyph
|
|
958
|
+
* slots ({@link GlyphSlotAllocator}) and one row block in a float texture
|
|
959
|
+
* ({@link LabelDataTexture}) that the vertex shader reads through the
|
|
960
|
+
* `labelIndex` attribute. A label changing its text rewrites only its own run
|
|
961
|
+
* — and not even that when the new glyph count stays inside the run's
|
|
962
|
+
* power-of-two size class.
|
|
963
|
+
*
|
|
964
|
+
* Still extends {@link InstancedMesh} because `FeatureEvaluator` dispatches
|
|
965
|
+
* per-feature styling on `instanceof InstancedMesh`; the inherited child-mesh
|
|
966
|
+
* machinery (`allMeshes`, `markVisibility`) is deliberately unused.
|
|
967
|
+
*/
|
|
968
|
+
export declare class BatchedSdfTextMesh extends InstancedMesh<Object3D> implements PickableMesh, DeclutterParticipant {
|
|
969
|
+
/**
|
|
970
|
+
* Geometry type of this mesh.
|
|
971
|
+
*/
|
|
972
|
+
readonly geometryType: "text";
|
|
901
973
|
readonly ctx: EventContext;
|
|
902
974
|
/** The font identifier from material — may be a family name or a URL. */
|
|
903
975
|
private _fontIdentifier;
|
|
904
|
-
/** Per-batch text quality. All
|
|
905
|
-
*
|
|
906
|
-
* a new BatchedSdfTextMesh. */
|
|
976
|
+
/** Per-batch text quality. All labels in the batch share it because they
|
|
977
|
+
* sample the same atlas texture; flipping quality requires a new batch. */
|
|
907
978
|
private _highQuality;
|
|
908
979
|
private _fontManager;
|
|
909
980
|
private _needRender?;
|
|
@@ -915,16 +986,86 @@ export declare class BatchedSdfTextMesh extends InstancedMesh<SDFTextMesh> imple
|
|
|
915
986
|
* and must be balanced with unloadFont() on dispose or font change.
|
|
916
987
|
*/
|
|
917
988
|
private _loadedFaceUrls;
|
|
918
|
-
/** Geometry-extracted anchor data; per-index meshes slice it lazily. */
|
|
919
989
|
private _positions;
|
|
920
|
-
/** Sparse batchIndex → mesh; `allMeshes` holds only created meshes. */
|
|
921
|
-
private _meshByIndex;
|
|
922
|
-
/** Evaluator state received before a feature's mesh exists. */
|
|
923
|
-
private _pending;
|
|
924
|
-
/** Material/transform used when creating meshes lazily. */
|
|
925
990
|
private _material;
|
|
926
991
|
private _transform;
|
|
992
|
+
/** Labels in slot order — `_labels[slot]` is also the declutter handle map. */
|
|
993
|
+
private _labels;
|
|
994
|
+
/** Sparse batchIndex → label; labels are created on first per-feature touch. */
|
|
995
|
+
private _labelByIndex;
|
|
996
|
+
private _glyphs;
|
|
997
|
+
private _slots;
|
|
998
|
+
private _labelData;
|
|
999
|
+
/** Layout inputs baked into glyph quads; a change forces a re-layout. */
|
|
1000
|
+
private _maxWidth;
|
|
1001
|
+
private _lineHeight;
|
|
1002
|
+
private _textAlign;
|
|
1003
|
+
/** Layer-level declutter settings, mirrored from the material. */
|
|
1004
|
+
private _declutter;
|
|
1005
|
+
private _declutterPriority;
|
|
1006
|
+
/** Skips the per-frame fade walk entirely once everything has settled. */
|
|
1007
|
+
private _declutterAnimating;
|
|
1008
|
+
private _enhancer;
|
|
927
1009
|
constructor(ctx: EventContext, m: TextMesh, fontIdentifier: string, options: InstancedMeshOptions, loadedFaceUrls?: Set<string>);
|
|
1010
|
+
get fontIdentifier(): string;
|
|
1011
|
+
get highQuality(): boolean;
|
|
1012
|
+
/** Mount the enhancer and install the batch's single per-frame hook. */
|
|
1013
|
+
private _setupMaterial;
|
|
1014
|
+
/** Re-point the shader at the label texture (it is swapped on grow). */
|
|
1015
|
+
private _syncLabelDataUniform;
|
|
1016
|
+
/**
|
|
1017
|
+
* A material-level text renders without the evaluator ever setting text, so
|
|
1018
|
+
* that case needs a label per anchor up front. With per-feature texts (MVT)
|
|
1019
|
+
* most features never receive one, so labels are otherwise created lazily on
|
|
1020
|
+
* the first per-feature setter — a label slot is just an index plus a few
|
|
1021
|
+
* float writes, unlike the mesh-per-label this replaced.
|
|
1022
|
+
*/
|
|
1023
|
+
private _initLabels;
|
|
1024
|
+
private _ensureLabel;
|
|
1025
|
+
private _writeAnchor;
|
|
1026
|
+
private _writeStyle;
|
|
1027
|
+
private _writeBox;
|
|
1028
|
+
private _writeState;
|
|
1029
|
+
private _writeFontSize;
|
|
1030
|
+
private _writeAddHeight;
|
|
1031
|
+
private _writeShow;
|
|
1032
|
+
private _writeDeclutterHide;
|
|
1033
|
+
private _layoutOptions;
|
|
1034
|
+
/**
|
|
1035
|
+
* Shape `text`, lay it out, and write the label's glyph run. Assumes the
|
|
1036
|
+
* text is already prepared in the font worker.
|
|
1037
|
+
*/
|
|
1038
|
+
private _applyText;
|
|
1039
|
+
/** Return a label's glyph slots and blank them. */
|
|
1040
|
+
private _releaseRun;
|
|
1041
|
+
/** Replace the retained glyph set, releasing the old references and (if
|
|
1042
|
+
* shown) retaining the new ones. */
|
|
1043
|
+
private _setGlyphKeys;
|
|
1044
|
+
/**
|
|
1045
|
+
* Reconcile atlas references with visibility: retain glyphs while the label
|
|
1046
|
+
* is shown, release them when hidden. If shown after the glyphs were evicted
|
|
1047
|
+
* (cache no longer prepared), re-prepare to re-rasterize them and rebuild
|
|
1048
|
+
* with fresh metrics.
|
|
1049
|
+
*/
|
|
1050
|
+
private _syncGlyphRefs;
|
|
1051
|
+
/**
|
|
1052
|
+
* Fold `requestedShow` and "has text" into the effective visibility, pushing
|
|
1053
|
+
* it to the shader and reconciling atlas retains when it flips.
|
|
1054
|
+
*/
|
|
1055
|
+
private _recomputeShow;
|
|
1056
|
+
/**
|
|
1057
|
+
* After an atlas eviction, re-lay-out any shown label whose text is now
|
|
1058
|
+
* stale (its pinned glyphs may have been evicted before the retain landed
|
|
1059
|
+
* and its rect reused). Fresh labels short-circuit on the cheap
|
|
1060
|
+
* `isTextPrepared` check, so this is inexpensive to run per eviction.
|
|
1061
|
+
*/
|
|
1062
|
+
private _revalidateStaleLabels;
|
|
1063
|
+
private _refreshAtlasTextures;
|
|
1064
|
+
/**
|
|
1065
|
+
* Build each shown label's collision box. The local box mirrors the vertex
|
|
1066
|
+
* shader's layout: glyphs span [0, textWidth] x [bgMinY, bgMaxY] in em
|
|
1067
|
+
* units, shifted by the `center` anchor and scaled by the font size.
|
|
1068
|
+
*/
|
|
928
1069
|
collectDeclutterCandidates(out: DeclutterCandidate[]): void;
|
|
929
1070
|
applyDeclutter(handle: number, hidden: boolean): void;
|
|
930
1071
|
stepDeclutterFade(deltaMs: number): boolean;
|
|
@@ -932,58 +1073,25 @@ export declare class BatchedSdfTextMesh extends InstancedMesh<SDFTextMesh> imple
|
|
|
932
1073
|
* declutter pass to re-place on its next update. */
|
|
933
1074
|
private _markDeclutterDirty;
|
|
934
1075
|
setActive(active: boolean): void;
|
|
935
|
-
/**
|
|
936
|
-
* After an atlas eviction, re-prepare and force-rebuild any visible mesh whose
|
|
937
|
-
* shaped text is now stale (its pinned glyphs may have been evicted before the
|
|
938
|
-
* retain landed and its rect reused). Fresh meshes short-circuit on the cheap
|
|
939
|
-
* `isTextPrepared` check, so this is inexpensive to run per eviction.
|
|
940
|
-
*/
|
|
941
|
-
private _revalidateStaleMeshes;
|
|
942
|
-
get fontIdentifier(): string;
|
|
943
|
-
get highQuality(): boolean;
|
|
944
|
-
/**
|
|
945
|
-
* A mesh per anchor is expensive (geometry + ShaderMaterial + enhancer
|
|
946
|
-
* mount), and with per-feature texts (MVT) most features never receive a
|
|
947
|
-
* non-empty text — they'd sit invisible while still costing construction and
|
|
948
|
-
* every per-frame loop. So meshes are created lazily by `_ensureMeshAt` on
|
|
949
|
-
* the first non-empty `setTextByBatchIndex`. Only a non-empty material-level
|
|
950
|
-
* default text (single-label sources) renders without the evaluator ever
|
|
951
|
-
* setting text, so only that case creates all meshes eagerly.
|
|
952
|
-
*/
|
|
953
|
-
private initMeshes;
|
|
954
|
-
/** The font-level shared atlas textures for this batch's font+quality (the
|
|
955
|
-
* color atlas is `null` for monochrome fonts). */
|
|
956
|
-
private _sharedTextures;
|
|
957
|
-
/**
|
|
958
|
-
* The feature's mesh, created on first need (see `initMeshes`). `shared`
|
|
959
|
-
* lets a batch creation pass hoist the atlas lookups; when omitted (a single
|
|
960
|
-
* lazy creation) they are fetched here, since the atlas may have been
|
|
961
|
-
* (re)allocated since this batch was constructed.
|
|
962
|
-
*/
|
|
963
|
-
private _ensureMeshAt;
|
|
964
|
-
/** Pending-state slot for a feature whose mesh doesn't exist yet. */
|
|
965
|
-
private _pendingAt;
|
|
966
|
-
_update(m: TextMesh, needRender?: () => void): Promise<void>;
|
|
967
|
-
private _applyUpdate;
|
|
968
1076
|
onBeforePicking(): void;
|
|
969
1077
|
onAfterPicking(): void;
|
|
1078
|
+
getRenderable(): Object3D;
|
|
970
1079
|
private extractPositions;
|
|
1080
|
+
_update(m: TextMesh, needRender?: () => void): Promise<void>;
|
|
1081
|
+
private _applyUpdate;
|
|
971
1082
|
setTextByBatchIndex(batchIndex: number, text: string): void;
|
|
972
|
-
/**
|
|
973
|
-
* The mesh for a feature's `batchIndex`, or `undefined` if not created yet.
|
|
974
|
-
* Meshes are created lazily and pushed onto `allMeshes` in creation order, so
|
|
975
|
-
* `allMeshes[batchIndex]` (the base-class mapping) does NOT hold here; the
|
|
976
|
-
* batchIndex→mesh mapping lives in `_meshByIndex`. Overriding this one
|
|
977
|
-
* accessor keeps the base-class setters and any external caller (picking,
|
|
978
|
-
* plugins) correct without patching each call site.
|
|
979
|
-
*/
|
|
980
|
-
getMeshByBatchIndex(batchIndex: number): SDFTextMesh | undefined;
|
|
981
1083
|
setFeatureColorByBatchIndex(batchIndex: number, color: Color_3): void;
|
|
982
1084
|
setFeatureShowByBatchIndex(batchIndex: number, rawVisible: boolean): void;
|
|
983
1085
|
setFeatureHeightByBatchIndex(batchIndex: number, height: number): void;
|
|
984
1086
|
setFeatureSizeByBatchIndex(batchIndex: number, size: number): void;
|
|
985
|
-
setFeatureDeclutterPriorityByBatchIndex(batchIndex: number, priority: number): void;
|
|
986
1087
|
setFeatureOpacityByBatchIndex(batchIndex: number, opacity: number): void;
|
|
1088
|
+
setFeatureDeclutterPriorityByBatchIndex(batchIndex: number, priority: number): void;
|
|
1089
|
+
/**
|
|
1090
|
+
* Labels are no longer three.js objects, so there is no child mesh to hand
|
|
1091
|
+
* back. Overridden to stop the base class returning an unrelated object from
|
|
1092
|
+
* its (unused) `allMeshes` array.
|
|
1093
|
+
*/
|
|
1094
|
+
getMeshByBatchIndex(): undefined;
|
|
987
1095
|
dispose(): void;
|
|
988
1096
|
}
|
|
989
1097
|
|
|
@@ -1153,7 +1261,6 @@ declare class BoundingSphere {
|
|
|
1153
1261
|
* the sentence start and lines stack top-to-bottom in reading order, then
|
|
1154
1262
|
* every line is flipped back to visual order for rendering. Mixed-direction
|
|
1155
1263
|
* lines may still break sub-optimally — same trade other map renderers make.
|
|
1156
|
-
* Exported for tests.
|
|
1157
1264
|
*/
|
|
1158
1265
|
export declare function breakLines(glyphs: ShapedGlyph[], maxWidthFu: number, rtl?: boolean): ShapedGlyph[][];
|
|
1159
1266
|
|
|
@@ -1204,6 +1311,18 @@ export declare class BufferView {
|
|
|
1204
1311
|
dispose(): void;
|
|
1205
1312
|
}
|
|
1206
1313
|
|
|
1314
|
+
/**
|
|
1315
|
+
* Turn a shaping result into positioned glyph quads.
|
|
1316
|
+
*
|
|
1317
|
+
* Lines lay out top-down: line 0 keeps its baseline at y=0, later baselines
|
|
1318
|
+
* step down by the line height, and alignment shifts each line within the
|
|
1319
|
+
* widest line's width. Each glyph carries its own normalization scale so SDF
|
|
1320
|
+
* and colour glyphs share one em-space coordinate system downstream — the two
|
|
1321
|
+
* paths rasterize at different sizes (`SDF_PX_SIZE` vs `COLOR_GLYPH_PX_SIZE`)
|
|
1322
|
+
* but both end up in ems after dividing by their respective pixel size.
|
|
1323
|
+
*/
|
|
1324
|
+
export declare function buildLabelLayout(shapeResult: ShapeTextResult, options: LayoutOptions): LabelLayout;
|
|
1325
|
+
|
|
1207
1326
|
export declare type BuiltInEffectDescription = FinalCopyPassConfig | MRTPassConfig | SkyEnvMapPassConfig | TransparentPassConfig;
|
|
1208
1327
|
|
|
1209
1328
|
declare class CachedMeshHandle {
|
|
@@ -1485,7 +1604,13 @@ declare class Cesium3dTilesLayerDescription {
|
|
|
1485
1604
|
set type(value: string | null | undefined);
|
|
1486
1605
|
}
|
|
1487
1606
|
|
|
1488
|
-
export declare const
|
|
1607
|
+
export declare const CLOUD_LOCAL_WEATHER_URL: string;
|
|
1608
|
+
|
|
1609
|
+
export declare const CLOUD_SHAPE_DETAIL_URL: string;
|
|
1610
|
+
|
|
1611
|
+
export declare const CLOUD_SHAPE_URL: string;
|
|
1612
|
+
|
|
1613
|
+
export declare const CLOUD_TURBULENCE_URL: string;
|
|
1489
1614
|
|
|
1490
1615
|
/**
|
|
1491
1616
|
* Class representing a color.
|
|
@@ -2388,7 +2513,7 @@ declare type DeclutterCandidate = {
|
|
|
2388
2513
|
isShown: boolean;
|
|
2389
2514
|
/** Participant that owns this candidate; receives the placement result. */
|
|
2390
2515
|
owner: DeclutterParticipant;
|
|
2391
|
-
/** Participant-defined id (
|
|
2516
|
+
/** Participant-defined id (label slot for text batches, instance index for
|
|
2392
2517
|
* sprites) passed back to `applyDeclutter`. */
|
|
2393
2518
|
handle: number;
|
|
2394
2519
|
};
|
|
@@ -3383,6 +3508,21 @@ export declare class FeatureEvaluator {
|
|
|
3383
3508
|
*/
|
|
3384
3509
|
private obj;
|
|
3385
3510
|
constructor(handler: FeatureHandler, layerId: LayerId, featureSetId: FeatureSetId, obj: Object3D);
|
|
3511
|
+
/**
|
|
3512
|
+
* Track objects we've already warned about to avoid log spam.
|
|
3513
|
+
* Uses WeakSet so objects can be garbage collected.
|
|
3514
|
+
*/
|
|
3515
|
+
private static readonly warnedObjects;
|
|
3516
|
+
/**
|
|
3517
|
+
* Type guard to check if an Object3D has a geometryType getter.
|
|
3518
|
+
*/
|
|
3519
|
+
private hasGeometryType;
|
|
3520
|
+
/**
|
|
3521
|
+
* Determine geometry type from the mesh object.
|
|
3522
|
+
* Reads geometryType getter if available on the mesh.
|
|
3523
|
+
* Validates that the returned value is a valid GeometryType literal.
|
|
3524
|
+
*/
|
|
3525
|
+
private determineGeometryType;
|
|
3386
3526
|
/**
|
|
3387
3527
|
* Gets the unique identifier of this feature set.
|
|
3388
3528
|
*/
|
|
@@ -3509,6 +3649,8 @@ export declare type FeatureInfo = {
|
|
|
3509
3649
|
batchId: number;
|
|
3510
3650
|
properties: Record<string, unknown> | undefined;
|
|
3511
3651
|
layerId: LayerId | undefined;
|
|
3652
|
+
/** Mesh geometry type (e.g., "billboard", "text"). Not GeoJSON geometry ("Point", "Polygon"). */
|
|
3653
|
+
meshGeomType?: GeometryType;
|
|
3512
3654
|
};
|
|
3513
3655
|
|
|
3514
3656
|
export declare class FeatureMesh {
|
|
@@ -3686,6 +3828,24 @@ declare class GeoJsonSourceDescription {
|
|
|
3686
3828
|
set url(value: string | null | undefined);
|
|
3687
3829
|
}
|
|
3688
3830
|
|
|
3831
|
+
/**
|
|
3832
|
+
* Geometry type constants for mesh objects.
|
|
3833
|
+
* These types are used for feature evaluation and runtime validation.
|
|
3834
|
+
*/
|
|
3835
|
+
export declare const GEOMETRY_TYPES: {
|
|
3836
|
+
readonly Billboard: "billboard";
|
|
3837
|
+
readonly Text: "text";
|
|
3838
|
+
readonly Point: "point";
|
|
3839
|
+
readonly Polyline: "polyline";
|
|
3840
|
+
readonly Polygon: "polygon";
|
|
3841
|
+
readonly Model: "model";
|
|
3842
|
+
};
|
|
3843
|
+
|
|
3844
|
+
/**
|
|
3845
|
+
* Type representing a valid geometry type value.
|
|
3846
|
+
*/
|
|
3847
|
+
export declare type GeometryType = (typeof GEOMETRY_TYPES)[keyof typeof GEOMETRY_TYPES];
|
|
3848
|
+
|
|
3689
3849
|
export declare function getBatchDataTexture(material: Material): DataTexture | undefined;
|
|
3690
3850
|
|
|
3691
3851
|
/**
|
|
@@ -3903,6 +4063,33 @@ declare type GlobeOptions = Partial<Omit<Globe_2, "constructor" | "free" | "elev
|
|
|
3903
4063
|
color?: Color_2;
|
|
3904
4064
|
};
|
|
3905
4065
|
|
|
4066
|
+
/** Per-instance `glyphKind` values. Must match the `GLYPH_KIND_*` defines in
|
|
4067
|
+
* `shaders/glsl/sdfText.vert.glsl`. */
|
|
4068
|
+
export declare const GlyphKind: {
|
|
4069
|
+
readonly SDF: 0;
|
|
4070
|
+
readonly COLOR: 1;
|
|
4071
|
+
readonly BACKGROUND: 2;
|
|
4072
|
+
/** A slot inside a label's run that its text doesn't use, or a hole left by
|
|
4073
|
+
* a freed run. Culled in the vertex shader. */
|
|
4074
|
+
readonly EMPTY: 3;
|
|
4075
|
+
};
|
|
4076
|
+
|
|
4077
|
+
/** One positioned glyph quad in em space, ready to become an instance. */
|
|
4078
|
+
export declare type GlyphQuad = {
|
|
4079
|
+
offsetEmX: number;
|
|
4080
|
+
offsetEmY: number;
|
|
4081
|
+
sizeEmX: number;
|
|
4082
|
+
sizeEmY: number;
|
|
4083
|
+
/** Atlas sub-rect in PIXEL space; the shader divides by the live atlas size
|
|
4084
|
+
* uniform so an atlas resize doesn't invalidate the instance data. */
|
|
4085
|
+
uvL: number;
|
|
4086
|
+
uvT: number;
|
|
4087
|
+
uvR: number;
|
|
4088
|
+
uvB: number;
|
|
4089
|
+
/** Sample the COLRv1 colour atlas rather than the SDF atlas. */
|
|
4090
|
+
isColor: boolean;
|
|
4091
|
+
};
|
|
4092
|
+
|
|
3906
4093
|
/**
|
|
3907
4094
|
* Events emitted by handles.
|
|
3908
4095
|
*/
|
|
@@ -4352,6 +4539,7 @@ export declare type InstancedSpriteMaterialProps = {
|
|
|
4352
4539
|
};
|
|
4353
4540
|
|
|
4354
4541
|
export declare class InstancedSpriteMesh extends Mesh_2<BufferGeometry, Material | Material[], CustomObject3DEventMap> implements PickableMesh, DeclutterParticipant {
|
|
4542
|
+
private _geometryType;
|
|
4355
4543
|
private _batchIdToInstance;
|
|
4356
4544
|
private _initialColor;
|
|
4357
4545
|
private _initialHeight;
|
|
@@ -4392,6 +4580,23 @@ export declare class InstancedSpriteMesh extends Mesh_2<BufferGeometry, Material
|
|
|
4392
4580
|
private _declutterAnimating;
|
|
4393
4581
|
constructor(options: InstancedSpriteOptions);
|
|
4394
4582
|
setActive(active: boolean): void;
|
|
4583
|
+
/**
|
|
4584
|
+
* Set the geometry type for this mesh.
|
|
4585
|
+
*
|
|
4586
|
+
* This affects how FeatureEvaluator provides meshGeomType to evaluators,
|
|
4587
|
+
* which is used by MapLibreStylePlugin to determine which properties to apply
|
|
4588
|
+
* (e.g., billboard vs text rendering for symbol layers).
|
|
4589
|
+
*
|
|
4590
|
+
* Changing this after initialization is supported and will affect subsequent
|
|
4591
|
+
* feature evaluations, but does NOT automatically trigger re-evaluation.
|
|
4592
|
+
* Call layer.forceUpdate() if you need to re-evaluate existing features.
|
|
4593
|
+
*/
|
|
4594
|
+
setGeometryType(type: SpriteGeometryType): void;
|
|
4595
|
+
/**
|
|
4596
|
+
* Get the geometry type of this mesh.
|
|
4597
|
+
* Defaults to GEOMETRY_TYPES.Point if not explicitly set.
|
|
4598
|
+
*/
|
|
4599
|
+
get geometryType(): SpriteGeometryType;
|
|
4395
4600
|
collectDeclutterCandidates(out: DeclutterCandidate[]): void;
|
|
4396
4601
|
applyDeclutter(handle: number, hidden: boolean): void;
|
|
4397
4602
|
stepDeclutterFade(deltaMs: number): boolean;
|
|
@@ -4468,6 +4673,7 @@ export declare class InstancedSpriteMesh extends Mesh_2<BufferGeometry, Material
|
|
|
4468
4673
|
export declare type InstancedSpriteOptions = {
|
|
4469
4674
|
renderOrder?: number;
|
|
4470
4675
|
ctx: EventContext;
|
|
4676
|
+
geometryType: SpriteGeometryType;
|
|
4471
4677
|
};
|
|
4472
4678
|
|
|
4473
4679
|
/** Type guard distinguishing a raw HTML credit from a structured source. */
|
|
@@ -4479,7 +4685,7 @@ export declare const isPickableMesh: (v: object) => v is PickableMesh;
|
|
|
4479
4685
|
|
|
4480
4686
|
/** Paragraph direction from the first strong directional character (UAX #9
|
|
4481
4687
|
* P2/P3 approximation): the first letter decides, RTL ranges win over other
|
|
4482
|
-
* letters.
|
|
4688
|
+
* letters. */
|
|
4483
4689
|
export declare function isRtlText(text: string): boolean;
|
|
4484
4690
|
|
|
4485
4691
|
export declare const JAPAN_GSI_ELEVATION_DECODER: () => ElevationDecoder;
|
|
@@ -4490,6 +4696,19 @@ declare type JsEvents = {
|
|
|
4490
4696
|
|
|
4491
4697
|
declare type JsEventsKey = keyof JsEvents;
|
|
4492
4698
|
|
|
4699
|
+
/** A laid-out label: its glyph quads plus the block metrics the shader and the
|
|
4700
|
+
* declutter pass need. All measurements are in ems. */
|
|
4701
|
+
export declare type LabelLayout = {
|
|
4702
|
+
quads: GlyphQuad[];
|
|
4703
|
+
/** Unique atlas glyphs referenced, for retain/release against the atlas. */
|
|
4704
|
+
glyphKeys: bigint[];
|
|
4705
|
+
widthEm: number;
|
|
4706
|
+
heightEm: number;
|
|
4707
|
+
/** Y bounds of the actual rendered glyph bboxes, for the background quad. */
|
|
4708
|
+
minYEm: number;
|
|
4709
|
+
maxYEm: number;
|
|
4710
|
+
};
|
|
4711
|
+
|
|
4493
4712
|
export declare type LatLng = Omit<LatLngHeight, "height">;
|
|
4494
4713
|
|
|
4495
4714
|
export declare type LatLngHeight = Required<NormalizeWASMClass<LLE>>;
|
|
@@ -4591,6 +4810,17 @@ declare class LayersManager {
|
|
|
4591
4810
|
getEffectDescs(): Generator<EffectHandle>;
|
|
4592
4811
|
}
|
|
4593
4812
|
|
|
4813
|
+
declare type LayoutOptions = {
|
|
4814
|
+
/** The source string — only used to detect paragraph direction. */
|
|
4815
|
+
text: string;
|
|
4816
|
+
/** Wrap width in ems (multiples of font size); 0 disables soft wrapping. */
|
|
4817
|
+
maxWidth: number;
|
|
4818
|
+
/** Multiplier on the font's natural line height. */
|
|
4819
|
+
lineHeight: number;
|
|
4820
|
+
/** 0 left, 0.5 center, 1 right. */
|
|
4821
|
+
textAlign: number;
|
|
4822
|
+
};
|
|
4823
|
+
|
|
4594
4824
|
declare class LegacyElevationHeatmapMaterial {
|
|
4595
4825
|
private constructor();
|
|
4596
4826
|
free(): void;
|
|
@@ -4943,7 +5173,7 @@ export declare class LightHandle<T extends LightDesc = LightDesc> extends BaseHa
|
|
|
4943
5173
|
export declare type LightUpdate = Pick<LightConfig, "position"> & BaseDescConfigUpdate;
|
|
4944
5174
|
|
|
4945
5175
|
/** Line width in font units: advances summed, trailing whitespace ignored so
|
|
4946
|
-
* it never affects alignment or the block width.
|
|
5176
|
+
* it never affects alignment or the block width. */
|
|
4947
5177
|
export declare function lineWidthFu(line: ShapedGlyph[]): number;
|
|
4948
5178
|
|
|
4949
5179
|
declare class LLE {
|
|
@@ -4955,6 +5185,12 @@ declare class LLE {
|
|
|
4955
5185
|
lng: number;
|
|
4956
5186
|
}
|
|
4957
5187
|
|
|
5188
|
+
/**
|
|
5189
|
+
* The textures guaranteed to be present in an {@link Atmosphere.onTexturesReady}
|
|
5190
|
+
* callback for a given needs declaration.
|
|
5191
|
+
*/
|
|
5192
|
+
declare type LoadedAtmosphereTextures<N extends AtmosphereTextureNeeds> = Required<Pick<PrecomputedTextures, `${Extract<keyof N, AtmosphereTextureName>}Texture`>>;
|
|
5193
|
+
|
|
4958
5194
|
/**
|
|
4959
5195
|
* LOD fog settings: a distance-based screen-space-error relaxation used by
|
|
4960
5196
|
* the tile traversals (far tiles tolerate a larger error and stay coarser,
|
|
@@ -5581,8 +5817,6 @@ declare class ModelMaterial_2 {
|
|
|
5581
5817
|
set applyWaterNormal(value: boolean | null | undefined);
|
|
5582
5818
|
get castShadow(): boolean | undefined;
|
|
5583
5819
|
set castShadow(value: boolean | null | undefined);
|
|
5584
|
-
get clampToGround(): boolean | undefined;
|
|
5585
|
-
set clampToGround(value: boolean | null | undefined);
|
|
5586
5820
|
get color(): number | undefined;
|
|
5587
5821
|
set color(value: number | null | undefined);
|
|
5588
5822
|
/**
|
|
@@ -5754,6 +5988,10 @@ export declare class ModelMesh extends Object3D<CustomObject3DEventMap> implemen
|
|
|
5754
5988
|
scene: Group;
|
|
5755
5989
|
credit?: string;
|
|
5756
5990
|
}, m: ModelMesh_2);
|
|
5991
|
+
/**
|
|
5992
|
+
* Geometry type of this mesh.
|
|
5993
|
+
*/
|
|
5994
|
+
readonly geometryType: "model";
|
|
5757
5995
|
get water(): boolean;
|
|
5758
5996
|
set water(v: boolean);
|
|
5759
5997
|
private init;
|
|
@@ -5972,8 +6210,6 @@ declare class MvtLayerDescription {
|
|
|
5972
6210
|
set vectorTile(value: LegacyVectorTileMaterial | null | undefined);
|
|
5973
6211
|
}
|
|
5974
6212
|
|
|
5975
|
-
export declare const NOISE_ASSETS_URL: string;
|
|
5976
|
-
|
|
5977
6213
|
/**
|
|
5978
6214
|
* A pass that copies normal buffer contents to a render target.
|
|
5979
6215
|
*/
|
|
@@ -6881,6 +7117,10 @@ export declare class PolygonMesh extends BatchedFeatureMesh<BufferGeometry<Attri
|
|
|
6881
7117
|
private _enhancedMaterial?;
|
|
6882
7118
|
constructor(ctx: EventContext, layerId: string);
|
|
6883
7119
|
ready(): boolean;
|
|
7120
|
+
/**
|
|
7121
|
+
* Geometry type of this mesh.
|
|
7122
|
+
*/
|
|
7123
|
+
readonly geometryType: "polygon";
|
|
6884
7124
|
init(mesh: PolygonMesh_2, tileHandle: TileHandle | undefined): this;
|
|
6885
7125
|
clone(): this;
|
|
6886
7126
|
private initGeometry;
|
|
@@ -7274,6 +7514,10 @@ export declare class PolylineMesh extends BatchedFeatureMesh<BufferGeometry<Attr
|
|
|
7274
7514
|
/** Flag indicating geometry initialization failed - mesh should never be visible */
|
|
7275
7515
|
private _geometryInitFailed;
|
|
7276
7516
|
constructor(ctx: EventContext);
|
|
7517
|
+
/**
|
|
7518
|
+
* Geometry type of this mesh.
|
|
7519
|
+
*/
|
|
7520
|
+
readonly geometryType: "polyline";
|
|
7277
7521
|
init(mesh: PolylineMesh_2): this;
|
|
7278
7522
|
private initGeometry;
|
|
7279
7523
|
private initMaterial;
|
|
@@ -7362,8 +7606,6 @@ declare class QuantizedMeshSourceDescription {
|
|
|
7362
7606
|
*/
|
|
7363
7607
|
export declare function radianToDegree(radian: number): number;
|
|
7364
7608
|
|
|
7365
|
-
export declare const RAIN_ASSETS_URL: string;
|
|
7366
|
-
|
|
7367
7609
|
/** One baked raster layer: its overlapping WM tile textures, mosaicked into one
|
|
7368
7610
|
* render target. Heatmap layers carry encoded DEM, copied raw (nearest, no
|
|
7369
7611
|
* color conversion) so the composite decode stays valid. */
|
|
@@ -7915,10 +8157,6 @@ export declare type SdfTextBaseMutates = Mutates<SdfTextBaseState, SdfTextBaseUn
|
|
|
7915
8157
|
* Update per-frame camera uniforms (FOV, screen height, far plane, RTE eye).
|
|
7916
8158
|
*/
|
|
7917
8159
|
updatePerFrame: (fovRad: number, screenHeightPx: number, farPlane: number, cameraX: number, cameraY: number, cameraZ: number, viewMatrix: Matrix4, state: SdfTextBaseState) => void;
|
|
7918
|
-
/**
|
|
7919
|
-
* Update text dimension uniforms after text shaping.
|
|
7920
|
-
*/
|
|
7921
|
-
updateTextDimensions: (textWidth: number, textHeight: number, bgMinY: number, bgMaxY: number) => void;
|
|
7922
8160
|
/**
|
|
7923
8161
|
* Set the SDF atlas texture external ref.
|
|
7924
8162
|
*/
|
|
@@ -7934,39 +8172,33 @@ export declare type SdfTextBaseMutates = Mutates<SdfTextBaseState, SdfTextBaseUn
|
|
|
7934
8172
|
*/
|
|
7935
8173
|
updateAtlasSizes: () => void;
|
|
7936
8174
|
/**
|
|
7937
|
-
*
|
|
8175
|
+
* Point the shader at the mesh's per-label data texture. Must be re-called
|
|
8176
|
+
* whenever the mesh grows it, since growing allocates a new texture.
|
|
7938
8177
|
*/
|
|
7939
|
-
|
|
7940
|
-
high: Float32Array;
|
|
7941
|
-
low: Float32Array;
|
|
7942
|
-
}, useRTE: boolean, rtcCenter?: [number, number, number]) => void;
|
|
8178
|
+
setLabelDataTexture: (texture: DataTexture | null, width: number, height: number) => void;
|
|
7943
8179
|
/**
|
|
7944
|
-
*
|
|
8180
|
+
* Update the batch's RTC center (the tile transform). Only meaningful in
|
|
8181
|
+
* RTC mode; in RTE mode anchors carry their own high/low split.
|
|
7945
8182
|
*/
|
|
7946
|
-
|
|
7947
|
-
/**
|
|
7948
|
-
* Set the declutter hide factor (0 = shown … 1 = hidden); the fragment
|
|
7949
|
-
* shader scales opacity by `1 - value` and the vertex shader hard-culls
|
|
7950
|
-
* at 1. Kept separate from `show`/`opacity` so user-driven visibility and
|
|
7951
|
-
* declutter results compose instead of clobbering each other.
|
|
7952
|
-
*/
|
|
7953
|
-
setDeclutterHide: (value: number) => void;
|
|
8183
|
+
setRtcCenter: (center: [number, number, number]) => void;
|
|
7954
8184
|
}>;
|
|
7955
8185
|
|
|
7956
8186
|
/**
|
|
7957
8187
|
* Props for the sdfText base enhancer.
|
|
8188
|
+
*
|
|
8189
|
+
* Everything here is **batch-wide**: one material draws every label in a
|
|
8190
|
+
* tile-layer. Per-label values (position, colour, opacity, font size, height,
|
|
8191
|
+
* block metrics, batch id, declutter fade) live in the label data texture
|
|
8192
|
+
* owned by `BatchedSdfTextMesh`, not in this state — see
|
|
8193
|
+
* `web/navara_three/src/mesh/sdfText/labelData.ts`.
|
|
7958
8194
|
*/
|
|
7959
8195
|
export declare type SdfTextBaseProps = {
|
|
7960
8196
|
useRTE?: boolean;
|
|
7961
8197
|
/** When `true` the fragment shader samples the atlas as 4-channel MTSDF
|
|
7962
8198
|
* (median of RGB + true SDF in alpha) instead of single-channel R8. */
|
|
7963
8199
|
useMsdf?: boolean;
|
|
7964
|
-
color?: number;
|
|
7965
|
-
opacity?: number;
|
|
7966
|
-
fontSize?: number;
|
|
7967
8200
|
center?: [number, number];
|
|
7968
8201
|
sizeInMeters?: boolean;
|
|
7969
|
-
addHeight?: number;
|
|
7970
8202
|
offsetDepth?: boolean;
|
|
7971
8203
|
outlineWidth?: number;
|
|
7972
8204
|
outlineColor?: number;
|
|
@@ -7988,12 +8220,8 @@ export declare type SdfTextBaseProps = {
|
|
|
7988
8220
|
* Internal type - not exposed externally.
|
|
7989
8221
|
*/
|
|
7990
8222
|
declare type SdfTextBaseRefs = {
|
|
7991
|
-
uColor: UniformValue<Color_3>;
|
|
7992
|
-
uOpacity: UniformValue<number>;
|
|
7993
|
-
uFontSize: UniformValue<number>;
|
|
7994
8223
|
uCenter: UniformValue<Vector2>;
|
|
7995
8224
|
uSizeInMeters: UniformValue<boolean>;
|
|
7996
|
-
uAddHeight: UniformValue<number>;
|
|
7997
8225
|
uOffsetDepth: UniformValue<boolean>;
|
|
7998
8226
|
uSdfThreshold: UniformValue<number>;
|
|
7999
8227
|
uOutlineWidth: UniformValue<number>;
|
|
@@ -8006,20 +8234,12 @@ declare type SdfTextBaseRefs = {
|
|
|
8006
8234
|
uFovRad: UniformValue<number>;
|
|
8007
8235
|
uScreenHeightPx: UniformValue<number>;
|
|
8008
8236
|
uFarPlane: UniformValue<number>;
|
|
8009
|
-
uTextWidth: UniformValue<number>;
|
|
8010
|
-
uTextHeight: UniformValue<number>;
|
|
8011
|
-
uBgYBounds: UniformValue<Vector2>;
|
|
8012
|
-
/** Screen-space declutter hide factor (0 = shown … 1 = hidden), animated
|
|
8013
|
-
* by the declutter fade. Driven by the declutter pass, not by material
|
|
8014
|
-
* style updates. */
|
|
8015
|
-
uDeclutterHide: UniformValue<number>;
|
|
8016
8237
|
uRTCCenter: UniformValue<Vector3>;
|
|
8017
8238
|
uRTCCenterView: UniformValue<Vector3>;
|
|
8018
8239
|
uEyeRTELow: UniformValue<Vector3>;
|
|
8019
8240
|
uEyeRTEHigh: UniformValue<Vector3>;
|
|
8020
8241
|
/** Always 1.0 — blocks fast-math reassociation of the RTE recombination. */
|
|
8021
8242
|
u_rteOne?: UniformValue<number>;
|
|
8022
|
-
nvr_uBatchId: UniformValue<number>;
|
|
8023
8243
|
nvr_uPickable: UniformValue<number>;
|
|
8024
8244
|
uAtlas: UniformValue<DataTexture | null>;
|
|
8025
8245
|
/** COLRv1 RGBA atlas. `null` when the font has no color glyphs. */
|
|
@@ -8028,9 +8248,12 @@ declare type SdfTextBaseRefs = {
|
|
|
8028
8248
|
uSdfAtlasSize: UniformValue<Vector2>;
|
|
8029
8249
|
/** Current color atlas pixel dimensions; updated when the color atlas grows. */
|
|
8030
8250
|
uColorAtlasSize: UniformValue<Vector2>;
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8251
|
+
/** Per-label state, indexed by the `labelIndex` instance attribute. Owned by
|
|
8252
|
+
* the mesh and swapped wholesale when it outgrows its capacity. */
|
|
8253
|
+
uLabelData: UniformValue<DataTexture | null>;
|
|
8254
|
+
/** Dimensions of `uLabelData` in texels, for the shader's index-to-texel
|
|
8255
|
+
* math. Read as an `ivec2`. */
|
|
8256
|
+
uLabelTexSize: UniformValue<Vector2>;
|
|
8034
8257
|
};
|
|
8035
8258
|
|
|
8036
8259
|
/**
|
|
@@ -8039,12 +8262,8 @@ declare type SdfTextBaseRefs = {
|
|
|
8039
8262
|
export declare type SdfTextBaseState = Readonly<{
|
|
8040
8263
|
useRTE: boolean;
|
|
8041
8264
|
useMsdf: boolean;
|
|
8042
|
-
color: Color_3;
|
|
8043
|
-
opacity: number;
|
|
8044
|
-
fontSize: number;
|
|
8045
8265
|
center: [number, number];
|
|
8046
8266
|
sizeInMeters: boolean;
|
|
8047
|
-
addHeight: number;
|
|
8048
8267
|
offsetDepth: boolean;
|
|
8049
8268
|
outlineWidth: number;
|
|
8050
8269
|
outlineColor: Color_3;
|
|
@@ -8068,163 +8287,6 @@ export declare type SdfTextMaterialProps = {
|
|
|
8068
8287
|
base?: SdfTextBaseProps;
|
|
8069
8288
|
};
|
|
8070
8289
|
|
|
8071
|
-
/**
|
|
8072
|
-
* A text mesh that renders glyphs from an SDF atlas using instanced geometry.
|
|
8073
|
-
*
|
|
8074
|
-
* Each glyph is an instanced unit quad positioned by shaping data,
|
|
8075
|
-
* sampling from a per-font SDF atlas texture. Uses billboard rendering
|
|
8076
|
-
* so text always faces the camera.
|
|
8077
|
-
*/
|
|
8078
|
-
export declare class SDFTextMesh extends Mesh_2<InstancedBufferGeometry, ShaderMaterial> implements PickableMesh {
|
|
8079
|
-
private _fontManager;
|
|
8080
|
-
private _fontUrl;
|
|
8081
|
-
/** Per-material text quality. Immutable after construction — switching
|
|
8082
|
-
* quality requires a separate (font, atlas) pair, so callers create a new
|
|
8083
|
-
* mesh rather than mutating this one. */
|
|
8084
|
-
private _highQuality;
|
|
8085
|
-
private _text;
|
|
8086
|
-
/** Wrap width in ems (multiples of font size); 0 disables soft wrapping. */
|
|
8087
|
-
private _maxWidth;
|
|
8088
|
-
/** Multiplier on the font's natural line height (ascender − descender + gap). */
|
|
8089
|
-
private _lineHeight;
|
|
8090
|
-
/** Alignment factor for multi-line blocks: 0 left, 0.5 center, 1 right. */
|
|
8091
|
-
private _textAlign;
|
|
8092
|
-
private _atlasTexture;
|
|
8093
|
-
/** Atlas texture is owned externally; do not dispose on cleanup when true. */
|
|
8094
|
-
private _sharedAtlas;
|
|
8095
|
-
/** Unique atlas glyphs this mesh currently renders (composite keys). */
|
|
8096
|
-
private _glyphKeys;
|
|
8097
|
-
/** The glyph set currently retained in the atlas (one visible-label
|
|
8098
|
-
* reference per key), or null when this mesh holds no references. */
|
|
8099
|
-
private _retainedKeys;
|
|
8100
|
-
/** Re-prepare a text in the worker (re-rasterizing evicted glyphs) using the
|
|
8101
|
-
* owner's font identity and loaded faces. Set by the parent batch. */
|
|
8102
|
-
private _reprepare?;
|
|
8103
|
-
/** Ask the owner to schedule a render after an async re-prepare. */
|
|
8104
|
-
private _requestRender?;
|
|
8105
|
-
/** World-space anchor in ECEF meters (f64), kept in sync with the position
|
|
8106
|
-
* uniforms so the declutter pass can project it without touching WASM. */
|
|
8107
|
-
private _worldAnchor;
|
|
8108
|
-
/** Whether this label participates in screen-space decluttering. */
|
|
8109
|
-
private _declutter;
|
|
8110
|
-
/** Layer-level placement priority from the material. */
|
|
8111
|
-
private _declutterPriority;
|
|
8112
|
-
/** Per-feature priority set through the evaluator; overrides the layer
|
|
8113
|
-
* value when defined. */
|
|
8114
|
-
private _declutterPriorityOverride;
|
|
8115
|
-
/** Current animated hide factor (mirrors the uDeclutterHide uniform) and
|
|
8116
|
-
* the placement target it is fading toward. */
|
|
8117
|
-
private _declutterHide;
|
|
8118
|
-
private _declutterTarget;
|
|
8119
|
-
/** Text block dimensions in em units, mirroring the uTextWidth/uTextHeight/
|
|
8120
|
-
* uBgYBounds uniforms; 0 width means "no collision box" (empty text). */
|
|
8121
|
-
private _labelWidthEm;
|
|
8122
|
-
private _labelHeightEm;
|
|
8123
|
-
private _labelMinYEm;
|
|
8124
|
-
private _labelMaxYEm;
|
|
8125
|
-
private _enhancer;
|
|
8126
|
-
constructor(position: Float32Array | {
|
|
8127
|
-
high: Float32Array;
|
|
8128
|
-
low: Float32Array;
|
|
8129
|
-
}, material: TextMaterial, transform: Transform_2, fontManager: FontManager, fontUrl: string, batchId: number | undefined, RTE: boolean, highQuality: boolean);
|
|
8130
|
-
/** The text this mesh currently renders (its baked glyph string). */
|
|
8131
|
-
get text(): string;
|
|
8132
|
-
/**
|
|
8133
|
-
* Set a shared atlas texture. When set, setText() will skip creating its own texture.
|
|
8134
|
-
* The caller is responsible for the texture lifecycle.
|
|
8135
|
-
*/
|
|
8136
|
-
setAtlasTexture(tex: DataTexture): void;
|
|
8137
|
-
/**
|
|
8138
|
-
* Set a shared color (COLRv1 RGBA) atlas texture.
|
|
8139
|
-
* Pass `null` to clear when the font has no color glyphs.
|
|
8140
|
-
*/
|
|
8141
|
-
setColorAtlasTexture(tex: DataTexture | null): void;
|
|
8142
|
-
/**
|
|
8143
|
-
* Wire the callbacks the parent batch uses to re-prepare evicted glyphs and
|
|
8144
|
-
* request a render. `reprepare` must apply the batch's font identity and
|
|
8145
|
-
* loaded faces so font refcounts stay balanced.
|
|
8146
|
-
*/
|
|
8147
|
-
setGlyphLifecycleHandlers(reprepare: (text: string) => Promise<void>, requestRender: () => void): void;
|
|
8148
|
-
/** Replace the retained glyph set, releasing the old references and (if
|
|
8149
|
-
* visible) retaining the new ones. */
|
|
8150
|
-
private _setGlyphKeys;
|
|
8151
|
-
/** Reconcile atlas references with current visibility: retain glyphs while
|
|
8152
|
-
* on screen, release them when hidden. If shown after the glyphs were
|
|
8153
|
-
* evicted (cache no longer prepared), re-prepare to re-rasterize them and
|
|
8154
|
-
* rebuild with fresh metrics. */
|
|
8155
|
-
private _syncGlyphRefs;
|
|
8156
|
-
/**
|
|
8157
|
-
* Set text to render. Shapes via WASM, rebuilds instanced geometry, updates atlas texture.
|
|
8158
|
-
*/
|
|
8159
|
-
setText(text: string, forceUpdate?: boolean): void;
|
|
8160
|
-
/**
|
|
8161
|
-
* Update visual properties: color, size, visibility, etc.
|
|
8162
|
-
*/
|
|
8163
|
-
setFont(fontUrl: string): void;
|
|
8164
|
-
setColor(color: Color_3): void;
|
|
8165
|
-
setFontSize(size: number): void;
|
|
8166
|
-
setSizeInMeters(enabled: boolean): void;
|
|
8167
|
-
setCenter(x: number, y: number): void;
|
|
8168
|
-
setHeight(height: number): void;
|
|
8169
|
-
setSize(size: number): void;
|
|
8170
|
-
setOpacity(opacity: number): void;
|
|
8171
|
-
/**
|
|
8172
|
-
* Set this label's declutter fade target; the actual hide factor animates
|
|
8173
|
-
* toward it in {@link stepDeclutterFade}. Deliberately separate from
|
|
8174
|
-
* `visible`/`show`: it neither churns scene-graph membership nor releases
|
|
8175
|
-
* glyph atlas retains, so the declutter pass can retarget it every
|
|
8176
|
-
* placement run at no cost.
|
|
8177
|
-
*/
|
|
8178
|
-
setDeclutterHidden(hidden: boolean): void;
|
|
8179
|
-
/**
|
|
8180
|
-
* Advance the hide factor toward its target by `deltaMs / DECLUTTER_FADE_MS`
|
|
8181
|
-
* and push it to the uniform. Returns true while still mid-fade.
|
|
8182
|
-
*/
|
|
8183
|
-
stepDeclutterFade(deltaMs: number): boolean;
|
|
8184
|
-
_setFeatureWidth(_width: number): void;
|
|
8185
|
-
_setFeatureOpacity(opacity: number): void;
|
|
8186
|
-
setPosition(position: Float32Array | {
|
|
8187
|
-
high: Float32Array;
|
|
8188
|
-
low: Float32Array;
|
|
8189
|
-
}, RTE: boolean, transform: Transform_2): void;
|
|
8190
|
-
/** Reconstruct the absolute ECEF anchor from the same inputs the position
|
|
8191
|
-
* uniforms receive (RTE high+low split, or RTC-relative + center). */
|
|
8192
|
-
private _cacheWorldAnchor;
|
|
8193
|
-
/**
|
|
8194
|
-
* Build this label's collision candidate for the shared declutter pass, or
|
|
8195
|
-
* null when it doesn't participate (declutter disabled, hidden, or empty).
|
|
8196
|
-
* The local box mirrors the vertex shader's layout: glyphs span
|
|
8197
|
-
* [0, textWidth] × [bgMinY, bgMaxY] in em units, shifted by the `center`
|
|
8198
|
-
* anchor and scaled by the font size (sdfText.vert.glsl:111-115).
|
|
8199
|
-
*/
|
|
8200
|
-
getDeclutterCandidate(owner: DeclutterParticipant, handle: number): DeclutterCandidate | null;
|
|
8201
|
-
/**
|
|
8202
|
-
* Set a per-feature placement priority (higher wins), overriding the
|
|
8203
|
-
* layer-level `declutterPriority` for this label. Pass `undefined` to fall
|
|
8204
|
-
* back to the layer value. Driven by the feature evaluator.
|
|
8205
|
-
*/
|
|
8206
|
-
setDeclutterPriority(priority: number | undefined): void;
|
|
8207
|
-
/**
|
|
8208
|
-
* Apply material properties from WASM TextMaterial.
|
|
8209
|
-
* Maps relevant properties to enhancer updates, with change tracking.
|
|
8210
|
-
*/
|
|
8211
|
-
update(material: TextMaterial, forceUpdate?: boolean): void;
|
|
8212
|
-
_setFeatureColor(color: Color_3): void;
|
|
8213
|
-
_getFeatureColor(): Color_3;
|
|
8214
|
-
_setFeatureShow(visible: boolean): void;
|
|
8215
|
-
_setFeatureExtrudedHeight(_height: number): void;
|
|
8216
|
-
_setFeatureHeight(height: number): void;
|
|
8217
|
-
_setFrustumCulled(culled: boolean): void;
|
|
8218
|
-
onBeforePicking(): void;
|
|
8219
|
-
onAfterPicking(): void;
|
|
8220
|
-
getRenderable(): Object3D;
|
|
8221
|
-
dispose(): void;
|
|
8222
|
-
private _createBaseGeometry;
|
|
8223
|
-
private _buildGlyphInstances;
|
|
8224
|
-
private _setInstanceAttribute;
|
|
8225
|
-
private _updateAtlasTexture;
|
|
8226
|
-
}
|
|
8227
|
-
|
|
8228
8290
|
export declare type SelectiveEffectConfig = {
|
|
8229
8291
|
selectiveEffect?: true;
|
|
8230
8292
|
} & EffectConfig;
|
|
@@ -8632,6 +8694,8 @@ export declare type SourceLayerBase<Layer extends {
|
|
|
8632
8694
|
*/
|
|
8633
8695
|
export declare type SourceRef = string | Source;
|
|
8634
8696
|
|
|
8697
|
+
declare type SpriteGeometryType = Extract<GeometryType, typeof GEOMETRY_TYPES.Point | typeof GEOMETRY_TYPES.Billboard>;
|
|
8698
|
+
|
|
8635
8699
|
export declare const STARS_ASSETS_URL: string;
|
|
8636
8700
|
|
|
8637
8701
|
export declare const STARS_RENDER_ORDER: number;
|
|
@@ -10343,6 +10407,11 @@ export declare class UnknownTypeError extends Error {
|
|
|
10343
10407
|
set watermask(value: number | null | undefined);
|
|
10344
10408
|
}
|
|
10345
10409
|
|
|
10410
|
+
/**
|
|
10411
|
+
* Array of valid geometry type values for runtime validation.
|
|
10412
|
+
*/
|
|
10413
|
+
export declare const VALID_GEOMETRY_TYPES: ("billboard" | "text" | "point" | "polyline" | "polygon" | "model")[];
|
|
10414
|
+
|
|
10346
10415
|
export declare type Vec2 = Required<NormalizeWASMClass<Vec2_3>>;
|
|
10347
10416
|
|
|
10348
10417
|
declare class Vec2_2 {
|
|
@@ -10651,8 +10720,6 @@ export declare class UnknownTypeError extends Error {
|
|
|
10651
10720
|
idle: () => void;
|
|
10652
10721
|
};
|
|
10653
10722
|
|
|
10654
|
-
export declare const WATER_ASSETS_URL: string;
|
|
10655
|
-
|
|
10656
10723
|
export declare const WATER_NORMAL_URL: string;
|
|
10657
10724
|
|
|
10658
10725
|
/**
|