@openglobus/og 0.15.3 → 0.15.4

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 (57) hide show
  1. package/css/og.css +24 -15
  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 +1 -1
  8. package/src/og/Globe.js +4 -0
  9. package/src/og/Object3d.js +1 -1
  10. package/src/og/control/DebugInfo.js +263 -165
  11. package/src/og/control/RulerSwitcher.js +4 -1
  12. package/src/og/control/SimpleNavigation.js +123 -128
  13. package/src/og/control/heightRuler/HeightRuler.js +12 -0
  14. package/src/og/control/heightRuler/HeightRulerScene.js +224 -0
  15. package/src/og/control/heightRuler/HeightRulerSwitcher.js +15 -0
  16. package/src/og/control/index.js +2 -0
  17. package/src/og/control/ruler/RulerScene.js +106 -79
  18. package/src/og/entity/Entity.js +6 -6
  19. package/src/og/entity/EntityCollection.js +4 -0
  20. package/src/og/entity/GeoObjectHandler.js +3 -0
  21. package/src/og/layer/BaseGeoImage.js +152 -16
  22. package/src/og/layer/GeoImage.js +0 -91
  23. package/src/og/layer/GeoTexture2d.js +54 -143
  24. package/src/og/layer/GeoVideo.js +6 -107
  25. package/src/og/layer/Material.js +1 -1
  26. package/src/og/layer/Vector.js +1 -0
  27. package/src/og/renderer/Renderer.js +90 -94
  28. package/src/og/renderer/RendererEvents.js +39 -23
  29. package/src/og/scene/BaseNode.js +113 -113
  30. package/src/og/scene/Planet.js +11 -8
  31. package/src/og/scene/RenderNode.js +42 -9
  32. package/src/og/segment/Segment.js +3 -3
  33. package/src/og/shaders/geoObject.js +12 -10
  34. package/src/og/shaders/pickingMask.js +1 -1
  35. package/src/og/utils/GeoImageCreator.js +61 -21
  36. package/src/og/utils/VectorTileCreator.js +32 -49
  37. package/src/og/webgl/Framebuffer.js +5 -0
  38. package/types/control/DebugInfo.d.ts +4 -0
  39. package/types/control/SimpleNavigation.d.ts +1 -0
  40. package/types/control/heightRuler/HeightRuler.d.ts +6 -0
  41. package/types/control/heightRuler/HeightRulerScene.d.ts +23 -0
  42. package/types/control/index.d.ts +2 -1
  43. package/types/control/ruler/RulerScene.d.ts +8 -5
  44. package/types/control/selection/SelectionScene.d.ts +0 -1
  45. package/types/entity/EntityCollection.d.ts +1 -0
  46. package/types/layer/BaseGeoImage.d.ts +17 -3
  47. package/types/layer/GeoImage.d.ts +0 -8
  48. package/types/layer/GeoTexture2d.d.ts +0 -2
  49. package/types/layer/GeoVideo.d.ts +0 -8
  50. package/types/renderer/Renderer.d.ts +12 -3
  51. package/types/scene/Axes.d.ts +1 -1
  52. package/types/scene/BaseNode.d.ts +2 -2
  53. package/types/scene/Planet.d.ts +0 -5
  54. package/types/scene/RenderNode.d.ts +16 -9
  55. package/types/scene/SkyBox.d.ts +1 -1
  56. package/types/utils/VectorTileCreator.d.ts +1 -3
  57. package/types/webgl/Framebuffer.d.ts +1 -0
@@ -1,113 +1,113 @@
1
- /**
2
- * @module og/scene/BaseNode
3
- */
4
-
5
- "use strict";
6
-
7
- /**
8
- * Scene node base class.
9
- * @class
10
- * @param {string} name - Node name.
11
- */
12
- class BaseNode {
13
- constructor(name) {
14
- /**
15
- * Node name.
16
- * @public
17
- * @type {string}
18
- */
19
- this.name = name;
20
-
21
- /**
22
- * Top scene tree node pointer.
23
- * @public
24
- * @type {RenderNode}
25
- */
26
- this.topNode = this;
27
-
28
- this._dictionary = [];
29
- this._dictionary[name] = this;
30
-
31
- /**
32
- * Children nodes.
33
- * @public
34
- * @type {Array.<RenderNode>}
35
- */
36
- this.childNodes = [];
37
-
38
- /**
39
- * Parent node pointer.
40
- * @public
41
- * @type {RenderNode}
42
- */
43
- this.parentNode = null;
44
-
45
- this.__staticId = BaseNode._staticCounter++;
46
- }
47
-
48
- static get _staticCounter() {
49
- if (!this.__counter__ && this.__counter__ !== 0) {
50
- this.__counter__ = 0;
51
- }
52
- return this.__counter__;
53
- }
54
-
55
- static set _staticCounter(n) {
56
- this.__counter__ = n;
57
- }
58
-
59
- /**
60
- * Adds node to the current hierarchy.
61
- * @public
62
- * @type {BaseNode}
63
- */
64
- addNode(node) {
65
- if (this.parentNode == null) {
66
- node.topNode = this;
67
- } else {
68
- node.topNode = this.topNode;
69
- }
70
- node.parentNode = this;
71
- node._dictionary = this.topNode._dictionary;
72
- this.childNodes.push(node);
73
- this.topNode._dictionary[node.name] = node;
74
- }
75
-
76
- /**
77
- * Destroy node.
78
- * @public
79
- */
80
- destroy() {
81
- for (var i = 0; i < this.childNodes.length; i++) {
82
- this.childNodes[i].destroy();
83
- }
84
- this._clear();
85
- }
86
-
87
- /**
88
- * Gets node by name in the current.
89
- * @public
90
- * @param {string} name - Node name.
91
- * @return {RenderNode} Node object in the current node.
92
- */
93
- getNodeByName(name) {
94
- return this._dictionary[name];
95
- }
96
-
97
- /**
98
- * Clear current node.
99
- * @protected
100
- */
101
- _clear() {
102
- this.name = "";
103
- this.parentNode = null;
104
- this.topNode = null;
105
- this.childNodes.length = 0;
106
- }
107
-
108
- isEqual(node) {
109
- return node.__staticId === this.__staticId;
110
- }
111
- }
112
-
113
- export { BaseNode };
1
+ /**
2
+ * @module og/scene/BaseNode
3
+ */
4
+
5
+ "use strict";
6
+
7
+ /**
8
+ * Scene node base class.
9
+ * @class
10
+ * @param {string} name - Node name.
11
+ */
12
+ class BaseNode {
13
+ constructor(name) {
14
+ /**
15
+ * Node name.
16
+ * @public
17
+ * @type {string}
18
+ */
19
+ this.name = name;
20
+
21
+ /**
22
+ * Top scene tree node pointer.
23
+ * @public
24
+ * @type {BaseNode}
25
+ */
26
+ this.topNode = this;
27
+
28
+ this._dictionary = [];
29
+ this._dictionary[name] = this;
30
+
31
+ /**
32
+ * Children nodes.
33
+ * @public
34
+ * @type {Array.<RenderNode>}
35
+ */
36
+ this.childNodes = [];
37
+
38
+ /**
39
+ * Parent node pointer.
40
+ * @public
41
+ * @type {RenderNode}
42
+ */
43
+ this.parentNode = null;
44
+
45
+ this.__staticId = BaseNode._staticCounter++;
46
+ }
47
+
48
+ static get _staticCounter() {
49
+ if (!this.__counter__ && this.__counter__ !== 0) {
50
+ this.__counter__ = 0;
51
+ }
52
+ return this.__counter__;
53
+ }
54
+
55
+ static set _staticCounter(n) {
56
+ this.__counter__ = n;
57
+ }
58
+
59
+ /**
60
+ * Adds node to the current hierarchy.
61
+ * @public
62
+ * @type {BaseNode}
63
+ */
64
+ addNode(node) {
65
+ if (this.parentNode == null) {
66
+ node.topNode = this;
67
+ } else {
68
+ node.topNode = this.topNode;
69
+ }
70
+ node.parentNode = this;
71
+ node._dictionary = this.topNode._dictionary;
72
+ this.childNodes.push(node);
73
+ this.topNode._dictionary[node.name] = node;
74
+ }
75
+
76
+ /**
77
+ * Destroy node.
78
+ * @public
79
+ */
80
+ destroy() {
81
+ for (var i = 0; i < this.childNodes.length; i++) {
82
+ this.childNodes[i].destroy();
83
+ }
84
+ this._clear();
85
+ }
86
+
87
+ /**
88
+ * Gets node by name in the current.
89
+ * @public
90
+ * @param {string} name - Node name.
91
+ * @return {RenderNode} Node object in the current node.
92
+ */
93
+ getNodeByName(name) {
94
+ return this._dictionary[name];
95
+ }
96
+
97
+ /**
98
+ * Clear current node.
99
+ * @protected
100
+ */
101
+ _clear() {
102
+ this.name = "";
103
+ this.parentNode = null;
104
+ this.topNode = null;
105
+ this.childNodes.length = 0;
106
+ }
107
+
108
+ isEqual(node) {
109
+ return node.__staticId === this.__staticId;
110
+ }
111
+ }
112
+
113
+ export { BaseNode };
@@ -740,9 +740,7 @@ export class Planet extends RenderNode {
740
740
  h.addProgram(shaders.drawnode_heightPicking(), true);
741
741
 
742
742
  this.renderer.addPickingCallback(this, this._renderColorPickingFramebufferPASS);
743
-
744
743
  this.renderer.addDepthCallback(this, this._renderDepthFramebufferPASS);
745
-
746
744
  this.renderer.addDistanceCallback(this, this._renderDistanceFramebufferPASS);
747
745
  }
748
746
 
@@ -1136,7 +1134,7 @@ export class Planet extends RenderNode {
1136
1134
  * Render node callback.
1137
1135
  * @public
1138
1136
  */
1139
- frame() {
1137
+ preFrame() {
1140
1138
 
1141
1139
  if (this._updateLayer) {
1142
1140
  this._updateLayer = false;
@@ -1147,13 +1145,17 @@ export class Planet extends RenderNode {
1147
1145
  this._firstPASS();
1148
1146
  }
1149
1147
 
1150
- this._renderScreenNodesPASS();
1151
-
1152
- //this._renderHeightPickingFramebufferPASS();
1153
-
1154
1148
  this.drawEntityCollections(this._frustumEntityCollections);
1155
1149
  }
1156
1150
 
1151
+ /**
1152
+ * Render node callback.
1153
+ * @public
1154
+ */
1155
+ frame() {
1156
+ this._renderScreenNodesPASS();
1157
+ }
1158
+
1157
1159
  _checkRendercompleted() {
1158
1160
  if (this._renderCompleted) {
1159
1161
  if (!this._renderCompletedActivated) {
@@ -1299,6 +1301,7 @@ export class Planet extends RenderNode {
1299
1301
  }
1300
1302
 
1301
1303
  gl.enable(gl.POLYGON_OFFSET_FILL);
1304
+ //gl.disable(gl.CULL_FACE);
1302
1305
  for (let j = 1, len = sl.length; j < len; j++) {
1303
1306
  let slj = sl[j];
1304
1307
  for (i = slj.length - 1; i >= 0; --i) {
@@ -1314,6 +1317,7 @@ export class Planet extends RenderNode {
1314
1317
  rn[i].segment.screenRendering(sh, sl[j], j, this.transparentTexture, true);
1315
1318
  }
1316
1319
  }
1320
+ //gl.enable(gl.CULL_FACE);
1317
1321
  gl.disable(gl.POLYGON_OFFSET_FILL);
1318
1322
  }
1319
1323
 
@@ -1594,7 +1598,6 @@ export class Planet extends RenderNode {
1594
1598
  this.terrain.abortLoading();
1595
1599
  this._tileLoader.abortAll();
1596
1600
 
1597
-
1598
1601
  this.quadTreeStrategy.clear();
1599
1602
  this.layerLock.free(this._memKey);
1600
1603
  this.terrainLock.free(this._memKey);
@@ -5,16 +5,17 @@ import { BaseNode } from "./BaseNode.js";
5
5
 
6
6
  /**
7
7
  * Render node is a logical part of a render mechanism. Represents scene rendering.
8
- * Forexample one scene node for rendering the Earth, another one for rendering the Moon, another node for rendering stars etc.
8
+ * For example one scene node for rendering the Earth, another one for rendering the Moon, another node for rendering stars etc.
9
9
  * Each render node has own model view space defined with matrices(scale, rotation, translation, transformation).
10
10
  * There are collections of ligh sources, entities and so on in the node.
11
11
  * Access to the node is renderer.renderNodes["Earth"]
12
12
  * @class
13
- * @extends {RenderNode}
13
+ * @extends {BaseNode}
14
14
  * @param {string} name - Node name.
15
15
  */
16
+
16
17
  class RenderNode extends BaseNode {
17
- constructor(name) {
18
+ constructor(name = "") {
18
19
  super(name);
19
20
 
20
21
  /**
@@ -167,6 +168,15 @@ class RenderNode extends BaseNode {
167
168
  light.remove();
168
169
  }
169
170
 
171
+ /**
172
+ * Calls render frame node's callback. Used in renderer.
173
+ * @public
174
+ */
175
+ preDrawNode(frustum, frustumIndex) {
176
+ this._isActive && this._preDrawNodes(frustum, frustumIndex);
177
+ }
178
+
179
+
170
180
  /**
171
181
  * Calls render frame node's callback. Used in renderer.
172
182
  * @public
@@ -194,6 +204,8 @@ class RenderNode extends BaseNode {
194
204
 
195
205
  if (this.renderer) {
196
206
  if (this._isActive && this._pickingId === -1) {
207
+ // This picking callback MUST be the first picking callback
208
+ // in the rendering queue in the renderer. It affects on blending.
197
209
  this._pickingId = this.renderer.addPickingCallback(
198
210
  this,
199
211
  this._entityCollectionPickingCallback
@@ -264,6 +276,31 @@ class RenderNode extends BaseNode {
264
276
  }
265
277
  }
266
278
 
279
+ frame() {
280
+
281
+ }
282
+
283
+ preFrame() {
284
+
285
+ }
286
+
287
+ /**
288
+ * @private
289
+ */
290
+ _preDrawNodes() {
291
+ for (var i = 0; i < this.childNodes.length; i++) {
292
+ if (this.childNodes[i]._isActive) {
293
+ this.childNodes[i]._preDrawNodes();
294
+ }
295
+ }
296
+
297
+ if (this.show) {
298
+ //this.lightEnabled && this.transformLights();
299
+ this.preFrame();
300
+ this.drawEntityCollections(this.entityCollections);
301
+ }
302
+ }
303
+
267
304
  /**
268
305
  * @private
269
306
  */
@@ -275,11 +312,7 @@ class RenderNode extends BaseNode {
275
312
  }
276
313
 
277
314
  if (this.show) {
278
- if (this.frame) {
279
- //this.lightEnabled && this.transformLights();
280
- this.frame();
281
- }
282
- this.drawEntityCollections(this.entityCollections);
315
+ this.frame();
283
316
  }
284
317
  }
285
318
 
@@ -296,7 +329,7 @@ class RenderNode extends BaseNode {
296
329
  if (ec.length) {
297
330
 
298
331
  // billoard pass
299
- let i = ec.length;
332
+ let i = ec.length;
300
333
  while (i--) {
301
334
  ec[i]._fadingOpacity && ec[i].billboardHandler.drawPicking();
302
335
  }
@@ -316,7 +316,7 @@ class Segment {
316
316
  if (d === Ray.INSIDE) {
317
317
  return xyz.distance(res);
318
318
  } else if (d === Ray.AWAY) {
319
- _rayEx.set(xyz, xyz);
319
+ _rayEx.set(xyz, this.planet.ellipsoid.getSurfaceNormal3v(xyz));
320
320
  let d = _rayEx.hitTriangle(_v0, _v1, _v2, res, normal);
321
321
  if (d === Ray.INSIDE) {
322
322
  return -xyz.distance(res);
@@ -329,7 +329,7 @@ class Segment {
329
329
  if (d === Ray.INSIDE) {
330
330
  return xyz.distance(res);
331
331
  } else if (d === Ray.AWAY) {
332
- _rayEx.set(xyz, xyz);
332
+ _rayEx.set(xyz, this.planet.ellipsoid.getSurfaceNormal3v(xyz));
333
333
  let d = _rayEx.hitTriangle(_v1, _v3, _v2, res, normal);
334
334
  if (d === Ray.INSIDE) {
335
335
  return -xyz.distance(res);
@@ -1675,4 +1675,4 @@ class Segment {
1675
1675
  }
1676
1676
  }
1677
1677
 
1678
- export { Segment };
1678
+ export { Segment };
@@ -211,20 +211,21 @@ export const geo_object_picking = () =>
211
211
  const float RADIANS = 3.141592653589793 / 180.0;
212
212
 
213
213
  void main(void) {
214
-
214
+
215
215
  if (aDispose == 0.0) {
216
216
  return;
217
217
  }
218
218
 
219
219
  vColor = aPickingColor;
220
- float roll = aPitchRoll.y * RADIANS;
220
+
221
+ float roll = aPitchRoll.y;
221
222
  mat3 rotZ = mat3(
222
223
  vec3(cos(roll), sin(roll), 0.0),
223
224
  vec3(-sin(roll), cos(roll), 0.0),
224
225
  vec3(0.0, 0.0, 1.0)
225
226
  );
226
227
 
227
- float pitch = aPitchRoll.x * RADIANS;
228
+ float pitch = aPitchRoll.x;
228
229
  mat3 rotX = mat3(
229
230
  vec3(1.0, 0.0, 0.0),
230
231
  vec3(0.0, cos(pitch), sin(pitch)),
@@ -232,10 +233,11 @@ export const geo_object_picking = () =>
232
233
  );
233
234
 
234
235
  vec3 position = aPositionHigh + aPositionLow;
236
+ vec3 cameraPosition = eyePositionHigh + eyePositionLow;
235
237
  vec3 r = cross(normalize(-position), aDirection);
236
- mat3 modelMatrix = mat3(r, normalize(position), -aDirection) * rotX * rotZ; /*up=-cross(aDirection, r)*/
238
+ mat3 modelMatrix = mat3(r, normalize(position), -aDirection) * rotX * rotZ;
237
239
 
238
- float dist = length(eyePositionHigh + eyePositionLow);
240
+ float dist = length(cameraPosition);
239
241
 
240
242
  mat4 viewMatrixRTE = viewMatrix;
241
243
  viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
@@ -243,14 +245,14 @@ export const geo_object_picking = () =>
243
245
  vec3 highDiff = aPositionHigh - eyePositionHigh;
244
246
  vec3 lowDiff = aPositionLow - eyePositionLow;
245
247
 
246
- vec3 look = position - (eyePositionHigh + eyePositionLow);
248
+ vec3 look = cameraPosition - position;
247
249
  float lookLength = length(look);
248
-
250
+
249
251
  float scd = uScaleByDistance[2] * clamp(lookLength, uScaleByDistance[0], uScaleByDistance[1]) / uScaleByDistance[0];
250
252
 
251
- vec4 pos = vec4((highDiff + lowDiff) + modelMatrix * aVertexPosition * aScale * pickingScale * scd, 1.0);
252
-
253
- gl_Position = projectionMatrix * viewMatrixRTE * pos;
253
+ vec3 vert = modelMatrix * aVertexPosition * aScale * pickingScale * scd;
254
+
255
+ gl_Position = projectionMatrix * viewMatrixRTE * vec4(highDiff + lowDiff + vert, 1.0);
254
256
  }`,
255
257
  fragmentShader:
256
258
  `precision highp float;
@@ -20,7 +20,7 @@ export function pickingMask() {
20
20
  void main() {
21
21
 
22
22
  gl_Position = vec4(coordinates + offset, 0.0, 1.0);
23
- gl_PointSize = 20.0;
23
+ gl_PointSize = 5.0;
24
24
  }`,
25
25
  fragmentShader:
26
26
  `precision highp float;
@@ -4,6 +4,7 @@ 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 { doubleToTwoFloats2 } from "../math/coder.js";
7
8
 
8
9
  export class GeoImageCreator {
9
10
 
@@ -32,35 +33,67 @@ export class GeoImageCreator {
32
33
  * @return{WebGLBuffer} Grid coordinates buffer.
33
34
  */
34
35
  createGridBuffer(c, toMerc) {
35
- var gs = this._gridSize;
36
+ let gs = this._gridSize;
36
37
 
37
- var v03 = new LonLat((c[3].lon - c[0].lon) / gs, (c[3].lat - c[0].lat) / gs),
38
+ let v03 = new LonLat((c[3].lon - c[0].lon) / gs, (c[3].lat - c[0].lat) / gs),
38
39
  v12 = new LonLat((c[2].lon - c[1].lon) / gs, (c[2].lat - c[1].lat) / gs),
39
40
  v01 = new LonLat((c[1].lon - c[0].lon) / gs, (c[1].lat - c[0].lat) / gs),
40
41
  v32 = new LonLat((c[2].lon - c[3].lon) / gs, (c[2].lat - c[3].lat) / gs);
41
42
 
42
- var grid = new Float32Array((gs + 1) * (gs + 1) * 2);
43
- var k = 0;
43
+ const size = (gs + 1) * (gs + 1) * 2,
44
+ halfSize = size / 2;
45
+
46
+ let gridHigh = new Float32Array(size),
47
+ gridLow = new Float32Array(size);
48
+
49
+ let lonLatArr = new Array(halfSize);
50
+
51
+ let kh = 0,
52
+ kl = 0,
53
+ k = 0;
54
+
55
+ let tempArr = new Float32Array(2);
56
+
44
57
  for (let i = 0; i <= gs; i++) {
45
- var P03i = new LonLat(c[0].lon + i * v03.lon, c[0].lat + i * v03.lat),
58
+
59
+ let P03i = new LonLat(c[0].lon + i * v03.lon, c[0].lat + i * v03.lat),
46
60
  P12i = new LonLat(c[1].lon + i * v12.lon, c[1].lat + i * v12.lat);
61
+
47
62
  for (let j = 0; j <= gs; j++) {
48
- var P01j = new LonLat(c[0].lon + j * v01.lon, c[0].lat + j * v01.lat),
63
+ let P01j = new LonLat(c[0].lon + j * v01.lon, c[0].lat + j * v01.lat),
49
64
  P32j = new LonLat(c[3].lon + j * v32.lon, c[3].lat + j * v32.lat);
50
- var xx = utils.getLinesIntersectionLonLat(P03i, P12i, P01j, P32j);
51
- grid[k++] = xx.lon;
52
- grid[k++] = xx.lat;
65
+ let xx = utils.getLinesIntersectionLonLat(P03i, P12i, P01j, P32j);
66
+ doubleToTwoFloats2(xx.lon, tempArr);
67
+ gridHigh[kh++] = tempArr[0];
68
+ gridLow[kl++] = tempArr[1];
69
+ doubleToTwoFloats2(xx.lat, tempArr);
70
+ gridHigh[kh++] = tempArr[0];
71
+ gridLow[kl++] = tempArr[1];
72
+
73
+ lonLatArr[k++] = xx;
53
74
  }
54
75
  }
55
76
 
56
77
  if (toMerc) {
57
- for (let i = 0; i < grid.length; i += 2) {
58
- let c = new LonLat(grid[i], grid[i + 1]).forwardMercator();
59
- grid[i] = c.lon;
60
- grid[i + 1] = c.lat;
78
+ for (let i = 0; i < halfSize; i++) {
79
+ let c = lonLatArr[i].forwardMercator();
80
+ doubleToTwoFloats2(c.lon, tempArr);
81
+ gridHigh[i * 2] = tempArr[0];
82
+ gridLow[i * 2] = tempArr[1];
83
+
84
+ doubleToTwoFloats2(c.lat, tempArr);
85
+ gridHigh[i * 2 + 1] = tempArr[0];
86
+ gridLow[i * 2 + 1] = tempArr[1];
87
+
88
+ //grid[i] = c.lon;
89
+ //grid[i + 1] = c.lat;
61
90
  }
62
91
  }
63
- return this._planet.renderer.handler.createArrayBuffer(grid, 2, grid.length / 2);
92
+
93
+ return [
94
+ this._planet.renderer.handler.createArrayBuffer(gridHigh, 2, halfSize),
95
+ this._planet.renderer.handler.createArrayBuffer(gridLow, 2, halfSize)
96
+ ];
64
97
  }
65
98
 
66
99
  frame() {
@@ -133,20 +166,27 @@ export class GeoImageCreator {
133
166
  this._planet.renderer.handler.addProgram(new Program("geoImageTransform", {
134
167
  uniforms: {
135
168
  sourceTexture: "sampler2d",
136
- extentParams: "vec4",
169
+ extentParamsHigh: "vec4",
170
+ extentParamsLow: "vec4",
137
171
  isFullExtent: "bool"
138
172
  },
139
173
  attributes: {
140
- corners: "vec2",
174
+ cornersHigh: "vec2",
175
+ cornersLow: "vec2",
141
176
  texCoords: "vec2"
142
177
  },
143
- vertexShader: `attribute vec2 corners;
178
+ vertexShader:
179
+ `attribute vec2 cornersHigh;
180
+ attribute vec2 cornersLow;
144
181
  attribute vec2 texCoords;
145
- varying vec2 v_texCoords;
146
- uniform vec4 extentParams;
147
- void main() {
182
+ uniform vec4 extentParamsHigh;
183
+ uniform vec4 extentParamsLow;
184
+ varying vec2 v_texCoords;
185
+ void main() {
148
186
  v_texCoords = texCoords;
149
- gl_Position = vec4((-1.0 + (corners - extentParams.xy) * extentParams.zw) * vec2(1.0, -1.0), 0.0, 1.0);
187
+ vec2 highDiff = cornersHigh - extentParamsHigh.xy;
188
+ vec2 lowDiff = cornersLow - extentParamsLow.xy;
189
+ gl_Position = vec4((-1.0 + (highDiff + lowDiff) * extentParamsHigh.zw) * vec2(1.0, -1.0), 0.0, 1.0);
150
190
  }`,
151
191
  fragmentShader:
152
192
  `precision highp float;