@openglobus/og 0.13.7 → 0.13.10

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 (106) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +388 -129
  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 +20 -19
  9. package/src/og/Globe.js +15 -16
  10. package/src/og/Object3d.js +417 -0
  11. package/src/og/arial.js +1705 -1703
  12. package/src/og/camera/Camera.js +640 -640
  13. package/src/og/control/EarthCoordinates.js +1 -1
  14. package/src/og/control/GeoImageDragControl.js +102 -75
  15. package/src/og/control/LayerAnimation.js +383 -0
  16. package/src/og/control/LayerSwitcher.js +506 -159
  17. package/src/og/control/Lighting.js +27 -27
  18. package/src/og/control/MouseNavigation.js +460 -460
  19. package/src/og/control/RulerSwitcher.js +69 -0
  20. package/src/og/control/Sun.js +170 -170
  21. package/src/og/control/UIhelpers.js +146 -0
  22. package/src/og/control/ZoomControl.js +0 -2
  23. package/src/og/control/index.js +5 -1
  24. package/src/og/control/ruler/Ruler.js +43 -0
  25. package/src/og/control/ruler/RulerScene.js +374 -0
  26. package/src/og/control/visibleExtent/Segment.js +3 -5
  27. package/src/og/ellipsoid/Ellipsoid.js +19 -0
  28. package/src/og/ellipsoid/wgs84.js +1 -1
  29. package/src/og/entity/Entity.js +1 -1
  30. package/src/og/entity/GeoObject.js +1 -1
  31. package/src/og/entity/LabelHandler.js +6 -2
  32. package/src/og/entity/LabelWorker.js +38 -53
  33. package/src/og/layer/BaseGeoImage.js +347 -312
  34. package/src/og/layer/CanvasTiles.js +312 -290
  35. package/src/og/layer/GeoImage.js +222 -214
  36. package/src/og/layer/GeoVideo.js +291 -291
  37. package/src/og/layer/Layer.js +94 -70
  38. package/src/og/layer/Material.js +109 -109
  39. package/src/og/layer/Vector.js +81 -14
  40. package/src/og/layer/XYZ.js +23 -11
  41. package/src/og/light/LightSource.js +364 -363
  42. package/src/og/math/Vec3.js +1 -1
  43. package/src/og/math.js +6 -6
  44. package/src/og/quadTree/Node.js +8 -6
  45. package/src/og/renderer/Renderer.js +2 -3
  46. package/src/og/res/images.js +0 -2
  47. package/src/og/scene/Planet.js +106 -44
  48. package/src/og/segment/Segment.js +34 -64
  49. package/src/og/segment/Slice.js +1 -1
  50. package/src/og/shaders/drawnode.js +1 -1
  51. package/src/og/shaders/label.js +30 -42
  52. package/src/og/terrain/GlobusTerrain.js +31 -20
  53. package/src/og/terrain/MapboxTerrain.js +1 -1
  54. package/src/og/utils/BaseWorker.js +46 -0
  55. package/src/og/utils/FontAtlas.js +1 -2
  56. package/src/og/utils/GeoImageCreator.js +164 -161
  57. package/src/og/utils/Loader.js +187 -153
  58. package/src/og/utils/NormalMapCreator.js +403 -412
  59. package/src/og/utils/PlainSegmentWorker.js +29 -55
  60. package/src/og/utils/TerrainWorker.js +572 -589
  61. package/src/og/utils/VectorTileCreator.js +1 -1
  62. package/src/og/utils/functionComposition.js +13 -0
  63. package/src/og/webgl/Handler.js +42 -41
  64. package/src/og/webgl/ProgramController.js +143 -143
  65. package/types/Object3d.d.ts +22 -0
  66. package/types/arial.d.ts +1 -0
  67. package/types/camera/PlanetCamera.d.ts +4 -0
  68. package/types/control/GeoImageDragControl.d.ts +2 -0
  69. package/types/control/LayerAnimation.d.ts +73 -0
  70. package/types/control/LayerSwitcher.d.ts +55 -11
  71. package/types/control/MouseNavigation.d.ts +1 -0
  72. package/types/control/MouseWheelZoomControl.d.ts +1 -0
  73. package/types/control/Sun.d.ts +2 -1
  74. package/types/control/TouchNavigation.d.ts +1 -0
  75. package/types/control/UIhelpers.d.ts +13 -0
  76. package/types/control/index.d.ts +3 -1
  77. package/types/control/ruler/Ruler.d.ts +13 -0
  78. package/types/control/ruler/RulerScene.d.ts +48 -0
  79. package/types/ellipsoid/Ellipsoid.d.ts +8 -0
  80. package/types/entity/LabelHandler.d.ts +2 -0
  81. package/types/entity/LabelWorker.d.ts +5 -7
  82. package/types/layer/BaseGeoImage.d.ts +9 -1
  83. package/types/layer/CanvasTiles.d.ts +5 -1
  84. package/types/layer/GeoImage.d.ts +1 -0
  85. package/types/layer/GeoTexture2d.d.ts +1 -0
  86. package/types/layer/Layer.d.ts +28 -32
  87. package/types/layer/Vector.d.ts +9 -0
  88. package/types/layer/WMS.d.ts +1 -0
  89. package/types/layer/XYZ.d.ts +8 -5
  90. package/types/math.d.ts +2 -2
  91. package/types/quadTree/EntityCollectionNode.d.ts +7 -0
  92. package/types/quadTree/Node.d.ts +1 -2
  93. package/types/renderer/Renderer.d.ts +1 -1
  94. package/types/renderer/RendererEvents.d.ts +16 -0
  95. package/types/res/images.d.ts +0 -1
  96. package/types/scene/Planet.d.ts +21 -6
  97. package/types/segment/SegmentLonLat.d.ts +2 -0
  98. package/types/terrain/BilTerrain.d.ts +6 -0
  99. package/types/terrain/GlobusTerrain.d.ts +7 -0
  100. package/types/terrain/MapboxTerrain.d.ts +8 -0
  101. package/types/utils/BaseWorker.d.ts +14 -0
  102. package/types/utils/Loader.d.ts +4 -1
  103. package/types/utils/PlainSegmentWorker.d.ts +4 -6
  104. package/types/utils/TerrainWorker.d.ts +4 -6
  105. package/types/utils/functionComposition.d.ts +5 -0
  106. package/types/webgl/Handler.d.ts +4 -1
@@ -194,7 +194,7 @@ export class Vec3 {
194
194
  * @returns {Vec3} -
195
195
  */
196
196
  static lerp(v1, v2, l) {
197
- return Vec3(v1.x + (v2.x - v1.x) * l, v1.y + (v2.y - v1.y) * l, v1.z + (v2.z - v1.z) * l);
197
+ return new Vec3(v1.x + (v2.x - v1.x) * l, v1.y + (v2.y - v1.y) * l, v1.z + (v2.z - v1.z) * l);
198
198
  }
199
199
 
200
200
  /**
package/src/og/math.js CHANGED
@@ -135,12 +135,12 @@ export function isPowerOfTwo(x) {
135
135
  * @param {number} x - Input value.
136
136
  * @returns {number} -
137
137
  */
138
- export function nextHighestPowerOfTwo(x) {
138
+ export function nextHighestPowerOfTwo(x, maxValue = 4096) {
139
139
  --x;
140
140
  for (var i = 1; i < 32; i <<= 1) {
141
141
  x = x | (x >> i);
142
142
  }
143
- return x + 1;
143
+ return (x + 1) > maxValue ? maxValue : x + 1
144
144
  }
145
145
 
146
146
  /**
@@ -200,15 +200,15 @@ export function mod(m, n) {
200
200
  * @returns {number} -
201
201
  */
202
202
  export function zeroTwoPI(a) {
203
- var mod = mod(a, TWO_PI);
204
- if (Math.abs(mod) < EPSILON14 && Math.abs(a) > EPSILON14) {
203
+ const res = mod(a, TWO_PI);
204
+ if (Math.abs(res) < EPSILON14 && Math.abs(a) > EPSILON14) {
205
205
  return TWO_PI;
206
206
  }
207
- return mod;
207
+ return res;
208
208
  }
209
209
 
210
210
  /**
211
- * Returns 0.0 if x is smaller then edge and otherwise 1.0.
211
+ * Returns 0.0 if x is smaller than edge and otherwise 1.0.
212
212
  * @function
213
213
  * @param {number} edge -
214
214
  * @param {number} x - Value to edge.
@@ -75,8 +75,7 @@ class Node {
75
75
  this.sideSizeLog2 = [0, 0, 0, 0];
76
76
  this.ready = false;
77
77
  this.neighbors = [[], [], [], []];
78
- this.equalizedNeighborId = [-1, -1, -1, -1];
79
- this.equalizedNeighborGridSize = [-1, -1, -1, -1];
78
+ this.equalizedSideWithNodeId = [this.nodeId, this.nodeId, this.nodeId, this.nodeId];
80
79
  this.nodes = [null, null, null, null];
81
80
  this.segment = new SegmentPrototype(this, planet, tileZoom, extent);
82
81
  this._cameraInside = false;
@@ -284,7 +283,7 @@ class Node {
284
283
  } else if (
285
284
  seg.terrainReady &&
286
285
  seg.tileZoom < planet.terrain._maxNodeZoom &&
287
- (!maxZoom || maxZoom && cam.projectedSize(seg.bsphere.center, seg.bsphere.radius) > this.planet._maxLodSize)) {
286
+ (!maxZoom || cam.projectedSize(seg.bsphere.center, seg.bsphere.radius) > this.planet._maxLodSize)) {
288
287
  this.traverseNodes(cam, maxZoom, seg, stopLoading);
289
288
  } else if (altVis) {
290
289
  seg.passReady = maxZoom ? seg.terrainReady : false;
@@ -639,6 +638,9 @@ class Node {
639
638
  let tempVertices, tempVerticesHigh, tempVerticesLow, noDataVertices;
640
639
 
641
640
  this.appliedTerrainNodeId = pn.nodeId;
641
+ this.equalizedSideWithNodeId[N] = this.equalizedSideWithNodeId[E] =
642
+ this.equalizedSideWithNodeId[S] = this.equalizedSideWithNodeId[W] = this.appliedTerrainNodeId;
643
+
642
644
 
643
645
  let gridSize = pn.segment.gridSize / dZ2,
644
646
  gridSizeExt = pn.segment.fileGridSize / dZ2;
@@ -819,6 +821,8 @@ class Node {
819
821
  seg.terrainVerticesLow = tempVerticesLow;
820
822
 
821
823
  this.appliedTerrainNodeId = this.nodeId;
824
+ this.equalizedSideWithNodeId[N] = this.equalizedSideWithNodeId[E] =
825
+ this.equalizedSideWithNodeId[S] = this.equalizedSideWithNodeId[W] = this.appliedTerrainNodeId;
822
826
 
823
827
  if (pn.segment.terrainExists) {
824
828
  seg.terrainExists = true;
@@ -883,9 +887,7 @@ class Node {
883
887
  clearTree() {
884
888
  var state = this.getState();
885
889
 
886
- if (state === NOTRENDERING) {
887
- this.destroyBranches();
888
- } else if (state === RENDERING) {
890
+ if (state === NOTRENDERING || state === RENDERING) {
889
891
  this.destroyBranches();
890
892
  } else {
891
893
  for (var i = 0; i < this.nodes.length; i++) {
@@ -15,7 +15,6 @@ import { FontAtlas } from "../utils/FontAtlas.js";
15
15
  import { TextureAtlas } from "../utils/TextureAtlas.js";
16
16
  import * as arial from "../arial.js";
17
17
  import { depth } from "../shaders/depth.js";
18
- import { ARIAL_FONT_B64 } from "../res/images.js";
19
18
  import { LabelWorker } from "../entity/LabelWorker.js";
20
19
 
21
20
  let __pickingCallbackCounter__ = 0;
@@ -478,7 +477,7 @@ class Renderer {
478
477
  };
479
478
  }
480
479
 
481
- this.handler.onCanvasResize = () => {
480
+ this.handler.ONCANVASRESIZE = () => {
482
481
  this.resize();
483
482
  this.events.dispatch(this.events.resize, this.handler.canvas);
484
483
  };
@@ -497,7 +496,7 @@ class Renderer {
497
496
 
498
497
  this.outputTexture = this.screenTexture.screen;
499
498
 
500
- this.fontAtlas.initFont("arial", arial.data, ARIAL_FONT_B64);
499
+ this.fontAtlas.initFont("arial", arial.data, arial.image);
501
500
  }
502
501
 
503
502
  setCurrentScreen(screenName) {