@openglobus/og 0.15.0 → 0.15.2

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 (147) hide show
  1. package/README.md +10 -4
  2. package/css/og.css +44 -45
  3. package/dist/@openglobus/og.css +1 -1
  4. package/dist/@openglobus/og.esm.js +2 -2
  5. package/dist/@openglobus/og.esm.js.map +1 -1
  6. package/dist/@openglobus/og.umd.js +2 -2
  7. package/dist/@openglobus/og.umd.js.map +1 -1
  8. package/package.json +12 -12
  9. package/src/og/Clock.js +1 -1
  10. package/src/og/Events.js +1 -1
  11. package/src/og/Extent.js +1 -1
  12. package/src/og/Globe.js +3 -5
  13. package/src/og/Popup.js +38 -63
  14. package/src/og/astro/earth.js +2 -2
  15. package/src/og/astro/rotation.js +2 -2
  16. package/src/og/bv/Box.js +1 -0
  17. package/src/og/bv/index.js +1 -1
  18. package/src/og/camera/Camera.js +4 -4
  19. package/src/og/camera/PlanetCamera.js +26 -6
  20. package/src/og/camera/index.js +1 -1
  21. package/src/og/control/Atmosphere.js +3 -8
  22. package/src/og/control/CompassButton.js +4 -5
  23. package/src/og/control/Control.js +25 -15
  24. package/src/og/control/EarthCoordinates.js +3 -2
  25. package/src/og/control/EarthNavigation.js +0 -1
  26. package/src/og/control/GeoImageDragControl.js +2 -2
  27. package/src/og/control/KeyboardNavigation.js +3 -2
  28. package/src/og/control/LayerAnimation.js +2 -2
  29. package/src/og/control/LayerSwitcher.js +5 -4
  30. package/src/og/control/Lighting.js +106 -35
  31. package/src/og/control/MouseNavigation.js +4 -4
  32. package/src/og/control/MouseWheelZoomControl.js +2 -2
  33. package/src/og/control/RulerSwitcher.js +4 -3
  34. package/src/og/control/ScaleControl.js +2 -2
  35. package/src/og/control/ShowFps.js +2 -1
  36. package/src/og/control/SimpleNavigation.js +2 -1
  37. package/src/og/control/SimpleSkyBackground.js +2 -2
  38. package/src/og/control/Sun.js +9 -2
  39. package/src/og/control/ToggleWireframe.js +2 -1
  40. package/src/og/control/TouchNavigation.js +4 -3
  41. package/src/og/control/ZoomControl.js +6 -5
  42. package/src/og/control/index.js +10 -10
  43. package/src/og/control/ruler/RulerScene.js +19 -11
  44. package/src/og/control/selection/Selection.js +1 -1
  45. package/src/og/control/selection/SelectionScene.js +5 -8
  46. package/src/og/control/timeline/TimelineControl.js +3 -4
  47. package/src/og/control/timeline/TimelineModel.js +2 -2
  48. package/src/og/control/timeline/TimelineView.js +10 -5
  49. package/src/og/control/visibleExtent/Segment.js +5 -5
  50. package/src/og/control/visibleExtent/VisibleExtent.js +1 -1
  51. package/src/og/ellipsoid/Ellipsoid.js +3 -3
  52. package/src/og/entity/BaseBillboard.js +2 -2
  53. package/src/og/entity/BillboardHandler.js +10 -2
  54. package/src/og/entity/Entity.js +10 -51
  55. package/src/og/entity/EntityCollection.js +3 -20
  56. package/src/og/entity/GeoObject.js +2 -4
  57. package/src/og/entity/GeoObjectHandler.js +12 -11
  58. package/src/og/entity/Geometry.js +2 -2
  59. package/src/og/entity/GeometryHandler.js +2 -2
  60. package/src/og/entity/Label.js +2 -2
  61. package/src/og/entity/LabelHandler.js +7 -5
  62. package/src/og/entity/Polyline.js +8 -7
  63. package/src/og/entity/Ray.js +1 -2
  64. package/src/og/entity/RayHandler.js +4 -0
  65. package/src/og/entity/Strip.js +8 -5
  66. package/src/og/entity/index.js +1 -1
  67. package/src/og/index.core.js +4 -4
  68. package/src/og/index.js +7 -5
  69. package/src/og/index.webgl.js +3 -3
  70. package/src/og/layer/BaseGeoImage.js +2 -2
  71. package/src/og/layer/GeoImage.js +2 -2
  72. package/src/og/layer/GeoTexture2d.js +1 -1
  73. package/src/og/layer/Layer.js +3 -3
  74. package/src/og/layer/Vector.js +7 -11
  75. package/src/og/layer/WMS.js +2 -1
  76. package/src/og/layer/XYZ.js +2 -4
  77. package/src/og/math/Line3.js +0 -1
  78. package/src/og/math/Plane.js +0 -1
  79. package/src/og/math/Ray.js +0 -1
  80. package/src/og/math/Vec2.js +62 -62
  81. package/src/og/math/Vec3.js +1 -1
  82. package/src/og/math/Vec4.js +1 -1
  83. package/src/og/math/index.js +1 -1
  84. package/src/og/proj/EPSG3857.js +1 -1
  85. package/src/og/proj/EPSG4326.js +1 -1
  86. package/src/og/quadTree/EarthQuadTreeStrategy.js +4 -4
  87. package/src/og/quadTree/MarsQuadTreeStrategy.js +4 -4
  88. package/src/og/quadTree/Node.js +1 -1
  89. package/src/og/quadTree/Wgs84QuadTreeStrategy.js +4 -4
  90. package/src/og/quadTree/index.js +2 -2
  91. package/src/og/renderer/Renderer.js +196 -77
  92. package/src/og/renderer/RendererEvents.js +35 -10
  93. package/src/og/scene/Axes.js +2 -2
  94. package/src/og/scene/Planet.js +52 -80
  95. package/src/og/scene/RenderNode.js +2 -13
  96. package/src/og/scene/SkyBox.js +1 -1
  97. package/src/og/scene/index.js +2 -2
  98. package/src/og/segment/Segment.js +5 -5
  99. package/src/og/segment/SegmentLonLatWgs84.js +2 -3
  100. package/src/og/shaders/drawnode.js +5 -1
  101. package/src/og/shaders/geoObject.js +2 -6
  102. package/src/og/shaders/pickingMask.js +31 -0
  103. package/src/og/terrain/BilTerrain.js +4 -4
  104. package/src/og/terrain/GlobusTerrain.js +7 -7
  105. package/src/og/terrain/MapboxTerrain.js +2 -2
  106. package/src/og/terrain/index.js +2 -2
  107. package/src/og/ui/Button.js +5 -4
  108. package/src/og/ui/Dialog.js +3 -6
  109. package/src/og/ui/Slider.js +29 -3
  110. package/src/og/ui/View.js +5 -5
  111. package/src/og/ui/icons.js +3 -0
  112. package/src/og/utils/FontAtlas.js +2 -2
  113. package/src/og/utils/GeoImageCreator.js +0 -1
  114. package/src/og/utils/NormalMapCreator.js +6 -5
  115. package/src/og/utils/TerrainWorker.js +1 -1
  116. package/src/og/utils/VectorTileCreator.js +4 -4
  117. package/src/og/utils/shared.js +1 -1
  118. package/src/og/webgl/Framebuffer.js +3 -1
  119. package/src/og/webgl/Handler.js +77 -62
  120. package/src/og/webgl/Multisample.js +18 -7
  121. package/src/og/webgl/Program.js +2 -2
  122. package/src/og/webgl/index.js +2 -2
  123. package/types/Popup.d.ts +8 -21
  124. package/types/camera/PlanetCamera.d.ts +1 -0
  125. package/types/control/Sun.d.ts +1 -0
  126. package/types/control/ruler/RulerScene.d.ts +4 -3
  127. package/types/entity/Entity.d.ts +2 -19
  128. package/types/entity/EntityCollection.d.ts +0 -7
  129. package/types/index.d.ts +2 -1
  130. package/types/math/Vec2.d.ts +95 -95
  131. package/types/renderer/Renderer.d.ts +28 -16
  132. package/types/scene/Planet.d.ts +2 -7
  133. package/types/shaders/pickingMask.d.ts +2 -0
  134. package/types/ui/Slider.d.ts +3 -0
  135. package/types/ui/View.d.ts +1 -0
  136. package/types/ui/icons.d.ts +1 -0
  137. package/types/webgl/Framebuffer.d.ts +1 -0
  138. package/types/webgl/Handler.d.ts +3 -2
  139. package/src/og/entity/ShapeHandler.js +0 -99
  140. package/src/og/shaders/shape.js +0 -135
  141. package/src/og/shapes/BaseShape.js +0 -557
  142. package/src/og/shapes/Icosphere.js +0 -179
  143. package/src/og/shapes/Sphere.js +0 -100
  144. package/types/entity/ShapeHandler.d.ts +0 -22
  145. package/types/shaders/shape.d.ts +0 -4
  146. package/types/shapes/BaseShape.d.ts +0 -250
  147. package/types/shapes/Sphere.d.ts +0 -41
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- import { View } from './View.js';
4
- import { stringTemplate } from '../utils/shared.js';
5
3
  import { clamp } from '../math.js';
4
+ import { stringTemplate } from '../utils/shared.js';
5
+ import { View } from './View.js';
6
6
 
7
7
  const TEMPLATE = `<div class="og-slider">
8
8
  <div class="og-slider-label">{label}</div>
@@ -81,6 +81,23 @@ class Slider extends View {
81
81
 
82
82
  this._onMouseWheel_ = this._onMouseWheel.bind(this);
83
83
  this.$panel.addEventListener("mousewheel", this._onMouseWheel_);
84
+
85
+ this._onMouseWheelFF_ = this._onMouseWheelFF.bind(this);
86
+ this.$panel.addEventListener("wheel", this._onMouseWheelFF_);
87
+ }
88
+
89
+ _clearEvents() {
90
+ this.$panel.removeEventListener("mousedown", this._onMouseDown_);
91
+ this._onMouseDown_ = undefined;
92
+
93
+ this.$input.removeEventListener("input", this._onInput_);
94
+ this._onInput_ = undefined;
95
+
96
+ this.$panel.removeEventListener("mousewheel", this._onMouseWheel_);
97
+ this._onMouseWheel_ = undefined;
98
+
99
+ this.$panel.removeEventListener("wheel", this._onMouseWheelFF_);
100
+ this._onMouseWheelFF_ = undefined;
84
101
  }
85
102
 
86
103
  _onMouseWheel(e) {
@@ -90,6 +107,10 @@ class Slider extends View {
90
107
  this.value = this._value + Math.sign(e.wheelDelta) * (this._max - this._min) / 100.0;
91
108
  }
92
109
 
110
+ _onMouseWheelFF(e) {
111
+ this._onMouseWheel(e);
112
+ }
113
+
93
114
  _onInput(e) {
94
115
  e = e || window.event;
95
116
  e.preventDefault();
@@ -137,8 +158,13 @@ class Slider extends View {
137
158
  document.removeEventListener("mousemove", this._onMouseMove_);
138
159
  this._onMouseMove_ = undefined;
139
160
  }
161
+
162
+ remove() {
163
+ this._clearEvents();
164
+ super.remove();
165
+ }
140
166
  }
141
167
 
142
168
  export {
143
169
  Slider
144
- }
170
+ };
package/src/og/ui/View.js CHANGED
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
 
4
- import { stringTemplate } from '../utils/shared.js';
5
- import { parseHTML } from "../utils/shared.js";
6
4
  import { Events } from '../Events.js';
5
+ import { parseHTML, stringTemplate } from '../utils/shared.js';
7
6
 
8
7
  class View {
9
8
  constructor(options = {}) {
@@ -13,9 +12,6 @@ class View {
13
12
  this.template = options.template || "";
14
13
  this.parent = options.parent || null;
15
14
  this._classList = options.classList || [];
16
- if (options.appendTo) {
17
- this.appendTo(options.appendTo);
18
- }
19
15
  }
20
16
 
21
17
  static set __staticCounter(n) {
@@ -60,6 +56,10 @@ class View {
60
56
  }
61
57
  }
62
58
 
59
+ get events() {
60
+ return this._events;
61
+ }
62
+
63
63
  on(eventName, callback, sender) {
64
64
  return this._events.on(eventName, callback, sender);
65
65
  }
@@ -0,0 +1,3 @@
1
+ export const CLOSE_ICON = `<svg className="svg-icon" style="width: 1em; height: 1em;vertical-align: middle;fill: currentColor; overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M777.856 280.192l-33.92-33.952-231.872 231.872-231.84-231.872-33.984 33.888 231.872 231.904-231.84 231.84 33.888 33.984 231.904-231.904 231.84 231.872 33.952-33.888-231.872-231.904z"/>
3
+ </svg>`
@@ -4,9 +4,9 @@
4
4
 
5
5
  'use strict';
6
6
 
7
+ import { Deferred } from '../Deferred.js';
7
8
  import { Rectangle } from '../Rectangle.js';
8
9
  import { TextureAtlas, TextureAtlasNode } from './TextureAtlas.js';
9
- import { Deferred } from '../Deferred.js';
10
10
 
11
11
  //TODO: get the value from shader module
12
12
  const MAX_SIZE = 11;
@@ -219,4 +219,4 @@ class FontAtlas {
219
219
  }
220
220
  }
221
221
 
222
- export { FontAtlas };
222
+ export { FontAtlas };
@@ -4,7 +4,6 @@ import { LonLat } from '../LonLat.js';
4
4
  import * as utils from '../utils/shared.js';
5
5
  import { Framebuffer } from '../webgl/Framebuffer.js';
6
6
  import { Program } from '../webgl/Program.js';
7
- import { types } from '../webgl/types.js';
8
7
 
9
8
  export class GeoImageCreator {
10
9
 
@@ -4,12 +4,11 @@
4
4
 
5
5
  "use strict";
6
6
 
7
+ import { Lock } from "../Lock.js";
7
8
  import * as quadTree from "../quadTree/quadTree.js";
9
+ import { QueueArray } from "../QueueArray.js";
8
10
  import { Framebuffer } from "../webgl/Framebuffer.js";
9
- import { Lock } from "../Lock.js";
10
11
  import { Program } from "../webgl/Program.js";
11
- import { types } from "../webgl/types.js";
12
- import { QueueArray } from "../QueueArray.js";
13
12
 
14
13
  export class NormalMapCreator {
15
14
 
@@ -313,6 +312,7 @@ export class NormalMapCreator {
313
312
 
314
313
  gl.disable(gl.CULL_FACE);
315
314
  gl.disable(gl.DEPTH_TEST);
315
+ gl.disable(gl.BLEND);
316
316
 
317
317
  if (segment.terrainReady && this._drawNormalMap(segment)) {
318
318
  segment.normalMapReady = true;
@@ -323,9 +323,9 @@ export class NormalMapCreator {
323
323
  }
324
324
  segment._inTheQueue = false;
325
325
 
326
- gl.disable(gl.BLEND);
327
326
  gl.enable(gl.DEPTH_TEST);
328
327
  gl.enable(gl.CULL_FACE);
328
+ gl.enable(gl.BLEND);
329
329
 
330
330
  this._framebuffer.deactivate();
331
331
  }
@@ -339,6 +339,7 @@ export class NormalMapCreator {
339
339
 
340
340
  gl.disable(gl.CULL_FACE);
341
341
  gl.disable(gl.DEPTH_TEST);
342
+ gl.disable(gl.BLEND);
342
343
 
343
344
  var deltaTime = 0,
344
345
  startTime = window.performance.now();
@@ -356,7 +357,7 @@ export class NormalMapCreator {
356
357
  deltaTime = window.performance.now() - startTime;
357
358
  }
358
359
 
359
- gl.disable(gl.BLEND);
360
+ gl.enable(gl.BLEND);
360
361
  gl.enable(gl.DEPTH_TEST);
361
362
  gl.enable(gl.CULL_FACE);
362
363
 
@@ -570,4 +570,4 @@ const _programm =
570
570
  ]);
571
571
  }`;
572
572
 
573
- export { TerrainWorker };
573
+ export { TerrainWorker };
@@ -198,9 +198,10 @@ export class VectorTileCreator {
198
198
 
199
199
  gl.disable(gl.CULL_FACE);
200
200
  gl.disable(gl.DEPTH_TEST);
201
- gl.enable(gl.BLEND);
202
- gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
203
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
201
+
202
+ // gl.enable(gl.BLEND);
203
+ // gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);
204
+ // gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
204
205
 
205
206
  var hLine = h.programs.vectorTileLineRasterization,
206
207
  hPoly = h.programs.vectorTilePolygonRasterization;
@@ -396,7 +397,6 @@ export class VectorTileCreator {
396
397
  // prevLayerId = material.layer._id;
397
398
  }
398
399
 
399
- gl.disable(gl.BLEND);
400
400
  gl.enable(gl.DEPTH_TEST);
401
401
  gl.enable(gl.CULL_FACE);
402
402
 
@@ -4,12 +4,12 @@
4
4
 
5
5
  "use strict";
6
6
 
7
- import { colorTable } from "./colorTable.js";
8
7
  import { Extent } from "../Extent.js";
9
8
  import { LonLat } from "../LonLat.js";
10
9
  import { Vec2 } from "../math/Vec2.js";
11
10
  import { Vec3 } from "../math/Vec3.js";
12
11
  import { Vec4 } from "../math/Vec4.js";
12
+ import { colorTable } from "./colorTable.js";
13
13
 
14
14
  export function getDefault(param, def) {
15
15
  return param != undefined ? param : def;
@@ -77,6 +77,8 @@ export class Framebuffer {
77
77
 
78
78
  this._depthComponent = options.depthComponent != undefined ? options.depthComponent : "DEPTH_COMPONENT16";
79
79
 
80
+ this._renderbufferTarget = options.renderbufferTarget != undefined ? options.renderbufferTarget : "DEPTH_ATTACHMENT";
81
+
80
82
  this._useDepth = options.useDepth != undefined ? options.useDepth : true;
81
83
 
82
84
  /**
@@ -170,7 +172,7 @@ export class Framebuffer {
170
172
  this._depthRenderbuffer = gl.createRenderbuffer();
171
173
  gl.bindRenderbuffer(gl.RENDERBUFFER, this._depthRenderbuffer);
172
174
  gl.renderbufferStorage(gl.RENDERBUFFER, gl[this._depthComponent], this._width, this._height);
173
- gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this._depthRenderbuffer);
175
+ gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl[this._renderbufferTarget], gl.RENDERBUFFER, this._depthRenderbuffer);
174
176
  gl.bindRenderbuffer(gl.RENDERBUFFER, null);
175
177
  }
176
178
 
@@ -4,14 +4,14 @@
4
4
 
5
5
  "use strict";
6
6
 
7
- import { cons } from "../cons.js";
8
7
  import { Clock } from "../Clock.js";
8
+ import { cons } from "../cons.js";
9
+ import { Events } from "../Events.js";
9
10
  import { ImageCanvas } from "../ImageCanvas.js";
11
+ import { Vec2 } from "../math/Vec2.js";
12
+ import { Stack } from "../Stack.js";
10
13
  import { isEmpty } from "../utils/shared.js";
11
14
  import { ProgramController } from "./ProgramController.js";
12
- import { Stack } from "../Stack.js";
13
- import { Vec2 } from "../math/Vec2.js";
14
- import { Events } from "../Events.js";
15
15
 
16
16
  const vendorPrefixes = ["", "WEBKIT_", "MOZ_"];
17
17
 
@@ -99,6 +99,8 @@ class Handler {
99
99
  this._params.extensions = this._params.extensions || [];
100
100
  this._oneByHeight = 1.0 / (this._params.height * this._params.pixelRatio);
101
101
 
102
+ this._params.context.stencil = true;
103
+
102
104
  /**
103
105
  * Current WebGL extensions. Becomes here after context initialization.
104
106
  * @public
@@ -145,8 +147,6 @@ class Handler {
145
147
  if (params.autoActivate || isEmpty(params.autoActivate)) {
146
148
  this.initialize();
147
149
  }
148
-
149
- this.createTexture_n = this.gl.type === "webgl2" ? this.createTexture_n_webgl2 : this.createTexture_n_webgl1;
150
150
  }
151
151
 
152
152
  /**
@@ -176,11 +176,18 @@ class Handler {
176
176
  let ctx = null;
177
177
 
178
178
  try {
179
- for (let i = 0; i < CONTEXT_TYPE.length; i++) {
180
- ctx = canvas.getContext(CONTEXT_TYPE[i], contextAttributes);
181
- if (ctx) {
182
- ctx.type = CONTEXT_TYPE[i];
183
- break;
179
+ let urlParams = new URLSearchParams(location.search);
180
+ let ver = urlParams.get('og_ver');
181
+ if (ver) {
182
+ ctx = canvas.getContext(ver, contextAttributes);
183
+ ctx.type = ver;
184
+ } else {
185
+ for (let i = 0; i < CONTEXT_TYPE.length; i++) {
186
+ ctx = canvas.getContext(CONTEXT_TYPE[i], contextAttributes);
187
+ if (ctx) {
188
+ ctx.type = CONTEXT_TYPE[i];
189
+ break;
190
+ }
184
191
  }
185
192
  }
186
193
  } catch (ex) {
@@ -613,64 +620,72 @@ class Handler {
613
620
  }
614
621
 
615
622
  this.gl = Handler.getContext(this.canvas, this._params.context);
616
- this._initialized = true;
617
-
618
- /** Sets deafult extensions */
619
- this._params.extensions.push("EXT_texture_filter_anisotropic");
620
-
621
- if (this.gl.type === "webgl") {
622
- this._params.extensions.push("OES_standard_derivatives");
623
- this._params.extensions.push("OES_element_index_uint");
624
- this._params.extensions.push("WEBGL_depth_texture");
625
- this._params.extensions.push("ANGLE_instanced_arrays");
626
- //this._params.extensions.push("WEBGL_draw_buffers");
627
- //this._params.extensions.push("EXT_frag_depth");
628
- } else {
629
- this._params.extensions.push("EXT_color_buffer_float");
630
- this._params.extensions.push("OES_texture_float_linear");
631
- //this._params.extensions.push("WEBGL_draw_buffers");
632
- }
633
623
 
634
- let i = this._params.extensions.length;
635
- while (i--) {
636
- this.initializeExtension(this._params.extensions[i], true);
637
- }
624
+ if(this.gl) {
625
+ this._initialized = true;
638
626
 
639
- if (this.gl.type === "webgl") {
640
- this.createTexture_n = this.createTexture_n_webgl1.bind(this);
641
- this.createTexture_l = this.createTexture_l_webgl1.bind(this);
642
- this.createTexture_mm = this.createTexture_mm_webgl1.bind(this);
643
- this.createTexture_a = this.createTexture_a_webgl1.bind(this);
644
- } else {
645
- this.createTexture_n = this.createTexture_n_webgl2.bind(this);
646
- this.createTexture_l = this.createTexture_l_webgl2.bind(this);
647
- this.createTexture_mm = this.createTexture_mm_webgl2.bind(this);
648
- this.createTexture_a = this.createTexture_a_webgl2.bind(this);
649
- }
627
+ /** Sets default extensions */
628
+ this._params.extensions.push("EXT_texture_filter_anisotropic");
650
629
 
651
- this.createTexture["NEAREST"] = this.createTexture_n;
652
- this.createTexture["LINEAR"] = this.createTexture_l;
653
- this.createTexture["MIPMAP"] = this.createTexture_mm;
654
- this.createTexture["ANISOTROPIC"] = this.createTexture_a;
630
+ if (this.gl.type === "webgl") {
631
+ this._params.extensions.push("OES_standard_derivatives");
632
+ this._params.extensions.push("OES_element_index_uint");
633
+ this._params.extensions.push("WEBGL_depth_texture");
634
+ this._params.extensions.push("ANGLE_instanced_arrays");
635
+ //this._params.extensions.push("WEBGL_draw_buffers");
636
+ //this._params.extensions.push("EXT_frag_depth");
637
+ } else {
638
+ this._params.extensions.push("EXT_color_buffer_float");
639
+ this._params.extensions.push("OES_texture_float_linear");
640
+ //this._params.extensions.push("WEBGL_draw_buffers");
641
+ }
655
642
 
656
- if (!this.extensions.EXT_texture_filter_anisotropic) {
657
- this.createTextureDefault = this.createTexture_mm;
658
- } else {
659
- this.createTextureDefault = this.createTexture_a;
660
- }
643
+ let i = this._params.extensions.length;
644
+ while (i--) {
645
+ this.initializeExtension(this._params.extensions[i], true);
646
+ }
647
+
648
+ if (this.gl.type === "webgl") {
649
+ this.createTexture_n = this.createTexture_n_webgl1.bind(this);
650
+ this.createTexture_l = this.createTexture_l_webgl1.bind(this);
651
+ this.createTexture_mm = this.createTexture_mm_webgl1.bind(this);
652
+ this.createTexture_a = this.createTexture_a_webgl1.bind(this);
653
+ } else {
654
+ this.createTexture_n = this.createTexture_n_webgl2.bind(this);
655
+ this.createTexture_l = this.createTexture_l_webgl2.bind(this);
656
+ this.createTexture_mm = this.createTexture_mm_webgl2.bind(this);
657
+ this.createTexture_a = this.createTexture_a_webgl2.bind(this);
658
+ }
661
659
 
662
- /** Initilalize shaders and rendering parameters*/
663
- this._initPrograms();
664
- this._setDefaults();
660
+ this.createTexture["NEAREST"] = this.createTexture_n;
661
+ this.createTexture["LINEAR"] = this.createTexture_l;
662
+ this.createTexture["MIPMAP"] = this.createTexture_mm;
663
+ this.createTexture["ANISOTROPIC"] = this.createTexture_a;
665
664
 
666
- this.observer = new IntersectionObserver((entries) => {
667
- this._toggleVisibilityChange(entries[0].isIntersecting === true);
668
- }, { threshold: 0 });
669
- this.observer.observe(this.canvas);
665
+ if (!this.extensions.EXT_texture_filter_anisotropic) {
666
+ this.createTextureDefault = this.createTexture_mm;
667
+ } else {
668
+ this.createTextureDefault = this.createTexture_a;
669
+ }
670
670
 
671
- document.addEventListener("visibilitychange", () => {
672
- this._toggleVisibilityChange(document.visibilityState === 'visible');
673
- });
671
+ /** Initilalize shaders and rendering parameters*/
672
+ this._initPrograms();
673
+ this._setDefaults();
674
+
675
+ this.intersectionObserver = new IntersectionObserver((entries) => {
676
+ this._toggleVisibilityChange(entries[0].isIntersecting === true);
677
+ }, { threshold: 0 });
678
+ this.intersectionObserver.observe(this.canvas);
679
+
680
+ this.resizeObserver = new ResizeObserver(entries => {
681
+ this._toggleVisibilityChange(entries[0].contentRect.width !== 0 && entries[0].contentRect.height !== 0);
682
+ });
683
+ this.resizeObserver.observe(this.canvas);
684
+
685
+ document.addEventListener("visibilitychange", () => {
686
+ this._toggleVisibilityChange(document.visibilityState === 'visible');
687
+ });
688
+ }
674
689
  }
675
690
 
676
691
  _toggleVisibilityChange(visibility) {
@@ -123,13 +123,24 @@ export class Multisample {
123
123
  for (var i = 0; i < this.renderbuffers.length; i++) {
124
124
  let rb = gl.createRenderbuffer();
125
125
  gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
126
- gl.renderbufferStorageMultisample(
127
- gl.RENDERBUFFER,
128
- this._msaa,
129
- gl[this._internalFormat],
130
- this._width,
131
- this._height
132
- );
126
+
127
+ if (this._msaa > 0) {
128
+ gl.renderbufferStorageMultisample(
129
+ gl.RENDERBUFFER,
130
+ this._msaa,
131
+ gl[this._internalFormat],
132
+ this._width,
133
+ this._height
134
+ );
135
+ } else {
136
+ gl.renderbufferStorage(
137
+ gl.RENDERBUFFER,
138
+ gl[this._internalFormat],
139
+ this._width,
140
+ this._height
141
+ );
142
+ }
143
+
133
144
  gl.framebufferRenderbuffer(
134
145
  gl.FRAMEBUFFER,
135
146
  gl.COLOR_ATTACHMENT0 + i,
@@ -4,9 +4,9 @@
4
4
 
5
5
  "use strict";
6
6
 
7
- import { callbacks } from "./callbacks.js";
8
7
  import { cons } from "../cons.js";
9
- import { typeStr, types } from "./types.js";
8
+ import { callbacks } from "./callbacks.js";
9
+ import { types, typeStr } from "./types.js";
10
10
 
11
11
  const itemTypes = ["BYTE", "SHORT", "UNSIGNED_BYTE", "UNSIGNED_SHORT", "FLOAT", "HALF_FLOAT"];
12
12
 
@@ -1,8 +1,8 @@
1
1
  import { Framebuffer } from "./Framebuffer.js";
2
2
  import { Handler } from "./Handler.js";
3
3
  import { Multisample } from "./Multisample.js";
4
- import { types } from "./types.js";
5
4
  import { Program } from "./Program.js";
5
+ import { types } from "./types.js";
6
6
 
7
7
  export {
8
8
  Framebuffer,
@@ -10,4 +10,4 @@ export {
10
10
  Multisample,
11
11
  types,
12
12
  Program
13
- };
13
+ };
package/types/Popup.d.ts CHANGED
@@ -1,42 +1,29 @@
1
- export class Popup {
2
- static set _staticCounter(arg: any);
3
- static get _staticCounter(): any;
4
- /**
5
- *
6
- * @param {*} options
7
- */
8
- constructor(options: any);
9
- _id: number;
10
- events: Events;
11
- _template: string;
12
- el: ChildNode;
13
- _title: any;
1
+ export class Popup extends View {
14
2
  _content: any;
15
- _contentEl: any;
16
- _titleEl: any;
3
+ $content: any;
4
+ $tip: any;
5
+ $title: any;
17
6
  _planet: any;
18
7
  _offset: any;
19
8
  _lonLat: any;
20
9
  _cartPos: Vec3;
21
10
  _visibility: any;
22
- _renderTemplate(): ChildNode;
23
11
  _updatePosition(): void;
24
12
  setScreen(p: any): void;
25
13
  get clientWidth(): any;
26
14
  get clientHeight(): any;
27
15
  setOffset(x?: number, y?: number): Popup;
28
16
  render(params: any): Popup;
29
- _tipEl: any;
30
17
  setVisibility(visibility: any): Popup;
31
18
  getContainer(): any;
32
19
  getToolbarContainer(): any;
33
20
  show(): Popup;
34
21
  hide(): Popup;
35
22
  setCartesian3v(cart: any, height?: number): Popup;
36
- setTitle(html: any): Popup;
37
- setLonLat(lonLat: any): Popup;
38
- setContent(content: any): Popup;
23
+ setTitle(html: any): void;
24
+ setLonLat(lonLat: any): void;
25
+ setContent(content: any): void;
39
26
  clear(): void;
40
27
  }
41
- import { Events } from "./Events.js";
28
+ import { View } from "./ui/View.js";
42
29
  import { Vec3 } from "./math/Vec3.js";
@@ -83,6 +83,7 @@ export class PlanetCamera extends Camera {
83
83
  _completeCallback: any;
84
84
  _flying: boolean;
85
85
  _checkTerrainCollision: boolean;
86
+ _velCart: Vec3;
86
87
  setTerrainCollisionActivity(isActive: any): void;
87
88
  eyeNorm: Vec3;
88
89
  updateGeodeticPosition(): void;
@@ -43,6 +43,7 @@ export class Sun extends Control {
43
43
  _lightOn: boolean;
44
44
  _stopped: any;
45
45
  stop(): void;
46
+ start(): void;
46
47
  bindClock(clock: any): void;
47
48
  _draw(): void;
48
49
  _f: number;
@@ -21,14 +21,16 @@ export class RulerScene extends RenderNode {
21
21
  _onLclick_: any;
22
22
  _onMouseMove_: any;
23
23
  _onLdblclick_: any;
24
+ _onLUp_: any;
24
25
  _onCornerEnter_: any;
25
26
  _onCornerLeave_: any;
26
27
  _onCornerLdown_: any;
27
28
  _onCornerLup_: any;
28
29
  _deactivate(): void;
29
30
  _onCornerLdown(e: any): void;
30
- _anchorLonLat: LonLat;
31
- _onCornerLup(e: any): void;
31
+ _anchorLonLat: import("../../LonLat.js").LonLat;
32
+ _onLUp(): void;
33
+ _onCornerLup(): void;
32
34
  _onCornerEnter(e: any): void;
33
35
  _onCornerLeave(e: any): void;
34
36
  _onLdblclick(): void;
@@ -44,4 +46,3 @@ import { RenderNode } from "../../scene/RenderNode.js";
44
46
  import { Vec2 } from "../../math/Vec2.js";
45
47
  import { Entity } from "../../entity/Entity.js";
46
48
  import { Vector } from "../../layer/Vector.js";
47
- import { LonLat } from "../../LonLat.js";
@@ -5,14 +5,12 @@
5
5
  * @class
6
6
  * @param {Object} [options] - Entity options:
7
7
  * @param {string} [options.name] - A human readable name to display to users. It does not have to be unique.
8
- * @param {Vec3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label, sphere etc. cartesian position.
9
- * @param {LonLat} [options.lonlat] - Geodetic coordiantes for an entities like billboard, label, sphere etc.
8
+ * @param {Vec3|Array.<number>} [options.cartesian] - Spatial entities like billboard, label etc. cartesian position.
9
+ * @param {LonLat} [options.lonlat] - Geodetic coordiantes for an entities like billboard, label etc.
10
10
  * @param {boolean} [options.aground] - True for entities that have to be placed on the relief.
11
11
  * @param {boolean} [options.visibility] - Entity visibility.
12
12
  * @param {*} [options.billboard] - Billboard options(see {@link og.Billboard}).
13
13
  * @param {*} [options.label] - Label options(see {@link og.Label}).
14
- * @param {*} [options.sphere] - Sphere options(see {@link og.shape.Sphere}).
15
- * @param {*} [options.box] - Sphere options(see {@link og.shape.Box}).
16
14
  * @param {*} [options.polyline] - Polyline options(see {@link og.Polyline}).
17
15
  * @param {*} [options.ray] - Ray options(see {@link og.Ray}).
18
16
  * @param {*} [options.pointCloud] - Point cloud options(see {@link og.PointCloud}).
@@ -110,7 +108,6 @@ export class Entity {
110
108
  _featureConstructorArray: {
111
109
  billboard: (typeof Billboard | ((billboard: Billboard) => Billboard))[];
112
110
  label: (typeof Label | ((label: Label) => Label))[];
113
- sphere: (typeof Sphere | ((shape: BaseShape) => Polyline))[];
114
111
  polyline: (typeof Polyline | ((polyline: Polyline) => Polyline))[];
115
112
  pointCloud: (typeof PointCloud | ((pointCloud: PointCloud) => PointCloud))[];
116
113
  geometry: (typeof Geometry | ((geometry: Geometry) => Geometry))[];
@@ -130,12 +127,6 @@ export class Entity {
130
127
  * @type {Label}
131
128
  */
132
129
  public label: Label;
133
- /**
134
- * Shape entity.
135
- * @public
136
- * @type {shape.BaseShape}
137
- */
138
- public shape: shape.BaseShape;
139
130
  /**
140
131
  * Polyline entity.
141
132
  * @public
@@ -280,13 +271,6 @@ export class Entity {
280
271
  * @returns {Ray} -
281
272
  */
282
273
  public setRay(ray: Ray): Ray;
283
- /**
284
- * Sets entity shape.
285
- * @public
286
- * @param {BaseShape} shape - Shape object.
287
- * @returns {Polyline} -
288
- */
289
- public setShape(shape: BaseShape): Polyline;
290
274
  /**
291
275
  * Sets entity polyline.
292
276
  * @public
@@ -346,7 +330,6 @@ import { Vec3 } from "../math/Vec3.js";
346
330
  import { LonLat } from "../LonLat.js";
347
331
  import { Billboard } from "./Billboard.js";
348
332
  import { Label } from "./Label.js";
349
- import { Sphere } from "../shapes/Sphere.js";
350
333
  import { Polyline } from "./Polyline.js";
351
334
  import { PointCloud } from "./PointCloud.js";
352
335
  import { Geometry } from "./Geometry.js";
@@ -92,12 +92,6 @@ export class EntityCollection {
92
92
  * @type {LabelHandler}
93
93
  */
94
94
  public labelHandler: LabelHandler;
95
- /**
96
- * Shape handler
97
- * @public
98
- * @type {ShapeHandler}
99
- */
100
- public shapeHandler: ShapeHandler;
101
95
  /**
102
96
  * Polyline handler
103
97
  * @public
@@ -301,7 +295,6 @@ export class EntityCollection {
301
295
  }
302
296
  import { BillboardHandler } from "./BillboardHandler.js";
303
297
  import { LabelHandler } from "./LabelHandler.js";
304
- import { ShapeHandler } from "./ShapeHandler.js";
305
298
  import { PolylineHandler } from "./PolylineHandler.js";
306
299
  import { RayHandler } from "./RayHandler.js";
307
300
  import { PointCloudHandler } from "./PointCloudHandler.js";