@openglobus/og 0.26.6 → 0.27.1

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/lib/Globe.d.ts CHANGED
@@ -11,6 +11,7 @@ import type { HTMLDivElementExt } from "./renderer/Renderer";
11
11
  import { RenderNode } from "./scene/RenderNode";
12
12
  import { Extent } from "./Extent";
13
13
  import type { IAtmosphereParams } from "./control/atmosphere/Atmosphere";
14
+ import { QuadTreeStrategy } from "./quadTree";
14
15
  export interface IGlobeParams {
15
16
  attributionContainer?: HTMLElement;
16
17
  target?: string | HTMLElement;
@@ -28,7 +29,7 @@ export interface IGlobeParams {
28
29
  maxEqualZoomAltitude?: number;
29
30
  minEqualZoomAltitude?: number;
30
31
  minEqualZoomCameraSlope?: number;
31
- quadTreeStrategyPrototype?: any;
32
+ quadTreeStrategyPrototype?: typeof QuadTreeStrategy;
32
33
  maxLoadingRequests?: number;
33
34
  atmosphereEnabled?: boolean;
34
35
  transitionOpacityEnabled?: boolean;
@@ -21,6 +21,8 @@ export interface ICameraParams {
21
21
  frustums?: NumberArray2[];
22
22
  width?: number;
23
23
  height?: number;
24
+ isOrthographic?: boolean;
25
+ focusDistance?: number;
24
26
  }
25
27
  export interface IFlyCartesianParams extends IFlyBaseParams {
26
28
  look?: Vec3 | LonLat;
@@ -71,6 +73,8 @@ declare class Camera {
71
73
  * @type {Events}
72
74
  */
73
75
  events: EventsHandler<CameraEvents>;
76
+ protected _isOrthographic: boolean;
77
+ protected _focusDistance: number;
74
78
  /**
75
79
  * Camera position.
76
80
  * @public
@@ -154,6 +158,10 @@ declare class Camera {
154
158
  protected _frameCallback: Function | null;
155
159
  protected _flying: boolean;
156
160
  constructor(options?: ICameraParams);
161
+ get isOrthographic(): boolean;
162
+ set isOrthographic(isOrthographic: boolean);
163
+ get focusDistance(): number;
164
+ set focusDistance(dist: number);
157
165
  get id(): number;
158
166
  /**
159
167
  * Flies to the cartesian coordinates.
@@ -221,10 +229,10 @@ declare class Camera {
221
229
  /**
222
230
  * Sets up camera projection
223
231
  * @public
224
- * @param {number} angle - Camera view angle
232
+ * @param {number} viewAngle - Camera view angle
225
233
  * @param {number} aspect - Screen aspect ratio
226
234
  */
227
- protected _setProj(angle: number, aspect: number): void;
235
+ protected _setProj(viewAngle: number, aspect: number): void;
228
236
  protected _updateViewportParameters(): void;
229
237
  /**
230
238
  * Sets camera view angle in degrees
@@ -310,7 +318,7 @@ declare class Camera {
310
318
  * @param {number} y - Screen Y coordinate
311
319
  * @returns {Vec3} - Direction vector
312
320
  */
313
- unproject(x: number, y: number): Vec3;
321
+ unproject(x: number, y: number, dist?: number, outPos?: Vec3): Vec3;
314
322
  /**
315
323
  * Gets projected 3d point to the 2d screen coordinates
316
324
  * @public
@@ -355,9 +363,10 @@ declare class Camera {
355
363
  rotateVertical(angle: number, center?: Vec3): void;
356
364
  /**
357
365
  * Gets 3d size factor. Uses in LOD distance calculation.
366
+ * It is very important function used in Node.ts
358
367
  * @public
359
- * @param {Vec3} p - Far point.
360
- * @param {Vec3} r - Far point.
368
+ * @param {Vec3} p - Point in 3d.
369
+ * @param {Vec3} r - size.
361
370
  * @returns {number} - Size factor.
362
371
  */
363
372
  projectedSize(p: Vec3, r: number): number;
@@ -88,12 +88,13 @@ declare class Frustum {
88
88
  /**
89
89
  * Sets up camera projection matrix.
90
90
  * @public
91
- * @param {number} angle - Camera's vertical fov view angle.
91
+ * @param {number} viewAngle - Camera's vertical fov view angle.
92
92
  * @param {number} aspect - Screen aspect ratio.
93
93
  * @param {number} near - Near camera distance.
94
94
  * @param {number} far - Far camera distance.
95
95
  */
96
- setProjectionMatrix(angle: number, aspect: number, near: number, far: number): void;
96
+ setProjectionMatrix(viewAngle: number, aspect: number, near: number, far: number, isOrthographic?: boolean, focusDistance?: number): void;
97
+ protected _setFrustumParams(top: number, right: number, near: number, far: number): void;
97
98
  setProjectionViewRTEMatrix(viewRTEMatrix: Mat4): void;
98
99
  /**
99
100
  * Camera's projection matrix values.
@@ -1,7 +1,9 @@
1
1
  import { Control } from "./Control";
2
2
  import type { IControlParams } from "./Control";
3
3
  import type { IMouseState } from "../renderer/RendererEvents";
4
+ import { Vec2 } from "../math/Vec2";
4
5
  import { Vec3 } from "../math/Vec3";
6
+ import { Camera } from "../camera/Camera";
5
7
  interface ISimpleNavigationParams extends IControlParams {
6
8
  speed?: number;
7
9
  }
@@ -16,14 +18,19 @@ export declare class SimpleNavigation extends Control {
16
18
  protected _lookPos: Vec3 | undefined;
17
19
  protected _up: Vec3 | null;
18
20
  protected _grabbedPoint: Vec3 | undefined;
21
+ protected _grabbedScreenPoint: Vec2;
19
22
  protected _eye0: Vec3;
23
+ protected _wheelPos: Vec3;
24
+ protected _savedFocusDistance: number;
25
+ protected _savedEye: Vec3;
20
26
  constructor(options?: ISimpleNavigationParams);
21
27
  oninit(): void;
22
28
  onactivate(): void;
23
29
  ondeactivate(): void;
24
- protected _onMouseLeftButtonClick: (e: IMouseState) => void;
25
- protected _onMouseLeftButtonUp: (e: IMouseState) => void;
30
+ protected _onProjChanged: (cam: Camera) => void;
26
31
  protected _onMouseLeftButtonDown: (e: IMouseState) => void;
32
+ protected _onMouseLeftButtonUp: (e: IMouseState) => void;
33
+ protected _onMouseLeftButtonHold: (e: IMouseState) => void;
27
34
  protected _onRHold: (e: IMouseState) => void;
28
35
  protected _onRDown: (e: IMouseState) => void;
29
36
  protected _onMouseWheel: (e: IMouseState) => void;
@@ -37,7 +44,9 @@ export declare class SimpleNavigation extends Control {
37
44
  protected onCameraTurnRight: () => void;
38
45
  protected onCameraRollLeft: () => void;
39
46
  protected onCameraRollRight: () => void;
40
- protected get dt(): number;
47
+ protected _handleMouseWheel(): void;
41
48
  protected onDraw(): void;
49
+ protected get dt(): number;
50
+ protected _updateVel(): void;
42
51
  }
43
52
  export {};
@@ -6,13 +6,16 @@ import { Control, IControlParams } from "../Control";
6
6
  import { Vec3 } from "../../math/Vec3";
7
7
  import { LonLat } from "../../LonLat";
8
8
  import { GeoImage } from "../../layer/GeoImage";
9
- export interface ICameraDepthhandlerParams extends IControlParams {
9
+ import { QuadTreeStrategy } from "../../quadTree";
10
+ export interface ICameraDepthHandlerParams extends IControlParams {
10
11
  }
11
12
  export declare class CameraDepthHandler extends Control {
12
- protected _depthHandler: CameraFrameHandler | null;
13
+ protected _frameHandler: CameraFrameHandler | null;
13
14
  protected _frameComposer: CameraFrameComposer;
14
15
  readonly cameraGeoImage: GeoImage;
15
- constructor(params: ICameraDepthhandlerParams);
16
+ protected _quadTreeStrategy: QuadTreeStrategy | null;
17
+ protected _skipPreRender: boolean;
18
+ constructor(params: ICameraDepthHandlerParams);
16
19
  protected _createCamera(): Camera;
17
20
  get camera(): Camera | undefined;
18
21
  oninit(): void;
@@ -109,6 +109,7 @@ export interface IEntityParams {
109
109
  */
110
110
  declare class Entity {
111
111
  static __counter__: number;
112
+ protected _name: string;
112
113
  /**
113
114
  * Uniq identifier.
114
115
  * @public
@@ -266,6 +267,8 @@ declare class Entity {
266
267
  _absoluteQRot: Quat;
267
268
  protected _useDirectQuaternion: boolean;
268
269
  constructor(options?: IEntityParams);
270
+ get name(): string;
271
+ set name(name: string);
269
272
  get isEmpty(): boolean;
270
273
  /**
271
274
  * Returns root entity object.
@@ -322,10 +325,9 @@ declare class Entity {
322
325
  * Adds current entity into the specified entity collection.
323
326
  * @public
324
327
  * @param {EntityCollection | Vector} collection - Specified entity collection or vector layer.
325
- * @param {boolean} [rightNow=false] - Entity insertion option for vector layer.
326
328
  * @returns {Entity} - This object.
327
329
  */
328
- addTo(collection: EntityCollection | Vector, rightNow?: boolean): Entity;
330
+ addTo(collection: EntityCollection | Vector): Entity;
329
331
  /**
330
332
  * Removes current entity from its collection or layer.
331
333
  * @public
@@ -619,6 +621,13 @@ declare class Entity {
619
621
  */
620
622
  get layer(): Vector | null;
621
623
  get rendererEvents(): VectorEventsType | EntityCollectionEvents | null;
624
+ /**
625
+ * Append child entity.
626
+ * @public
627
+ * @param {Entity[]} entities - Child entities.
628
+ * @param {boolean} [forceRelativePosition] - Force relative position property.
629
+ */
630
+ appendChildren(entities: Entity[], forceRelativePosition?: boolean): void;
622
631
  /**
623
632
  * Append child entity.
624
633
  * @public
@@ -376,7 +376,7 @@ declare class Layer {
376
376
  protected _correctFullExtent(): void;
377
377
  get opacity(): number;
378
378
  get screenOpacity(): number;
379
- _refreshFadingOpacity(): boolean;
379
+ _refreshFadingOpacity(minCurrZoom: number, maxCurrZoom: number): boolean;
380
380
  createMaterial(segment: Segment): Material;
381
381
  redraw(): void;
382
382
  abortMaterialLoading(material: Material): void;
@@ -128,7 +128,6 @@ declare class Vector extends Layer {
128
128
  * Adds layer to the planet.
129
129
  * @public
130
130
  * @param {Planet} planet - Planet scene object.
131
- * @returns {Vector} -
132
131
  */
133
132
  addTo(planet: Planet): void;
134
133
  remove(): this;
@@ -142,28 +141,25 @@ declare class Vector extends Layer {
142
141
  * Adds entity to the layer.
143
142
  * @public
144
143
  * @param {Entity} entity - Entity.
145
- * @param {boolean} [rightNow=false] - Entity insertion option. False is default.
146
144
  * @returns {Vector} - Returns this layer.
147
145
  */
148
- add(entity: Entity, rightNow?: boolean): this;
146
+ add(entity: Entity): this;
149
147
  /**
150
148
  * Adds entity to the layer in the index position.
151
149
  * @public
152
150
  * @param {Entity} entity - Entity.
153
151
  * @param {Number} index - Index position.
154
- * @param {boolean} [rightNow] - Entity insertion option. False is default.
155
152
  * @returns {Vector} - Returns this layer.
156
153
  */
157
- insert(entity: Entity, index: number, rightNow?: boolean): this;
158
- protected _proceedEntity(entity: Entity, rightNow?: boolean): void;
154
+ insert(entity: Entity, index: number): this;
155
+ protected _proceedEntity(entity: Entity): void;
159
156
  /**
160
157
  * Adds entity array to the layer.
161
158
  * @public
162
159
  * @param {Array.<Entity>} entities - Entities array.
163
- * @param {boolean} [rightNow=false] - Entity insertion option. False is default.
164
160
  * @returns {Vector} - Returns this layer.
165
161
  */
166
- addEntities(entities: Entity[], rightNow?: boolean): this;
162
+ addEntities(entities: Entity[]): Vector;
167
163
  /**
168
164
  * Remove entity from layer.
169
165
  * TODO: memory leaks.
@@ -233,7 +229,7 @@ declare class Vector extends Layer {
233
229
  * @param {Material} material - Segment material.
234
230
  */
235
231
  abortMaterialLoading(material: Material): void;
236
- applyMaterial(material: Material, isForced?: boolean): NumberArray4;
232
+ applyMaterial(material: Material): NumberArray4;
237
233
  clearMaterial(material: Material): void;
238
234
  update(): void;
239
235
  }
@@ -189,7 +189,7 @@ export declare class Mat4 {
189
189
  * @param {number} far -
190
190
  * @return {Mat4} -
191
191
  */
192
- setOrtho(left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4;
192
+ setOrthographic(left: number, right: number, bottom: number, top: number, near: number, far: number): Mat4;
193
193
  /**
194
194
  * Sets current rotation matrix by euler's angles.
195
195
  * @public
@@ -156,6 +156,8 @@ export declare class Vec3 {
156
156
  * @returns {Vec3} -
157
157
  */
158
158
  static orthoNormalize(normal: Vec3, tangent: Vec3): Vec3;
159
+ static isOrthogonal(a: Vec3, b: Vec3, epsilon?: number): boolean;
160
+ isOrthogonal(b: Vec3, epsilon?: number): boolean;
159
161
  /**
160
162
  * Returns vector components division product one to another.
161
163
  * @static