@openglobus/og 0.14.10 → 0.15.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.
Files changed (140) hide show
  1. package/css/og.css +378 -275
  2. package/dist/@openglobus/og.css +1 -1
  3. package/dist/@openglobus/og.esm.js +2 -2
  4. package/dist/@openglobus/og.esm.js.map +1 -1
  5. package/dist/@openglobus/og.umd.js +2 -2
  6. package/dist/@openglobus/og.umd.js.map +1 -1
  7. package/package.json +18 -17
  8. package/src/og/Clock.js +218 -194
  9. package/src/og/Globe.js +5 -5
  10. package/src/og/Object3d.js +104 -145
  11. package/src/og/camera/Camera.js +31 -27
  12. package/src/og/camera/PlanetCamera.js +22 -14
  13. package/src/og/cons.js +107 -107
  14. package/src/og/control/Atmosphere.js +396 -0
  15. package/src/og/control/CompassButton.js +11 -18
  16. package/src/og/control/Control.js +197 -188
  17. package/src/og/control/GeoImageDragControl.js +84 -66
  18. package/src/og/control/LayerSwitcher.js +56 -138
  19. package/src/og/control/Lighting.js +314 -186
  20. package/src/og/control/MouseNavigation.js +2 -2
  21. package/src/og/control/RulerSwitcher.js +24 -19
  22. package/src/og/control/ScaleControl.js +30 -10
  23. package/src/og/control/SimpleSkyBackground.js +210 -0
  24. package/src/og/control/Sun.js +3 -1
  25. package/src/og/control/ZoomControl.js +30 -42
  26. package/src/og/control/index.js +6 -0
  27. package/src/og/control/ruler/RulerScene.js +5 -23
  28. package/src/og/control/selection/Selection.js +99 -0
  29. package/src/og/control/selection/SelectionScene.js +350 -0
  30. package/src/og/control/timeline/TimelineControl.js +99 -0
  31. package/src/og/control/timeline/TimelineModel.js +133 -0
  32. package/src/og/control/timeline/TimelineView.js +449 -0
  33. package/src/og/control/timeline/timelineUtils.js +132 -0
  34. package/src/og/ellipsoid/Ellipsoid.js +120 -93
  35. package/src/og/ellipsoid/wgs84.js +13 -13
  36. package/src/og/entity/Entity.js +36 -9
  37. package/src/og/entity/EntityCollection.js +0 -2
  38. package/src/og/entity/GeoObject.js +72 -56
  39. package/src/og/entity/GeoObjectHandler.js +487 -656
  40. package/src/og/entity/GeometryHandler.js +1341 -1337
  41. package/src/og/entity/Polyline.js +0 -16
  42. package/src/og/entity/Ray.js +0 -10
  43. package/src/og/entity/RayHandler.js +3 -44
  44. package/src/og/entity/Strip.js +1 -6
  45. package/src/og/index.js +13 -7
  46. package/src/og/input/input.js +3 -1
  47. package/src/og/layer/CanvasTiles.js +39 -34
  48. package/src/og/layer/Layer.js +69 -9
  49. package/src/og/layer/Material.js +1 -8
  50. package/src/og/layer/WMS.js +16 -5
  51. package/src/og/light/LightSource.js +2 -0
  52. package/src/og/math/Line3.js +140 -139
  53. package/src/og/math/Plane.js +118 -117
  54. package/src/og/math/Ray.js +242 -239
  55. package/src/og/math/Vec3.js +56 -37
  56. package/src/og/math/Vec4.js +3 -4
  57. package/src/og/math.js +21 -21
  58. package/src/og/quadTree/Node.js +5 -4
  59. package/src/og/quadTree/index.js +12 -0
  60. package/src/og/renderer/Renderer.js +64 -37
  61. package/src/og/renderer/RendererEvents.js +1071 -1065
  62. package/src/og/scene/Planet.js +354 -174
  63. package/src/og/scene/RenderNode.js +27 -12
  64. package/src/og/segment/Segment.js +0 -5
  65. package/src/og/shaders/atmos.js +332 -0
  66. package/src/og/shaders/drawnode.js +475 -109
  67. package/src/og/shaders/geoObject.js +96 -51
  68. package/src/og/shaders/polyline.js +212 -17
  69. package/src/og/shaders/ray.js +13 -6
  70. package/src/og/shaders/toneMapping.js +5 -5
  71. package/src/og/shaders/utils.js +88 -0
  72. package/src/og/terrain/GlobusTerrain.js +5 -4
  73. package/src/og/terrain/MapboxTerrain.js +231 -52
  74. package/src/og/ui/Button.js +106 -0
  75. package/src/og/ui/ButtonGroup.js +57 -0
  76. package/src/og/ui/Dialog.js +242 -0
  77. package/src/og/ui/Slider.js +144 -0
  78. package/src/og/ui/ToggleButton.js +51 -0
  79. package/src/og/{control → ui}/UIhelpers.js +11 -2
  80. package/src/og/ui/View.js +190 -0
  81. package/src/og/utils/shared.js +960 -942
  82. package/src/og/webgl/Framebuffer.js +308 -387
  83. package/src/og/webgl/Handler.js +90 -30
  84. package/src/og/webgl/Multisample.js +8 -0
  85. package/types/Clock.d.ts +7 -2
  86. package/types/Object3d.d.ts +14 -3
  87. package/types/camera/Camera.d.ts +18 -17
  88. package/types/camera/PlanetCamera.d.ts +3 -1
  89. package/types/control/Atmosphere.d.ts +15 -0
  90. package/types/control/CompassButton.d.ts +1 -2
  91. package/types/control/GeoImageDragControl.d.ts +7 -1
  92. package/types/control/LayerSwitcher.d.ts +5 -6
  93. package/types/control/Lighting.d.ts +32 -7
  94. package/types/control/ScaleControl.d.ts +2 -1
  95. package/types/control/SimpleSkyBackground.d.ts +15 -0
  96. package/types/control/ZoomControl.d.ts +0 -1
  97. package/types/control/index.d.ts +4 -1
  98. package/types/control/ruler/RulerScene.d.ts +0 -1
  99. package/types/control/selection/Selection.d.ts +49 -0
  100. package/types/control/selection/SelectionScene.d.ts +34 -0
  101. package/types/ellipsoid/Ellipsoid.d.ts +3 -2
  102. package/types/entity/Entity.d.ts +8 -0
  103. package/types/entity/GeoObject.d.ts +28 -22
  104. package/types/entity/GeoObjectHandler.d.ts +16 -56
  105. package/types/entity/Ray.d.ts +0 -3
  106. package/types/entity/RayHandler.d.ts +0 -4
  107. package/types/index.d.ts +9 -6
  108. package/types/input/input.d.ts +2 -0
  109. package/types/layer/CanvasTiles.d.ts +1 -0
  110. package/types/layer/Layer.d.ts +9 -0
  111. package/types/layer/WMS.d.ts +7 -3
  112. package/types/math/Plane.d.ts +1 -1
  113. package/types/math/Vec3.d.ts +19 -16
  114. package/types/math/Vec4.d.ts +2 -3
  115. package/types/math.d.ts +20 -20
  116. package/types/quadTree/index.d.ts +10 -0
  117. package/types/renderer/Renderer.d.ts +11 -37
  118. package/types/scene/Planet.d.ts +27 -1
  119. package/types/scene/RenderNode.d.ts +2 -1
  120. package/types/segment/Segment.d.ts +1 -1
  121. package/types/shaders/atmos.d.ts +4 -0
  122. package/types/shaders/drawnode.d.ts +3 -2
  123. package/types/shaders/utils.d.ts +1 -0
  124. package/types/terrain/GlobusTerrain.d.ts +1 -1
  125. package/types/terrain/MapboxTerrain.d.ts +2 -1
  126. package/types/ui/Button.d.ts +21 -0
  127. package/types/ui/Dialog.d.ts +41 -0
  128. package/types/ui/Slider.d.ts +30 -0
  129. package/types/ui/ToggleButton.d.ts +10 -0
  130. package/types/{control → ui}/UIhelpers.d.ts +1 -1
  131. package/types/ui/View.d.ts +32 -0
  132. package/types/utils/shared.d.ts +16 -14
  133. package/types/webgl/Framebuffer.d.ts +2 -5
  134. package/types/webgl/Handler.d.ts +15 -10
  135. package/types/webgl/Multisample.d.ts +2 -0
  136. package/src/og/ajax.js +0 -204
  137. package/src/og/entity/Object3d.js +0 -504
  138. package/src/og/utils/quadTreeType.js +0 -11
  139. package/types/ajax.d.ts +0 -24
  140. package/types/utils/quadTreeType.d.ts +0 -8
@@ -127,6 +127,8 @@ class Handler {
127
127
 
128
128
  this.transparentTexture = null;
129
129
 
130
+ this.defaultTexture = null;
131
+
130
132
  this.framebufferStack = new Stack();
131
133
 
132
134
  this.createTexture = {
@@ -285,9 +287,9 @@ class Handler {
285
287
  * @param {Object} image - Image or Canvas object.
286
288
  * @returns {Object} - WebGL texture object.
287
289
  */
288
- createTexture_n_webgl1(image, internalFormat) {
289
- var gl = this.gl;
290
- var texture = gl.createTexture();
290
+ createTexture_n_webgl1(image, internalFormat, texture) {
291
+ let gl = this.gl;
292
+ texture = texture || gl.createTexture();
291
293
  gl.bindTexture(gl.TEXTURE_2D, texture);
292
294
  //gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
293
295
  gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
@@ -305,13 +307,11 @@ class Handler {
305
307
  * @param {Object} image - Image or Canvas object.
306
308
  * @returns {Object} - WebGL texture object.
307
309
  */
308
- createTexture_l_webgl1(image, internalFormat) {
310
+ createTexture_l_webgl1(image, internalFormat, texture) {
309
311
  let gl = this.gl;
310
- let texture = gl.createTexture();
312
+ texture = texture || gl.createTexture();
311
313
  gl.bindTexture(gl.TEXTURE_2D, texture);
312
-
313
314
  gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
314
-
315
315
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
316
316
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
317
317
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
@@ -326,9 +326,9 @@ class Handler {
326
326
  * @param {Object} image - Image or Canvas object.
327
327
  * @returns {Object} - WebGL texture object.
328
328
  */
329
- createTexture_mm_webgl1(image, internalFormat) {
329
+ createTexture_mm_webgl1(image, internalFormat, texture) {
330
330
  let gl = this.gl;
331
- let texture = gl.createTexture();
331
+ texture = texture || gl.createTexture();
332
332
  gl.bindTexture(gl.TEXTURE_2D, texture);
333
333
  //gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
334
334
  gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
@@ -346,9 +346,9 @@ class Handler {
346
346
  * @param {Object} image - Image or Canvas object.
347
347
  * @returns {Object} - WebGL texture object.
348
348
  */
349
- createTexture_a_webgl1(image, internalFormat) {
349
+ createTexture_a_webgl1(image, internalFormat, texture) {
350
350
  let gl = this.gl;
351
- let texture = gl.createTexture();
351
+ texture = texture || gl.createTexture();
352
352
  gl.bindTexture(gl.TEXTURE_2D, texture);
353
353
  //gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
354
354
  gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
@@ -367,9 +367,9 @@ class Handler {
367
367
  * @param {Object} image - Image or Canvas object.
368
368
  * @returns {Object} - WebGL texture object.
369
369
  */
370
- createTexture_n_webgl2(image, internalFormat) {
371
- var gl = this.gl;
372
- var texture = gl.createTexture();
370
+ createTexture_n_webgl2(image, internalFormat, texture) {
371
+ let gl = this.gl;
372
+ texture = texture || gl.createTexture();
373
373
  gl.bindTexture(gl.TEXTURE_2D, texture);
374
374
  //gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
375
375
  //gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
@@ -389,9 +389,9 @@ class Handler {
389
389
  * @param {Object} image - Image or Canvas object.
390
390
  * @returns {Object} - WebGL texture object.
391
391
  */
392
- createTexture_l_webgl2(image, internalFormat) {
392
+ createTexture_l_webgl2(image, internalFormat, texture) {
393
393
  let gl = this.gl;
394
- let texture = gl.createTexture();
394
+ texture = texture || gl.createTexture();
395
395
  gl.bindTexture(gl.TEXTURE_2D, texture);
396
396
  //gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
397
397
  //gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
@@ -411,11 +411,10 @@ class Handler {
411
411
  * @param {Object} image - Image or Canvas object.
412
412
  * @returns {Object} - WebGL texture object.
413
413
  */
414
- createTexture_mm_webgl2(image, internalFormat) {
414
+ createTexture_mm_webgl2(image, internalFormat, texture) {
415
415
  let gl = this.gl;
416
- let texture = gl.createTexture();
416
+ texture = texture || gl.createTexture();
417
417
  gl.bindTexture(gl.TEXTURE_2D, texture);
418
- //gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
419
418
  //gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
420
419
  gl.texStorage2D(gl.TEXTURE_2D, MAX_LEVELS, internalFormat || gl.RGBA8, image.width, image.height);
421
420
  gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, gl.RGBA, gl.UNSIGNED_BYTE, image);
@@ -433,9 +432,9 @@ class Handler {
433
432
  * @param {Object} image - Image or Canvas object.
434
433
  * @returns {Object} - WebGL texture object.
435
434
  */
436
- createTexture_a_webgl2(image, internalFormat) {
435
+ createTexture_a_webgl2(image, internalFormat, texture) {
437
436
  let gl = this.gl;
438
- let texture = gl.createTexture();
437
+ texture = texture || gl.createTexture();
439
438
  gl.bindTexture(gl.TEXTURE_2D, texture);
440
439
  //gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
441
440
  //gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);
@@ -624,10 +623,12 @@ class Handler {
624
623
  this._params.extensions.push("OES_element_index_uint");
625
624
  this._params.extensions.push("WEBGL_depth_texture");
626
625
  this._params.extensions.push("ANGLE_instanced_arrays");
626
+ //this._params.extensions.push("WEBGL_draw_buffers");
627
627
  //this._params.extensions.push("EXT_frag_depth");
628
628
  } else {
629
629
  this._params.extensions.push("EXT_color_buffer_float");
630
630
  this._params.extensions.push("OES_texture_float_linear");
631
+ //this._params.extensions.push("WEBGL_draw_buffers");
631
632
  }
632
633
 
633
634
  let i = this._params.extensions.length;
@@ -662,18 +663,27 @@ class Handler {
662
663
  this._initPrograms();
663
664
  this._setDefaults();
664
665
 
666
+ this.observer = new IntersectionObserver((entries) => {
667
+ this._toggleVisibilityChange(entries[0].isIntersecting === true);
668
+ }, { threshold: 0 });
669
+ this.observer.observe(this.canvas);
670
+
665
671
  document.addEventListener("visibilitychange", () => {
666
- if (document.visibilityState === 'visible') {
667
- this.start();
668
- this.ONCANVASRESIZE && this.ONCANVASRESIZE();
669
- this.events.dispatch(this.events.visibilitychange, true);
670
- } else {
671
- this.events.dispatch(this.events.visibilitychange, false);
672
- this.stop();
673
- }
672
+ this._toggleVisibilityChange(document.visibilityState === 'visible');
674
673
  });
675
674
  }
676
675
 
676
+ _toggleVisibilityChange(visibility) {
677
+ if (visibility) {
678
+ this.start();
679
+ this.ONCANVASRESIZE && this.ONCANVASRESIZE();
680
+ this.events.dispatch(this.events.visibilitychange, true);
681
+ } else {
682
+ this.events.dispatch(this.events.visibilitychange, false);
683
+ this.stop();
684
+ }
685
+ }
686
+
677
687
  /**
678
688
  * Sets default gl render parameters. Used in init function.
679
689
  * @private
@@ -693,6 +703,9 @@ class Handler {
693
703
  this.createDefaultTexture({ color: "rgba(0,0,0,0.0)" }, (t) => {
694
704
  this.transparentTexture = t;
695
705
  });
706
+ this.createDefaultTexture({ color: "rgba(255, 255, 255, 1.0)" }, (t) => {
707
+ this.defaultTexture = t;
708
+ });
696
709
  }
697
710
 
698
711
  /**
@@ -919,6 +932,10 @@ class Handler {
919
932
  }
920
933
  }
921
934
 
935
+ isStopped() {
936
+ return !this._requestAnimationFrameId;
937
+ }
938
+
922
939
  /**
923
940
  * Check is gl context type equals webgl2
924
941
  * @public
@@ -934,7 +951,7 @@ class Handler {
934
951
  _animationFrameCallback() {
935
952
  this._requestAnimationFrameId = window.requestAnimationFrame(() => {
936
953
  this.drawFrame();
937
- this._animationFrameCallback();
954
+ this._requestAnimationFrameId && this._animationFrameCallback();
938
955
  });
939
956
  }
940
957
 
@@ -973,6 +990,12 @@ class Handler {
973
990
  }
974
991
  }
975
992
 
993
+ deleteTexture(texture) {
994
+ if (texture && !texture.default) {
995
+ this.gl.deleteTexture(texture);
996
+ }
997
+ }
998
+
976
999
  /**
977
1000
  * @public
978
1001
  */
@@ -988,6 +1011,9 @@ class Handler {
988
1011
  gl.deleteTexture(this.transparentTexture);
989
1012
  this.transparentTexture = null;
990
1013
 
1014
+ gl.deleteTexture(this.defaultTexture);
1015
+ this.defaultTexture = null;
1016
+
991
1017
  this.framebufferStack = null;
992
1018
  this.framebufferStack = new Stack();
993
1019
 
@@ -1064,6 +1090,40 @@ class Handler {
1064
1090
  }
1065
1091
  }
1066
1092
  }
1093
+
1094
+ // var loadTextureData = function(textureName, callback) {
1095
+ // const xhr = new XMLHttpRequest();
1096
+ // xhr.open('GET', textureName);
1097
+ // xhr.responseType = 'arraybuffer';
1098
+ // xhr.onload = (event) => {
1099
+ // const data = new DataView(xhr.response);
1100
+ // const array =
1101
+ // new Float32Array(data.byteLength / Float32Array.BYTES_PER_ELEMENT);
1102
+ // for (var i = 0; i < array.length; ++i) {
1103
+ // array[i] = data.getFloat32(i * Float32Array.BYTES_PER_ELEMENT, true);
1104
+ // }
1105
+ // callback(array);
1106
+ // };
1107
+ // xhr.send();
1108
+ // }
1109
+
1110
+ // loadTextureData('transmittance.dat', (data) => {
1111
+ //
1112
+ // let gl = this.renderer.handler.gl;
1113
+ //
1114
+ // const texture = gl.createTexture();
1115
+ // gl.activeTexture(gl.TEXTURE0);
1116
+ // gl.bindTexture(gl.TEXTURE_2D, texture);
1117
+ // gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
1118
+ // gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
1119
+ // gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
1120
+ // gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
1121
+ // gl.texImage2D(gl.TEXTURE_2D, 0, gl.getExtension('OES_texture_float_linear') ? gl.RGBA32F : gl.RGBA16F,
1122
+ // TRANSMITTANCE_TEXTURE_WIDTH, TRANSMITTANCE_TEXTURE_HEIGHT, 0, gl.RGBA,
1123
+ // gl.FLOAT, data);
1124
+ //
1125
+ // this.transmittanceTextureBrn = texture;
1126
+ // });
1067
1127
  }
1068
1128
 
1069
1129
  export { Handler };
@@ -81,6 +81,14 @@ export class Multisample {
81
81
  this.renderbuffers = new Array(this._size);
82
82
  }
83
83
 
84
+ get width() {
85
+ return this._width;
86
+ }
87
+
88
+ get height() {
89
+ return this._height;
90
+ }
91
+
84
92
  destroy() {
85
93
  var gl = this.handler.gl;
86
94
 
package/types/Clock.d.ts CHANGED
@@ -51,7 +51,8 @@ export class Clock {
51
51
  * @public
52
52
  * @type {number}
53
53
  */
54
- public multiplier: number;
54
+ public _multiplier: number;
55
+ _running: number;
55
56
  /**
56
57
  * Animation frame delta time.
57
58
  * @public
@@ -89,6 +90,10 @@ export class Clock {
89
90
  * @param {Clock} clock - Clock instance to compare.
90
91
  * @returns {boolean} - Returns true if a clock is the same instance.
91
92
  */
92
- public equal(clock: Clock): boolean;
93
+ public isEqual(clock: Clock): boolean;
94
+ start(): void;
95
+ set multiplier(arg: number);
96
+ get multiplier(): number;
97
+ stop(): void;
93
98
  }
94
99
  import { Events } from "./Events.js";
@@ -1,4 +1,5 @@
1
1
  export class Object3d {
2
+ static centering(verts: any): void;
2
3
  static scale(vertices: any, s: any): void;
3
4
  static centroid(vertices: any): number[];
4
5
  static translate(vertices: any, v: any): void;
@@ -11,12 +12,22 @@ export class Object3d {
11
12
  constructor(data: any);
12
13
  _name: any;
13
14
  _vertices: any;
14
- _texCoords: any[];
15
+ _numVertices: number;
16
+ _texCoords: any;
17
+ /**
18
+ * Image src.
19
+ * @protected
20
+ * @type {string}
21
+ */
22
+ protected _src: string;
15
23
  color: any[] | Float32Array;
16
- _indexes: any;
24
+ _indices: any;
17
25
  _normals: any;
26
+ get src(): string;
18
27
  get name(): any;
19
28
  get vertices(): any;
20
29
  get normals(): any;
21
- get indexes(): any;
30
+ get indices(): any;
31
+ get texCoords(): any;
32
+ get numVertices(): number;
22
33
  }
@@ -4,7 +4,7 @@
4
4
  * @param {Renderer} [renderer] - Renderer uses the camera instance.
5
5
  * @param {Object} [options] - Camera options:
6
6
  * @param {Object} [options.name] - Camera name.
7
- * @param {number} [options.viewAngle=38] - Camera angle of view. Default is 30.0
7
+ * @param {number} [options.viewAngle=47] - Camera angle of view. Default is 47.0
8
8
  * @param {number} [options.near=1] - Camera near plane distance. Default is 1.0
9
9
  * @param {number} [options.far=og.math.MAX] - Camera far plane distance. Deafult is og.math.MAX
10
10
  * @param {Vec3} [options.eye=[0,0,0]] - Camera eye position. Default (0,0,0)
@@ -61,18 +61,18 @@ export class Camera {
61
61
  * @type {Number}
62
62
  */
63
63
  protected _viewAngle: number;
64
- /**
65
- * Camera normal matrix.
66
- * @protected
67
- * @type {Mat3}
68
- */
69
- protected _normalMatrix: Mat3;
70
64
  /**
71
65
  * Camera view matrix.
72
66
  * @protected
73
67
  * @type {Mat4}
74
68
  */
75
69
  protected _viewMatrix: Mat4;
70
+ /**
71
+ * Camera normal matrix.
72
+ * @protected
73
+ * @type {Mat3}
74
+ */
75
+ protected _normalMatrix: Mat3;
76
76
  /**
77
77
  * Camera right vector.
78
78
  * @protected
@@ -95,21 +95,22 @@ export class Camera {
95
95
  _pv: Vec3;
96
96
  _pn: Vec3;
97
97
  _peye: Vec3;
98
- isMoved: boolean;
98
+ isMoving: boolean;
99
99
  _tanViewAngle_hrad: number;
100
100
  _tanViewAngle_hradOneByHeight: number;
101
101
  frustums: Frustum[];
102
102
  nearFarArr: any[];
103
103
  frustumColors: any[];
104
104
  FARTHEST_FRUSTUM_INDEX: number;
105
- _currentFrustum: number;
105
+ currentFrustumIndex: number;
106
+ isFirstPass: boolean;
106
107
  checkMoveEnd(): void;
107
108
  /**
108
109
  * Camera initialization.
109
110
  * @public
110
111
  * @param {Renderer} renderer - OpenGlobus renderer object.
111
112
  * @param {Object} [options] - Camera options:
112
- * @param {number} [options.viewAngle] - Camera angle of view. Default is 30.0
113
+ * @param {number} [options.viewAngle] - Camera angle of view.
113
114
  * @param {number} [options.near] - Camera near plane distance. Default is 1.0
114
115
  * @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
115
116
  * @param {Vec3} [options.eye] - Camera eye position. Default (0,0,0)
@@ -264,18 +265,18 @@ export class Camera {
264
265
  * @returns {number} - Size factor.
265
266
  */
266
267
  public projectedSize(p: Vec3, r: Vec3): number;
267
- /**
268
- * Returns normal matrix.
269
- * @public
270
- * @returns {Mat3} - Normal matrix.
271
- */
272
- public getNormalMatrix(): Mat3;
273
268
  /**
274
269
  * Returns model matrix.
275
270
  * @public
276
271
  * @returns {Mat4} - View matrix.
277
272
  */
278
273
  public getViewMatrix(): Mat4;
274
+ /**
275
+ * Returns normal matrix.
276
+ * @public
277
+ * @returns {Mat3} - Normal matrix.
278
+ */
279
+ public getNormalMatrix(): Mat3;
279
280
  setCurrentFrustum(k: any): void;
280
281
  getCurrentFrustum(): number;
281
282
  get frustum(): Frustum;
@@ -306,7 +307,7 @@ export class Camera {
306
307
  }
307
308
  import { Events } from "../Events.js";
308
309
  import { Vec3 } from "../math/Vec3.js";
309
- import { Mat3 } from "../math/Mat3.js";
310
310
  import { Mat4 } from "../math/Mat4.js";
311
+ import { Mat3 } from "../math/Mat3.js";
311
312
  import { Frustum } from "./Frustum.js";
312
313
  import { Vec2 } from "../math/Vec2.js";
@@ -5,7 +5,7 @@
5
5
  * @param {RenderNode} planet - Planet render node.
6
6
  * @param {Object} [options] - Planet camera options:
7
7
  * @param {Object} [options.name] - Camera name.
8
- * @param {number} [options.viewAngle=37] - Camera angle of view. Default is 35.0
8
+ * @param {number} [options.viewAngle] - Camera angle of view.
9
9
  * @param {number} [options.near] - Camera near plane distance. Default is 1.0
10
10
  * @param {number} [options.far] - Camera far plane distance. Deafult is og.math.MAX
11
11
  * @param {number} [options.minAltitude] - Minimal altitude for the camera. Deafult is 5
@@ -82,6 +82,8 @@ export class PlanetCamera extends Camera {
82
82
  _numFrames: number;
83
83
  _completeCallback: any;
84
84
  _flying: boolean;
85
+ _checkTerrainCollision: boolean;
86
+ setTerrainCollisionActivity(isActive: any): void;
85
87
  eyeNorm: Vec3;
86
88
  updateGeodeticPosition(): void;
87
89
  /**
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Frame per second(FPS) display control.
3
+ * @class
4
+ * @extends {Control}
5
+ * @param {Object} [options] - Control options.
6
+ */
7
+ export class Atmosphere extends Control {
8
+ _transmittanceBuffer: Framebuffer;
9
+ _scatteringBuffer: Framebuffer;
10
+ opacity: number;
11
+ _drawAtmosphereTextures(): void;
12
+ _drawBackground(): void;
13
+ }
14
+ import { Control } from "./Control.js";
15
+ import { Framebuffer } from "../webgl/index.js";
@@ -6,8 +6,7 @@ export function compassButton(options: any): CompassButton;
6
6
  * @params {Object} [options] - Control options.
7
7
  */
8
8
  export class CompassButton extends Control {
9
- planet: any;
10
- compassSvg: any;
9
+ constructor(options?: {});
11
10
  _heading: any;
12
11
  _svg: any;
13
12
  _onClick(): void;
@@ -2,7 +2,13 @@ export class GeoImageDragControl extends Control {
2
2
  constructor(options?: {});
3
3
  _cornerIndex: number;
4
4
  _catchCorner: boolean;
5
- createDraggerButton(): void;
5
+ _toggleBtn: ToggleButton;
6
6
  _bindLayer(layer: any): void;
7
+ _unbindLayer(layer: any): void;
8
+ _onLUp(ms: any): void;
9
+ _onLDown(ms: any): void;
10
+ _onMouseLeave(): void;
11
+ _onMouseMove(ms: any): void;
7
12
  }
8
13
  import { Control } from "./Control.js";
14
+ import { ToggleButton } from "../ui/ToggleButton.js";
@@ -6,20 +6,19 @@
6
6
  * @param {Object} [options] - Control options.
7
7
  */
8
8
  export class LayerSwitcher extends Control {
9
- static set numSwitches(arg: any);
10
- static get numSwitches(): any;
11
9
  constructor(options?: {});
12
10
  switcherDependent: any;
13
11
  expandedSections: any;
14
- switcherInMenu: any;
15
12
  docListener: any;
13
+ dialog: Dialog;
14
+ _menuBtn: ToggleButton;
16
15
  setupSwitcher(): void;
17
16
  planetDataBasic(): {
18
17
  collectTerrains: (planet: any) => any[];
19
18
  collectLayers: (planet: any) => any;
20
19
  pickBaseLayers: (layers: any) => any;
21
20
  pickOverlays: (layers: any) => any;
22
- classifyObject: (object: any) => "Terrain Providers" | "Overlays" | "BaseLayers";
21
+ classifyObject: (object: any) => "Terrain Providers" | "Base Layers" | "Overlays";
23
22
  sortByZIndex: (layers: any) => any;
24
23
  serializeZIndices: (layers: any) => any;
25
24
  normalizeOverlay: (overlay: any) => any;
@@ -53,13 +52,13 @@ export class LayerSwitcher extends Control {
53
52
  getUserPrefs(): {
54
53
  switcherDependency: any;
55
54
  sectionsOpening: any;
56
- btnInMenu: any;
57
55
  };
58
56
  buildBasicDOM(): {
59
57
  $mainContainer: any;
60
- whereClickHandler: (e: any) => void;
61
58
  };
62
59
  buildRecords(myData: any, $mainContainer: any, depth: any, createLastDropZone: any): void;
63
60
  removeRecords(): void;
64
61
  }
65
62
  import { Control } from "./Control.js";
63
+ import { Dialog } from "../ui/Dialog.js";
64
+ import { ToggleButton } from "../ui/ToggleButton.js";
@@ -1,16 +1,41 @@
1
- export function lighting(options: any): Lighting;
2
- /**
3
- * Helps to setup lighting.
4
- * @class
5
- * @extends {Control}
6
- * @param {Object} [options] -
7
- */
8
1
  export class Lighting extends Control {
9
2
  constructor(options?: {});
10
3
  _selectedLayer: any;
4
+ _toggleBtn: ToggleButton;
5
+ _dialog: Dialog;
6
+ _panel: View;
7
+ _atmosphereMaxOpacity: Slider;
8
+ _atmosphereMinOpacity: Slider;
9
+ _gamma: Slider;
10
+ _exposure: Slider;
11
+ _night: Slider;
12
+ _opacity: Slider;
13
+ _diffuse_r: Slider;
14
+ _diffuse_g: Slider;
15
+ _diffuse_b: Slider;
16
+ _ambient_r: Slider;
17
+ _ambient_g: Slider;
18
+ _ambient_b: Slider;
19
+ _specular_r: Slider;
20
+ _specular_g: Slider;
21
+ _specular_b: Slider;
22
+ _shininess: Slider;
11
23
  bindLayer(layer: any): void;
24
+ $atmosphereOpacity: Element;
25
+ $gamma: Element;
26
+ $exposure: Element;
27
+ $opacity: Element;
28
+ $diffuse: Element;
29
+ $ambient: Element;
30
+ $specular: Element;
31
+ $night: Element;
32
+ _update(): void;
12
33
  _fetchLayers(): void;
13
34
  _onLayerAdd(e: any): void;
14
35
  _onLayerRemove(e: any): void;
15
36
  }
16
37
  import { Control } from "./Control.js";
38
+ import { ToggleButton } from "../ui/ToggleButton.js";
39
+ import { Dialog } from "../ui/Dialog.js";
40
+ import { View } from "../ui/View.js";
41
+ import { Slider } from "../ui/Slider.js";
@@ -11,10 +11,11 @@ export class ScaleControl extends Control {
11
11
  planet: any;
12
12
  _minWidth: number;
13
13
  _maxWidth: number;
14
+ _isCenter: any;
14
15
  _renderTemplate(): ChildNode;
15
16
  el: ChildNode;
16
17
  _scaleLabelEl: any;
17
- _draw(e: any): void;
18
+ _drawScreen(px: any): void;
18
19
  _mPx: number;
19
20
  currWidth: number;
20
21
  _metersInMinSize: number;
@@ -0,0 +1,15 @@
1
+ export function simpleSkyBackground(options: any): SimpleSkyBackground;
2
+ /**
3
+ * Frame per second(FPS) display control.
4
+ * @class
5
+ * @extends {Control}
6
+ * @param {Object} [options] - Control options.
7
+ */
8
+ export class SimpleSkyBackground extends Control {
9
+ _colorOne: Float32Array;
10
+ _colorTwo: Float32Array;
11
+ set colorOne(arg: any);
12
+ set colorTwo(arg: any);
13
+ _drawBackground(): void;
14
+ }
15
+ import { Control } from "./Control.js";
@@ -7,7 +7,6 @@ export function zoomControl(options: any): ZoomControl;
7
7
  */
8
8
  export class ZoomControl extends Control {
9
9
  _keyLock: Key;
10
- planet: any;
11
10
  _move: number;
12
11
  /**
13
12
  * Planet zoom in.
@@ -11,10 +11,13 @@ import { ToggleWireframe } from "./ToggleWireframe.js";
11
11
  import { TouchNavigation } from "./TouchNavigation.js";
12
12
  import { SimpleNavigation } from "./SimpleNavigation.js";
13
13
  import { ShowFps } from "./ShowFps.js";
14
+ import { ScaleControl } from "./ScaleControl.js";
14
15
  import { Sun } from "./Sun.js";
15
16
  import { ZoomControl } from "./ZoomControl.js";
16
17
  import { MouseWheelZoomControl } from "./MouseWheelZoomControl.js";
17
18
  import { Lighting } from "./Lighting.js";
18
19
  import { Ruler } from "./ruler/Ruler.js";
20
+ import { SimpleSkyBackground } from "./SimpleSkyBackground.js";
21
+ import { Selection } from "./selection/Selection.js";
19
22
  import { LayerAnimation } from "./LayerAnimation.js";
20
- export { Control, CompassButton, DebugInfo, EarthNavigation, EarthCoordinates, GeoImageDragControl, KeyboardNavigation, LayerSwitcher, MouseNavigation, ToggleWireframe, TouchNavigation, SimpleNavigation, ShowFps, Sun, ZoomControl, MouseWheelZoomControl, Lighting, Ruler, LayerAnimation };
23
+ export { Control, CompassButton, DebugInfo, EarthNavigation, EarthCoordinates, GeoImageDragControl, KeyboardNavigation, LayerSwitcher, MouseNavigation, ToggleWireframe, TouchNavigation, SimpleNavigation, ShowFps, ScaleControl, Sun, ZoomControl, MouseWheelZoomControl, Lighting, Ruler, SimpleSkyBackground, Selection, LayerAnimation };
@@ -37,7 +37,6 @@ export class RulerScene extends RenderNode {
37
37
  _drawLine(startLonLat: any, endLonLat: any, startPos: any): void;
38
38
  _onMouseMove(e: any): void;
39
39
  clear(): void;
40
- getScale(cart: any): number;
41
40
  frame(): void;
42
41
  get ellipsoid(): any;
43
42
  }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Activate Selection
3
+ * @class
4
+ * @extends {Control}
5
+ * @param {Object} [options] - Control options.
6
+ * @param {boolean} [options.ignoreTerrain=false].
7
+ * @param {function} options.onSelect - callback (extent) => {} where extent is selected extent array [minLon,minLat,maxLon,maxLat]
8
+ * @param {boolean} [options.autoSelectionHide=false] - clear selection rectangle after passing extent to callback
9
+ * @example:
10
+ * to use bootstrap icons, include
11
+ * <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css">
12
+ *
13
+ * new Selection({
14
+ * ignoreTerrain: false,
15
+ * autoSelectionHide:true,
16
+ * onSelect: (extent) => {
17
+ *
18
+ * var vectorSource = new ol.source.Vector({
19
+ * format: new GeoJSON(),
20
+ * url: function (extent) {
21
+ * return 'https://snap.ogs.trieste.it/geoserver/snap/ows?service=WFS&' +
22
+ * 'version=1.1.0&request=GetFeature&typename=snap:all_dataset_segy_view&' +
23
+ * 'outputFormat=application/json&srsname=EPSG:4326&' +
24
+ * 'bbox=' + extent.join(',') + ',EPSG:4326';
25
+ * },
26
+ * strategy: function (extent, resolution) {
27
+ * if (this.resolution && this.resolution != resolution) {
28
+ * this.loadedExtentsRtree_.clear();
29
+ * }
30
+ * return [extent];
31
+ * }
32
+ * });
33
+ *
34
+ * vectorSource.loadFeatures(extent);
35
+ *
36
+ * console.log(extent);
37
+ *
38
+ * }
39
+ * });
40
+ */
41
+ export class Selection extends Control {
42
+ constructor(options?: {});
43
+ _selectorScene: SelectionScene;
44
+ _toggleBtn: ToggleButton;
45
+ set ignoreTerrain(arg: any);
46
+ }
47
+ import { Control } from "../Control.js";
48
+ import { SelectionScene } from "./SelectionScene.js";
49
+ import { ToggleButton } from "../../ui/ToggleButton.js";