@openglobus/og 0.11.5 → 0.12.0

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 (267) hide show
  1. package/css/og.css +5 -2
  2. package/package.json +12 -14
  3. package/src/og/Clock.js +6 -10
  4. package/src/og/Events.js +5 -7
  5. package/src/og/Extent.js +73 -32
  6. package/src/og/Globe.js +25 -10
  7. package/src/og/ImageCanvas.js +18 -15
  8. package/src/og/LonLat.js +13 -10
  9. package/src/og/Popup.js +19 -17
  10. package/src/og/QueueArray.js +3 -4
  11. package/src/og/Rectangle.js +4 -6
  12. package/src/og/Stack.js +2 -4
  13. package/src/og/ajax.js +20 -14
  14. package/src/og/astro/earth.js +21 -15
  15. package/src/og/bv/Box.js +2 -3
  16. package/src/og/bv/Sphere.js +10 -7
  17. package/src/og/camera/Camera.js +70 -79
  18. package/src/og/camera/Frustum.js +19 -12
  19. package/src/og/camera/PlanetCamera.js +33 -34
  20. package/src/og/control/CompassButton.js +1 -2
  21. package/src/og/control/Control.js +7 -9
  22. package/src/og/control/DebugInfo.js +2 -3
  23. package/src/og/control/EarthNavigation.js +26 -17
  24. package/src/og/control/KeyboardNavigation.js +9 -9
  25. package/src/og/control/LayerSwitcher.js +21 -20
  26. package/src/og/control/Lighting.js +74 -64
  27. package/src/og/control/MouseNavigation.js +30 -29
  28. package/src/og/control/MouseWheelZoomControl.js +257 -0
  29. package/src/og/control/SegmentBoundVisualization.js +5 -6
  30. package/src/og/control/ShowFps.js +12 -7
  31. package/src/og/control/SimpleNavigation.js +5 -7
  32. package/src/og/control/Sun.js +24 -14
  33. package/src/og/control/ToggleWireframe.js +3 -3
  34. package/src/og/control/TouchNavigation.js +43 -32
  35. package/src/og/control/ZoomControl.js +40 -24
  36. package/src/og/control/index.js +2 -0
  37. package/src/og/control/visibleExtent/Segment.js +1862 -0
  38. package/src/og/control/visibleExtent/VisibleExtent.js +80 -0
  39. package/src/og/control/visibleExtent/drawnode.js +751 -0
  40. package/src/og/ellipsoid/Ellipsoid.js +149 -57
  41. package/src/og/ellipsoid/wgs84.js +3 -3
  42. package/src/og/entity/BaseBillboard.js +72 -30
  43. package/src/og/entity/Billboard.js +9 -5
  44. package/src/og/entity/BillboardHandler.js +315 -62
  45. package/src/og/entity/Entity.js +742 -704
  46. package/src/og/entity/EntityCollection.js +47 -24
  47. package/src/og/entity/GeoObject.js +228 -0
  48. package/src/og/entity/GeoObjectHandler.js +895 -0
  49. package/src/og/entity/GeometryHandler.js +595 -123
  50. package/src/og/entity/Label.js +62 -30
  51. package/src/og/entity/LabelHandler.js +42 -243
  52. package/src/og/entity/LabelWorker.js +218 -0
  53. package/src/og/entity/Object3d.js +504 -0
  54. package/src/og/entity/PointCloud.js +76 -28
  55. package/src/og/entity/PointCloudHandler.js +5 -5
  56. package/src/og/entity/Ray.js +49 -16
  57. package/src/og/entity/Strip.js +72 -43
  58. package/src/og/entity/StripHandler.js +23 -23
  59. package/src/og/layer/BaseGeoImage.js +50 -19
  60. package/src/og/layer/CanvasTiles.js +16 -17
  61. package/src/og/layer/GeoImage.js +8 -16
  62. package/src/og/layer/GeoTexture2d.js +2 -10
  63. package/src/og/layer/GeoVideo.js +2 -10
  64. package/src/og/layer/KML.js +55 -33
  65. package/src/og/layer/Layer.js +24 -33
  66. package/src/og/layer/Material.js +1 -1
  67. package/src/og/layer/Vector.js +94 -48
  68. package/src/og/layer/WMS.js +33 -18
  69. package/src/og/layer/XYZ.js +24 -26
  70. package/src/og/light/LightSource.js +19 -12
  71. package/src/og/math/Mat3.js +24 -12
  72. package/src/og/math/Mat4.js +603 -603
  73. package/src/og/math/Plane.js +19 -18
  74. package/src/og/math/Ray.js +17 -12
  75. package/src/og/math/Vec2.js +24 -14
  76. package/src/og/math/Vec3.js +78 -32
  77. package/src/og/math/coder.js +7 -7
  78. package/src/og/proj/EPSG3857.js +3 -3
  79. package/src/og/proj/EPSG4326.js +3 -3
  80. package/src/og/proj/Proj.js +2 -4
  81. package/src/og/quadTree/Node.js +50 -95
  82. package/src/og/quadTree/quadTree.js +1 -1
  83. package/src/og/renderer/Renderer.js +106 -126
  84. package/src/og/renderer/RendererEvents.js +45 -23
  85. package/src/og/scene/BaseNode.js +2 -3
  86. package/src/og/scene/Planet.js +139 -191
  87. package/src/og/scene/RenderNode.js +15 -8
  88. package/src/og/segment/Segment.js +93 -268
  89. package/src/og/segment/Slice.js +45 -0
  90. package/src/og/shaders/drawnode.js +174 -360
  91. package/src/og/shaders/geoObject.js +211 -0
  92. package/src/og/shaders/pointCloud.js +41 -41
  93. package/src/og/shaders/shape.js +12 -18
  94. package/src/og/shaders/skybox.js +36 -36
  95. package/src/og/shaders/toneMapping.js +1 -0
  96. package/src/og/shapes/BaseShape.js +108 -36
  97. package/src/og/shapes/Icosphere.js +25 -10
  98. package/src/og/shapes/Sphere.js +8 -11
  99. package/src/og/terrain/EmptyTerrain.js +3 -2
  100. package/src/og/terrain/GlobusTerrain.js +2 -0
  101. package/src/og/utils/FontAtlas.js +6 -2
  102. package/src/og/utils/GeoImageCreator.js +5 -1
  103. package/src/og/utils/Loader.js +1 -1
  104. package/src/og/utils/PlainSegmentWorker.js +0 -13
  105. package/src/og/utils/TextureAtlas.js +18 -20
  106. package/src/og/utils/VectorTileCreator.js +1 -3
  107. package/src/og/utils/shared.js +2 -2
  108. package/src/og/webgl/Handler.js +219 -162
  109. package/src/og/webgl/Multisample.js +44 -16
  110. package/src/og/webgl/Program.js +78 -33
  111. package/src/og/webgl/callbacks.js +3 -3
  112. package/types/Clock.d.ts +0 -94
  113. package/types/Deferred.d.ts +0 -6
  114. package/types/Events.d.ts +0 -77
  115. package/types/Extent.d.ts +0 -166
  116. package/types/Globe.d.ts +0 -82
  117. package/types/ImageCanvas.d.ts +0 -123
  118. package/types/Lock.d.ts +0 -12
  119. package/types/LonLat.d.ts +0 -108
  120. package/types/Popup.d.ts +0 -42
  121. package/types/QueueArray.d.ts +0 -19
  122. package/types/Rectangle.d.ts +0 -80
  123. package/types/Stack.d.ts +0 -19
  124. package/types/ajax.d.ts +0 -24
  125. package/types/arial.d.ts +0 -48
  126. package/types/astro/astro.d.ts +0 -38
  127. package/types/astro/earth.d.ts +0 -7
  128. package/types/astro/jd.d.ts +0 -254
  129. package/types/bv/Box.d.ts +0 -30
  130. package/types/bv/Sphere.d.ts +0 -38
  131. package/types/bv/index.d.ts +0 -3
  132. package/types/camera/Camera.d.ts +0 -312
  133. package/types/camera/Frustum.d.ts +0 -133
  134. package/types/camera/PlanetCamera.d.ts +0 -218
  135. package/types/camera/index.d.ts +0 -3
  136. package/types/cons.d.ts +0 -40
  137. package/types/control/CompassButton.d.ts +0 -17
  138. package/types/control/Control.d.ts +0 -104
  139. package/types/control/DebugInfo.d.ts +0 -15
  140. package/types/control/EarthCoordinates.d.ts +0 -47
  141. package/types/control/EarthNavigation.d.ts +0 -42
  142. package/types/control/GeoImageDragControl.d.ts +0 -6
  143. package/types/control/KeyboardNavigation.d.ts +0 -21
  144. package/types/control/LayerSwitcher.d.ts +0 -21
  145. package/types/control/Lighting.d.ts +0 -16
  146. package/types/control/MouseNavigation.d.ts +0 -47
  147. package/types/control/ScaleControl.d.ts +0 -22
  148. package/types/control/ShowFps.d.ts +0 -11
  149. package/types/control/SimpleNavigation.d.ts +0 -25
  150. package/types/control/Sun.d.ts +0 -50
  151. package/types/control/ToggleWireframe.d.ts +0 -12
  152. package/types/control/TouchNavigation.d.ts +0 -48
  153. package/types/control/ZoomControl.d.ts +0 -27
  154. package/types/control/index.d.ts +0 -17
  155. package/types/ellipsoid/Ellipsoid.d.ts +0 -146
  156. package/types/ellipsoid/index.d.ts +0 -3
  157. package/types/ellipsoid/wgs84.d.ts +0 -6
  158. package/types/entity/BaseBillboard.d.ts +0 -208
  159. package/types/entity/Billboard.d.ts +0 -94
  160. package/types/entity/BillboardHandler.d.ts +0 -78
  161. package/types/entity/Entity.d.ts +0 -333
  162. package/types/entity/EntityCollection.d.ts +0 -311
  163. package/types/entity/Geometry.d.ts +0 -74
  164. package/types/entity/GeometryHandler.d.ts +0 -76
  165. package/types/entity/Label.d.ts +0 -189
  166. package/types/entity/LabelHandler.d.ts +0 -29
  167. package/types/entity/PointCloud.d.ts +0 -174
  168. package/types/entity/PointCloudHandler.d.ts +0 -38
  169. package/types/entity/Polyline.d.ts +0 -306
  170. package/types/entity/PolylineHandler.d.ts +0 -18
  171. package/types/entity/Ray.d.ts +0 -124
  172. package/types/entity/RayHandler.d.ts +0 -67
  173. package/types/entity/ShapeHandler.d.ts +0 -22
  174. package/types/entity/Strip.d.ts +0 -119
  175. package/types/entity/StripHandler.d.ts +0 -38
  176. package/types/entity/index.d.ts +0 -8
  177. package/types/index.core.d.ts +0 -65
  178. package/types/index.d.ts +0 -45
  179. package/types/index.webgl.d.ts +0 -7
  180. package/types/input/KeyboardHandler.d.ts +0 -10
  181. package/types/input/MouseHandler.d.ts +0 -5
  182. package/types/input/TouchHandler.d.ts +0 -5
  183. package/types/input/input.d.ts +0 -34
  184. package/types/layer/BaseGeoImage.d.ts +0 -94
  185. package/types/layer/CanvasTiles.d.ts +0 -68
  186. package/types/layer/GeoImage.d.ts +0 -52
  187. package/types/layer/GeoTexture2d.d.ts +0 -8
  188. package/types/layer/GeoVideo.d.ts +0 -55
  189. package/types/layer/KML.d.ts +0 -63
  190. package/types/layer/Layer.d.ts +0 -326
  191. package/types/layer/Material.d.ts +0 -45
  192. package/types/layer/Vector.d.ts +0 -208
  193. package/types/layer/WMS.d.ts +0 -63
  194. package/types/layer/XYZ.d.ts +0 -120
  195. package/types/layer/index.d.ts +0 -10
  196. package/types/light/LightSource.d.ts +0 -178
  197. package/types/math/Line2.d.ts +0 -11
  198. package/types/math/Line3.d.ts +0 -10
  199. package/types/math/Mat3.d.ts +0 -65
  200. package/types/math/Mat4.d.ts +0 -176
  201. package/types/math/Plane.d.ts +0 -18
  202. package/types/math/Quat.d.ts +0 -379
  203. package/types/math/Ray.d.ts +0 -82
  204. package/types/math/Vec2.d.ts +0 -309
  205. package/types/math/Vec3.d.ts +0 -460
  206. package/types/math/Vec4.d.ts +0 -162
  207. package/types/math/coder.d.ts +0 -43
  208. package/types/math/index.d.ts +0 -11
  209. package/types/math.d.ts +0 -261
  210. package/types/mercator.d.ts +0 -92
  211. package/types/proj/EPSG3857.d.ts +0 -6
  212. package/types/proj/EPSG4326.d.ts +0 -6
  213. package/types/proj/Proj.d.ts +0 -42
  214. package/types/quadTree/EntityCollectionNode.d.ts +0 -34
  215. package/types/quadTree/Node.d.ts +0 -61
  216. package/types/quadTree/quadTree.d.ts +0 -40
  217. package/types/renderer/Renderer.d.ts +0 -298
  218. package/types/renderer/RendererEvents.d.ts +0 -233
  219. package/types/res/images.d.ts +0 -3
  220. package/types/scene/Axes.d.ts +0 -11
  221. package/types/scene/BaseNode.d.ts +0 -60
  222. package/types/scene/Planet.d.ts +0 -577
  223. package/types/scene/RenderNode.d.ts +0 -142
  224. package/types/scene/SkyBox.d.ts +0 -10
  225. package/types/scene/index.d.ts +0 -4
  226. package/types/segment/Segment.d.ts +0 -279
  227. package/types/segment/SegmentLonLat.d.ts +0 -16
  228. package/types/segment/segmentHelper.d.ts +0 -13
  229. package/types/shaders/billboard.d.ts +0 -3
  230. package/types/shaders/depth.d.ts +0 -2
  231. package/types/shaders/drawnode.d.ts +0 -7
  232. package/types/shaders/label.d.ts +0 -4
  233. package/types/shaders/pointCloud.d.ts +0 -2
  234. package/types/shaders/polyline.d.ts +0 -3
  235. package/types/shaders/ray.d.ts +0 -2
  236. package/types/shaders/screenFrame.d.ts +0 -2
  237. package/types/shaders/shape.d.ts +0 -4
  238. package/types/shaders/skybox.d.ts +0 -2
  239. package/types/shaders/toneMapping.d.ts +0 -2
  240. package/types/shapes/BaseShape.d.ts +0 -250
  241. package/types/shapes/Sphere.d.ts +0 -41
  242. package/types/terrain/BilTerrain.d.ts +0 -7
  243. package/types/terrain/EmptyTerrain.d.ts +0 -72
  244. package/types/terrain/Geoid.d.ts +0 -26
  245. package/types/terrain/GlobusTerrain.d.ts +0 -116
  246. package/types/terrain/MapboxTerrain.d.ts +0 -7
  247. package/types/terrain/index.d.ts +0 -5
  248. package/types/utils/FontAtlas.d.ts +0 -14
  249. package/types/utils/GeoImageCreator.d.ts +0 -30
  250. package/types/utils/ImagesCacheManager.d.ts +0 -10
  251. package/types/utils/Loader.d.ts +0 -25
  252. package/types/utils/NormalMapCreator.d.ts +0 -39
  253. package/types/utils/PlainSegmentWorker.d.ts +0 -10
  254. package/types/utils/TerrainWorker.d.ts +0 -9
  255. package/types/utils/TextureAtlas.d.ts +0 -111
  256. package/types/utils/VectorTileCreator.d.ts +0 -16
  257. package/types/utils/colorTable.d.ts +0 -143
  258. package/types/utils/earcut.d.ts +0 -6
  259. package/types/utils/shared.d.ts +0 -231
  260. package/types/webgl/Framebuffer.d.ts +0 -135
  261. package/types/webgl/Handler.d.ts +0 -388
  262. package/types/webgl/Multisample.d.ts +0 -89
  263. package/types/webgl/Program.d.ts +0 -155
  264. package/types/webgl/ProgramController.d.ts +0 -89
  265. package/types/webgl/callbacks.d.ts +0 -1
  266. package/types/webgl/index.d.ts +0 -6
  267. package/types/webgl/types.d.ts +0 -2
@@ -2,11 +2,11 @@
2
2
  * @module og/shape/BaseShape
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Vec3 } from '../math/Vec3.js';
8
- import { Quat } from '../math/Quat.js';
9
- import { Mat4 } from '../math/Mat4.js';
7
+ import { Vec3 } from "../math/Vec3.js";
8
+ import { Quat } from "../math/Quat.js";
9
+ import { Mat4 } from "../math/Mat4.js";
10
10
 
11
11
  /**
12
12
  * Base geometry shape class.
@@ -20,9 +20,7 @@ import { Mat4 } from '../math/Mat4.js';
20
20
  * @param {boolean} [options.visibility] - Shape visibility.
21
21
  */
22
22
  class BaseShape {
23
-
24
23
  constructor(options) {
25
-
26
24
  options = options || {};
27
25
 
28
26
  /**
@@ -59,14 +57,16 @@ class BaseShape {
59
57
  * @public
60
58
  * @type {Array.<number>} - (exactly 4 entries)
61
59
  */
62
- this.color = options.color ? new Float32Array(options.color) : new Float32Array([1.0, 1.0, 1.0, 1.0]);
60
+ this.color = options.color
61
+ ? new Float32Array(options.color)
62
+ : new Float32Array([1.0, 1.0, 1.0, 1.0]);
63
63
 
64
64
  /**
65
65
  * Shape visibility.
66
66
  * @public
67
67
  * @type {boolean}
68
68
  */
69
- this.visibility = (options.visibility != undefined ? options.visibility : true);
69
+ this.visibility = options.visibility != undefined ? options.visibility : true;
70
70
 
71
71
  /**
72
72
  * Image url source.
@@ -206,7 +206,6 @@ class BaseShape {
206
206
  * @public
207
207
  */
208
208
  clear() {
209
-
210
209
  this.position.set(0.0, 0.0, 0.0);
211
210
  this.orientation.set(0.0, 0.0, 0.0, 1.0);
212
211
  this.scale.set(1.0, 1.0, 1.0);
@@ -305,7 +304,7 @@ class BaseShape {
305
304
  var img = new Image();
306
305
  var that = this;
307
306
  img.onload = function () {
308
- that.texture = renderNode.renderer.handler.createTexture(this);
307
+ that.texture = renderNode.renderer.handler.createTextureDefault(this);
309
308
  };
310
309
  img.src = this._src;
311
310
  }
@@ -377,10 +376,26 @@ class BaseShape {
377
376
  _createBuffers() {
378
377
  this._deleteBuffers();
379
378
  var r = this._renderNode.renderer;
380
- this._positionBuffer = r.handler.createArrayBuffer(new Float32Array(this._positionData), 3, this._positionData.length / 3);
381
- this._normalBuffer = r.handler.createArrayBuffer(new Float32Array(this._normalData), 3, this._normalData.length / 3);
382
- this._indexBuffer = r.handler.createElementArrayBuffer(new Uint16Array(this._indexData), 1, this._indexData.length);
383
- this._textureCoordBuffer = r.handler.createArrayBuffer(new Float32Array(this._textureCoordData), 2, this._textureCoordData.length / 2);
379
+ this._positionBuffer = r.handler.createArrayBuffer(
380
+ new Float32Array(this._positionData),
381
+ 3,
382
+ this._positionData.length / 3
383
+ );
384
+ this._normalBuffer = r.handler.createArrayBuffer(
385
+ new Float32Array(this._normalData),
386
+ 3,
387
+ this._normalData.length / 3
388
+ );
389
+ this._indexBuffer = r.handler.createElementArrayBuffer(
390
+ new Uint16Array(this._indexData),
391
+ 1,
392
+ this._indexData.length
393
+ );
394
+ this._textureCoordBuffer = r.handler.createArrayBuffer(
395
+ new Float32Array(this._textureCoordData),
396
+ 2,
397
+ this._textureCoordData.length / 2
398
+ );
384
399
  }
385
400
 
386
401
  /**
@@ -400,9 +415,11 @@ class BaseShape {
400
415
  let rn = this._renderNode;
401
416
  let r = rn.renderer;
402
417
 
403
- let sh, p,
418
+ let sh,
419
+ p,
404
420
  gl = r.handler.gl,
405
- sha, shu;
421
+ sha,
422
+ shu;
406
423
 
407
424
  if (rn.lightEnabled) {
408
425
  sh = r.handler.programs.shape_wl;
@@ -415,12 +432,23 @@ class BaseShape {
415
432
  gl.uniform4fv(shu.lightsPositions, rn._lightsTransformedPositions);
416
433
  gl.uniform3fv(shu.lightsParamsv, rn._lightsParamsv);
417
434
  gl.uniform1fv(shu.lightsParamsf, rn._lightsParamsf);
418
- gl.uniformMatrix4fv(shu.projectionMatrix, false, r.activeCamera.getProjectionMatrix());
435
+ gl.uniformMatrix4fv(
436
+ shu.projectionMatrix,
437
+ false,
438
+ r.activeCamera.getProjectionMatrix()
439
+ );
419
440
  gl.uniformMatrix4fv(shu.viewMatrix, false, r.activeCamera.getViewMatrix());
420
441
  gl.uniformMatrix3fv(shu.normalMatrix, false, r.activeCamera.getNormalMatrix());
421
442
 
422
443
  gl.bindBuffer(gl.ARRAY_BUFFER, this._normalBuffer);
423
- gl.vertexAttribPointer(sha.aVertexNormal, this._normalBuffer.itemSize, gl.FLOAT, false, 0, 0);
444
+ gl.vertexAttribPointer(
445
+ sha.aVertexNormal,
446
+ this._normalBuffer.itemSize,
447
+ gl.FLOAT,
448
+ false,
449
+ 0,
450
+ 0
451
+ );
424
452
  } else {
425
453
  sh = r.handler.programs.shape_nl;
426
454
  p = sh._program;
@@ -429,13 +457,24 @@ class BaseShape {
429
457
 
430
458
  sh.activate();
431
459
 
432
- gl.uniformMatrix4fv(shu.projectionViewMatrix, false, r.activeCamera.getProjectionViewMatrix());
460
+ gl.uniformMatrix4fv(
461
+ shu.projectionViewMatrix,
462
+ false,
463
+ r.activeCamera.getProjectionViewMatrix()
464
+ );
433
465
  }
434
466
 
435
467
  gl.uniform4fv(shu.uColor, this.color);
436
468
 
437
469
  gl.bindBuffer(gl.ARRAY_BUFFER, this._positionBuffer);
438
- gl.vertexAttribPointer(sha.aVertexPosition, this._positionBuffer.itemSize, gl.FLOAT, false, 0, 0);
470
+ gl.vertexAttribPointer(
471
+ sha.aVertexPosition,
472
+ this._positionBuffer.itemSize,
473
+ gl.FLOAT,
474
+ false,
475
+ 0,
476
+ 0
477
+ );
439
478
  gl.uniformMatrix4fv(shu.modelMatrix, false, this._mxModel._m);
440
479
 
441
480
  gl.activeTexture(gl.TEXTURE0);
@@ -443,41 +482,74 @@ class BaseShape {
443
482
  gl.uniform1i(shu.uSampler, 0);
444
483
 
445
484
  gl.bindBuffer(gl.ARRAY_BUFFER, this._textureCoordBuffer);
446
- gl.vertexAttribPointer(sha.aTextureCoord, this._textureCoordBuffer.itemSize, gl.FLOAT, false, 0, 0);
485
+ gl.vertexAttribPointer(
486
+ sha.aTextureCoord,
487
+ this._textureCoordBuffer.itemSize,
488
+ gl.FLOAT,
489
+ false,
490
+ 0,
491
+ 0
492
+ );
447
493
 
448
494
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
449
- gl.drawElements(r.handler.gl.TRIANGLES, this._indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);
495
+ gl.drawElements(
496
+ r.handler.gl.TRIANGLES,
497
+ this._indexBuffer.numItems,
498
+ gl.UNSIGNED_SHORT,
499
+ 0
500
+ );
450
501
  }
451
502
  }
452
503
 
453
- drawPicking() {
504
+ drawPicking() {
454
505
  if (this.visibility) {
455
506
  let rn = this._renderNode;
456
507
  let r = rn.renderer;
457
508
 
458
- let sh, p,
509
+ let sh,
510
+ p,
459
511
  gl = r.handler.gl,
460
- sha, shu;
512
+ sha,
513
+ shu;
461
514
 
515
+ sh = r.handler.programs.shape_picking;
516
+ p = sh._program;
517
+ shu = p.uniforms;
518
+ sha = p.attributes;
462
519
 
520
+ sh.activate();
463
521
 
464
- sh = r.handler.programs.shape_picking;
465
- p = sh._program;
466
- shu = p.uniforms;
467
- sha = p.attributes;
468
-
469
- sh.activate();
470
-
471
- gl.uniformMatrix4fv(shu.projectionViewMatrix, false, r.activeCamera.getProjectionViewMatrix());
522
+ gl.uniformMatrix4fv(
523
+ shu.projectionViewMatrix,
524
+ false,
525
+ r.activeCamera.getProjectionViewMatrix()
526
+ );
472
527
 
473
- gl.uniform4fv(shu.uColor, [this._pickingColor[0], this._pickingColor[1], this._pickingColor[2], 1.0]);
528
+ gl.uniform4fv(shu.uColor, [
529
+ this._pickingColor[0],
530
+ this._pickingColor[1],
531
+ this._pickingColor[2],
532
+ 1.0
533
+ ]);
474
534
 
475
535
  gl.bindBuffer(gl.ARRAY_BUFFER, this._positionBuffer);
476
- gl.vertexAttribPointer(sha.aVertexPosition, this._positionBuffer.itemSize, gl.FLOAT, false, 0, 0);
536
+ gl.vertexAttribPointer(
537
+ sha.aVertexPosition,
538
+ this._positionBuffer.itemSize,
539
+ gl.FLOAT,
540
+ false,
541
+ 0,
542
+ 0
543
+ );
477
544
  gl.uniformMatrix4fv(shu.modelMatrix, false, this._mxModel._m);
478
545
 
479
546
  gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
480
- gl.drawElements(r.handler.gl.TRIANGLES, this._indexBuffer.numItems, gl.UNSIGNED_SHORT, 0);
547
+ gl.drawElements(
548
+ r.handler.gl.TRIANGLES,
549
+ this._indexBuffer.numItems,
550
+ gl.UNSIGNED_SHORT,
551
+ 0
552
+ );
481
553
  }
482
554
  }
483
555
  }
@@ -2,9 +2,9 @@
2
2
  * @module og/shape/BaseShape
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { BaseShape } from './BaseShape.js';
7
+ import { BaseShape } from "./BaseShape.js";
8
8
 
9
9
  /**
10
10
  * @class
@@ -45,7 +45,11 @@ class Icosphere extends BaseShape {
45
45
  // add vertex to mesh, fix position to be on unit sphere, return index
46
46
  _addVertex(p) {
47
47
  var length = Math.sqrt(p[0] * p[0] + p[1] * p[1] + p[2] * p[2]);
48
- this._positionData.push(this._size * p[0] / length, this._size * p[1] / length, this._size * p[2] / length);
48
+ this._positionData.push(
49
+ (this._size * p[0]) / length,
50
+ (this._size * p[1]) / length,
51
+ (this._size * p[2]) / length
52
+ );
49
53
  return this._index++;
50
54
  }
51
55
 
@@ -63,9 +67,21 @@ class Icosphere extends BaseShape {
63
67
  return ret;
64
68
  }
65
69
 
66
- var point1 = [this._positionData[p1 * 3], this._positionData[p1 * 3 + 1], this._positionData[p1 * 3 + 2]];
67
- var point2 = [this._positionData[p2 * 3], this._positionData[p2 * 3 + 1], this._positionData[p2 * 3 + 2]];
68
- var middle = [(point1[0] + point2[0]) / 2.0, (point1[1] + point2[1]) / 2.0, (point1[2] + point2[2]) / 2.0];
70
+ var point1 = [
71
+ this._positionData[p1 * 3],
72
+ this._positionData[p1 * 3 + 1],
73
+ this._positionData[p1 * 3 + 2]
74
+ ];
75
+ var point2 = [
76
+ this._positionData[p2 * 3],
77
+ this._positionData[p2 * 3 + 1],
78
+ this._positionData[p2 * 3 + 2]
79
+ ];
80
+ var middle = [
81
+ (point1[0] + point2[0]) / 2.0,
82
+ (point1[1] + point2[1]) / 2.0,
83
+ (point1[2] + point2[2]) / 2.0
84
+ ];
69
85
 
70
86
  // add vertex makes sure point is on unit sphere
71
87
  var i = this._addVertex(middle);
@@ -79,7 +95,6 @@ class Icosphere extends BaseShape {
79
95
  * @virtual
80
96
  */
81
97
  _createData() {
82
-
83
98
  this._positionData = [];
84
99
  this._indexData = [];
85
100
  this._index = 0;
@@ -113,7 +128,7 @@ class Icosphere extends BaseShape {
113
128
  faces.push([0, 7, 10]);
114
129
  faces.push([0, 10, 11]);
115
130
 
116
- // 5 adjacent faces
131
+ // 5 adjacent faces
117
132
  faces.push([1, 5, 9]);
118
133
  faces.push([5, 11, 4]);
119
134
  faces.push([11, 10, 2]);
@@ -127,7 +142,7 @@ class Icosphere extends BaseShape {
127
142
  faces.push([3, 6, 8]);
128
143
  faces.push([3, 8, 9]);
129
144
 
130
- // 5 adjacent faces
145
+ // 5 adjacent faces
131
146
  faces.push([4, 9, 5]);
132
147
  faces.push([2, 4, 11]);
133
148
  faces.push([6, 2, 10]);
@@ -161,4 +176,4 @@ class Icosphere extends BaseShape {
161
176
  }
162
177
  }
163
178
 
164
- export { Icosphere };
179
+ export { Icosphere };
@@ -2,9 +2,9 @@
2
2
  * @module og/shape/BaseShape
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { BaseShape } from './BaseShape.js';
7
+ import { BaseShape } from "./BaseShape.js";
8
8
 
9
9
  /**
10
10
  * @class
@@ -21,11 +21,9 @@ import { BaseShape } from './BaseShape.js';
21
21
  * @param {number} [options.lonBands=16] - Number of longitude bands.
22
22
  */
23
23
  class Sphere extends BaseShape {
24
-
25
24
  constructor(options) {
26
-
27
25
  super(options);
28
-
26
+
29
27
  /**
30
28
  * Sphere radius.
31
29
  * @protected
@@ -57,20 +55,19 @@ class Sphere extends BaseShape {
57
55
  * @virtual
58
56
  */
59
57
  _createData() {
60
-
61
58
  for (let latNumber = 0; latNumber <= this._latBands; latNumber++) {
62
- var theta = latNumber * Math.PI / this._latBands;
59
+ var theta = (latNumber * Math.PI) / this._latBands;
63
60
  var sinTheta = Math.sin(theta);
64
61
  var cosTheta = Math.cos(theta);
65
62
 
66
63
  for (let longNumber = 0; longNumber <= this._lonBands; longNumber++) {
67
- var phi = longNumber * 2 * Math.PI / this._lonBands;
64
+ var phi = (longNumber * 2 * Math.PI) / this._lonBands;
68
65
  var sinPhi = Math.sin(phi);
69
66
  var cosPhi = Math.cos(phi);
70
67
  var x = cosPhi * sinTheta;
71
68
  var y = cosTheta;
72
69
  var z = sinPhi * sinTheta;
73
- var u = 1 - (longNumber / this._lonBands);
70
+ var u = 1 - longNumber / this._lonBands;
74
71
  var v = latNumber / this._latBands;
75
72
  this._normalData.push(x);
76
73
  this._normalData.push(y);
@@ -85,7 +82,7 @@ class Sphere extends BaseShape {
85
82
 
86
83
  for (let latNumber = 0; latNumber < this._latBands; latNumber++) {
87
84
  for (let longNumber = 0; longNumber < this._lonBands; longNumber++) {
88
- var first = (latNumber * (this._lonBands + 1)) + longNumber;
85
+ var first = latNumber * (this._lonBands + 1) + longNumber;
89
86
  var second = first + this._lonBands + 1;
90
87
 
91
88
  this._indexData.push(first);
@@ -100,4 +97,4 @@ class Sphere extends BaseShape {
100
97
  }
101
98
  }
102
99
 
103
- export { Sphere };
100
+ export { Sphere };
@@ -14,7 +14,9 @@ class EmptyTerrain {
14
14
  constructor(options = {}) {
15
15
  this.equalizeVertices = false;
16
16
 
17
- this.equalizeNormals = false;
17
+ this.equalizeNormals = false;
18
+
19
+ this.isEmpty = true;
18
20
 
19
21
  /**
20
22
  * Provider name is "empty"
@@ -106,7 +108,6 @@ class EmptyTerrain {
106
108
 
107
109
  set geoid(geoid) {
108
110
  this._geoid = geoid;
109
- //...this._planet
110
111
  }
111
112
 
112
113
  get geoid() {
@@ -66,6 +66,8 @@ class GlobusTerrain extends EmptyTerrain {
66
66
  */
67
67
  this.events = new Events(EVENT_NAMES, this);
68
68
 
69
+ this.isEmpty = false;
70
+
69
71
  this.equalizeNormals = true;
70
72
 
71
73
  /**
@@ -138,10 +138,14 @@ class FontAtlas {
138
138
 
139
139
  let img = new Image();
140
140
  img.onload = () => {
141
- atlas.createTexture(img);
141
+ this._createTexture(atlas, img);
142
142
  def.resolve(index);
143
143
  };
144
144
  img.src = ARIAL_FONT_B64;
145
+ }
146
+
147
+ _createTexture(atlas, img) {
148
+ atlas.createTexture(img);
145
149
  }
146
150
 
147
151
  loadFont(faceName, srcDir, atlasUrl) {
@@ -183,7 +187,7 @@ class FontAtlas {
183
187
 
184
188
  let img = new Image();
185
189
  img.onload = () => {
186
- atlas.createTexture(img);
190
+ this._createTexture(atlas, img);
187
191
  def.resolve(index);
188
192
  };
189
193
 
@@ -151,7 +151,11 @@ export class GeoImageCreator {
151
151
  `precision highp float;
152
152
  uniform sampler2D sourceTexture;
153
153
  varying vec2 v_texCoords;
154
- void main () {
154
+ void main () {
155
+ if(v_texCoords.x <= 0.001 || v_texCoords.x >= 0.999 ||
156
+ v_texCoords.y <= 0.001 || v_texCoords.y >= 0.999) {
157
+ discard;
158
+ }
155
159
  gl_FragColor = texture2D(sourceTexture, v_texCoords);
156
160
  }`
157
161
  }));
@@ -16,7 +16,7 @@ if (window && !('createImageBitmap' in window)) {
16
16
 
17
17
  export class Loader {
18
18
 
19
- constructor(maxRequests = 12) {
19
+ constructor(maxRequests = 24) {
20
20
 
21
21
  this.MAX_REQUESTS = maxRequests;
22
22
 
@@ -222,19 +222,6 @@ const _programm = `
222
222
  res.x = nc * Math.sin(lonrad);
223
223
  res.y = (N * (1.0 - E2) + h) * slt;
224
224
  res.z = nc * Math.cos(lonrad);
225
-
226
- //let cosLat = Math.cos(lat * RADIANS)
227
- //let sinLat = Math.sin(lat * RADIANS)
228
-
229
- //let cosLong = Math.cos(lon * RADIANS)
230
- //let sinLong = Math.sin(lon * RADIANS)
231
-
232
- //let c = 1.0 / Math.sqrt(cosLat * cosLat + (1 - f) * (1 - f) * sinLat * sinLat)
233
- //s = (1 - f) * (1 - f) * c
234
-
235
- //x = (R*c + altitude) * cosLat * cosLong
236
- //y = (R*c + altitude) * cosLat * sinLong
237
- //z = (R*s + altitude) * sinLat
238
225
  };
239
226
 
240
227
  var lonLatToCartesianInverse = function (lon, lat, heightFactor, res){
@@ -1,11 +1,11 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- import { ImageCanvas } from '../ImageCanvas.js';
4
- import { Rectangle } from '../Rectangle.js';
5
- import { ImagesCacheManager } from './ImagesCacheManager.js';
3
+ import { ImageCanvas } from "../ImageCanvas.js";
4
+ import { Rectangle } from "../Rectangle.js";
5
+ import { ImagesCacheManager } from "./ImagesCacheManager.js";
6
6
 
7
7
  /**
8
- * Texture atlas stores images in one texture. Each image has its own
8
+ * Texture atlas stores images in one texture. Each image has its own
9
9
  * atlas texture coordinates.
10
10
  * @class
11
11
  * @param {number} [width] - Texture atlas width, if it hasn't 1024 default.
@@ -13,7 +13,6 @@ import { ImagesCacheManager } from './ImagesCacheManager.js';
13
13
  */
14
14
  class TextureAtlas {
15
15
  constructor(width, height) {
16
-
17
16
  /**
18
17
  * Atlas nodes where input images store. It can be access by image.__nodeIndex.
19
18
  * @public
@@ -93,12 +92,11 @@ class TextureAtlas {
93
92
  * Adds image to the atlas and returns creted node with texture coordinates of the stored image.
94
93
  * @public
95
94
  * @param {Object} image - Input javascript image object.
96
- * @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
95
+ * @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
97
96
  * and store image in the curent atlas sheme.
98
97
  * @returns {utils.TextureAtlasNode} -
99
98
  */
100
99
  addImage(image, fastInsert) {
101
-
102
100
  if (!(image.width && image.height)) {
103
101
  return;
104
102
  }
@@ -145,11 +143,10 @@ class TextureAtlas {
145
143
  /**
146
144
  * Main atlas making function.
147
145
  * @private
148
- * @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
146
+ * @param {boolean} [fastInsert] - If it's true atlas doesnt restore all images again
149
147
  * and store image in the curent atlas sheme.
150
148
  */
151
149
  _makeAtlas(fastInsert) {
152
-
153
150
  if (fastInsert && this._btree) {
154
151
  let im = this._images[this._images.length - 1];
155
152
  this._completeNode(this.nodes, this._btree.insert(im));
@@ -157,10 +154,15 @@ class TextureAtlas {
157
154
  let im = this._images.slice(0);
158
155
 
159
156
  im.sort(function (b, a) {
160
- return ((a.atlasWidth || a.width) - (b.atlasWidth || b.width)) || ((a.atlasHeight || a.height) - (b.atlasHeight || b.height));
157
+ return (
158
+ (a.atlasWidth || a.width) - (b.atlasWidth || b.width) ||
159
+ (a.atlasHeight || a.height) - (b.atlasHeight || b.height)
160
+ );
161
161
  });
162
162
 
163
- this._btree = new TextureAtlasNode(new Rectangle(0, 0, this.canvas.getWidth(), this.canvas.getHeight()));
163
+ this._btree = new TextureAtlasNode(
164
+ new Rectangle(0, 0, this.canvas.getWidth(), this.canvas.getHeight())
165
+ );
164
166
  this._btree.atlas = this;
165
167
 
166
168
  this.clearCanvas();
@@ -178,19 +180,19 @@ class TextureAtlas {
178
180
  * Creates atlas gl texture.
179
181
  * @public
180
182
  */
181
- createTexture(img) {
183
+ createTexture(img, internalFormat) {
182
184
  if (this._handler) {
183
185
  this._handler.gl.deleteTexture(this.texture);
184
186
  if (img) {
185
187
  this.canvas.resize(img.width, img.height);
186
188
  this.canvas.drawImage(img, 0, 0, img.width, img.height);
187
189
  }
188
- this.texture = this._handler.createTexture_l(this.canvas._canvas);
190
+ this.texture = this._handler.createTexture_l(this.canvas._canvas, internalFormat);
189
191
  }
190
192
  }
191
193
 
192
194
  /**
193
- * Image handler callback.
195
+ * Image handler callback.
194
196
  * @callback Object~successCallback
195
197
  * @param {Image} img - Loaded image.
196
198
  */
@@ -227,9 +229,7 @@ class TextureAtlasNode {
227
229
  }
228
230
 
229
231
  insert(img) {
230
-
231
232
  if (this.childNodes) {
232
-
233
233
  var newNode = this.childNodes[0].insert(img);
234
234
 
235
235
  if (newNode != null) {
@@ -237,9 +237,7 @@ class TextureAtlasNode {
237
237
  }
238
238
 
239
239
  return this.childNodes[1].insert(img);
240
-
241
240
  } else {
242
-
243
241
  if (this.image != null) {
244
242
  return null;
245
243
  }
@@ -279,4 +277,4 @@ class TextureAtlasNode {
279
277
  }
280
278
  }
281
279
 
282
- export { TextureAtlas, TextureAtlasNode };
280
+ export { TextureAtlas, TextureAtlasNode };
@@ -217,8 +217,6 @@ export class VectorTileCreator {
217
217
 
218
218
  // var prevLayerId = -1;
219
219
 
220
- var extentParams = new Float32Array(4);
221
-
222
220
  var extentParamsHigh = new Float32Array(4);
223
221
  var extentParamsLow = new Float32Array(4);
224
222
 
@@ -245,7 +243,7 @@ export class VectorTileCreator {
245
243
 
246
244
  f.bindOutputTexture(texture);
247
245
 
248
- gl.clearColor(1.0, 1.0, 1.0, 0.0);
246
+ gl.clearColor(0.0, 0.0, 0.0, 0.0);
249
247
  gl.clear(gl.COLOR_BUFFER_BIT);
250
248
 
251
249
  var extent = material.segment.getExtentMerc();
@@ -752,7 +752,7 @@ export function concatTypedArrays(a, b) {
752
752
  * @param {TypedArray | Array} a
753
753
  * @param {TypedArray | Array} b
754
754
  */
755
- export function concatArrays(a, b) {
755
+ export function concatArrays(a = [], b) {
756
756
  if (ArrayBuffer.isView(a)) {
757
757
  return concatTypedArrays(a, b);
758
758
  } else {
@@ -940,4 +940,4 @@ export function cloneArray(items) {
940
940
  */
941
941
  export function isUndef(obj) {
942
942
  return obj === void 0;
943
- }
943
+ }