@openglobus/og 1.0.0-rc2 → 1.0.0-rc21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +2 -0
  2. package/lib/Globe.d.ts +21 -8
  3. package/lib/Object3d.d.ts +1 -1
  4. package/lib/assets/LabelWorker.worker-C24YLEkW.js.map +1 -0
  5. package/lib/assets/PlainSegmentWorker.worker-DJHXd0bF.js.map +1 -0
  6. package/lib/assets/TerrainWorker.worker-BwueoQpg.js.map +1 -0
  7. package/lib/camera/Camera.d.ts +57 -8
  8. package/lib/camera/Frustum.d.ts +37 -1
  9. package/lib/camera/PlanetCamera.d.ts +29 -4
  10. package/lib/control/DebugInfo.d.ts +1 -0
  11. package/lib/control/FramebufferPreview.d.ts +18 -2
  12. package/lib/control/FreeNavigation.d.ts +253 -0
  13. package/lib/control/LayerSwitcher.d.ts +18 -0
  14. package/lib/control/Lighting.d.ts +3 -0
  15. package/lib/control/Navigation.d.ts +18 -1
  16. package/lib/control/ShowFps.d.ts +15 -3
  17. package/lib/control/Sun.d.ts +59 -0
  18. package/lib/control/depthCamera/DepthCamera.d.ts +132 -0
  19. package/lib/control/depthCamera/DepthCameraHandler.d.ts +25 -0
  20. package/lib/control/depthCamera/depth_camera.d.ts +2 -0
  21. package/lib/control/entityEditor/CameraEditorView.d.ts +60 -0
  22. package/lib/control/entityEditor/EntityEditor.d.ts +2 -1
  23. package/lib/control/entityEditor/EntityEditorDialog.d.ts +15 -47
  24. package/lib/control/entityEditor/EntityEditorScene.d.ts +16 -0
  25. package/lib/control/entityEditor/EntityEditorView.d.ts +68 -0
  26. package/lib/control/entityEditor/ProjectorEditorView.d.ts +31 -0
  27. package/lib/control/entityEditor/RotateEntity.d.ts +5 -1
  28. package/lib/control/index.d.ts +3 -3
  29. package/lib/control/timeline/TimelineControl.d.ts +86 -0
  30. package/lib/control/timeline/TimelineModel.d.ts +46 -1
  31. package/lib/control/timeline/TimelineView.d.ts +55 -2
  32. package/lib/entity/Entity.d.ts +18 -0
  33. package/lib/entity/EntityCollection.d.ts +71 -13
  34. package/lib/entity/billboard/BaseBillboardHandler.d.ts +16 -0
  35. package/lib/entity/geoObject/GeoObjectHandler.d.ts +3 -0
  36. package/lib/entity/geoObject/InstanceData.d.ts +6 -0
  37. package/lib/entity/geometry/Geometry.d.ts +18 -0
  38. package/lib/entity/geometry/GeometryHandler.d.ts +1 -0
  39. package/lib/entity/label/Label.d.ts +8 -6
  40. package/lib/entity/pointCloud/PointCloud.d.ts +1 -0
  41. package/lib/entity/pointCloud/PointCloudHandler.d.ts +5 -0
  42. package/lib/entity/polyline/Polyline.d.ts +15 -0
  43. package/lib/entity/polyline/PolylineBatchRenderer.d.ts +1 -0
  44. package/lib/entity/polyline/PolylineHandler.d.ts +5 -0
  45. package/lib/entity/ray/Ray.d.ts +2 -0
  46. package/lib/entity/ray/RayHandler.d.ts +1 -0
  47. package/lib/index.d.ts +20 -3
  48. package/lib/input/KeyboardHandler.d.ts +5 -1
  49. package/lib/layer/BaseTileMaterialLayer.d.ts +36 -0
  50. package/lib/layer/CanvasTiles.d.ts +8 -12
  51. package/lib/layer/Layer.d.ts +8 -1
  52. package/lib/layer/Vector.d.ts +74 -18
  53. package/lib/layer/XYZ.d.ts +5 -21
  54. package/lib/math/Line2.d.ts +9 -0
  55. package/lib/math.d.ts +8 -0
  56. package/lib/og.css +2 -1
  57. package/lib/og.es.js +1 -1
  58. package/lib/og.es.js.map +1 -1
  59. package/lib/quadTree/EntityCollectionsTreeStrategy.d.ts +3 -0
  60. package/lib/quadTree/QuadTreeStrategy.d.ts +18 -1
  61. package/lib/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +3 -0
  62. package/lib/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +3 -0
  63. package/lib/renderer/PhongDeferredShading.d.ts +2 -0
  64. package/lib/renderer/Renderer.d.ts +89 -6
  65. package/lib/renderer/RendererEvents.d.ts +2 -0
  66. package/lib/renderer/cascadeShadows/CascadeShadowManager.d.ts +34 -0
  67. package/lib/renderer/cascadeShadows/CascadeShadowMap.d.ts +110 -0
  68. package/lib/renderer/cascadeShadows/cascade_shadow_depth.d.ts +2 -0
  69. package/lib/renderer/projectors/Projector.d.ts +67 -0
  70. package/lib/renderer/projectors/ProjectorManager.d.ts +86 -0
  71. package/lib/renderer/projectors/ProjectorsPass.d.ts +37 -0
  72. package/lib/renderer/shadows/ShadowManager.d.ts +41 -0
  73. package/lib/renderer/shadows/ShadowMap.d.ts +21 -0
  74. package/lib/renderer/textureUnits.d.ts +6 -0
  75. package/lib/scene/Planet.d.ts +80 -8
  76. package/lib/scene/Scene.d.ts +1 -8
  77. package/lib/scene/SkyBox.d.ts +2 -1
  78. package/lib/segment/Segment.d.ts +18 -1
  79. package/lib/shaders/common/uniforms.d.ts +29 -0
  80. package/lib/shaders/geo_object/geo_object.d.ts +1 -0
  81. package/lib/shaders/projectorsPass/projectorsPass.d.ts +2 -0
  82. package/lib/shaders/tone_mapping/toneMapping.d.ts +1 -1
  83. package/lib/shaders/varianceBlur.d.ts +2 -0
  84. package/lib/terrain/EmptyTerrain.d.ts +43 -2
  85. package/lib/terrain/GlobusRgbTerrain.d.ts +1 -0
  86. package/lib/terrain/MapterhornTerrain.d.ts +11 -0
  87. package/lib/terrain/RgbTerrain.d.ts +11 -0
  88. package/lib/terrain/index.d.ts +6 -2
  89. package/lib/ui/Button.d.ts +1 -0
  90. package/lib/ui/Checkbox.d.ts +1 -0
  91. package/lib/ui/Color.d.ts +6 -2
  92. package/lib/ui/Dialog.d.ts +46 -1
  93. package/lib/ui/Dock.d.ts +151 -0
  94. package/lib/ui/Input.d.ts +14 -1
  95. package/lib/ui/Slider.d.ts +1 -0
  96. package/lib/ui/TitleBarView.d.ts +21 -0
  97. package/lib/ui/index.d.ts +2 -0
  98. package/lib/utils/FontAtlas.d.ts +5 -3
  99. package/lib/utils/GeoImageCreator.d.ts +7 -0
  100. package/lib/utils/Loader.d.ts +6 -0
  101. package/lib/utils/NormalMapCreator.d.ts +6 -0
  102. package/lib/utils/TerrainWorker.d.ts +1 -0
  103. package/lib/utils/VectorTileCreator.d.ts +6 -0
  104. package/lib/utils/cameraFootprint.d.ts +72 -0
  105. package/lib/utils/gltf/types.d.ts +5 -4
  106. package/lib/utils/shadowCameraFit.d.ts +175 -0
  107. package/lib/utils/shared.d.ts +11 -0
  108. package/lib/webgl/BaseFramebuffer.d.ts +28 -0
  109. package/lib/webgl/Framebuffer.d.ts +5 -7
  110. package/lib/webgl/Handler.d.ts +28 -0
  111. package/package.json +11 -9
  112. package/lib/assets/LabelWorker.worker-DYd7xn3M.js.map +0 -1
  113. package/lib/assets/PlainSegmentWorker.worker-JsKldq-e.js.map +0 -1
  114. package/lib/assets/TerrainWorker.worker-CqUJvMOv.js.map +0 -1
  115. package/lib/control/CameraFrameComposer.d.ts +0 -19
  116. package/lib/control/CameraFrameHandler.d.ts +0 -26
  117. package/lib/control/cameraDepthHandler/CameraDepthHandler.d.ts +0 -42
  118. package/lib/control/cameraDepthHandler/camera_depth.d.ts +0 -2
  119. package/lib/tsconfig.tsbuildinfo +0 -1
@@ -2,6 +2,7 @@ import { Button } from "./Button";
2
2
  import { View } from "./View";
3
3
  import type { IViewParams, ViewEventsList } from "./View";
4
4
  import type { EventsHandler } from "../Events";
5
+ import type { DockSide } from "./Dock";
5
6
  export interface IDialogParams extends IViewParams {
6
7
  title?: string;
7
8
  visible?: boolean;
@@ -16,8 +17,39 @@ export interface IDialogParams extends IViewParams {
16
17
  minWidth?: number;
17
18
  maxWidth?: number;
18
19
  useHide?: boolean;
20
+ dock?: DockSide;
21
+ hideToolbar?: boolean;
19
22
  }
20
23
  export type DialogEventsList = ["resize", "focus", "visibility", "dragstart", "dragend"];
24
+ /** Carries the dialog back from its element, the way a Button does. */
25
+ export interface DialogElement extends HTMLElement {
26
+ __og_dialog__?: Dialog<any>;
27
+ }
28
+ /** Preferred side of the anchor element a dialog opens on. */
29
+ export type DialogPlacement = "right" | "below";
30
+ /**
31
+ * Floating dialog window with a draggable header, a resizable body and a close button.
32
+ * Dragged by its header to an edge of its container, the dialog docks to that side when a
33
+ * {@link DockManager} watches the container, and the `dock` option opens it docked at once.
34
+ * @class
35
+ * @extends {View}
36
+ * @param {IDialogParams} [options] - Options:
37
+ * @param {string} [options.title=""] - Header title.
38
+ * @param {boolean} [options.visible=true] - Initial visibility.
39
+ * @param {boolean} [options.resizable=true] - Resize handle flag.
40
+ * @param {number} [options.width=300] - Dialog width in pixels.
41
+ * @param {number} [options.height=200] - Dialog height in pixels. Fits the content when it is not set.
42
+ * @param {number} [options.left=0] - Offset from the left edge of the container in pixels.
43
+ * @param {number} [options.right] - Offset from the right edge of the container in pixels, applied instead of the left one.
44
+ * @param {number} [options.top=0] - Offset from the top edge of the container in pixels.
45
+ * @param {number} [options.minHeight] - Minimal height in pixels.
46
+ * @param {number} [options.maxHeight] - Maximal height in pixels.
47
+ * @param {number} [options.minWidth] - Minimal width in pixels.
48
+ * @param {number} [options.maxWidth] - Maximal width in pixels.
49
+ * @param {boolean} [options.useHide=false] - Hides the dialog on close instead of removing it.
50
+ * @param {DockSide} [options.dock] - Side to open docked to the first time the dialog is shown, if a dock manager is there.
51
+ * @param {boolean} [options.hideToolbar=false] - Hides the bar the dialog is dragged by. Without it the dialog cannot be moved.
52
+ */
21
53
  declare class Dialog<M> extends View<M> {
22
54
  static __zIndex__: number;
23
55
  events: EventsHandler<DialogEventsList> & EventsHandler<ViewEventsList>;
@@ -42,7 +74,11 @@ declare class Dialog<M> extends View<M> {
42
74
  protected _touchDragPointerId: number | null;
43
75
  protected _touchResizePointerId: number | null;
44
76
  protected _titleText: string;
77
+ protected _dock: DockSide | null;
78
+ protected _hideToolbar: boolean;
45
79
  constructor(options?: IDialogParams);
80
+ /** Side this dialog asks to open docked to. */
81
+ get dock(): DockSide | null;
46
82
  setContainer(htmlStr: string): void;
47
83
  get container(): HTMLElement | null;
48
84
  get width(): number;
@@ -55,8 +91,17 @@ declare class Dialog<M> extends View<M> {
55
91
  close(): void;
56
92
  setVisibility(visibility: boolean): void;
57
93
  getVisibility(): boolean;
58
- positionNearElementOnFirstOpen(anchorEl: HTMLElement | null, rootEl?: HTMLElement | null, gap?: number): void;
94
+ /**
95
+ * Places the dialog next to an anchor element, once, on its first open.
96
+ * @param anchorEl - Element to place the dialog against, e.g. the control toggle button.
97
+ * @param rootEl - Container the dialog is kept inside of, the dialog parent by default.
98
+ * @param gap - Distance between the anchor and the dialog in pixels.
99
+ * @param placement - "right" opens the dialog right of the anchor, mirrored to its left when the
100
+ * anchor sits in the right half of the container; "below" opens it underneath the anchor.
101
+ */
102
+ positionNearElementOnFirstOpen(anchorEl: HTMLElement | null, rootEl?: HTMLElement | null, gap?: number, placement?: DialogPlacement): void;
59
103
  protected _initButtons(): void;
104
+ afterRender(parentNode: HTMLElement): void;
60
105
  protected _initEvents(): void;
61
106
  protected _onCloseBtnClick: () => void;
62
107
  protected _onMouseDownAll: () => void;
@@ -0,0 +1,151 @@
1
+ import type { EventsHandler } from "../Events";
2
+ import type { Dialog } from "./Dialog";
3
+ export type DockSide = "top" | "bottom" | "left" | "right" | "center";
4
+ /** How a side lays its dialogs out. */
5
+ export type DockDirection = "row" | "column";
6
+ /** Which third of a side a dialog was dropped on, and so where it goes. */
7
+ export type DockPlacement = "start" | "middle" | "end";
8
+ export interface IDockManagerParams {
9
+ host: HTMLElement;
10
+ /** How close to an edge a dragged dialog has to come before that side offers itself. */
11
+ edgeThreshold?: number;
12
+ /** Size a side takes when nothing better is known. */
13
+ defaultSize?: number;
14
+ }
15
+ type DockEventsList = ["dock", "undock", "layout"];
16
+ interface Rect {
17
+ x: number;
18
+ y: number;
19
+ width: number;
20
+ height: number;
21
+ }
22
+ interface DockZone {
23
+ side: DockSide;
24
+ direction: DockDirection;
25
+ size: number;
26
+ rect: Rect;
27
+ el: HTMLElement;
28
+ items: Dialog<any>[];
29
+ shares: number[];
30
+ }
31
+ /** A draggable edge: the side's own when `after` is null, otherwise a seam inside its stack. */
32
+ interface DockSplitter {
33
+ el: HTMLElement;
34
+ zone: DockZone;
35
+ after: number | null;
36
+ }
37
+ interface FloatingState {
38
+ left: string;
39
+ top: string;
40
+ width: string;
41
+ height: string;
42
+ position: string;
43
+ }
44
+ interface DialogState {
45
+ attached: boolean;
46
+ opened: boolean;
47
+ floating: FloatingState | null;
48
+ }
49
+ /**
50
+ * Docks dialogs to the sides of a host element. Sides claim bands in first-use
51
+ * order, while dialogs on the same side stack and share its length.
52
+ *
53
+ * Draggable edges render in a separate layer, keeping panels flush and preventing
54
+ * clipped seams or thickness-related layout adjustments.
55
+ */
56
+ export declare class DockManager {
57
+ readonly events: EventsHandler<DockEventsList>;
58
+ protected _host: HTMLElement;
59
+ protected _edgeThreshold: number;
60
+ protected _defaultSize: number;
61
+ protected _zones: DockZone[];
62
+ protected _splitters: DockSplitter[];
63
+ protected _splitterLayer: HTMLElement;
64
+ protected _grab: number;
65
+ protected _dialogs: Map<Dialog<any>, DialogState>;
66
+ protected _hint: HTMLElement;
67
+ protected _free: Rect;
68
+ protected _resizeObserver: ResizeObserver;
69
+ protected _domObserver: MutationObserver;
70
+ protected _dragging: Dialog<any> | null;
71
+ protected _drop: {
72
+ side: DockSide;
73
+ placement: DockPlacement;
74
+ } | null;
75
+ protected _pointer: {
76
+ x: number;
77
+ y: number;
78
+ };
79
+ constructor(params: IDockManagerParams);
80
+ /** The rectangle no side has taken, in host coordinates. */
81
+ get freeRect(): Rect;
82
+ getSide(dialog: Dialog<any>): DockSide | null;
83
+ isDocked(dialog: Dialog<any>): boolean;
84
+ attach(dialog: Dialog<any>): void;
85
+ detach(dialog: Dialog<any>): void;
86
+ protected _state(dialog: Dialog<any>): DialogState;
87
+ dock(dialog: Dialog<any>, side: DockSide, placement?: DockPlacement): void;
88
+ undock(dialog: Dialog<any>): void;
89
+ /** Recomputes every side from the host rectangle, taking a band off it in dock order. */
90
+ layout(): void;
91
+ destroy(): void;
92
+ /** What a side opens at for this dialog: its width standing on end, or its height. */
93
+ protected _dockSize(dialog: Dialog<any> | null, side: DockSide): number;
94
+ protected _applyZoneRect(zone: DockZone, rect: Rect): void;
95
+ /** The band a side takes off a rectangle, and what the sides after it will see. */
96
+ protected _band(rect: Rect, side: DockSide, size: number): {
97
+ zone: Rect;
98
+ rest: Rect;
99
+ size: number;
100
+ };
101
+ /**
102
+ * Returns a newcomer's stack share: the existing average, normalized to 1 / (count + 1).
103
+ */
104
+ protected _slot(rect: Rect, direction: DockDirection, atStart: boolean, count: number): Rect;
105
+ protected _attachElement(node: Node): void;
106
+ protected _onMutations: (records: MutationRecord[]) => void;
107
+ /**
108
+ * A dialog can ask to open docked, and it takes its side as soon as it turns up - a
109
+ * dialog created hidden would otherwise let a later one claim the corner first. A side
110
+ * with nothing shown in it costs no room until something is.
111
+ */
112
+ protected _openDocked(dialog: Dialog<any>): void;
113
+ protected _onDialogVisibility: (visible: boolean, dialog: Dialog<any>) => void;
114
+ protected _getZone(side: DockSide): DockZone;
115
+ protected _removeZone(zone: DockZone): void;
116
+ protected _averageShare(zone: DockZone): number;
117
+ protected _normalize(zone: DockZone): void;
118
+ protected _shares(zone: DockZone): {
119
+ visible: number[];
120
+ total: number;
121
+ };
122
+ protected _visibleItems(zone: DockZone): number[];
123
+ protected _refresh(zone: DockZone): void;
124
+ protected _renderZone(zone: DockZone): void;
125
+ protected _rebuildSplitters(): void;
126
+ protected _createSplitter(zone: DockZone, after: number | null): HTMLElement;
127
+ protected _positionSplitters(): void;
128
+ protected _itemOffset(zone: DockZone, item: number): number;
129
+ protected _onSplitterDown: (event: PointerEvent, zone: DockZone, after: number | null) => void;
130
+ protected _zoneResizer(zone: DockZone, start: PointerEvent): (event: PointerEvent) => void;
131
+ protected _stackResizer(zone: DockZone, after: number, start: PointerEvent): (event: PointerEvent) => void;
132
+ protected _remember(dialog: Dialog<any>): void;
133
+ protected _restore(dialog: Dialog<any>): void;
134
+ protected _onPointerDown: (event: PointerEvent) => void;
135
+ protected _onDragStart: (dialog: Dialog<any>) => void;
136
+ protected _onDragMove: (event: MouseEvent | PointerEvent) => void;
137
+ protected _onDragEnd: (dialog: Dialog<any>) => void;
138
+ protected _shownZone(side: DockSide): DockZone | null;
139
+ protected _sideAt(clientX: number, clientY: number, host: DOMRect): DockSide | null;
140
+ /** The band a side would occupy, whether it is in use yet or not. */
141
+ protected _sideRect(side: DockSide): Rect;
142
+ protected _dropAt(clientX: number, clientY: number): {
143
+ side: DockSide;
144
+ placement: DockPlacement;
145
+ } | null;
146
+ protected _showHint(drop: {
147
+ side: DockSide;
148
+ placement: DockPlacement;
149
+ } | null): void;
150
+ }
151
+ export {};
package/lib/ui/Input.d.ts CHANGED
@@ -25,13 +25,26 @@ declare class Input extends View<null> {
25
25
  render(params: any): this;
26
26
  protected _onResize: () => void;
27
27
  set value(val: string | number);
28
- protected _setValue(val: string | number): void;
28
+ protected _setCommittedValue(value: string, forceSync?: boolean): void;
29
29
  get value(): string;
30
+ protected _formatValue(val: string | number): string;
31
+ protected _formatNumber(val: number): string;
32
+ protected _getMaxFixed(): number;
33
+ protected _clampNumber(value: number): number;
34
+ protected _parseNumber(value: string): number | null;
35
+ protected _normalizeUserValue(value: string): string | null;
36
+ protected _syncInputValue(): void;
37
+ afterRender(parentNode: HTMLElement): void;
30
38
  protected _initEvents(): void;
31
39
  protected _clearEvents(): void;
32
40
  protected _onMouseWheel: (e: WheelEvent) => void;
33
41
  protected _onMouseWheelFF: (e: WheelEvent) => void;
34
42
  protected _onInput: (e: Event) => void;
43
+ protected _onChange: (e: Event) => void;
44
+ protected _onKeyDown: (e: KeyboardEvent) => void;
45
+ protected _onBlur: () => void;
46
+ protected _commitUserInput(): void;
47
+ protected _stepValue(direction: number): void;
35
48
  remove(): void;
36
49
  set visibility(visibility: boolean);
37
50
  }
@@ -28,6 +28,7 @@ declare class Slider extends View<null> {
28
28
  protected _syncUiFromValue(): void;
29
29
  set value(val: number);
30
30
  get value(): number;
31
+ afterRender(parentNode: HTMLElement): void;
31
32
  protected _initEvents(): void;
32
33
  protected _clearEvents(): void;
33
34
  protected _onMouseWheel: (e: WheelEvent) => void;
@@ -0,0 +1,21 @@
1
+ import type { EventsHandler } from "../Events";
2
+ import { View, type IViewParams, type ViewEventsList } from "./View";
3
+ interface ITitleBarViewParams extends IViewParams {
4
+ title: string;
5
+ isCollapsed?: boolean;
6
+ }
7
+ type TitleBarViewEventsList = ["change"];
8
+ export declare class TitleBarView extends View<null> {
9
+ events: EventsHandler<TitleBarViewEventsList> & EventsHandler<ViewEventsList>;
10
+ protected _title: string;
11
+ protected _isCollapsed: boolean;
12
+ protected _toggleBtn: HTMLButtonElement | null;
13
+ constructor(params: ITitleBarViewParams);
14
+ get isCollapsed(): boolean;
15
+ setCollapsed(isCollapsed: boolean, stopPropagation?: boolean): void;
16
+ render(params?: unknown): this;
17
+ remove(): void;
18
+ protected _syncToggleButton(): void;
19
+ protected _onToggleClick: (e: MouseEvent) => void;
20
+ }
21
+ export {};
package/lib/ui/index.d.ts CHANGED
@@ -3,7 +3,9 @@ export * from "./ButtonGroup";
3
3
  export * from "./Checkbox";
4
4
  export * from "./Color";
5
5
  export * from "./Dialog";
6
+ export * from "./Dock";
6
7
  export * from "./Input";
7
8
  export * from "./Slider";
8
9
  export * from "./ToggleButton";
10
+ export * from "./TitleBarView";
9
11
  export * from "./View";
@@ -1,6 +1,6 @@
1
1
  import { Deferred } from "../Deferred";
2
2
  import { Rectangle } from "../Rectangle";
3
- import { TextureAtlas, TextureAtlasNode } from "./TextureAtlas";
3
+ import { TextureAtlasNode } from "./TextureAtlas";
4
4
  import type { WebGLTextureExt } from "../webgl/Handler";
5
5
  import { Handler } from "../webgl/Handler";
6
6
  import type { HTMLImageElementExt } from "./ImagesCacheManager";
@@ -77,16 +77,18 @@ export interface IMSDFAtlasParams {
77
77
  glyphs: IMSDFGlyph[];
78
78
  kerning: IMSDFKerning[];
79
79
  }
80
- declare class FontTextureAtlas extends TextureAtlas {
80
+ declare class FontTextureAtlas {
81
81
  width: number;
82
82
  height: number;
83
83
  gliphSize: number;
84
84
  distanceRange: number;
85
85
  isMtsdf: boolean;
86
+ sourceImage: HTMLImageElementExt | null;
86
87
  nodes: Map<number, FontTextureAtlasNode>;
87
88
  kernings: Record<number, Record<number, number>>;
88
- constructor(width?: number, height?: number);
89
+ constructor();
89
90
  get(key: number): FontTextureAtlasNode | undefined;
91
+ createTexture(img?: HTMLImageElementExt | null): void;
90
92
  }
91
93
  interface IMetrics extends IChar {
92
94
  nChar: string;
@@ -26,6 +26,13 @@ export declare class GeoImageCreator {
26
26
  * @return{WebGLBuffer} Grid coordinates buffer.
27
27
  */
28
28
  createGridBuffer(c: LonLat[], toMerc?: boolean): [WebGLBufferExt, WebGLBufferExt];
29
+ /**
30
+ * Returns true when there is nothing left to rasterize and no animated
31
+ * geo images(i.e. GeoVideo) are being played.
32
+ * @public
33
+ * @returns {boolean}
34
+ */
35
+ get isIdle(): boolean;
29
36
  frame(): void;
30
37
  add(geoImage: BaseGeoImage): void;
31
38
  remove(geoImage: BaseGeoImage): void;
@@ -61,6 +61,12 @@ export declare class Loader<T extends Obj<T>> {
61
61
  abort(sender: T): void;
62
62
  abortAll(): void;
63
63
  get loading(): number;
64
+ /**
65
+ * Returns true when there is nothing being loaded and nothing left in the queue.
66
+ * @public
67
+ * @returns {boolean}
68
+ */
69
+ get isFree(): boolean;
64
70
  get queue(): QueueData<T>[];
65
71
  }
66
72
  export {};
@@ -33,6 +33,12 @@ export declare class NormalMapCreator {
33
33
  protected _drawNormalMapNoBlur(segment: Segment): boolean;
34
34
  protected _drawNormalMap(segment: Segment): boolean;
35
35
  drawSingle(segment: Segment): void;
36
+ /**
37
+ * Returns true when there is nothing left to rasterize.
38
+ * @public
39
+ * @returns {boolean}
40
+ */
41
+ get isIdle(): boolean;
36
42
  frame(): void;
37
43
  get queueSize(): number;
38
44
  queue(segment: Segment): void;
@@ -15,6 +15,7 @@ export interface ITerrainWorkerData {
15
15
  terrainVerticesLow: Float32Array | null;
16
16
  noDataVertices: Uint8Array | null;
17
17
  bounds: NumberArray6;
18
+ radiusRange: number[] | null;
18
19
  relativeCenter: NumberArray3;
19
20
  }
20
21
  type MessageEventExt = MessageEvent & {
@@ -11,6 +11,12 @@ export declare class VectorTileCreator {
11
11
  protected _handler: Handler | null;
12
12
  constructor(planet: Planet, width?: number, height?: number);
13
13
  init(): void;
14
+ /**
15
+ * Returns true when there is nothing left to rasterize.
16
+ * @public
17
+ * @returns {boolean}
18
+ */
19
+ get isIdle(): boolean;
14
20
  frame(): void;
15
21
  add(material: Material): void;
16
22
  remove(material: Material): void;
@@ -0,0 +1,72 @@
1
+ import { Ellipsoid } from "../ellipsoid/Ellipsoid";
2
+ import type { PlanetCamera } from "../camera/PlanetCamera";
3
+ import { Vec3 } from "../math/Vec3";
4
+ /**
5
+ * Points under the screen corners, as [leftTop, rightTop, leftBottom, rightBottom].
6
+ */
7
+ export type CameraFootprintCorners = [Vec3 | undefined, Vec3 | undefined, Vec3 | undefined, Vec3 | undefined];
8
+ export interface ICameraFootprintParams {
9
+ screenMargin?: number;
10
+ terrainHeightStep?: number;
11
+ drop?: number;
12
+ }
13
+ /**
14
+ * Reference surface points under the four screen corners, as [leftTop, rightTop, leftBottom, rightBottom].
15
+ *
16
+ * @param {PlanetCamera} camera - Camera to take the footprint of.
17
+ * @param {number} [screenMargin=100] - Border of the screen, in screen pixels, the corners are sampled inside of.
18
+ * @param {Ellipsoid} [ellipsoid] - Reference surface, the planet ellipsoid by default. See CameraFootprint
19
+ * for one raised to the terrain under the camera.
20
+ */
21
+ export declare function getCameraFootprint(camera: PlanetCamera, screenMargin?: number, ellipsoid?: Ellipsoid): CameraFootprintCorners;
22
+ /**
23
+ * The ground area a camera sees: the four screen corners cast onto a reference surface and dropped onto the
24
+ * rendered terrain, plus the center, surface normals and radius derived from them.
25
+ *
26
+ * The reference surface is the planet ellipsoid raised to the terrain right under the camera, so that a
27
+ * camera on a mountain does not measure its footprint against sea level. Only the height under the camera
28
+ * is used, which keeps the footprint independent of how far the surrounding tiles have loaded.
29
+ */
30
+ export declare class CameraFootprint {
31
+ /** Border of the screen, in screen pixels, the corners are sampled inside of. */
32
+ screenMargin: number;
33
+ /**
34
+ * Terrain height under the camera is quantized to this step, in world units, before the reference
35
+ * ellipsoid is rebuilt, so that the footprint does not jitter while flying over rough terrain.
36
+ */
37
+ terrainHeightStep: number;
38
+ /** Lowers the reference ellipsoid by this many world units. */
39
+ drop: number;
40
+ /** Camera the current footprint was taken of. */
41
+ camera: PlanetCamera | null;
42
+ /** Reference surface, the planet ellipsoid raised to the terrain under the camera. */
43
+ ellipsoid: Ellipsoid | null;
44
+ /** Height the reference ellipsoid is raised by, in world units. */
45
+ ellipsoidHeight: number;
46
+ /** Whether the last update found all four corners. */
47
+ isValid: boolean;
48
+ /** Reference surface corners in screen order, as [leftTop, rightTop, leftBottom, rightBottom]. */
49
+ corners: CameraFootprintCorners;
50
+ /** Reference surface corners in contour order. */
51
+ surfacePoints: Vec3[];
52
+ /** Corners dropped onto the rendered terrain, in contour order. */
53
+ points: Vec3[];
54
+ /** Reference surface normals under the ground points. */
55
+ normals: Vec3[];
56
+ center: Vec3;
57
+ /** Distance from the center to the farthest ground point. */
58
+ radius: number;
59
+ constructor(params?: ICameraFootprintParams);
60
+ /**
61
+ * Takes the footprint of the camera.
62
+ *
63
+ * @param {PlanetCamera} camera - Camera to take the footprint of.
64
+ * @returns {boolean} - False when the screen misses the planet, which leaves the previous points in place.
65
+ */
66
+ update(camera: PlanetCamera): boolean;
67
+ /**
68
+ * Level the reference ellipsoid is raised to: the terrain right under the camera, and nothing else.
69
+ */
70
+ protected _getTerrainHeight(camera: PlanetCamera): number;
71
+ protected _updateEllipsoid(camera: PlanetCamera): void;
72
+ }
@@ -1,4 +1,5 @@
1
1
  import { Object3d } from "../../Object3d";
2
+ import type { TypedArray } from "../shared";
2
3
  export interface GltfData {
3
4
  bin: ArrayBuffer[];
4
5
  gltf: GltfMetadata;
@@ -156,10 +157,10 @@ export interface Mesh {
156
157
  }
157
158
  export interface Primitive {
158
159
  name: string;
159
- indices?: ArrayBufferLike;
160
- vertices: ArrayBufferLike;
161
- normals?: ArrayBufferLike;
162
- texCoords?: ArrayBufferLike;
160
+ indices?: TypedArray;
161
+ vertices: TypedArray;
162
+ normals?: TypedArray;
163
+ texCoords?: TypedArray;
163
164
  material?: Material;
164
165
  mode: PrimitiveMode;
165
166
  object3d?: Object3d;
@@ -0,0 +1,175 @@
1
+ import type { DepthCamera } from "../control/depthCamera/DepthCamera";
2
+ import type { Planet } from "../scene/Planet";
3
+ import type { CameraFootprint } from "./cameraFootprint";
4
+ import { Vec3 } from "../math/Vec3";
5
+ export interface ILightSpaceBounds {
6
+ minX: number;
7
+ maxX: number;
8
+ minY: number;
9
+ maxY: number;
10
+ minZ: number;
11
+ maxZ: number;
12
+ }
13
+ export interface IOrthoBounds {
14
+ left: number;
15
+ right: number;
16
+ bottom: number;
17
+ top: number;
18
+ }
19
+ interface ITerrainRelief {
20
+ up: number;
21
+ down: number;
22
+ depthUp: number;
23
+ depthDown: number;
24
+ cornerSpread: number;
25
+ }
26
+ export interface IShadowCameraFitParams {
27
+ /**
28
+ * Adds proportional padding to each side of the fitted bounds.
29
+ * 0.01 adds 1% per side. This keeps curved ground between the four
30
+ * sampled screen corners inside the shadow map.
31
+ */
32
+ orthoMarginFactor?: number;
33
+ /**
34
+ * Extends caster coverage toward the Sun:
35
+ * max(casterClearance, casterHeight * casterClearanceFactor)
36
+ */
37
+ casterClearance?: number;
38
+ casterClearanceFactor?: number;
39
+ /**
40
+ * Minimum view-ray slope used when adjusting the footprint for terrain relief.
41
+ * 0.1 limits sideways movement to 10 metres per metre of relief.
42
+ * This prevents near-horizontal rays from greatly expanding the shadow map.
43
+ */
44
+ minFootprintRaySlope?: number;
45
+ /**
46
+ * Limits sideways footprint expansion caused by terrain below the reference level.
47
+ * 0.5 allows expansion up to half the footprint radius.
48
+ * Higher values improve downhill coverage but reduce shadow resolution.
49
+ */
50
+ reliefLateralFactor?: number;
51
+ /** Upper limits on the terrain relief the fit takes from the quad tree, in world units. */
52
+ maxReliefUp?: number;
53
+ maxReliefDown?: number;
54
+ /**
55
+ * Aligns the fitted bounds to a texel grid fixed in the world, so that shadow edges stop crawling while
56
+ * the camera moves. See _snapOrthographicBounds.
57
+ */
58
+ snapToTexelGrid?: boolean;
59
+ /**
60
+ * How the shadow rectangle is turned around the sun direction: along the local horizon under the
61
+ * footprint, or along the world axes. The camera aims at the sun either way, only the roll changes.
62
+ * Horizon aligned wastes less of the map, but then the rectangle turns as the camera moves and its
63
+ * texel grid stops holding still. See getStableLightUp.
64
+ */
65
+ horizonAlignedLightUp?: boolean;
66
+ /**
67
+ * Pads each side of the shadow map by the distance the camera travels in one frame, times this number.
68
+ *
69
+ * The fit always runs a frame behind the view, so while flying fast the ground right in front of the
70
+ * camera can fall outside the map and lose its shadow - this is what covers it. In exchange the map size
71
+ * follows the camera speed and the shadow edges start crawling, so it is off by default.
72
+ */
73
+ motionMarginFrames?: number;
74
+ /**
75
+ * Shadow depth bias, counted in shadow map texels so that it follows its resolution, plus a flat
76
+ * offset in metres:
77
+ *
78
+ * depthBiasWorld = texelWorldSize * depthBiasTexels + depthBiasOffset
79
+ *
80
+ * Too little and surfaces shadow themselves, too much and the shadow comes away from the foot of its
81
+ * caster by depthBiasWorld * cos(sunElevation). The shader adds a slope term of its own, also
82
+ * counted in texels, see SHADOW_MAP_SLOPE_DEPTH_BIAS.
83
+ */
84
+ depthBiasTexels?: number;
85
+ depthBiasOffset?: number;
86
+ /**
87
+ * Renders the depth pass from the depth camera's own quad tree traversal rather than from the planet's.
88
+ * The planet's one covers only the near band of the view and drops tiles while they fade. Above a main
89
+ * camera height of about 136 km DepthCamera takes the planet's traversal whatever this says.
90
+ */
91
+ pinOwnQuadTreeTraversal?: boolean;
92
+ }
93
+ /** Last fit measurements, for readouts and debugging. */
94
+ export interface IShadowCameraFitStats {
95
+ /** Shadow texel size in world units, the way ShadowManager measures it. */
96
+ texelWorldSize: number;
97
+ footprintRadius: number;
98
+ /** Spread of the footprint ground points in geocentric radius. */
99
+ cornerHeightSpread: number;
100
+ /** Terrain relief above and below the footprint corners, as the main camera traversal reports it. */
101
+ reliefUp: number;
102
+ reliefDown: number;
103
+ /** The same, with the depth camera traversal taken into account. Only the down side is used, by the far plane. */
104
+ depthReliefUp: number;
105
+ depthReliefDown: number;
106
+ casterHeight: number;
107
+ /** Main camera displacement since the previous fit, in world units. */
108
+ cameraStep: number;
109
+ orthoWidth: number;
110
+ orthoHeight: number;
111
+ orthoBounds: IOrthoBounds;
112
+ near: number;
113
+ far: number;
114
+ }
115
+ /**
116
+ * Places and sizes an orthographic depth camera over a camera footprint, so that the shadow map covers the
117
+ * ground the main camera sees, and everything that casts onto it, at the tightest texel the footprint allows.
118
+ *
119
+ * The fit holds state between frames - the texel grid step and the camera displacement - so one instance
120
+ * belongs to one depth camera.
121
+ */
122
+ export declare class ShadowCameraFit {
123
+ orthoMarginFactor: number;
124
+ casterClearance: number;
125
+ casterClearanceFactor: number;
126
+ minFootprintRaySlope: number;
127
+ reliefLateralFactor: number;
128
+ maxReliefUp: number;
129
+ maxReliefDown: number;
130
+ snapToTexelGrid: boolean;
131
+ horizonAlignedLightUp: boolean;
132
+ motionMarginFrames: number;
133
+ depthBiasTexels: number;
134
+ depthBiasOffset: number;
135
+ pinOwnQuadTreeTraversal: boolean;
136
+ readonly stats: IShadowCameraFitStats;
137
+ protected _lastCameraEye: Vec3;
138
+ protected _cameraStep: number;
139
+ protected _orthoTexelSizeX: number;
140
+ protected _orthoTexelSizeY: number;
141
+ constructor(params?: IShadowCameraFitParams);
142
+ /** Drops the state carried between frames, for a camera that has been teleported. */
143
+ reset(): void;
144
+ /**
145
+ * Places the depth camera over the footprint and sets its orthographic projection and depth biases.
146
+ *
147
+ * @param {DepthCamera} depthCamera - Orthographic depth camera to fit.
148
+ * @param {CameraFootprint} footprint - Ground area to cover, taken of the main camera this frame.
149
+ * @param {Vec3} sunPos - Sun position.
150
+ * @returns {boolean} - False when the footprint is incomplete or gives no usable bounds.
151
+ */
152
+ fit(depthCamera: DepthCamera, footprint: CameraFootprint, sunPos: Vec3): boolean;
153
+ /** Returns how much higher and how much lower the terrain goes than the four footprint corners. */
154
+ protected _getTerrainRelief(depthCamera: DepthCamera, footprint: CameraFootprint): ITerrainRelief;
155
+ /**
156
+ * Returns the points the bounds are fitted to: the four footprint corners, plus the relief they hide,
157
+ * reached by walking each corner along its own view ray. Along the ray, because that is where the hidden
158
+ * terrain lies - pushing the corners sideways instead would widen the bounds for relief that is only ever
159
+ * an estimate.
160
+ */
161
+ protected _getReceiverBoundsPoints(footprint: CameraFootprint, relief: ITerrainRelief): Vec3[];
162
+ /**
163
+ * Returns the caster height, rounded to a coarse step. It decides where the shadow camera stands, and a
164
+ * camera that jumps every time the terrain range is revised makes the whole map blink.
165
+ */
166
+ protected _getCasterHeight(planet: Planet, footprintRadius: number, terrainRelief: number): number;
167
+ protected _expandOrthographicBounds(bounds: ILightSpaceBounds, textureWidth: number, textureHeight: number): IOrthoBounds;
168
+ /**
169
+ * Returns the texel size to fit the extent onto, keeping the previous one while it is still large enough.
170
+ */
171
+ protected _quantizeOrthoTexelSize(extent: number, resolution: number, prevTexelSize: number): number;
172
+ protected _snapOrthographicBounds(bounds: IOrthoBounds, right: Vec3, up: Vec3, anchor: Vec3, resolutionX: number, resolutionY: number): IOrthoBounds;
173
+ protected _updateDepthBiases(depthCamera: DepthCamera, orthoBounds: IOrthoBounds, textureWidth: number): void;
174
+ }
175
+ export {};