@openglobus/og 0.26.3 → 0.26.4

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.
@@ -5,12 +5,36 @@ import { Quat } from "../math/Quat";
5
5
  import { Sphere } from "../bv/Sphere";
6
6
  import { Vec2 } from "../math/Vec2";
7
7
  import { Vec3 } from "../math/Vec3";
8
- interface IEarthNavigationParams extends IControlParams {
9
- speed?: number;
8
+ import { type EventsHandler } from "../Events";
9
+ interface IMouseNavigationParams extends IControlParams {
10
10
  fixedUp?: boolean;
11
+ inertia?: number;
12
+ dragInertia?: number;
13
+ minSlope?: number;
14
+ mass?: number;
15
+ zoomSpeed?: number;
11
16
  }
17
+ export type MouseNavigationEventsList = [
18
+ "drag",
19
+ "zoom",
20
+ "rotate"
21
+ ];
22
+ /**
23
+ * Mouse navigation.
24
+ * @class
25
+ * @extends {Control}
26
+ * @param {IMouseNavigationParams} [options] - Mouse navigation options:
27
+ * @param {boolean} [options.fixedUp] - fix up at north pole
28
+ * @param {number} [options.inertia] - inertia factor
29
+ * @param {number} [options.dragInertia] - drag inertia
30
+ * @param {number} [options.mass] - camera mass, affects velocity. Default is 1
31
+ * @param {number} [options.minSlope] - minimal slope for vertical camera movement. Default is 0.35
32
+ * @param {number} [options.zoomSpeed] - zoom speed factor. Default is 1
33
+ * @fires og.MouseNavigation#drag
34
+ * @fires og.MouseNavigation#zoom
35
+ * @fires og.MouseNavigation#rotate
36
+ */
12
37
  export declare class MouseNavigation extends Control {
13
- speed: number;
14
38
  force: Vec3;
15
39
  force_h: number;
16
40
  force_v: number;
@@ -18,8 +42,13 @@ export declare class MouseNavigation extends Control {
18
42
  vel_h: number;
19
43
  vel_v: number;
20
44
  mass: number;
45
+ minSlope: number;
46
+ inertia: number;
47
+ dragInertia: number;
48
+ zoomSpeed: number;
21
49
  vel_roll: number;
22
50
  force_roll: number;
51
+ events: EventsHandler<MouseNavigationEventsList>;
23
52
  protected _lookPos: Vec3 | undefined;
24
53
  protected _grabbedPoint: Vec3 | null;
25
54
  protected _targetZoomPoint: Vec3 | null;
@@ -46,8 +75,7 @@ export declare class MouseNavigation extends Control {
46
75
  protected _screenPosIsChanged: boolean;
47
76
  protected _rotHDir: number;
48
77
  protected _rotVDir: number;
49
- protected _dragInertia: number;
50
- constructor(options?: IEarthNavigationParams);
78
+ constructor(options?: IMouseNavigationParams);
51
79
  oninit(): void;
52
80
  onadd(): void;
53
81
  onremove(): void;
@@ -75,6 +103,7 @@ export declare class MouseNavigation extends Control {
75
103
  protected _updateVel_v(): void;
76
104
  protected _updateVel_roll(): void;
77
105
  protected get dt(): number;
106
+ protected get velocityInertia(): number;
78
107
  stop(): void;
79
108
  }
80
109
  export {};
@@ -6,8 +6,15 @@ import { Sphere } from "../bv/Sphere";
6
6
  import { Vec2 } from "../math/Vec2";
7
7
  import { Vec3 } from "../math/Vec3";
8
8
  import type { ITouchState } from "../renderer/RendererEvents";
9
+ import { EventsHandler } from "../Events";
9
10
  interface ITouchNavigationParams extends IControlParams {
11
+ inertia?: number;
10
12
  }
13
+ export type TouchNavigationEventsList = [
14
+ "inertiamove",
15
+ "drag",
16
+ "doubletapzoom"
17
+ ];
11
18
  declare class TouchExt {
12
19
  x: number;
13
20
  y: number;
@@ -25,10 +32,18 @@ declare class TouchExt {
25
32
  }
26
33
  /**
27
34
  * Touch pad planet camera dragging control.
35
+ * @class
36
+ * @extends {Control}
37
+ * @param {ITouchNavigationParams} [options] - Mouse navigation options:
38
+ * @param {number} [options.inertia] - inertia factor. Default is 0.007
39
+ * @fires og.TouchNavigation#inertiamove
40
+ * @fires og.TouchNavigation#drag
41
+ * @fires og.TouchNavigation#doubletapzoom
28
42
  */
29
43
  export declare class TouchNavigation extends Control {
30
44
  grabbedPoint: Vec3;
31
45
  inertia: number;
46
+ events: EventsHandler<TouchNavigationEventsList>;
32
47
  protected grabbedSpheroid: Sphere;
33
48
  protected qRot: Quat;
34
49
  protected scaleRot: number;
@@ -264,6 +264,7 @@ declare class Entity {
264
264
  protected _qFrame: Quat;
265
265
  protected _qRot: Quat;
266
266
  _absoluteQRot: Quat;
267
+ protected _useDirectQuaternion: boolean;
267
268
  constructor(options?: IEntityParams);
268
269
  get isEmpty(): boolean;
269
270
  /**
@@ -401,6 +402,13 @@ declare class Entity {
401
402
  * @param {Quat} rot - The new rotation quaternion.
402
403
  */
403
404
  setRotation(rot: Quat): void;
405
+ /**
406
+ * Sets rotation directly from glTF quaternion with common coordinate system conversion.
407
+ * This method avoids current pitch/yaw/roll airplane like conversion.
408
+ * @public
409
+ * @param {Quat} rot - Quaternion from glTF
410
+ */
411
+ setDirectQuaternionRotation(rot: Quat): void;
404
412
  /**
405
413
  * Sets the pitch rotation of the entity.
406
414
  * @param {number} val - The new pitch angle in radians.