@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.
- package/README.md +2 -0
- package/lib/Globe.d.ts +21 -8
- package/lib/Object3d.d.ts +1 -1
- package/lib/assets/LabelWorker.worker-C24YLEkW.js.map +1 -0
- package/lib/assets/PlainSegmentWorker.worker-DJHXd0bF.js.map +1 -0
- package/lib/assets/TerrainWorker.worker-BwueoQpg.js.map +1 -0
- package/lib/camera/Camera.d.ts +57 -8
- package/lib/camera/Frustum.d.ts +37 -1
- package/lib/camera/PlanetCamera.d.ts +29 -4
- package/lib/control/DebugInfo.d.ts +1 -0
- package/lib/control/FramebufferPreview.d.ts +18 -2
- package/lib/control/FreeNavigation.d.ts +253 -0
- package/lib/control/LayerSwitcher.d.ts +18 -0
- package/lib/control/Lighting.d.ts +3 -0
- package/lib/control/Navigation.d.ts +18 -1
- package/lib/control/ShowFps.d.ts +15 -3
- package/lib/control/Sun.d.ts +59 -0
- package/lib/control/depthCamera/DepthCamera.d.ts +132 -0
- package/lib/control/depthCamera/DepthCameraHandler.d.ts +25 -0
- package/lib/control/depthCamera/depth_camera.d.ts +2 -0
- package/lib/control/entityEditor/CameraEditorView.d.ts +60 -0
- package/lib/control/entityEditor/EntityEditor.d.ts +2 -1
- package/lib/control/entityEditor/EntityEditorDialog.d.ts +15 -47
- package/lib/control/entityEditor/EntityEditorScene.d.ts +16 -0
- package/lib/control/entityEditor/EntityEditorView.d.ts +68 -0
- package/lib/control/entityEditor/ProjectorEditorView.d.ts +31 -0
- package/lib/control/entityEditor/RotateEntity.d.ts +5 -1
- package/lib/control/index.d.ts +3 -3
- package/lib/control/timeline/TimelineControl.d.ts +86 -0
- package/lib/control/timeline/TimelineModel.d.ts +46 -1
- package/lib/control/timeline/TimelineView.d.ts +55 -2
- package/lib/entity/Entity.d.ts +18 -0
- package/lib/entity/EntityCollection.d.ts +71 -13
- package/lib/entity/billboard/BaseBillboardHandler.d.ts +16 -0
- package/lib/entity/geoObject/GeoObjectHandler.d.ts +3 -0
- package/lib/entity/geoObject/InstanceData.d.ts +6 -0
- package/lib/entity/geometry/Geometry.d.ts +18 -0
- package/lib/entity/geometry/GeometryHandler.d.ts +1 -0
- package/lib/entity/label/Label.d.ts +8 -6
- package/lib/entity/pointCloud/PointCloud.d.ts +1 -0
- package/lib/entity/pointCloud/PointCloudHandler.d.ts +5 -0
- package/lib/entity/polyline/Polyline.d.ts +15 -0
- package/lib/entity/polyline/PolylineBatchRenderer.d.ts +1 -0
- package/lib/entity/polyline/PolylineHandler.d.ts +5 -0
- package/lib/entity/ray/Ray.d.ts +2 -0
- package/lib/entity/ray/RayHandler.d.ts +1 -0
- package/lib/index.d.ts +20 -3
- package/lib/input/KeyboardHandler.d.ts +5 -1
- package/lib/layer/BaseTileMaterialLayer.d.ts +36 -0
- package/lib/layer/CanvasTiles.d.ts +8 -12
- package/lib/layer/Layer.d.ts +8 -1
- package/lib/layer/Vector.d.ts +74 -18
- package/lib/layer/XYZ.d.ts +5 -21
- package/lib/math/Line2.d.ts +9 -0
- package/lib/math.d.ts +8 -0
- package/lib/og.css +2 -1
- package/lib/og.es.js +1 -1
- package/lib/og.es.js.map +1 -1
- package/lib/quadTree/EntityCollectionsTreeStrategy.d.ts +3 -0
- package/lib/quadTree/QuadTreeStrategy.d.ts +18 -1
- package/lib/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +3 -0
- package/lib/quadTree/equi/EquiEntityCollectionsTreeStrategy.d.ts +3 -0
- package/lib/renderer/PhongDeferredShading.d.ts +2 -0
- package/lib/renderer/Renderer.d.ts +89 -6
- package/lib/renderer/RendererEvents.d.ts +2 -0
- package/lib/renderer/cascadeShadows/CascadeShadowManager.d.ts +34 -0
- package/lib/renderer/cascadeShadows/CascadeShadowMap.d.ts +110 -0
- package/lib/renderer/cascadeShadows/cascade_shadow_depth.d.ts +2 -0
- package/lib/renderer/projectors/Projector.d.ts +67 -0
- package/lib/renderer/projectors/ProjectorManager.d.ts +86 -0
- package/lib/renderer/projectors/ProjectorsPass.d.ts +37 -0
- package/lib/renderer/shadows/ShadowManager.d.ts +41 -0
- package/lib/renderer/shadows/ShadowMap.d.ts +21 -0
- package/lib/renderer/textureUnits.d.ts +6 -0
- package/lib/scene/Planet.d.ts +80 -8
- package/lib/scene/Scene.d.ts +1 -8
- package/lib/scene/SkyBox.d.ts +2 -1
- package/lib/segment/Segment.d.ts +18 -1
- package/lib/shaders/common/uniforms.d.ts +29 -0
- package/lib/shaders/geo_object/geo_object.d.ts +1 -0
- package/lib/shaders/projectorsPass/projectorsPass.d.ts +2 -0
- package/lib/shaders/tone_mapping/toneMapping.d.ts +1 -1
- package/lib/shaders/varianceBlur.d.ts +2 -0
- package/lib/terrain/EmptyTerrain.d.ts +43 -2
- package/lib/terrain/GlobusRgbTerrain.d.ts +1 -0
- package/lib/terrain/MapterhornTerrain.d.ts +11 -0
- package/lib/terrain/RgbTerrain.d.ts +11 -0
- package/lib/terrain/index.d.ts +6 -2
- package/lib/ui/Button.d.ts +1 -0
- package/lib/ui/Checkbox.d.ts +1 -0
- package/lib/ui/Color.d.ts +6 -2
- package/lib/ui/Dialog.d.ts +46 -1
- package/lib/ui/Dock.d.ts +151 -0
- package/lib/ui/Input.d.ts +14 -1
- package/lib/ui/Slider.d.ts +1 -0
- package/lib/ui/TitleBarView.d.ts +21 -0
- package/lib/ui/index.d.ts +2 -0
- package/lib/utils/FontAtlas.d.ts +5 -3
- package/lib/utils/GeoImageCreator.d.ts +7 -0
- package/lib/utils/Loader.d.ts +6 -0
- package/lib/utils/NormalMapCreator.d.ts +6 -0
- package/lib/utils/TerrainWorker.d.ts +1 -0
- package/lib/utils/VectorTileCreator.d.ts +6 -0
- package/lib/utils/cameraFootprint.d.ts +72 -0
- package/lib/utils/gltf/types.d.ts +5 -4
- package/lib/utils/shadowCameraFit.d.ts +175 -0
- package/lib/utils/shared.d.ts +11 -0
- package/lib/webgl/BaseFramebuffer.d.ts +28 -0
- package/lib/webgl/Framebuffer.d.ts +5 -7
- package/lib/webgl/Handler.d.ts +28 -0
- package/package.json +11 -9
- package/lib/assets/LabelWorker.worker-DYd7xn3M.js.map +0 -1
- package/lib/assets/PlainSegmentWorker.worker-JsKldq-e.js.map +0 -1
- package/lib/assets/TerrainWorker.worker-CqUJvMOv.js.map +0 -1
- package/lib/control/CameraFrameComposer.d.ts +0 -19
- package/lib/control/CameraFrameHandler.d.ts +0 -26
- package/lib/control/cameraDepthHandler/CameraDepthHandler.d.ts +0 -42
- package/lib/control/cameraDepthHandler/camera_depth.d.ts +0 -2
- package/lib/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { IControlParams } from "./Control";
|
|
2
|
+
import { Control } from "./Control";
|
|
3
|
+
import type { IMouseState } from "../renderer/RendererEvents";
|
|
4
|
+
import { Navigation } from "./Navigation";
|
|
5
|
+
import type { Vec2 } from "../math/Vec2";
|
|
6
|
+
import { Vec3 } from "../math/Vec3";
|
|
7
|
+
import { type EventsHandler } from "../Events";
|
|
8
|
+
export interface IFreeNavigationParams extends IControlParams {
|
|
9
|
+
speed?: number;
|
|
10
|
+
minSpeed?: number;
|
|
11
|
+
maxSpeed?: number;
|
|
12
|
+
speedStep?: number;
|
|
13
|
+
speedFactor?: number;
|
|
14
|
+
lookSensitivity?: number;
|
|
15
|
+
rollSpeed?: number;
|
|
16
|
+
accelerationTime?: number;
|
|
17
|
+
decelerationTime?: number;
|
|
18
|
+
pitchLimit?: number;
|
|
19
|
+
invertY?: boolean;
|
|
20
|
+
pointerLock?: boolean;
|
|
21
|
+
toggleKey?: number;
|
|
22
|
+
showInfo?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export type FreeNavigationEventsList = ["move", "rotate", "speedchange", "activate", "deactivate"];
|
|
25
|
+
/**
|
|
26
|
+
* Free-flight camera navigation.
|
|
27
|
+
*
|
|
28
|
+
* - W/S — move forward/backward
|
|
29
|
+
* - A/D — strafe left/right
|
|
30
|
+
* - Space/Ctrl — increase/decrease altitude
|
|
31
|
+
* - Shift — hold to move without changing the camera height above the ellipsoid
|
|
32
|
+
* - Q/E — roll
|
|
33
|
+
* - Mouse — look around
|
|
34
|
+
* - Mouse wheel — adjust movement speed
|
|
35
|
+
* - Right mouse button — hold to keep the point under the screen center in the center
|
|
36
|
+
* - F — activate and deactivate the control, see `toggleKey`
|
|
37
|
+
*
|
|
38
|
+
* Yaw follows the local ellipsoid normal, while pitch uses the camera's right vector.
|
|
39
|
+
* The camera preserves its orientation relative to the local horizon while moving.
|
|
40
|
+
*
|
|
41
|
+
* By default, pointer lock allows unrestricted mouse rotation. Pressing Escape releases
|
|
42
|
+
* the pointer and deactivates the control. Set `pointerLock` to `false` to use regular
|
|
43
|
+
* mouse movement instead.
|
|
44
|
+
*
|
|
45
|
+
* The control conflicts with the {@link Navigation} control, so an active {@link Navigation}
|
|
46
|
+
* is deactivated while the free navigation is active, and restored back on deactivation.
|
|
47
|
+
*
|
|
48
|
+
* @class
|
|
49
|
+
* @extends {Control}
|
|
50
|
+
* @param {IFreeNavigationParams} [options] - Free navigation options:
|
|
51
|
+
* @param {number} [options.speed] - Initial selected movement speed in m/s. Default is 0
|
|
52
|
+
* @param {number} [options.minSpeed] - Minimal selected movement speed in m/s. Default is -300
|
|
53
|
+
* @param {number} [options.maxSpeed] - Maximal selected movement speed in m/s. Default is 1000000
|
|
54
|
+
* @param {number} [options.speedStep] - Mouse wheel speed step near the zero speed in m/s. Default is 1
|
|
55
|
+
* @param {number} [options.speedFactor] - Relative speed increment per one mouse wheel step. Default is 0.45
|
|
56
|
+
* @param {number} [options.lookSensitivity] - Camera rotation angle in radians per mouse move pixel
|
|
57
|
+
* @param {number} [options.rollSpeed] - Q/E roll angular speed in radians per second the smoothed
|
|
58
|
+
* roll velocity approaches
|
|
59
|
+
* @param {number} [options.accelerationTime] - Acceleration smoothing time in seconds. Default is 0.6
|
|
60
|
+
* @param {number} [options.decelerationTime] - Deceleration smoothing time in seconds. Default is 0.4
|
|
61
|
+
* @param {number} [options.pitchLimit] - Maximal pitch angle above and below the local horizon in radians
|
|
62
|
+
* @param {boolean} [options.invertY] - Inverts vertical mouse rotation direction. Default is false
|
|
63
|
+
* @param {boolean} [options.pointerLock] - Locks and hides the mouse pointer. Default is true
|
|
64
|
+
* @param {number} [options.toggleKey] - Key code which activates and deactivates the control,
|
|
65
|
+
* it works while the control is inactive as well. Zero disables it. Default is `input.KEY_F`
|
|
66
|
+
* @param {boolean} [options.showInfo] - Shows the movement speed and the key hint. Default is false
|
|
67
|
+
* @fires move
|
|
68
|
+
* @fires rotate
|
|
69
|
+
* @fires speedchange
|
|
70
|
+
* @fires activate
|
|
71
|
+
* @fires deactivate
|
|
72
|
+
*/
|
|
73
|
+
export declare class FreeNavigation extends Control {
|
|
74
|
+
events: EventsHandler<FreeNavigationEventsList>;
|
|
75
|
+
minSpeed: number;
|
|
76
|
+
maxSpeed: number;
|
|
77
|
+
speedStep: number;
|
|
78
|
+
speedFactor: number;
|
|
79
|
+
lookSensitivity: number;
|
|
80
|
+
rollSpeed: number;
|
|
81
|
+
accelerationTime: number;
|
|
82
|
+
decelerationTime: number;
|
|
83
|
+
pitchLimit: number;
|
|
84
|
+
invertY: boolean;
|
|
85
|
+
pointerLock: boolean;
|
|
86
|
+
toggleKey: number;
|
|
87
|
+
/**
|
|
88
|
+
* Current camera velocity in meters per second.
|
|
89
|
+
* @public
|
|
90
|
+
* @type {Vec3}
|
|
91
|
+
*/
|
|
92
|
+
vel: Vec3;
|
|
93
|
+
/**
|
|
94
|
+
* Current camera roll angular velocity in radians per second.
|
|
95
|
+
* @public
|
|
96
|
+
* @type {number}
|
|
97
|
+
*/
|
|
98
|
+
rollVel: number;
|
|
99
|
+
/**
|
|
100
|
+
* Selected movement speed in meters per second.
|
|
101
|
+
* @protected
|
|
102
|
+
* @type {number}
|
|
103
|
+
*/
|
|
104
|
+
protected _speed: number;
|
|
105
|
+
protected _moveForward: boolean;
|
|
106
|
+
protected _moveBackward: boolean;
|
|
107
|
+
protected _moveLeft: boolean;
|
|
108
|
+
protected _moveRight: boolean;
|
|
109
|
+
protected _moveUp: boolean;
|
|
110
|
+
protected _moveDown: boolean;
|
|
111
|
+
protected _rollDir: number;
|
|
112
|
+
protected _dx: number;
|
|
113
|
+
protected _dy: number;
|
|
114
|
+
protected _skipPointerMove: boolean;
|
|
115
|
+
protected _targetPoint: Vec3 | null;
|
|
116
|
+
protected _targetRequest: number;
|
|
117
|
+
protected _holdHeight: number | null;
|
|
118
|
+
protected _lastFrameTime: number;
|
|
119
|
+
protected _frameDeltaTime: number;
|
|
120
|
+
protected _infoEl: HTMLElement | null;
|
|
121
|
+
protected _suspendedNavigation: Navigation[];
|
|
122
|
+
constructor(options?: IFreeNavigationParams);
|
|
123
|
+
onadd(): void;
|
|
124
|
+
oninit(): void;
|
|
125
|
+
onremove(): void;
|
|
126
|
+
/**
|
|
127
|
+
* Activates the control when it is inactive and deactivates it otherwise.
|
|
128
|
+
* @public
|
|
129
|
+
*/
|
|
130
|
+
toggle(): void;
|
|
131
|
+
protected _onToggleKey: () => void;
|
|
132
|
+
protected _updateInfo(): void;
|
|
133
|
+
onactivate(): void;
|
|
134
|
+
ondeactivate(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Returns selected movement speed in meters per second.
|
|
137
|
+
* @public
|
|
138
|
+
* @return {number} -
|
|
139
|
+
*/
|
|
140
|
+
get speed(): number;
|
|
141
|
+
/**
|
|
142
|
+
* Sets selected movement speed in meters per second.
|
|
143
|
+
* @public
|
|
144
|
+
* @param {number} speed - Speed in m/s.
|
|
145
|
+
*/
|
|
146
|
+
set speed(speed: number);
|
|
147
|
+
/**
|
|
148
|
+
* Sets selected movement speed in meters per second, clamped to the min and max speed.
|
|
149
|
+
* @public
|
|
150
|
+
* @param {number} speed - Speed in m/s.
|
|
151
|
+
*/
|
|
152
|
+
setSpeed(speed: number): void;
|
|
153
|
+
/**
|
|
154
|
+
* Changes the movement speed by the given number of wheel steps.
|
|
155
|
+
*
|
|
156
|
+
* The speed step increases with the current speed. Changes are reversible,
|
|
157
|
+
* and zero speed is always reachable.
|
|
158
|
+
* @public
|
|
159
|
+
* @param {number} steps - Number of the wheel steps, negative decreases the speed.
|
|
160
|
+
*/
|
|
161
|
+
stepSpeed(steps: number): void;
|
|
162
|
+
/**
|
|
163
|
+
* True when the mouse pointer is locked by the control.
|
|
164
|
+
* @public
|
|
165
|
+
* @return {boolean} -
|
|
166
|
+
*/
|
|
167
|
+
isPointerLocked(): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Locks and hides the mouse pointer over the canvas.
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
requestPointerLock(): void;
|
|
173
|
+
/**
|
|
174
|
+
* Releases the mouse pointer.
|
|
175
|
+
* @public
|
|
176
|
+
*/
|
|
177
|
+
exitPointerLock(): void;
|
|
178
|
+
/**
|
|
179
|
+
* Locked target point in the cartesian coordinates, or null when no target is locked.
|
|
180
|
+
* @public
|
|
181
|
+
* @return {Vec3 | null} -
|
|
182
|
+
*/
|
|
183
|
+
get targetPoint(): Vec3 | null;
|
|
184
|
+
/**
|
|
185
|
+
* Locks the target point, so the camera keeps looking at it wherever it moves,
|
|
186
|
+
* @public
|
|
187
|
+
* @param {Vec3} [point] - Target point in the cartesian coordinates.
|
|
188
|
+
*/
|
|
189
|
+
lockTarget(point?: Vec3 | null): void;
|
|
190
|
+
/**
|
|
191
|
+
* Releases the locked target point.
|
|
192
|
+
* @public
|
|
193
|
+
*/
|
|
194
|
+
unlockTarget(): void;
|
|
195
|
+
/**
|
|
196
|
+
* Stops the camera movement and releases the locked target point.
|
|
197
|
+
* @public
|
|
198
|
+
*/
|
|
199
|
+
stop(): void;
|
|
200
|
+
protected onPreDraw(): void;
|
|
201
|
+
protected _hasInput(): boolean;
|
|
202
|
+
protected _resetInput(): void;
|
|
203
|
+
private _onCameraFly;
|
|
204
|
+
protected _onMouseMove: (e: IMouseState) => void;
|
|
205
|
+
protected _onLockedMouseMove: (e: MouseEvent) => void;
|
|
206
|
+
protected _onPointerLockChange: () => void;
|
|
207
|
+
protected _onLDown: () => void;
|
|
208
|
+
protected _onRDown: () => void;
|
|
209
|
+
protected _onRUp: () => void;
|
|
210
|
+
protected _onKeyEscape: () => void;
|
|
211
|
+
protected _onMouseLeave: () => void;
|
|
212
|
+
protected _onMouseWheel: (e: IMouseState) => void;
|
|
213
|
+
protected _onKeyForward: () => void;
|
|
214
|
+
protected _onKeyBackward: () => void;
|
|
215
|
+
protected _onKeyLeft: () => void;
|
|
216
|
+
protected _onKeyRight: () => void;
|
|
217
|
+
protected _onKeyUp: () => void;
|
|
218
|
+
protected _onKeyDown: () => void;
|
|
219
|
+
protected _onKeyRollLeft: () => void;
|
|
220
|
+
protected _onKeyRollRight: () => void;
|
|
221
|
+
protected _getLocalUp(eye: Vec3): Vec3;
|
|
222
|
+
protected _getTargetPixel(): Vec2;
|
|
223
|
+
protected _pickTargetPoint(px: Vec2): Vec3 | null;
|
|
224
|
+
protected _handleTargetLock(): void;
|
|
225
|
+
protected _handleRotation(): void;
|
|
226
|
+
/**
|
|
227
|
+
* Clamps the pitch rotation angle.
|
|
228
|
+
* @protected
|
|
229
|
+
* @param {number} angle - Pitch angle in radians.
|
|
230
|
+
* @param {Vec3} forward - Camera forward vector.
|
|
231
|
+
* @param {Vec3} right - Camera right vector.
|
|
232
|
+
* @param {Vec3} localUp - Local reference frame up direction.
|
|
233
|
+
* @return {number} - Applicable pitch angle in radians.
|
|
234
|
+
*/
|
|
235
|
+
protected _limitPitch(angle: number, forward: Vec3, right: Vec3, localUp: Vec3): number;
|
|
236
|
+
/**
|
|
237
|
+
* Rollls the camera around its forward axis and keeps its angular velocity smoothed.
|
|
238
|
+
* @protected
|
|
239
|
+
*/
|
|
240
|
+
protected _handleRoll(): void;
|
|
241
|
+
protected _orthonormalizeCamera(): void;
|
|
242
|
+
/**
|
|
243
|
+
* Moves the camera and keeps its orientation in the local reference frame.
|
|
244
|
+
* @protected
|
|
245
|
+
*/
|
|
246
|
+
protected _handleMove(): void;
|
|
247
|
+
protected _isHeightHold(): boolean;
|
|
248
|
+
protected _handleHeightHold(): void;
|
|
249
|
+
protected _suspendNavigation(): void;
|
|
250
|
+
protected _restoreNavigation(): void;
|
|
251
|
+
protected _updateFrameDeltaTime(): void;
|
|
252
|
+
protected get dt(): number;
|
|
253
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Control } from "./Control";
|
|
2
2
|
import type { IControlParams } from "./Control";
|
|
3
3
|
import { Dialog } from "../ui/Dialog";
|
|
4
|
+
import { EmptyTerrain } from "../terrain/EmptyTerrain";
|
|
4
5
|
import { Layer } from "../layer/Layer";
|
|
5
6
|
import { ToggleButton } from "../ui/ToggleButton";
|
|
6
7
|
import { View } from "../ui/View";
|
|
@@ -15,6 +16,17 @@ declare class LayerButtonView extends View<Layer> {
|
|
|
15
16
|
protected _onDblClick: () => void;
|
|
16
17
|
remove(): void;
|
|
17
18
|
}
|
|
19
|
+
interface ITerrainButtonParams extends IViewParams {
|
|
20
|
+
model: EmptyTerrain;
|
|
21
|
+
onClick: (terrain: EmptyTerrain) => void;
|
|
22
|
+
}
|
|
23
|
+
declare class TerrainButtonView extends View<EmptyTerrain> {
|
|
24
|
+
protected _onClickCallback: (terrain: EmptyTerrain) => void;
|
|
25
|
+
constructor(params: ITerrainButtonParams);
|
|
26
|
+
render(params?: any): this;
|
|
27
|
+
setActive(isActive: boolean): void;
|
|
28
|
+
protected _onClick: () => void;
|
|
29
|
+
}
|
|
18
30
|
/**
|
|
19
31
|
* Advanced :) layer switcher, includes base layers, overlays, geo images etc. groups.
|
|
20
32
|
* Double click for zoom, drag-and-drop to change zIndex
|
|
@@ -23,11 +35,17 @@ export declare class LayerSwitcher extends Control {
|
|
|
23
35
|
protected _dialog: Dialog<null>;
|
|
24
36
|
protected _toggleBtn: ToggleButton;
|
|
25
37
|
protected _panel: View<null>;
|
|
38
|
+
$terrains: HTMLElement | null;
|
|
26
39
|
$baseLayers: HTMLElement | null;
|
|
27
40
|
$overlays: HTMLElement | null;
|
|
28
41
|
_layerViews: LayerButtonView[];
|
|
42
|
+
_terrainViews: TerrainButtonView[];
|
|
29
43
|
constructor(options?: ILayerSwitcherParams);
|
|
30
44
|
oninit(): void;
|
|
45
|
+
protected _initTerrains(): void;
|
|
46
|
+
protected _onTerrainChange: () => void;
|
|
47
|
+
addTerrain: (terrain: EmptyTerrain) => void;
|
|
48
|
+
removeTerrain: (terrain: EmptyTerrain) => void;
|
|
31
49
|
protected _initLayers(): void;
|
|
32
50
|
protected _createLayerButton(layer: Layer): LayerButtonView;
|
|
33
51
|
protected _findLayerView(layer: Layer): LayerButtonView | null;
|
|
@@ -18,10 +18,12 @@ export declare class Lighting extends Control {
|
|
|
18
18
|
protected _panel: View<null>;
|
|
19
19
|
protected _atmosphereMaxOpacity: Slider;
|
|
20
20
|
protected _atmosphereMinOpacity: Slider;
|
|
21
|
+
protected _atmosphereOpacityCurveShift: Slider;
|
|
21
22
|
protected _simpleSkyBackgroundColorOne: Color;
|
|
22
23
|
protected _simpleSkyBackgroundColorTwo: Color;
|
|
23
24
|
protected _gamma: Slider;
|
|
24
25
|
protected _exposure: Slider;
|
|
26
|
+
protected _whitepoint: Slider;
|
|
25
27
|
protected _night: Slider;
|
|
26
28
|
protected _opacity: Slider;
|
|
27
29
|
protected _diffuse_r: Slider;
|
|
@@ -36,6 +38,7 @@ export declare class Lighting extends Control {
|
|
|
36
38
|
protected _shininess: Slider;
|
|
37
39
|
$gamma: HTMLElement | null;
|
|
38
40
|
$exposure: HTMLElement | null;
|
|
41
|
+
$whitepoint: HTMLElement | null;
|
|
39
42
|
$night: HTMLElement | null;
|
|
40
43
|
$opacity: HTMLElement | null;
|
|
41
44
|
$diffuse: HTMLElement | null;
|
|
@@ -9,6 +9,9 @@ import { type EventsHandler } from "../Events";
|
|
|
9
9
|
export type NavigationMode = "north" | "adaptive" | "free";
|
|
10
10
|
export interface INavigationParams extends IControlParams {
|
|
11
11
|
inertia?: number;
|
|
12
|
+
minInertia?: number;
|
|
13
|
+
maxInertia?: number;
|
|
14
|
+
minInertiaAltitude?: number;
|
|
12
15
|
velInertia?: number;
|
|
13
16
|
dragInertia?: number;
|
|
14
17
|
minSlope?: number;
|
|
@@ -27,6 +30,9 @@ export type NavigationEventsList = ["drag", "zoom", "rotate"];
|
|
|
27
30
|
* @param {INavigationParams} [options] - Navigation options:
|
|
28
31
|
* @param {NavigationMode} [options.mode] - Navigation mode: "north" (keeps north fixed), "adaptive" (default, auto-detects arc mode), "free" (arc rotation mode)
|
|
29
32
|
* @param {number} [options.inertia] - inertia factor
|
|
33
|
+
* @param {number} [options.minInertia] - inertia factor at minInertiaAltitude. Default is 1
|
|
34
|
+
* @param {number} [options.maxInertia] - inertia factor at maximal camera altitude. Default is 1.1
|
|
35
|
+
* @param {number} [options.minInertiaAltitude] - minimal altitude where inertia interpolation starts. Default is 3000000
|
|
30
36
|
* @param {number} [options.velInertia] - base velocity inertia factor. Default is 0.89
|
|
31
37
|
* @param {number} [options.dragInertia] - drag inertia
|
|
32
38
|
* @param {number} [options.mass] - camera mass, affects velocity. Default is 1
|
|
@@ -48,6 +54,9 @@ export declare class Navigation extends Control {
|
|
|
48
54
|
mass: number;
|
|
49
55
|
minSlope: number;
|
|
50
56
|
inertia: number;
|
|
57
|
+
minInertia: number;
|
|
58
|
+
maxInertia: number;
|
|
59
|
+
minInertiaAltitude: number;
|
|
51
60
|
dragInertia: number;
|
|
52
61
|
zoomSpeed: number;
|
|
53
62
|
poleThreshold: number;
|
|
@@ -67,6 +76,7 @@ export declare class Navigation extends Control {
|
|
|
67
76
|
protected _grabbedSphere: Sphere;
|
|
68
77
|
protected _wheelDirection: number;
|
|
69
78
|
protected _currScreenPos: Vec2;
|
|
79
|
+
protected _grabbedScreenPoint: Vec2;
|
|
70
80
|
protected _tUp: Vec3;
|
|
71
81
|
protected _tRad: number;
|
|
72
82
|
protected _shiftBusy: boolean;
|
|
@@ -89,7 +99,13 @@ export declare class Navigation extends Control {
|
|
|
89
99
|
onremove(): void;
|
|
90
100
|
onactivate(): void;
|
|
91
101
|
ondeactivate(): void;
|
|
92
|
-
protected
|
|
102
|
+
protected onPreDraw(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Returns true while the inertia has not been damped yet.
|
|
105
|
+
* @public
|
|
106
|
+
* @returns {boolean}
|
|
107
|
+
*/
|
|
108
|
+
isMoving(): boolean;
|
|
93
109
|
_onShiftFree: () => void;
|
|
94
110
|
private _onCameraFly;
|
|
95
111
|
protected _onMouseMove: (e: IMouseState) => void;
|
|
@@ -120,5 +136,6 @@ export declare class Navigation extends Control {
|
|
|
120
136
|
protected _updateVel_roll(): void;
|
|
121
137
|
protected get dt(): number;
|
|
122
138
|
protected get velocityInertia(): number;
|
|
139
|
+
protected _calcInertia(): number;
|
|
123
140
|
stop(): void;
|
|
124
141
|
}
|
package/lib/control/ShowFps.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
+
import { Button } from "../ui/Button";
|
|
1
2
|
import { Control } from "./Control";
|
|
2
3
|
import type { IControlParams } from "./Control";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Frames per second(FPS) display control. It looks like a map button in the top right
|
|
6
|
+
* corner and shows the current frame rate instead of an icon.
|
|
7
|
+
*
|
|
8
|
+
* Note that the rate is measured by the control itself and not taken from
|
|
9
|
+
* {@link Handler#deltaTime}, which is clamped and does not represent the real frame time.
|
|
10
|
+
* @class
|
|
11
|
+
* @extends {Control}
|
|
5
12
|
*/
|
|
6
13
|
export declare class ShowFps extends Control {
|
|
7
|
-
|
|
14
|
+
protected _btn: Button | null;
|
|
15
|
+
protected _text: HTMLElement | null;
|
|
16
|
+
protected _frames: number;
|
|
17
|
+
protected _measureStart: number;
|
|
18
|
+
constructor(options?: IControlParams);
|
|
8
19
|
oninit(): void;
|
|
9
|
-
|
|
20
|
+
onremove(): void;
|
|
21
|
+
protected _draw: () => void;
|
|
10
22
|
}
|
package/lib/control/Sun.d.ts
CHANGED
|
@@ -1,22 +1,48 @@
|
|
|
1
1
|
import { Control } from "./Control";
|
|
2
2
|
import type { IControlParams } from "./Control";
|
|
3
3
|
import { Clock } from "../Clock";
|
|
4
|
+
import type { JulianDate } from "../astro/jd";
|
|
4
5
|
import { Vec3 } from "../math/Vec3";
|
|
6
|
+
import type { PlanetCamera } from "../camera/PlanetCamera";
|
|
5
7
|
interface ISunParams extends IControlParams {
|
|
6
8
|
activationHeight?: number;
|
|
7
9
|
offsetVertical?: number;
|
|
8
10
|
offsetHorizontal?: number;
|
|
9
11
|
stopped?: boolean;
|
|
12
|
+
localDateTime?: Date | null;
|
|
10
13
|
}
|
|
11
14
|
/**
|
|
12
15
|
* Real Sun geocentric position control that place the Sun on the right place by the Earth.
|
|
16
|
+
* @class
|
|
17
|
+
*
|
|
18
|
+
* @example <caption>Lighting frozen at 21:30 local solar time under the camera</caption>
|
|
19
|
+
* new Sun({ localDateTime: new Date(2026, 7, 3, 21, 30) })
|
|
20
|
+
*
|
|
21
|
+
* @param {ISunParams} [options] - Options:
|
|
22
|
+
* @param {number} [options.activationHeight=12079000.0] - Camera height above which the Sun takes its real position by the clock.
|
|
23
|
+
* @param {number} [options.offsetVertical=-5000000] - Vertical offset of the camera following light.
|
|
24
|
+
* @param {number} [options.offsetHorizontal=5000000] - Horizontal offset of the camera following light.
|
|
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 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.
|
|
13
31
|
*/
|
|
14
32
|
export declare class Sun extends Control {
|
|
15
33
|
activationHeight: number;
|
|
16
34
|
offsetVertical: number;
|
|
17
35
|
offsetHorizontal: number;
|
|
36
|
+
/**
|
|
37
|
+
* Local apparent solar time under the camera, read by its UTC clock,
|
|
38
|
+
* or null for the camera following light.
|
|
39
|
+
* @public
|
|
40
|
+
* @type {Date | null}
|
|
41
|
+
*/
|
|
42
|
+
localDateTime: Date | null;
|
|
18
43
|
protected _currDate: number;
|
|
19
44
|
protected _prevDate: number;
|
|
45
|
+
protected _redrawDate: number;
|
|
20
46
|
protected _clockPtr: Clock | null;
|
|
21
47
|
protected _lightOn: boolean;
|
|
22
48
|
protected _stopped: boolean;
|
|
@@ -25,12 +51,45 @@ export declare class Sun extends Control {
|
|
|
25
51
|
protected _sunlightPosition: Vec3;
|
|
26
52
|
constructor(options?: ISunParams);
|
|
27
53
|
oninit(): void;
|
|
54
|
+
protected _onClockTick: () => void;
|
|
28
55
|
stop(): void;
|
|
29
56
|
start(): void;
|
|
30
57
|
onactivate(): void;
|
|
31
58
|
bindClock(clock: Clock): void;
|
|
32
59
|
getPosition(): Vec3;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the local apparent solar time under the camera, read by its UTC clock.
|
|
62
|
+
* @public
|
|
63
|
+
* @param {Date | null} localDateTime - Local date and time, or null to restore the camera following light.
|
|
64
|
+
*/
|
|
65
|
+
setLocalDateTime(localDateTime: Date | null): void;
|
|
33
66
|
protected _setSunPosition3v(position: Vec3): void;
|
|
67
|
+
/**
|
|
68
|
+
* Returns a light position offset from the camera along its own up and right axes,
|
|
69
|
+
* so that nearby terrain is lit regardless of the real Sun direction.
|
|
70
|
+
* @protected
|
|
71
|
+
* @param {PlanetCamera} cam - Planet camera.
|
|
72
|
+
* @returns {Vec3} -
|
|
73
|
+
*/
|
|
74
|
+
protected _getCameraFollowingPosition(cam: PlanetCamera): Vec3;
|
|
75
|
+
/**
|
|
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.
|
|
80
|
+
* @protected
|
|
81
|
+
* @param {JulianDate} utc - Julian date to take the clock of.
|
|
82
|
+
* @param {number} lon - Longitude under the camera, degrees.
|
|
83
|
+
* @returns {JulianDate} -
|
|
84
|
+
*/
|
|
85
|
+
protected _getLocalJulian(utc: JulianDate, lon: number): JulianDate;
|
|
86
|
+
/**
|
|
87
|
+
* Returns the Sun position for localDateTime at the location under the camera.
|
|
88
|
+
* @protected
|
|
89
|
+
* @param {PlanetCamera} cam - Planet camera.
|
|
90
|
+
* @returns {Vec3} -
|
|
91
|
+
*/
|
|
92
|
+
protected _getLocalDateTimePosition(cam: PlanetCamera): Vec3;
|
|
34
93
|
protected _draw(): void;
|
|
35
94
|
}
|
|
36
95
|
export {};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Camera } from "../../camera/Camera";
|
|
2
|
+
import { PlanetCamera } from "../../camera/PlanetCamera";
|
|
3
|
+
import { Entity } from "../../entity/Entity";
|
|
4
|
+
import { LonLat } from "../../LonLat";
|
|
5
|
+
import { Vec3 } from "../../math/Vec3";
|
|
6
|
+
import { Vec4, type NumberArray4 } from "../../math/Vec4";
|
|
7
|
+
import { QuadTreeStrategy } from "../../quadTree";
|
|
8
|
+
import type { Renderer } from "../../renderer/Renderer";
|
|
9
|
+
import type { Planet } from "../../scene/Planet";
|
|
10
|
+
import { Framebuffer } from "../../webgl";
|
|
11
|
+
import { Vector } from "../../layer/Vector";
|
|
12
|
+
import type { ShadowMap } from "../../renderer/shadows/ShadowMap";
|
|
13
|
+
import type { DepthCameraHandler } from "./DepthCameraHandler";
|
|
14
|
+
interface IPerimeterSegmentsData {
|
|
15
|
+
segments: LonLat[][];
|
|
16
|
+
isClosed: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IDepthCameraParams {
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
width?: number;
|
|
21
|
+
height?: number;
|
|
22
|
+
near?: number;
|
|
23
|
+
far?: number;
|
|
24
|
+
verticalViewAngle?: number;
|
|
25
|
+
horizontalViewAngle?: number;
|
|
26
|
+
showFrustum?: boolean;
|
|
27
|
+
showFootprint?: boolean;
|
|
28
|
+
frustumLength?: number;
|
|
29
|
+
frustumColor?: Vec4 | NumberArray4 | string;
|
|
30
|
+
isOrthographic?: boolean;
|
|
31
|
+
focusDistance?: number;
|
|
32
|
+
enableSegmentSkirts?: boolean;
|
|
33
|
+
enableSegmentFaceCulling?: boolean;
|
|
34
|
+
excludeLayers?: Vector[];
|
|
35
|
+
depthBiasWorld?: number;
|
|
36
|
+
normalBias?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare class DepthCamera {
|
|
39
|
+
protected static __counter__: number;
|
|
40
|
+
readonly id: number;
|
|
41
|
+
readonly width: number;
|
|
42
|
+
readonly height: number;
|
|
43
|
+
readonly near: number;
|
|
44
|
+
readonly far: number;
|
|
45
|
+
readonly verticalViewAngle: number;
|
|
46
|
+
readonly horizontalViewAngle?: number;
|
|
47
|
+
readonly excludeLayers: Vector[];
|
|
48
|
+
depthBiasWorld: number;
|
|
49
|
+
normalBias: number;
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
enableSegmentSkirts: boolean;
|
|
52
|
+
enableSegmentFaceCulling: boolean;
|
|
53
|
+
camera: Camera;
|
|
54
|
+
framebuffer: Framebuffer;
|
|
55
|
+
quadTreeStrategy: QuadTreeStrategy;
|
|
56
|
+
shadowMap: ShadowMap | null;
|
|
57
|
+
_handler: DepthCameraHandler | null;
|
|
58
|
+
_handlerIndex: number;
|
|
59
|
+
protected _planet: Planet | null;
|
|
60
|
+
protected _renderer: Renderer | null;
|
|
61
|
+
protected _initialized: boolean;
|
|
62
|
+
_forceOwnQuadTreeStrategyPass: boolean;
|
|
63
|
+
protected _showFrustum: boolean;
|
|
64
|
+
protected _showFootprint: boolean;
|
|
65
|
+
protected _isOrthographic: boolean;
|
|
66
|
+
protected _focusDistance: number;
|
|
67
|
+
protected _lastPlanetHeightFactor: number;
|
|
68
|
+
protected _orthoTexelSizeX: number;
|
|
69
|
+
protected _orthoTexelSizeY: number;
|
|
70
|
+
protected _frustumLength: number;
|
|
71
|
+
protected _frustumColor: Vec4 | NumberArray4 | string;
|
|
72
|
+
protected _cameraFrustumEntity: Entity | null;
|
|
73
|
+
protected _cameraFootprintEntity: Entity | null;
|
|
74
|
+
protected _cameraFootprintSegmentPointCounts: number[];
|
|
75
|
+
protected _cameraFootprintClosedState: boolean;
|
|
76
|
+
protected _prevCameraPos: Vec3;
|
|
77
|
+
protected _prevCameraPitch: number;
|
|
78
|
+
protected _prevCameraYaw: number;
|
|
79
|
+
protected _prevCameraRoll: number;
|
|
80
|
+
protected _prevCameraFrustumEntityPos: Vec3;
|
|
81
|
+
protected _prevCameraFrustumEntityPitch: number;
|
|
82
|
+
protected _prevCameraFrustumEntityYaw: number;
|
|
83
|
+
protected _prevCameraFrustumEntityRoll: number;
|
|
84
|
+
constructor(params?: IDepthCameraParams);
|
|
85
|
+
get initialized(): boolean;
|
|
86
|
+
get showFrustum(): boolean;
|
|
87
|
+
set showFrustum(showFrustum: boolean);
|
|
88
|
+
get showFootprint(): boolean;
|
|
89
|
+
set showFootprint(showFootprint: boolean);
|
|
90
|
+
get texelScale(): number;
|
|
91
|
+
get isOrthographic(): boolean;
|
|
92
|
+
set isOrthographic(isOrthographic: boolean);
|
|
93
|
+
get focusDistance(): number;
|
|
94
|
+
set focusDistance(focusDistance: number);
|
|
95
|
+
get cameraFootprintEntity(): Entity | null;
|
|
96
|
+
get cameraFrustumEntity(): Entity | null;
|
|
97
|
+
get frustumLength(): number;
|
|
98
|
+
set frustumLength(length: number);
|
|
99
|
+
get frustumColor(): Vec4 | NumberArray4 | string;
|
|
100
|
+
set frustumColor(color: Vec4 | NumberArray4 | string);
|
|
101
|
+
get frustumScale(): Vec3;
|
|
102
|
+
init(planet: Planet, renderer: Renderer): void;
|
|
103
|
+
destroy(): void;
|
|
104
|
+
frame(): void;
|
|
105
|
+
prepareFrame(): void;
|
|
106
|
+
protected _prepareCameraEntitySync(): void;
|
|
107
|
+
protected _finishCameraEntitySync(): void;
|
|
108
|
+
finishFrame(): void;
|
|
109
|
+
renderFootprint(): void;
|
|
110
|
+
getCamera(): Camera;
|
|
111
|
+
getFramebuffer(): Framebuffer;
|
|
112
|
+
getDepthTexture(): WebGLTexture;
|
|
113
|
+
protected _syncPlanetHeightFactor(): void;
|
|
114
|
+
protected _prepareOrthographicProjection(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Quantizes the orthographic extent and keeps the previous size while it still fits to prevent jitter.
|
|
117
|
+
*/
|
|
118
|
+
protected _quantizeOrthoTexelSize(extent: number, resolution: number, prevTexelSize: number): number;
|
|
119
|
+
protected _snapOrthographicProjectionToTexelGrid(): boolean;
|
|
120
|
+
getCartesianFromPixelTerrain(x: number, y: number): Vec3 | undefined;
|
|
121
|
+
getLonLatFromPixelTerrain(x: number, y: number): LonLat | undefined;
|
|
122
|
+
protected _createCameraFootprintEntity(): Entity;
|
|
123
|
+
protected _createCameraFrustumEntity(): Entity;
|
|
124
|
+
protected _createCamera(planet: Planet): Camera;
|
|
125
|
+
protected _createFramebuffer(renderer: Renderer): Framebuffer;
|
|
126
|
+
protected _createQuadTreeStrategy(planet: Planet, camera: PlanetCamera): QuadTreeStrategy;
|
|
127
|
+
protected _getQuadTreeStrategy(depthCamera: PlanetCamera): QuadTreeStrategy;
|
|
128
|
+
protected _segmentsPass(camera: PlanetCamera, quadTreeStrategy: QuadTreeStrategy): void;
|
|
129
|
+
protected _geoObjectsPass(camera: PlanetCamera): void;
|
|
130
|
+
protected _collectPerimeterLonLats(width: number, height: number): IPerimeterSegmentsData;
|
|
131
|
+
}
|
|
132
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Control, IControlParams } from "../Control";
|
|
2
|
+
import { DepthCamera } from "./DepthCamera";
|
|
3
|
+
import { Vector } from "../../layer";
|
|
4
|
+
export interface IDepthCameraHandlerParams extends IControlParams {
|
|
5
|
+
depthCameras?: DepthCamera[];
|
|
6
|
+
}
|
|
7
|
+
export declare class DepthCameraHandler extends Control {
|
|
8
|
+
protected _depthCameras: DepthCamera[];
|
|
9
|
+
readonly cameraFootprintLayer: Vector;
|
|
10
|
+
readonly cameraFrustumLayer: Vector;
|
|
11
|
+
constructor(params?: IDepthCameraHandlerParams);
|
|
12
|
+
get depthCameras(): DepthCamera[];
|
|
13
|
+
add(depthCamera: DepthCamera): DepthCamera;
|
|
14
|
+
remove(): void;
|
|
15
|
+
remove(depthCamera: DepthCamera): boolean;
|
|
16
|
+
clear(): void;
|
|
17
|
+
oninit(): void;
|
|
18
|
+
onactivate(): void;
|
|
19
|
+
ondeactivate(): void;
|
|
20
|
+
onremove(): void;
|
|
21
|
+
protected _initDepthCamera(depthCamera: DepthCamera): void;
|
|
22
|
+
protected _addDepthCameraEntities(depthCamera: DepthCamera): void;
|
|
23
|
+
protected _removeDepthCameraEntities(depthCamera: DepthCamera): void;
|
|
24
|
+
protected _onDraw: () => void;
|
|
25
|
+
}
|