@pirireis/webglobeplugins 0.9.10 → 0.9.11

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 (166) hide show
  1. package/Math/angle-calculation.js +8 -8
  2. package/Math/arc.js +18 -18
  3. package/Math/bounds/line-bbox.js +80 -78
  4. package/Math/constants.js +3 -3
  5. package/Math/juction/arc-plane.js +23 -23
  6. package/Math/juction/line-sphere.js +11 -11
  7. package/Math/juction/plane-plane.js +11 -11
  8. package/Math/line.js +16 -14
  9. package/Math/methods.js +72 -67
  10. package/Math/plane.js +18 -16
  11. package/Math/quaternion.js +49 -45
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +45 -42
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +8 -7
  16. package/altitude-locator/plugin.js +113 -97
  17. package/arrowfield/adaptor.js +4 -3
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +65 -62
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +225 -200
  22. package/circle-line-chain/chain-list-map.js +88 -82
  23. package/circle-line-chain/plugin.js +154 -129
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +126 -104
  26. package/compass-rose/compass-text-writer.js +70 -62
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +50 -46
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +48 -44
  32. package/heatwave/isobar/plugin.js +123 -104
  33. package/heatwave/isobar/quadtreecontours.js +92 -76
  34. package/heatwave/plugins/heatwaveglobeshell.js +87 -69
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +64 -32
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +84 -48
  40. package/partialrings/program.js +47 -136
  41. package/pin/pin-object-array.js +86 -83
  42. package/pin/pin-point-totem.js +22 -21
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +45 -40
  45. package/point-heat-map/point-to-heat-map-flow.js +42 -40
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +142 -127
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +62 -170
  50. package/programs/arrowfield/object.js +35 -33
  51. package/programs/data2legend/density-to-legend.js +21 -45
  52. package/programs/data2legend/point-to-density-texture.js +27 -52
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +42 -88
  55. package/programs/float2legendwithratio/object.js +46 -43
  56. package/programs/globe-util/is-globe-moved.js +11 -10
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +98 -191
  60. package/programs/globeshell/wiggle/object.js +35 -33
  61. package/programs/helpers/blender/program.js +19 -36
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +13 -35
  64. package/programs/helpers/fadeaway/object.js +10 -9
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +32 -91
  68. package/programs/line-on-globe/circle-accurate-3d.js +32 -82
  69. package/programs/line-on-globe/circle-accurate-flat.js +50 -108
  70. package/programs/line-on-globe/circle-accurate.js +33 -103
  71. package/programs/line-on-globe/circle.js +32 -97
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +33 -83
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +34 -79
  74. package/programs/line-on-globe/linestrip.js +39 -100
  75. package/programs/line-on-globe/naive-accurate-flexible.js +48 -118
  76. package/programs/line-on-globe/to-the-surface.js +29 -58
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +33 -117
  79. package/programs/point-on-globe/element-globe-surface-glow.js +38 -78
  80. package/programs/point-on-globe/element-point-glow.js +35 -103
  81. package/programs/point-on-globe/square-pixel-point.js +27 -76
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +21 -63
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +145 -156
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +197 -121
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +20 -73
  88. package/programs/rings/distancering/paddyflatprogram2d.js +22 -75
  89. package/programs/rings/distancering/paddyflatprogram3d.js +20 -73
  90. package/programs/rings/partial-ring/piece-of-pie.js +35 -137
  91. package/programs/totems/camerauniformblock.js +51 -64
  92. package/programs/totems/canvas-webglobe-info.js +40 -48
  93. package/programs/totems/gpu-selection-uniform-block.js +40 -44
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +29 -90
  96. package/programs/util.js +7 -6
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +29 -70
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +35 -91
  101. package/programs/vectorfields/logics/ubo.js +25 -31
  102. package/programs/vectorfields/pingpongbuffermanager.js +34 -30
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +252 -202
  105. package/rangerings/rangeringangletext.js +120 -108
  106. package/rangerings/ring-account.js +69 -52
  107. package/shaders/fragment-toy/firework.js +1 -55
  108. package/shaders/fragment-toy/singularity.js +1 -55
  109. package/timetracks/adaptors-line-strip.js +37 -26
  110. package/timetracks/adaptors.js +61 -47
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -59
  113. package/timetracks/plugin.js +69 -65
  114. package/timetracks/program-line-strip.js +103 -296
  115. package/timetracks/program.js +113 -419
  116. package/timetracks/programpoint-line-strip.js +44 -97
  117. package/timetracks/programpoint.js +44 -90
  118. package/util/account/bufferoffsetmanager.js +95 -72
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +43 -39
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +94 -64
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +30 -28
  124. package/util/account/util.js +4 -2
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +15 -13
  128. package/util/geometry/index.js +11 -9
  129. package/util/gl-util/buffer/attribute-loader.js +20 -8
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +7 -7
  132. package/util/gl-util/uniform-block/manager.js +67 -55
  133. package/util/heatwavedatamanager/datamanager.js +116 -56
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +40 -37
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +10 -9
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +29 -27
  140. package/util/interpolation/timetrack/web-worker-str.js +1 -179
  141. package/util/interpolation/timetrack/web-worker.js +4 -4
  142. package/util/jshelpers/data-filler.js +7 -7
  143. package/util/jshelpers/timefilters.js +7 -7
  144. package/util/picking/fence.js +7 -7
  145. package/util/picking/picker-displayer.js +52 -46
  146. package/util/programs/draw-texture-on-canvas.js +21 -39
  147. package/util/programs/shapesonglobe.js +64 -104
  148. package/util/programs/supersampletotextures.js +39 -45
  149. package/util/programs/texturetoglobe.js +48 -98
  150. package/util/shaderfunctions/geometrytransformations.js +27 -322
  151. package/util/shaderfunctions/nodata.js +1 -7
  152. package/util/shaderfunctions/noisefunctions.js +9 -39
  153. package/util/surface-line-data/arcs-to-cuts.js +23 -20
  154. package/util/webglobe/rasteroverlay.js +37 -35
  155. package/util/webglobjectbuilders.js +60 -55
  156. package/util/webglobjectbuilders1.js +49 -48
  157. package/waveparticles/adaptor.js +7 -6
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +84 -79
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +251 -453
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +48 -46
  165. package/write-text/context-text.js +58 -51
  166. package/write-text/context-text3.js +74 -69
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CirclePadding3DCache = void 0;
4
- const webglobjectbuilders_1 = require("../../util/webglobjectbuilders");
5
- const camerauniformblock_1 = require("../totems/camerauniformblock");
6
- const programcache_1 = require("../programcache");
4
+ var webglobjectbuilders_1 = require("../../util/webglobjectbuilders");
5
+ var camerauniformblock_1 = require("../totems/camerauniformblock");
6
+ var programcache_1 = require("../programcache");
7
7
  // import { vaoAttributeLoader } from "../../util/account/util";
8
- const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
9
- const util_1 = require("./util");
10
- const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
8
+ var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
9
+ var util_1 = require("./util");
10
+ var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
11
11
  /**
12
12
  * TODO:
13
13
  * 1. integrate geometry functions for radius angle and center
@@ -16,63 +16,11 @@ const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytr
16
16
  * TODO:
17
17
  * center_position is too small or doenst loaded as expected.
18
18
  */
19
- const INITIAL_EDGE_COUNT = 720;
20
- const vertexShaderSource = `#version 300 es
21
- precision highp float;
22
- ${camerauniformblock_1.CameraUniformBlockString}
23
- ${geometrytransformations_1.cartesian3DToGLPosition}
24
- ${geometrytransformations_1.circleLimpFromLongLatRadCenterCartesian3D_accurate}
25
-
26
-
27
- in vec3 center_position3d;
28
- in float big_radius;
29
- in float small_radius;
30
- in vec4 color;
31
-
32
- uniform float edge_count;
33
- uniform float step_angle;
34
- uniform int z_alpha_on;
35
-
36
- out float interpolation;
37
- out vec4 v_color;
38
- void main() {
39
- if( !is3D) {
40
- return;
41
- }
42
- v_color = color;
43
- if ( z_alpha_on == 1 ){
44
- float z_alpha = pow(z_level * 0.75, 3.0) * distance(big_radius, small_radius) / (R * 2.0);
45
- if ( z_alpha < 0.1 ) { return; }
46
- v_color.a *= z_alpha;
47
- }
48
- int pad_phase = gl_VertexID % 2; // 0 or 1
49
- interpolation = float( gl_VertexID - pad_phase) / edge_count;
50
- float angle = float( gl_VertexID - pad_phase) * step_angle;
51
- vec3 position;
52
- if ( pad_phase == 0 ) {
53
- position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, big_radius, angle);
54
- } else {
55
- position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, small_radius, angle);
56
- }
57
- gl_Position = cartesian3DToGLPosition(position);
58
-
59
- gl_PointSize = 5.0;
60
- }`;
61
- const fragmentShaderSource = `#version 300 es
62
- ${geometrytransformations_1.POLE}
63
- precision highp float;
64
- uniform float opacity;
65
- in vec4 v_color;
66
- in float interpolation;
67
- in vec2 v_limp;
68
- out vec4 color;
69
- void main() {
70
- color = v_color;
71
- color.a *= opacity;
72
- }
73
- `;
74
- class Logic {
75
- constructor(globe) {
19
+ var INITIAL_EDGE_COUNT = 720;
20
+ var vertexShaderSource = "#version 300 es\nprecision highp float;\n".concat(camerauniformblock_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\n").concat(geometrytransformations_1.circleLimpFromLongLatRadCenterCartesian3D_accurate, "\n\n\nin vec3 center_position3d;\nin float big_radius;\nin float small_radius;\nin vec4 color;\n\nuniform float edge_count;\nuniform float step_angle;\nuniform int z_alpha_on;\n\nout float interpolation;\nout vec4 v_color;\nvoid main() {\n if( !is3D) {\n return;\n }\n v_color = color;\n if ( z_alpha_on == 1 ){\n float z_alpha = pow(z_level * 0.75, 3.0) * distance(big_radius, small_radius) / (R * 2.0);\n if ( z_alpha < 0.1 ) { return; }\n v_color.a *= z_alpha;\n }\n int pad_phase = gl_VertexID % 2; // 0 or 1\n interpolation = float( gl_VertexID - pad_phase) / edge_count;\n float angle = float( gl_VertexID - pad_phase) * step_angle;\n vec3 position;\n if ( pad_phase == 0 ) {\n position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, big_radius, angle);\n } else {\n position = circleLimpFromLongLatRadCenterCartesian3D_accurate(center_position3d, small_radius, angle);\n }\n gl_Position = cartesian3DToGLPosition(position);\n\n gl_PointSize = 5.0;\n}");
21
+ var fragmentShaderSource = "#version 300 es\n".concat(geometrytransformations_1.POLE, "\nprecision highp float;\nuniform float opacity;\nin vec4 v_color;\nin float interpolation;\nin vec2 v_limp;\nout vec4 color;\nvoid main() {\n color = v_color;\n color.a *= opacity;\n}\n");
22
+ var Logic = /** @class */ (function () {
23
+ function Logic(globe) {
76
24
  this.globe = globe;
77
25
  this.gl = globe.gl;
78
26
  this._lastOpacity = 1.0;
@@ -80,7 +28,7 @@ class Logic {
80
28
  this._lastStepAngle = 720 / INITIAL_EDGE_COUNT;
81
29
  this._lastZAlphaMode = util_1.Z_ALPHA_MODE.ON;
82
30
  this.program = (0, webglobjectbuilders_1.createProgram)(this.gl, vertexShaderSource, fragmentShaderSource);
83
- const { gl, program } = this;
31
+ var _a = this, gl = _a.gl, program = _a.program;
84
32
  this.program.uniforms = {
85
33
  opacity: gl.getUniformLocation(program, "opacity"),
86
34
  edgeCount: gl.getUniformLocation(program, "edge_count"),
@@ -88,7 +36,7 @@ class Logic {
88
36
  zAlphaMode: gl.getUniformLocation(program, "z_alpha_on")
89
37
  };
90
38
  { // initial uniform values
91
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
39
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
92
40
  gl.useProgram(program);
93
41
  gl.uniform1f(program.uniforms.opacity, 1.0);
94
42
  gl.uniform1f(program.uniforms.edgeCount, INITIAL_EDGE_COUNT * 2);
@@ -104,23 +52,24 @@ class Logic {
104
52
  }
105
53
  this.cameraBindingPoint = 0;
106
54
  this.cameraBlockTotem = camerauniformblock_1.CameraUniformBlockTotemCache.get(globe);
107
- const cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
55
+ var cameraBlockLocation = gl.getUniformBlockIndex(program, "CameraUniformBlock");
108
56
  gl.uniformBlockBinding(program, cameraBlockLocation, this.cameraBindingPoint);
109
57
  }
110
- createVAO(center3dObj, bigRadiusObj, smallRadiusObj, colorObj) {
111
- const { gl } = this;
112
- const vao = gl.createVertexArray();
113
- const divisor = 1;
58
+ Logic.prototype.createVAO = function (center3dObj, bigRadiusObj, smallRadiusObj, colorObj) {
59
+ var gl = this.gl;
60
+ var vao = gl.createVertexArray();
61
+ var divisor = 1;
114
62
  gl.bindVertexArray(vao);
115
- (0, attribute_loader_1.attributeLoader)(gl, center3dObj, 0, 3, { divisor });
116
- (0, attribute_loader_1.attributeLoader)(gl, bigRadiusObj, 1, 1, { divisor });
117
- (0, attribute_loader_1.attributeLoader)(gl, smallRadiusObj, 2, 1, { divisor });
118
- (0, attribute_loader_1.attributeLoader)(gl, colorObj, 3, 4, { divisor });
63
+ (0, attribute_loader_1.attributeLoader)(gl, center3dObj, 0, 3, { divisor: divisor });
64
+ (0, attribute_loader_1.attributeLoader)(gl, bigRadiusObj, 1, 1, { divisor: divisor });
65
+ (0, attribute_loader_1.attributeLoader)(gl, smallRadiusObj, 2, 1, { divisor: divisor });
66
+ (0, attribute_loader_1.attributeLoader)(gl, colorObj, 3, 4, { divisor: divisor });
119
67
  gl.bindVertexArray(null);
120
68
  return vao;
121
- }
122
- draw(vao, length, edgeCount, stepAngle, opacity, zAlphaMode = util_1.Z_ALPHA_MODE.ON) {
123
- const { gl, program, cameraBlockTotem, cameraBindingPoint } = this;
69
+ };
70
+ Logic.prototype.draw = function (vao, length, edgeCount, stepAngle, opacity, zAlphaMode) {
71
+ if (zAlphaMode === void 0) { zAlphaMode = util_1.Z_ALPHA_MODE.ON; }
72
+ var _a = this, gl = _a.gl, program = _a.program, cameraBlockTotem = _a.cameraBlockTotem, cameraBindingPoint = _a.cameraBindingPoint;
124
73
  gl.useProgram(program);
125
74
  if (this._lastOpacity !== opacity) {
126
75
  gl.uniform1f(program.uniforms.opacity, opacity);
@@ -144,16 +93,17 @@ class Logic {
144
93
  // gl.drawArraysInstanced(gl.POINTS, 0, edgeCount, length);
145
94
  cameraBlockTotem.unbind(cameraBindingPoint);
146
95
  gl.bindVertexArray(null);
147
- }
148
- free() {
96
+ };
97
+ Logic.prototype.free = function () {
149
98
  if (this.isFreed)
150
99
  return;
151
100
  camerauniformblock_1.CameraUniformBlockTotemCache.release(this.globe);
152
101
  this.gl.deleteProgram(this.program);
153
102
  this.isFreed = true;
154
- }
155
- }
103
+ };
104
+ return Logic;
105
+ }());
156
106
  exports.CirclePadding3DCache = Object.freeze({
157
- get: (globe) => programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic),
158
- release: (globe) => programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic)
107
+ get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
108
+ release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
159
109
  });
@@ -1,77 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Z_ALPHA_MODE = exports.LinesColorInstancedFlatCache = void 0;
4
- const totems_1 = require("../totems");
5
- const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
6
- const programcache_1 = require("../programcache");
7
- const util_1 = require("../../util");
8
- const util_2 = require("./util");
4
+ var totems_1 = require("../totems");
5
+ var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
6
+ var programcache_1 = require("../programcache");
7
+ var util_1 = require("../../util");
8
+ var util_2 = require("./util");
9
9
  Object.defineProperty(exports, "Z_ALPHA_MODE", { enumerable: true, get: function () { return util_2.Z_ALPHA_MODE; } });
10
- const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
10
+ var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
11
11
  /**
12
12
  * This program draws line between points provided from the first and second buffer.
13
13
  * draw method gl.drawArraysInstanced( gl.POINTS, 0,2, lineCount);
14
14
  * */
15
15
  // TODO: find better way to eleminate edge case distance(posA, posB) > 37000000.0
16
- const vertexShaderSource = `#version 300 es
17
- precision highp float;
18
- ${totems_1.CameraUniformBlockString}
19
- ${geometrytransformations_1.mercatorXYToGLPosition}
20
- uniform float opacity;
21
- uniform int z_alpha_on;
22
-
23
- in vec2 posA;
24
- in vec2 posB;
25
- in vec4 color;
26
-
27
- out vec2 v_frame;
28
- out vec4 v_color;
29
- void main() {
30
-
31
- if ( is3D ) {
32
- return;
33
- }
34
- float gap = max( distance(posA.x, posB.x), distance(posA.y,posB.y)); //
35
- if ( gap > 37000000.0) { return; }
36
- float z_alpha;
37
- if ( z_alpha_on == 1 ){
38
- z_alpha = pow(2.0,z_level+1.0) / ( 10000000.0 / gap);
39
- z_alpha = smoothstep(0.1,0.9, z_alpha);
40
- if( z_alpha < 0.01) {return;}
41
- } else {
42
- z_alpha = 1.0;
43
- }
44
- vec2 pos;
45
- if ( gl_VertexID == 0 ) {
46
- pos = posA;
47
- } else {
48
- pos = posB;
49
- }
50
- v_frame = pos;
51
- gl_Position = mercatorXYToGLPosition( pos );
52
- v_color = color;
53
- v_color.a *= z_alpha * opacity;
54
- gl_PointSize = 4.0;
55
- }`;
56
- const fragmentShaderSource = `#version 300 es
57
- ${geometrytransformations_1.POLE}
58
- precision highp float;
59
- in vec4 v_color;
60
- in vec2 v_frame;
61
- out vec4 outColor;
62
- void main() {
63
- if ( v_frame.x < -POLE || v_frame.x > POLE || v_frame.y < -POLE || v_frame.y > POLE ){ discard; }
64
- outColor = v_color;
65
- }`;
66
- class Logic {
67
- constructor(globe) {
16
+ var vertexShaderSource = "#version 300 es\nprecision highp float;\n".concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.mercatorXYToGLPosition, "\nuniform float opacity;\nuniform int z_alpha_on;\n\nin vec2 posA;\nin vec2 posB;\nin vec4 color;\n\nout vec2 v_frame;\nout vec4 v_color;\nvoid main() {\n \n if ( is3D ) {\n return;\n }\n float gap = max( distance(posA.x, posB.x), distance(posA.y,posB.y)); // \n if ( gap > 37000000.0) { return; }\n float z_alpha;\n if ( z_alpha_on == 1 ){ \n z_alpha = pow(2.0,z_level+1.0) / ( 10000000.0 / gap);\n z_alpha = smoothstep(0.1,0.9, z_alpha);\n if( z_alpha < 0.01) {return;}\n } else {\n z_alpha = 1.0;\n }\n vec2 pos;\n if ( gl_VertexID == 0 ) {\n pos = posA;\n } else {\n pos = posB;\n }\n v_frame = pos;\n gl_Position = mercatorXYToGLPosition( pos );\n v_color = color;\n v_color.a *= z_alpha * opacity;\n gl_PointSize = 4.0;\n}");
17
+ var fragmentShaderSource = "#version 300 es\n".concat(geometrytransformations_1.POLE, "\nprecision highp float;\nin vec4 v_color;\nin vec2 v_frame;\nout vec4 outColor;\nvoid main() {\n if ( v_frame.x < -POLE || v_frame.x > POLE || v_frame.y < -POLE || v_frame.y > POLE ){ discard; }\n outColor = v_color;\n}");
18
+ var Logic = /** @class */ (function () {
19
+ function Logic(globe) {
68
20
  this.globe = globe;
69
21
  this.gl = globe.gl;
70
22
  this.program = (0, util_1.createProgram)(this.gl, vertexShaderSource, fragmentShaderSource);
71
23
  this._lastOpicity = 1.0;
72
24
  this._lastZAlphaOn = util_2.Z_ALPHA_MODE.OFF;
73
- const { gl, program } = this;
74
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
25
+ var _a = this, gl = _a.gl, program = _a.program;
26
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
75
27
  gl.useProgram(program);
76
28
  { // assign attribute locations
77
29
  gl.bindAttribLocation(program, 0, 'posA');
@@ -87,24 +39,26 @@ class Logic {
87
39
  { // uniform block
88
40
  this._cameraUniformBlock = totems_1.CameraUniformBlockTotemCache.get(globe);
89
41
  this._cameraBindingPoint = 0;
90
- const cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
42
+ var cameraBlockBindingIndex = gl.getUniformBlockIndex(program, 'CameraUniformBlock');
91
43
  gl.uniformBlockBinding(program, cameraBlockBindingIndex, this._cameraBindingPoint);
92
44
  }
93
45
  gl.useProgram(currentProgram);
94
46
  }
95
- createVAO(posAObj, posBObj, colorObj) {
96
- const { gl } = this;
97
- const vao = gl.createVertexArray();
98
- const divisor = 1;
47
+ Logic.prototype.createVAO = function (posAObj, posBObj, colorObj) {
48
+ var gl = this.gl;
49
+ var vao = gl.createVertexArray();
50
+ var divisor = 1;
99
51
  gl.bindVertexArray(vao);
100
- (0, attribute_loader_1.attributeLoader)(gl, posAObj, 0, 2, { divisor });
101
- (0, attribute_loader_1.attributeLoader)(gl, posBObj, 1, 2, { divisor });
102
- (0, attribute_loader_1.attributeLoader)(gl, colorObj, 2, 4, { divisor });
52
+ (0, attribute_loader_1.attributeLoader)(gl, posAObj, 0, 2, { divisor: divisor });
53
+ (0, attribute_loader_1.attributeLoader)(gl, posBObj, 1, 2, { divisor: divisor });
54
+ (0, attribute_loader_1.attributeLoader)(gl, colorObj, 2, 4, { divisor: divisor });
103
55
  gl.bindVertexArray(null);
104
56
  return vao;
105
- }
106
- draw(vao, lineCount, opacity = 1.0, zAlphaOn = util_2.Z_ALPHA_MODE.ON) {
107
- const { gl, program, _cameraBindingPoint, _cameraUniformBlock } = this;
57
+ };
58
+ Logic.prototype.draw = function (vao, lineCount, opacity, zAlphaOn) {
59
+ if (opacity === void 0) { opacity = 1.0; }
60
+ if (zAlphaOn === void 0) { zAlphaOn = util_2.Z_ALPHA_MODE.ON; }
61
+ var _a = this, gl = _a.gl, program = _a.program, _cameraBindingPoint = _a._cameraBindingPoint, _cameraUniformBlock = _a._cameraUniformBlock;
108
62
  gl.useProgram(program);
109
63
  _cameraUniformBlock.bind(_cameraBindingPoint);
110
64
  gl.bindVertexArray(vao);
@@ -119,18 +73,19 @@ class Logic {
119
73
  gl.drawArraysInstanced(gl.LINES, 0, 2, lineCount);
120
74
  _cameraUniformBlock.unbind(_cameraBindingPoint);
121
75
  gl.bindVertexArray(null);
122
- }
123
- free() {
76
+ };
77
+ Logic.prototype.free = function () {
124
78
  if (this.isFreed)
125
79
  return;
126
- const { gl, program, globe } = this;
80
+ var _a = this, gl = _a.gl, program = _a.program, globe = _a.globe;
127
81
  totems_1.CameraUniformBlockTotemCache.release(globe);
128
82
  gl.deleteProgram(program);
129
83
  this.isFreed = true;
130
- }
131
- }
132
- const LinesColorInstancedFlatCache = Object.freeze({
133
- get: (globe) => { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
134
- release: (globe) => { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
84
+ };
85
+ return Logic;
86
+ }());
87
+ var LinesColorInstancedFlatCache = Object.freeze({
88
+ get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
89
+ release: function (globe) { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
135
90
  });
136
91
  exports.LinesColorInstancedFlatCache = LinesColorInstancedFlatCache;
@@ -1,101 +1,35 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LineStripProgramCache = void 0;
4
- const webglobjectbuilders_1 = require("../../util/webglobjectbuilders");
4
+ var webglobjectbuilders_1 = require("../../util/webglobjectbuilders");
5
5
  require("../interface");
6
- const totems_1 = require("../totems");
7
- const geometrytransformations_js_1 = require("../../util/shaderfunctions/geometrytransformations.js");
8
- const programcache_1 = require("../programcache");
9
- const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
6
+ var totems_1 = require("../totems");
7
+ var geometrytransformations_js_1 = require("../../util/shaderfunctions/geometrytransformations.js");
8
+ var programcache_1 = require("../programcache");
9
+ var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
10
10
  require("../../util/gl-util/buffer/attribute-loader");
11
- const manager_1 = require("../../util/gl-util/uniform-block/manager");
11
+ var manager_1 = require("../../util/gl-util/uniform-block/manager");
12
12
  require("../../util/gl-util/uniform-block/types");
13
- const methods_1 = require("../../util/gl-util/draw-options/methods");
13
+ var methods_1 = require("../../util/gl-util/draw-options/methods");
14
14
  require("../../util/gl-util/draw-options/types");
15
- const ESCAPE_VALUE = -1;
16
- const uniformBindingPoints = {
15
+ var ESCAPE_VALUE = -1;
16
+ var uniformBindingPoints = {
17
17
  camera: 0,
18
18
  flexible: 1,
19
19
  };
20
- const one = new Float32Array([1]);
21
- const flexibleBlockManager = new manager_1.UniformBlockManager('FlexibleAttributes', [
20
+ var one = new Float32Array([1]);
21
+ var flexibleBlockManager = new manager_1.UniformBlockManager('FlexibleAttributes', [
22
22
  { name: "u_color", type: "vec4", value: new Float32Array([0.12, 1, 0.1, 1]) },
23
23
  { name: "u_dash_opacity", type: "float", value: one },
24
24
  { name: "u_dash_length", type: "float", value: one },
25
25
  ], uniformBindingPoints.flexible);
26
- const vertexShaderSource = `#version 300 es
27
- precision highp float;
28
-
29
- ${totems_1.CameraUniformBlockString}
30
- ${geometrytransformations_js_1.cartesian3DToGLPosition}
31
- ${geometrytransformations_js_1.mercatorXYToGLPosition}
32
-
33
- ${flexibleBlockManager.glslCode()}
34
-
35
- in vec3 position3d;
36
- in vec2 position2d;
37
- in vec4 color;
38
- in float dash_length;
39
- in float dash_opacity;
40
-
41
- out float v_dash_length;
42
- out float v_dash_opacity;
43
- out vec4 v_color;
44
-
45
- flat out vec3 v_flat_position;
46
- out vec3 v_position;
47
-
48
- void main() {
49
-
50
- v_color = ( color.r == -1.0 ) ? u_color : color;
51
- v_dash_length = ( dash_length == -1.0 ) ? u_dash_length : dash_length;
52
- v_dash_opacity = ( dash_opacity == -1.0 ) ? u_dash_opacity : dash_opacity;
53
-
54
- if ( is3D ) {
55
- gl_Position = cartesian3DToGLPosition( position3d );
56
- v_position = position3d;
57
- v_flat_position = position3d;
58
- } else {
59
- gl_Position = mercatorXYToGLPosition( position2d );
60
- v_position = vec3( position2d, 0.0 );
61
- v_flat_position = vec3( position2d, 0.0 );
62
- }
63
- gl_PointSize = 4.0;
64
- }`;
65
- const fragmentShaderSource = `#version 300 es
66
- precision highp float;
67
-
68
- uniform float opacity;
69
-
70
- in vec4 v_color;
71
- in float v_dash_length;
72
- in float v_dash_opacity;
73
-
74
- flat in vec3 v_flat_position;
75
- in vec3 v_position;
76
-
77
-
78
- out vec4 outColor;
79
-
80
- void main() {
81
- outColor = v_color;
82
- return;
83
- float dash_length = v_dash_length;
84
- float dash_opacity = v_dash_opacity;
85
-
86
- if ( dash_length == 0.0 ) {
87
- outColor = vec4( v_color.rgb, v_color.a * v_dash_opacity );
88
- } else {
89
- float dist = distance( v_flat_position, v_position );
90
- // float alpha = mod( dist , v_dash_length * 2.0 ) / v_dash_length < 1.0 ? 1.0 : v_dash_opacity;
91
- outColor = vec4( v_color.rgb, v_color.a * opacity );
92
- }
93
- }`;
26
+ var vertexShaderSource = "#version 300 es\nprecision highp float;\n\n".concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_js_1.cartesian3DToGLPosition, "\n").concat(geometrytransformations_js_1.mercatorXYToGLPosition, "\n\n").concat(flexibleBlockManager.glslCode(), "\n\nin vec3 position3d;\nin vec2 position2d;\nin vec4 color; \nin float dash_length;\nin float dash_opacity;\n\nout float v_dash_length;\nout float v_dash_opacity;\nout vec4 v_color;\n\nflat out vec3 v_flat_position;\nout vec3 v_position;\n\nvoid main() {\n\n v_color = ( color.r == -1.0 ) ? u_color : color;\n v_dash_length = ( dash_length == -1.0 ) ? u_dash_length : dash_length;\n v_dash_opacity = ( dash_opacity == -1.0 ) ? u_dash_opacity : dash_opacity;\n\n if ( is3D ) {\n gl_Position = cartesian3DToGLPosition( position3d );\n v_position = position3d;\n v_flat_position = position3d;\n } else {\n gl_Position = mercatorXYToGLPosition( position2d );\n v_position = vec3( position2d, 0.0 );\n v_flat_position = vec3( position2d, 0.0 );\n }\n gl_PointSize = 4.0;\n}");
27
+ var fragmentShaderSource = "#version 300 es\nprecision highp float;\n\nuniform float opacity;\n\nin vec4 v_color;\nin float v_dash_length;\nin float v_dash_opacity;\n\nflat in vec3 v_flat_position;\nin vec3 v_position;\n\n\nout vec4 outColor;\n\nvoid main() {\n outColor = v_color;\n return;\n float dash_length = v_dash_length;\n float dash_opacity = v_dash_opacity;\n\n if ( dash_length == 0.0 ) {\n outColor = vec4( v_color.rgb, v_color.a * v_dash_opacity );\n } else {\n float dist = distance( v_flat_position, v_position );\n // float alpha = mod( dist , v_dash_length * 2.0 ) / v_dash_length < 1.0 ? 1.0 : v_dash_opacity;\n outColor = vec4( v_color.rgb, v_color.a * opacity );\n }\n}";
94
28
  console.log("LineStripProgram");
95
29
  console.log(vertexShaderSource);
96
30
  console.log(fragmentShaderSource);
97
- class Logic {
98
- constructor(globe) {
31
+ var Logic = /** @class */ (function () {
32
+ function Logic(globe) {
99
33
  this._vaosPublished = [];
100
34
  this._ubosPublished = [];
101
35
  this._opacity = {
@@ -106,7 +40,7 @@ class Logic {
106
40
  this.gl = globe.gl;
107
41
  this.globe = globe;
108
42
  this.program = (0, webglobjectbuilders_1.createProgram)(this.gl, vertexShaderSource, fragmentShaderSource);
109
- const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
43
+ var currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
110
44
  this.gl.useProgram(this.program);
111
45
  this._opacity.location = this.gl.getUniformLocation(this.program, "opacity");
112
46
  this.gl.uniform1f(this._opacity.location, this._opacity.value);
@@ -122,14 +56,15 @@ class Logic {
122
56
  this._defaultFlexibleUBO = flexibleBlockManager.createUBO(this.gl);
123
57
  this.gl.useProgram(currentProgram);
124
58
  }
125
- createUBO(bufferReadType = "STATIC_DRAW") {
126
- const ubo = flexibleBlockManager.createUBO(this.gl, bufferReadType);
59
+ Logic.prototype.createUBO = function (bufferReadType) {
60
+ if (bufferReadType === void 0) { bufferReadType = "STATIC_DRAW"; }
61
+ var ubo = flexibleBlockManager.createUBO(this.gl, bufferReadType);
127
62
  this._ubosPublished.push(ubo);
128
63
  return ubo;
129
- }
130
- createVAO(position3D, position2D, color, dashLength, dashOpacity) {
131
- const { gl } = this;
132
- const vao = gl.createVertexArray();
64
+ };
65
+ Logic.prototype.createVAO = function (position3D, position2D, color, dashLength, dashOpacity) {
66
+ var gl = this.gl;
67
+ var vao = gl.createVertexArray();
133
68
  gl.bindVertexArray(vao);
134
69
  (0, attribute_loader_1.attributeLoader)(gl, position3D, 0, 3);
135
70
  (0, attribute_loader_1.attributeLoader)(gl, position2D, 1, 2);
@@ -138,15 +73,17 @@ class Logic {
138
73
  (0, attribute_loader_1.attributeLoader)(gl, dashOpacity, 4, 1, { escapeValues: [ESCAPE_VALUE] });
139
74
  gl.bindVertexArray(null);
140
75
  return vao;
141
- }
142
- draw(vao, drawOptions, opacity = 1, flexibleUBO = null) {
143
- const { gl, program, cameraBlockTotem } = this;
76
+ };
77
+ Logic.prototype.draw = function (vao, drawOptions, opacity, flexibleUBO) {
78
+ if (opacity === void 0) { opacity = 1; }
79
+ if (flexibleUBO === void 0) { flexibleUBO = null; }
80
+ var _a = this, gl = _a.gl, program = _a.program, cameraBlockTotem = _a.cameraBlockTotem;
144
81
  gl.useProgram(program);
145
82
  if (opacity !== this._opacity.value) {
146
83
  this._opacity.value = opacity;
147
84
  this.gl.uniform1f(this._opacity.location, this._opacity.value);
148
85
  }
149
- const ubo = flexibleUBO || this._defaultFlexibleUBO;
86
+ var ubo = flexibleUBO || this._defaultFlexibleUBO;
150
87
  cameraBlockTotem.bind(uniformBindingPoints.camera);
151
88
  ubo.bind();
152
89
  gl.bindVertexArray(vao);
@@ -155,17 +92,19 @@ class Logic {
155
92
  gl.bindVertexArray(null);
156
93
  ubo.unbind();
157
94
  cameraBlockTotem.unbind(uniformBindingPoints.camera);
158
- }
159
- free() {
160
- this._vaosPublished.forEach((vao) => this.gl.deleteVertexArray(vao));
161
- this._ubosPublished.forEach((ubo) => ubo.free());
95
+ };
96
+ Logic.prototype.free = function () {
97
+ var _this = this;
98
+ this._vaosPublished.forEach(function (vao) { return _this.gl.deleteVertexArray(vao); });
99
+ this._ubosPublished.forEach(function (ubo) { return ubo.free(); });
162
100
  this.gl.deleteProgram(this.program);
163
101
  this._defaultFlexibleUBO.free();
164
102
  totems_1.CameraUniformBlockTotemCache.release(this.globe);
165
103
  this.gl.deleteProgram(this.program);
166
- }
167
- }
104
+ };
105
+ return Logic;
106
+ }());
168
107
  exports.LineStripProgramCache = Object.freeze({
169
- get: (globe) => programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic),
170
- release: (globe) => programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic),
108
+ get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
109
+ release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); },
171
110
  });