@openglobus/og 1.0.0-rc15 → 1.0.0-rc18

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.
@@ -23,18 +23,19 @@ interface ISunParams extends IControlParams {
23
23
  * @param {number} [options.offsetVertical=-5000000] - Vertical offset of the camera following light.
24
24
  * @param {number} [options.offsetHorizontal=5000000] - Horizontal offset of the camera following light.
25
25
  * @param {boolean} [options.stopped=false] - Stops the control, leaving the Sun on its real position by the clock.
26
- * @param {Date} [options.localDateTime] - Lights the scene by a fixed local apparent solar time under the camera
27
- * instead of the camera following light, below activationHeight. At 12:00 the Sun stands on the meridian there,
28
- * while the date sets the season. Read for the wall clock numbers it shows locally, so it is not an instant in
29
- * time: one parsed from an absolute timestamp reads as the machine's time zone renders it. The Clock is left
30
- * untouched, and while the control is stopped this is ignored.
26
+ * @param {Date} [options.localDateTime] - Lights the scene by the local apparent solar time under the camera
27
+ * instead of the camera following light. At 12:00 the Sun stands on the meridian there, while the date sets the
28
+ * season. Read by its UTC clock, so it is not an instant in time but the numbers a wall clock shows: build it
29
+ * with Date.UTC. While it is set it drives the light at any height, whether the control is stopped or not, and
30
+ * the Clock is left untouched.
31
31
  */
32
32
  export declare class Sun extends Control {
33
33
  activationHeight: number;
34
34
  offsetVertical: number;
35
35
  offsetHorizontal: number;
36
36
  /**
37
- * Fixed local apparent solar time under the camera, or null for the camera following light.
37
+ * Local apparent solar time under the camera, read by its UTC clock,
38
+ * or null for the camera following light.
38
39
  * @public
39
40
  * @type {Date | null}
40
41
  */
@@ -57,7 +58,7 @@ export declare class Sun extends Control {
57
58
  bindClock(clock: Clock): void;
58
59
  getPosition(): Vec3;
59
60
  /**
60
- * Sets a fixed local apparent solar time under the camera.
61
+ * Sets the local apparent solar time under the camera, read by its UTC clock.
61
62
  * @public
62
63
  * @param {Date | null} localDateTime - Local date and time, or null to restore the camera following light.
63
64
  */
@@ -72,14 +73,16 @@ export declare class Sun extends Control {
72
73
  */
73
74
  protected _getCameraFollowingPosition(cam: PlanetCamera): Vec3;
74
75
  /**
75
- * Returns the julian date at which localDateTime is the local apparent solar time at lon.
76
- * Local mean solar time is the first guess, then the measured subsolar longitude corrects it;
77
- * that point drifts -360 degrees a day, so a residual of d degrees is worth -d / 360 of a day.
76
+ * Returns the julian date at which the clock of the given one, read as UTC, is the local apparent
77
+ * solar time at lon. Local mean solar time is the first guess, then the measured subsolar longitude
78
+ * corrects it; that point drifts -360 degrees a day, so a residual of d degrees is worth -d / 360
79
+ * of a day.
78
80
  * @protected
81
+ * @param {JulianDate} utc - Julian date to take the clock of.
79
82
  * @param {number} lon - Longitude under the camera, degrees.
80
83
  * @returns {JulianDate} -
81
84
  */
82
- protected _getLocalDateTimeJulian(lon: number): JulianDate;
85
+ protected _getLocalJulian(utc: JulianDate, lon: number): JulianDate;
83
86
  /**
84
87
  * Returns the Sun position for localDateTime at the location under the camera.
85
88
  * @protected
@@ -2,6 +2,7 @@ import { Dialog } from "../../ui/Dialog";
2
2
  import { ToggleButton } from "../../ui/ToggleButton";
3
3
  import { Control, type IControlParams } from "../Control";
4
4
  import { TimelineView } from "./TimelineView";
5
+ import type { ITimelineSpan, ITimelineSpanParams, TimelineModel } from "./TimelineModel";
5
6
  import { type EventsHandler } from "../../Events";
6
7
  type TimelineControlEventsList = [
7
8
  "visibility",
@@ -15,7 +16,8 @@ type TimelineControlEventsList = [
15
16
  "startdrag",
16
17
  "stopdrag",
17
18
  "startdragcurrent",
18
- "stopdragcurrent"
19
+ "stopdragcurrent",
20
+ "localtime"
19
21
  ];
20
22
  interface ITimelineControlParams extends IControlParams {
21
23
  name?: string;
@@ -30,6 +32,68 @@ declare class TimelineControl extends Control {
30
32
  protected _defaultClockWasRunningBeforeDrag: boolean;
31
33
  events: EventsHandler<TimelineControlEventsList>;
32
34
  constructor(options?: ITimelineControlParams);
35
+ /**
36
+ * Returns timeline data model.
37
+ * @public
38
+ */
39
+ get model(): TimelineModel;
40
+ /**
41
+ * Adds a colored time interval drawn on the scale, e.g. one per telemetry track.
42
+ * Spans that overlap in time are placed on separate rows automatically, and the
43
+ * rows share the scale height between them.
44
+ * @public
45
+ * @param {ITimelineSpanParams} params - Span start, end and color. An omitted id is generated.
46
+ * @returns {ITimelineSpan} - Stored span, with its id and assigned row.
47
+ */
48
+ addSpan(params: ITimelineSpanParams): ITimelineSpan;
49
+ /**
50
+ * Adds several spans at once, keeping the ones already on the scale.
51
+ * @public
52
+ * @param {ITimelineSpanParams[]} params - Spans to add.
53
+ * @returns {ITimelineSpan[]} - Stored spans, in the order they were given.
54
+ */
55
+ addSpans(params: ITimelineSpanParams[]): ITimelineSpan[];
56
+ /**
57
+ * Replaces every span on the scale, e.g. to redraw the whole set after a source
58
+ * was added or removed.
59
+ * @public
60
+ * @param {ITimelineSpanParams[]} params - Spans the scale is left with.
61
+ * @returns {ITimelineSpan[]} - Stored spans, in the order they were given.
62
+ */
63
+ setSpans(params: ITimelineSpanParams[]): ITimelineSpan[];
64
+ /**
65
+ * Replaces the time range, color and payload of a span, and reassigns the rows when
66
+ * its time range moved.
67
+ * @public
68
+ * @param {string} id - Span id.
69
+ * @param {ITimelineSpanParams} params - New span fields. Every field is replaced, the id is kept.
70
+ * @returns {ITimelineSpan | undefined} - Updated span, or undefined when the id is unknown.
71
+ */
72
+ updateSpan(id: string, params: ITimelineSpanParams): ITimelineSpan | undefined;
73
+ /**
74
+ * Removes a single span from the scale. An unknown id is ignored.
75
+ * @public
76
+ * @param {string} id - Span id.
77
+ */
78
+ removeSpan(id: string): void;
79
+ /**
80
+ * Removes every span from the scale.
81
+ * @public
82
+ */
83
+ clearSpans(): void;
84
+ /**
85
+ * Returns the spans currently on the scale.
86
+ * @public
87
+ * @returns {ITimelineSpan[]} - Stored spans, each carrying its assigned row.
88
+ */
89
+ getSpans(): ITimelineSpan[];
90
+ /**
91
+ * Returns a single span by its id.
92
+ * @public
93
+ * @param {string} id - Span id.
94
+ * @returns {ITimelineSpan | undefined} - Stored span, or undefined when the id is unknown.
95
+ */
96
+ getSpan(id: string): ITimelineSpan | undefined;
33
97
  oninit(): void;
34
98
  }
35
99
  export { TimelineControl };
@@ -1,5 +1,22 @@
1
1
  import { type EventsHandler } from "../../Events";
2
- type TimelineEventsList = ["change", "current"];
2
+ type TimelineEventsList = ["change", "current", "play", "stop", "spanschange"];
3
+ /** A colored time interval shown on the timeline scale. */
4
+ export interface ITimelineSpanParams {
5
+ id?: string;
6
+ start: Date;
7
+ end: Date;
8
+ color?: string;
9
+ data?: unknown;
10
+ }
11
+ export interface ITimelineSpan {
12
+ id: string;
13
+ start: Date;
14
+ end: Date;
15
+ color: string;
16
+ data?: unknown;
17
+ /** Row the span is drawn in, assigned so that overlapping spans never share one. */
18
+ lane: number;
19
+ }
3
20
  interface ITimelineParams {
4
21
  current?: Date;
5
22
  rangeStart?: Date;
@@ -9,6 +26,7 @@ interface ITimelineParams {
9
26
  multiplier?: number;
10
27
  }
11
28
  declare class TimelineModel {
29
+ static __spanCounter__: number;
12
30
  events: EventsHandler<TimelineEventsList>;
13
31
  protected _current: Date;
14
32
  protected _rangeStart: Date;
@@ -18,9 +36,26 @@ declare class TimelineModel {
18
36
  protected _maxDate: Date | null;
19
37
  protected _requestAnimationFrameId: number;
20
38
  protected _prevNow: number;
39
+ protected _spans: ITimelineSpan[];
40
+ protected _laneCount: number;
21
41
  multiplier: number;
22
42
  dt: number;
23
43
  constructor(options?: ITimelineParams);
44
+ addSpan(params: ITimelineSpanParams): ITimelineSpan;
45
+ addSpans(params: ITimelineSpanParams[]): ITimelineSpan[];
46
+ setSpans(params: ITimelineSpanParams[]): ITimelineSpan[];
47
+ updateSpan(id: string, params: ITimelineSpanParams): ITimelineSpan | undefined;
48
+ removeSpan(id: string): void;
49
+ clearSpans(): void;
50
+ getSpans(): ITimelineSpan[];
51
+ getSpan(id: string): ITimelineSpan | undefined;
52
+ /**
53
+ * Number of rows the current spans need, at least one when
54
+ * there are any.
55
+ */
56
+ get laneCount(): number;
57
+ protected _onSpansChange(): void;
58
+ protected _assignLanes(): void;
24
59
  play(): void;
25
60
  stop(): void;
26
61
  stopped(): boolean;
@@ -1,5 +1,6 @@
1
1
  import type { EventsHandler } from "../../Events";
2
2
  import { ButtonGroup } from "../../ui/ButtonGroup";
3
+ import { Checkbox } from "../../ui/Checkbox";
3
4
  import { View } from "../../ui/View";
4
5
  import type { IViewParams, ViewEventsList } from "../../ui/View";
5
6
  import { ToggleButton } from "../../ui/ToggleButton";
@@ -27,7 +28,8 @@ type TimelineViewEventsList = [
27
28
  "play",
28
29
  "playback",
29
30
  "pause",
30
- "visibility"
31
+ "visibility",
32
+ "localtime"
31
33
  ];
32
34
  type TimelineTouchMode = typeof TOUCH_MODE_NONE | typeof TOUCH_MODE_CURRENT | typeof TOUCH_MODE_PINCH | typeof TOUCH_MODE_SCALE;
33
35
  interface ITimelineTouchPointer {
@@ -43,6 +45,9 @@ declare class TimelineView extends View<TimelineModel> {
43
45
  protected _currentEl: HTMLElement | null;
44
46
  protected _canvasEl: HTMLCanvasElement;
45
47
  protected _ctx: CanvasRenderingContext2D;
48
+ protected _spansCanvasEl: HTMLCanvasElement;
49
+ protected _spansCtx: CanvasRenderingContext2D;
50
+ protected _appliedFillStyle: string;
46
51
  protected _isMouseOver: boolean;
47
52
  protected _isDragging: boolean;
48
53
  protected _isCurrentDragging: boolean;
@@ -67,6 +72,7 @@ declare class TimelineView extends View<TimelineModel> {
67
72
  protected _pauseBtn: ToggleButton;
68
73
  protected _playBtn: ToggleButton;
69
74
  protected _buttons: ButtonGroup;
75
+ protected _localTimeCheckbox: Checkbox;
70
76
  protected _visibility: boolean;
71
77
  constructor(options?: ITimelineViewParams);
72
78
  protected _onResizeObserver(): void;
@@ -75,7 +81,15 @@ declare class TimelineView extends View<TimelineModel> {
75
81
  resize(): void;
76
82
  afterRender(parentNode: HTMLElement): void;
77
83
  render(): this;
84
+ /**
85
+ * True when the timeline scale is read as the local date and time at the viewed location.
86
+ * @public
87
+ * @type {boolean}
88
+ */
89
+ get localTime(): boolean;
90
+ set localTime(localTime: boolean);
78
91
  setVisibility(visibility: boolean): void;
92
+ protected _syncPlayButtons: () => void;
79
93
  reset(): void;
80
94
  play(): void;
81
95
  pause(): void;
@@ -119,6 +133,8 @@ declare class TimelineView extends View<TimelineModel> {
119
133
  protected _clearEvents(): void;
120
134
  remove(): void;
121
135
  protected _clearCanvas(): void;
136
+ protected _applyScaleBackground(): void;
137
+ protected _drawSpans: () => void;
122
138
  protected _drawCurrent(): void;
123
139
  draw(): void;
124
140
  }
@@ -152,6 +152,12 @@ declare class Entity {
152
152
  protected _rootCartesian: Vec3;
153
153
  protected _localPosition: Vec3;
154
154
  protected _absoluteLocalPosition: Vec3;
155
+ /**
156
+ * Absolute cartesian position of the entity itself, i.e. `_rootCartesian + _absoluteLocalPosition`.
157
+ * @protected
158
+ * @type {Vec3}
159
+ */
160
+ protected _absoluteCartesian: Vec3;
155
161
  /**
156
162
  * Geodetic entity coordinates.
157
163
  * @public
@@ -265,6 +271,7 @@ declare class Entity {
265
271
  protected _absoluteScale: Vec3;
266
272
  protected _qFrame: Quat;
267
273
  protected _qRot: Quat;
274
+ protected _directQRot: Quat;
268
275
  _absoluteQRot: Quat;
269
276
  protected _useDirectQuaternion: boolean;
270
277
  protected _opacity: number | null;
@@ -377,6 +384,7 @@ declare class Entity {
377
384
  * @param {Vec3} scale - Scale vector.
378
385
  */
379
386
  setScale3v(scale: Vec3): void;
387
+ protected _propagateGlobalScale(scale: Vec3): void;
380
388
  /**
381
389
  * Sets uniform local scale.
382
390
  * @public
@@ -441,6 +449,14 @@ declare class Entity {
441
449
  * @param {number} val - The new roll angle in radians.
442
450
  */
443
451
  setRoll(val: number): void;
452
+ /**
453
+ * Sets pitch, yaw and roll at once.
454
+ * @public
455
+ * @param {number} pitch - The new pitch angle in radians.
456
+ * @param {number} yaw - The new yaw angle in radians.
457
+ * @param {number} roll - The new roll angle in radians.
458
+ */
459
+ setPitchYawRoll(pitch: number, yaw: number, roll: number): void;
444
460
  /**
445
461
  * Gets the pitch angle of the entity.
446
462
  * @public
@@ -524,8 +540,10 @@ declare class Entity {
524
540
  * @param {number} z - Z coordinate in 3D space.
525
541
  */
526
542
  setCartesian(x: number, y: number, z: number): void;
543
+ protected _propagateGlobalPosition(x: number, y: number, z: number): void;
527
544
  protected _updatePitchYawRoll(): void;
528
545
  _updateAbsolutePosition(): void;
546
+ protected _applyTransformToFeatures(): void;
529
547
  /**
530
548
  * Sets local cartesian position without dispatching events.
531
549
  * @public
@@ -8,6 +8,7 @@ import { GeoObjectHandler } from "./geoObject/GeoObjectHandler";
8
8
  import { LabelHandler } from "./label/LabelHandler";
9
9
  import { Vec3 } from "../math/Vec3";
10
10
  import type { NumberArray3 } from "../math/Vec3";
11
+ import type { NumberArray4 } from "../math/Vec4";
11
12
  import { PointCloudHandler } from "./pointCloud/PointCloudHandler";
12
13
  import { PolylineHandler } from "./polyline/PolylineHandler";
13
14
  import { RayHandler } from "./ray/RayHandler";
@@ -25,7 +26,7 @@ interface IEntityCollectionParams {
25
26
  receiveProjectors?: boolean;
26
27
  receiveShadows?: boolean;
27
28
  receiveFrameTransparency?: boolean;
28
- scaleByDistance?: NumberArray3;
29
+ scaleByDistance?: NumberArray3 | NumberArray4;
29
30
  pickingScale?: number | NumberArray3;
30
31
  opacity?: number;
31
32
  shadeMode?: ShadeModeInput;
@@ -45,10 +46,11 @@ interface IEntityCollectionParams {
45
46
  * @param {boolean} [options.receiveProjectors=true] - Enables/disables projector effect reception for this collection.
46
47
  * @param {boolean} [options.receiveFrameTransparency=false] - Enables/disables frame transparency reception for this collection.
47
48
  * @param {boolean} [options.receiveShadows=true] - Enables/disables shadow map reception for this collection.
48
- * @param {Array.<number>} [options.scaleByDistance] - Entity scale by distance parameters. (exactly 3 entries)
49
- * First index - near distance to the entity, after entity becomes full scale.
50
- * Second index - far distance to the entity, when the entity becomes zero scale.
51
- * Third index - far distance to the entity, when the entity becomes invisible.
49
+ * @param {Array.<number>} [options.scaleByDistance] - Scale by distance parameters:
50
+ * `[near, far, vanish, scale]`. The fourth entry is a plain multiplier and defaults to `1`, so
51
+ * three entries are accepted as well.
52
+ * See {@link EntityCollection#scaleByDistance} for what each entry means.
53
+ * Default is `[MAX32, MAX32, MAX32, 1]` (no distance scaling).
52
54
  * @param {number|Array.<number>} [options.pickingScale] - Picking scale value or xyz scale array.
53
55
  * @param {number} [options.opacity] - Entity global opacity.
54
56
  * @param {number|string} [options.shadeMode=1] - Geo object shading mode: `0|none|unlit`, `0.5|phong`, `1|pbr`.
@@ -167,13 +169,17 @@ declare class EntityCollection {
167
169
  */
168
170
  _entities: Entity[];
169
171
  /**
170
- * First index - near distance to the entity, after entity becomes full scale.
171
- * Second index - far distance to the entity, when entity becomes zero scale.
172
- * Third index - far distance to the entity, when entity becomes invisible.
172
+ * Distance-based scaling for geoObjects, billboards, and labels.
173
+ * [0] near - GeoObjects keep a fixed world size below this distance, then scale to
174
+ * maintain a fixed screen size until `far`. Ignored by billboards and labels.
175
+ * Set `near` to `0` to disable distance-based scaling.
176
+ * [1] far - GeoObjects stop growing here. If `vanish > far`, all types start fading.
177
+ * [2] vanish - Distance where the entity fades to zero. `vanish <= far` disables fading.
178
+ * [3] scale - Optional multiplier for all types. Default is `1`.
173
179
  * @public
174
180
  * @type {Array.<number>}
175
181
  */
176
- scaleByDistance: NumberArray3;
182
+ scaleByDistance: NumberArray4;
177
183
  pickingScale: Float32Array;
178
184
  /**
179
185
  * Global opacity.
@@ -291,11 +297,15 @@ declare class EntityCollection {
291
297
  /**
292
298
  * Sets scale by distance parameters.
293
299
  * @public
294
- * @param {number} near - Full scale entity distance.
295
- * @param {number} far - Zero scale entity distance.
296
- * @param {number} [farInvisible] - Entity visibility distance.
300
+ * @param {number} near - Distance below which a geoObject keeps its world size. Billboards
301
+ * and labels ignore it; pass `0` to disable the world scale ramp.
302
+ * @param {number} far - Distance up to which an entity keeps its size.
303
+ * @param {number} [vanish] - Distance at which the size reaches zero. Defaults to `far`, which
304
+ * means no fading at all: past `far` a billboard or a label keeps its screen size, and a
305
+ * geoObject keeps the world size it reached there.
306
+ * @param {number} [scale] - Plain multiplier applied on top, for every entity type.
297
307
  */
298
- setScaleByDistance(near: number, far: number, farInvisible?: number): void;
308
+ setScaleByDistance(near: number, far: number, vanish?: number, scale?: number): void;
299
309
  setVisibleSphere(p: Vec3, r: number): void;
300
310
  /**
301
311
  * Aligns collection entities to terrain.
@@ -43,6 +43,8 @@ declare class BaseBillboardHandler {
43
43
  protected _pickingColorArr: Float32Array;
44
44
  protected _buffersUpdateCallbacks: Function[];
45
45
  protected _changedBuffers: boolean[];
46
+ protected _changedPositionFrom: number;
47
+ protected _changedPositionTo: number;
46
48
  protected _configureDepthPass(depthWrite: boolean): void;
47
49
  protected _restoreDepthPass(depthWrite: boolean): void;
48
50
  constructor(entityCollection: EntityCollection);
@@ -62,6 +64,14 @@ declare class BaseBillboardHandler {
62
64
  * @param {number} index - Buffer index.
63
65
  */
64
66
  protected _setChangedBuffer(index: number): void;
67
+ /**
68
+ * Marks a half open range of the position arrays as changed, so that the next update uploads
69
+ * only that range instead of the whole buffer.
70
+ * @protected
71
+ * @param {number} from - First changed float index.
72
+ * @param {number} to - Index past the last changed float.
73
+ */
74
+ protected _setChangedPositionRange(from: number, to: number): void;
65
75
  protected _removeBillboards(): void;
66
76
  clear(): void;
67
77
  protected _deleteBuffers(): void;
@@ -32,7 +32,7 @@ declare const ALIGN: Record<string, number>;
32
32
  * @param {number} [options.size] - Font size in pixels.
33
33
  * @param {string} [options.style] - HTML5 font style. Example 'normal', 'italic'.
34
34
  * @param {string} [options.weight] - HTML5 font weight. Example 'normal', 'bold'.
35
- * @param {number} [options.outline] - Text outline size. 0 - no outline, 1 - maximum outline. Default 0.58.
35
+ * @param {number} [options.outline] - Text outline width in pixels. 0 - no outline. Default 0.
36
36
  * @param {Vec4|string|Array.<number>} [options.outlineColor] - Outline color.
37
37
  * @param {string} [options.align] - Text horizontal align: "left", "right" and "center".
38
38
  */
@@ -57,7 +57,7 @@ declare class Label extends BaseBillboard {
57
57
  */
58
58
  protected _size: number;
59
59
  /**
60
- * Label outline.
60
+ * Label outline width in pixels.
61
61
  * @protected
62
62
  * @type {number}
63
63
  */
@@ -156,13 +156,15 @@ declare class Label extends BaseBillboard {
156
156
  */
157
157
  getSize(): number;
158
158
  /**
159
- * Sets text outline border size. Where 0 - is no outline, and 1 - is the maximum outline size.
159
+ * Sets text outline border width in pixels. Where 0 - is no outline.
160
+ * The visible width is capped by the font atlas distance field range,
161
+ * which grows with the label font size.
160
162
  * @public
161
- * @param {number} outline - Text outline size.
163
+ * @param {number} outline - Text outline width in pixels.
162
164
  */
163
165
  setOutline(outline: number): void;
164
166
  /**
165
- * Gets text current outline size.
167
+ * Gets text current outline width in pixels.
166
168
  * @public
167
169
  * @returns {number}
168
170
  */
package/lib/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export * from "./entity/index";
15
15
  export * from "./layer/index";
16
16
  export * from "./Globe";
17
17
  export type { IControlParams } from "./control/Control";
18
- export type { ITouchState } from "./renderer/RendererEvents";
18
+ export type { IMouseState, ITouchState } from "./renderer/RendererEvents";
19
19
  export type { IDeferredShadingPass } from "./renderer/IDeferredShadingPass";
20
20
  export type { ITransparencyPass } from "./renderer/ITransparencyPass";
21
21
  export type { ProjectorSourceType, ProjectorRenderMode, IProjectorParams } from "./renderer/projectors/Projector";
@@ -42,6 +42,7 @@ import { Camera, PlanetCamera } from "./camera/index";
42
42
  import { Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4 } from "./math/index";
43
43
  import { Renderer } from "./renderer/Renderer";
44
44
  import { Clock } from "./Clock";
45
+ import { TimelineModel } from "./control/timeline/TimelineModel";
45
46
  import { Events, type EventsHandler, createEvents } from "./Events";
46
47
  import { Extent } from "./Extent";
47
48
  import { LonLat } from "./LonLat";
@@ -57,4 +58,4 @@ import { MoveAxisEntity } from "./control/entityEditor/MoveAxisEntity";
57
58
  import { Gltf } from "./utils/gltf/gltfParser";
58
59
  import { Easing } from "./utils/easing";
59
60
  import type { EasingFunction } from "./utils/easing";
60
- export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, moon, mars, terrain, layer, ui, webgl, Easing, EasingFunction, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, MapterhornTerrain, rgbToHeightByEncoding, rgbToHeightRgb, rgbToHeightTerrarium, resolveRgbToHeightFunc, BilTerrain, Camera, Ellipsoid, Planet, PlanetCamera, ShaderProgram, Handler, Multisample, Renderer, Clock, Events, EventsHandler, createEvents, Extent, LonLat, Scene, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy, EquiQuadTreeStrategy, EarthQuadTreeStrategy, Wgs84QuadTreeStrategy, Object3d, Gltf, MoveAxisEntity, Loader, IResponse };
61
+ export { bv, jd, math, mercator, utils, input, control, scene, quadTreeStrategyType, wgs84, moon, mars, terrain, layer, ui, webgl, Easing, EasingFunction, Framebuffer, EmptyTerrain, GlobusTerrain, RgbTerrain, GlobusRgbTerrain, MapterhornTerrain, rgbToHeightByEncoding, rgbToHeightRgb, rgbToHeightTerrarium, resolveRgbToHeightFunc, BilTerrain, Camera, Ellipsoid, Planet, PlanetCamera, ShaderProgram, Handler, Multisample, Renderer, Clock, TimelineModel, Events, EventsHandler, createEvents, Extent, LonLat, Scene, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, Geoid, Popup, QuadTreeStrategy, EquiQuadTreeStrategy, EarthQuadTreeStrategy, Wgs84QuadTreeStrategy, Object3d, Gltf, MoveAxisEntity, Loader, IResponse };
@@ -21,7 +21,7 @@ export interface IVectorParams extends IBaseTileMaterialLayerParams {
21
21
  clampToGround?: boolean;
22
22
  async?: boolean;
23
23
  pickingScale?: number | NumberArray3;
24
- scaleByDistance?: NumberArray3;
24
+ scaleByDistance?: NumberArray3 | NumberArray4;
25
25
  labelMaxLetters?: number;
26
26
  shadeMode?: ShadeModeInput;
27
27
  depthOrder?: number;
@@ -54,11 +54,11 @@ export type VectorEventsType = EventsHandler<VectorEventsList> & EventsHandler<L
54
54
  * @param {boolean} [options.fading=false] - Enables layer fade-in/fade-out transition logic.
55
55
  * @param {number} [options.height=0] - Layer height level used for rendering order.
56
56
  * @param {Array.<Entity|IEntityParams>} [options.entities] - Entities array or entity init params.
57
- * @param {Array.<number>} [options.scaleByDistance] - Scale by distance parameters. (exactly 3 entries)
58
- * First index - near distance to the entity, after entity becomes full scale.
59
- * Second index - far distance to the entity, when entity becomes zero scale.
60
- * Third index - far distance to the entity, when entity becomes invisible.
61
- * Default is `[MAX32, MAX32, MAX32]` (no distance scaling).
57
+ * @param {Array.<number>} [options.scaleByDistance] - Scale by distance parameters:
58
+ * `[near, far, vanish, scale]`. The fourth entry is a plain multiplier and defaults to `1`, so
59
+ * three entries are accepted as well.
60
+ * See {@link Vector#scaleByDistance} for what each entry means.
61
+ * Default is `[MAX32, MAX32, MAX32, 1]` (no distance scaling).
62
62
  * @param {number|Array.<number>} [options.pickingScale=[1,1,1]] - Picking scale value or xyz scale array.
63
63
  * @param {number} [options.nodeCapacity=60] - Maximum entities quantity in a quadtree node.
64
64
  * @param {boolean} [options.async=true] - Asynchronous vector data handling before rendering.
@@ -91,13 +91,17 @@ declare class Vector extends BaseTileMaterialLayer {
91
91
  */
92
92
  protected _entities: Entity[];
93
93
  /**
94
- * First index - near distance to the entity, after that entity becomes full scale.
95
- * Second index - far distance to the entity, when entity becomes zero scale.
96
- * Third index - far distance to the entity, when entity becomes invisible.
94
+ * Distance-based scaling for geoObjects, billboards, and labels.
95
+ * [0] near - GeoObjects keep a fixed world size below this distance, then scale to
96
+ * maintain a fixed screen size until `far`. Ignored by billboards and labels.
97
+ * Set `near` to `0` to disable distance-based scaling.
98
+ * [1] far - GeoObjects stop growing here. If `vanish > far`, all types start fading.
99
+ * [2] vanish - Distance where the entity fades to zero. `vanish <= far` disables fading.
100
+ * [3] scale - Optional multiplier for all types. Default is `1`.
97
101
  * @public
98
- * @type {NumberArray3}
102
+ * @type {Array.<number>}
99
103
  */
100
- scaleByDistance: NumberArray3;
104
+ scaleByDistance: NumberArray4;
101
105
  pickingScale: Float32Array;
102
106
  /**
103
107
  * Asynchronous data handling before rendering.
package/lib/math.d.ts CHANGED
@@ -67,6 +67,14 @@ export declare const EPS20 = 1e-20;
67
67
  * //returns 6
68
68
  */
69
69
  export declare function log(n: number, base: number): number;
70
+ /**
71
+ * Smooth Hermite interpolation between 0 and 1, the same as GLSL `smoothstep`.
72
+ * @param {number} edge0 - Lower edge.
73
+ * @param {number} edge1 - Upper edge.
74
+ * @param {number} x - Source value.
75
+ * @returns {number} -
76
+ */
77
+ export declare function smoothstep(edge0: number, edge1: number, x: number): number;
70
78
  /**
71
79
  * Clamp the number.
72
80
  * @function