@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,111 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LineOnGlobeCache = void 0;
4
- const totems_1 = require("../totems");
5
- const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
6
- const util_1 = require("../../util");
7
- const programcache_1 = require("../programcache");
8
- const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
9
- const manager_1 = require("../../util/gl-util/uniform-block/manager");
4
+ var totems_1 = require("../totems");
5
+ var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
6
+ var util_1 = require("../../util");
7
+ var programcache_1 = require("../programcache");
8
+ var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
9
+ var manager_1 = require("../../util/gl-util/uniform-block/manager");
10
10
  require("../../util/gl-util/draw-options/types");
11
- const methods_1 = require("../../util/gl-util/draw-options/methods");
12
- const GLOBE_MIDPOINT_COUNT = 30;
13
- const escapeValue = -1.0;
14
- const uniformBindingPoints = {
11
+ var methods_1 = require("../../util/gl-util/draw-options/methods");
12
+ var GLOBE_MIDPOINT_COUNT = 30;
13
+ var escapeValue = -1.0;
14
+ var uniformBindingPoints = {
15
15
  camera: 0,
16
16
  flexible: 1
17
17
  };
18
- const uniformBlockManager = new manager_1.UniformBlockManager('FlexibleAttibutes', [
18
+ var uniformBlockManager = new manager_1.UniformBlockManager('FlexibleAttibutes', [
19
19
  { name: 'u_color', type: 'vec4' },
20
20
  { name: 'u_dash_ratio', type: 'float' },
21
21
  { name: 'u_dash_opacity', type: 'float' }
22
22
  ], uniformBindingPoints.flexible);
23
- const vertexShader = `#version 300 es
24
- precision highp float;
25
-
26
- ${geometrytransformations_1.R_3D}
27
- ${totems_1.CameraUniformBlockString}
28
- ${geometrytransformations_1.slerp}
29
- ${geometrytransformations_1.mercatorXYToGLPosition}
30
- ${geometrytransformations_1.cartesian3DToGLPosition}
31
-
32
- ${uniformBlockManager.glslCode()}
33
-
34
- in vec2 start_position;
35
- in vec3 start_position3d;
36
- in vec2 end_position;
37
- in vec3 end_position3d;
38
-
39
- in float dash_ratio;
40
- in float dash_opacity;
41
- in vec4 color;
42
-
43
- out float v_dash_ratio;
44
- out float v_dash_opacity;
45
- out vec4 v_color;
46
-
47
- out vec2 v_limp;
48
- out float interpolation;
49
-
50
- void main() {
51
- vec2 longLat;
52
-
53
- v_color = (color.r == -1.0) ? u_color: color;
54
- v_dash_ratio = (dash_ratio == -1.0) ? u_dash_ratio : dash_ratio;
55
- v_dash_opacity = (dash_opacity == -1.0) ? u_dash_opacity : dash_opacity;
56
-
57
- if (is3D) {
58
- interpolation = float(gl_VertexID) / ${GLOBE_MIDPOINT_COUNT - 1}.0;
59
- vec3 cartesian = slerp(start_position3d, end_position3d, interpolation);
60
- gl_Position = cartesian3DToGLPosition(cartesian);
61
- v_limp = vec2(0.0, 0.0);
62
- } else {
63
- if ( distance( start_position, end_position) > 30000000.0) { return; }
64
- interpolation = float(gl_VertexID);
65
- if (gl_VertexID % 2 == 0) {
66
- longLat = start_position;
67
- } else {
68
- longLat = end_position;
69
- }
70
- v_limp = longLat;
71
- gl_Position = mercatorXYToGLPosition(longLat);
72
- }
73
- }
74
- `;
75
- const fragmentShader = `#version 300 es
76
- ${geometrytransformations_1.POLE}
77
- precision highp float;
78
-
79
- uniform float opacity;
80
-
81
- in float interpolation;
82
- in vec2 v_limp;
83
- in vec4 v_color;
84
- in float v_dash_ratio;
85
- in float v_dash_opacity;
86
-
87
- out vec4 color;
88
-
89
- void main() {
90
- if (v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE) { discard; }
91
- color = v_color;
92
- color.a *= opacity;
93
- if ( v_dash_ratio >= 1.0 ) { return; }
94
- if (interpolation > 0.95) { return; }
95
- if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5) { color.a *= v_dash_opacity; }
96
-
97
- }
98
- `;
99
- class Logic {
100
- constructor(globe) {
23
+ var vertexShader = "#version 300 es\nprecision highp float;\n\n".concat(geometrytransformations_1.R_3D, "\n").concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.slerp, "\n").concat(geometrytransformations_1.mercatorXYToGLPosition, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\n\n").concat(uniformBlockManager.glslCode(), "\n\nin vec2 start_position;\nin vec3 start_position3d;\nin vec2 end_position;\nin vec3 end_position3d;\n\nin float dash_ratio;\nin float dash_opacity;\nin vec4 color;\n\nout float v_dash_ratio;\nout float v_dash_opacity;\nout vec4 v_color;\n\nout vec2 v_limp;\nout float interpolation;\n\nvoid main() {\n vec2 longLat;\n\n v_color = (color.r == -1.0) ? u_color: color;\n v_dash_ratio = (dash_ratio == -1.0) ? u_dash_ratio : dash_ratio;\n v_dash_opacity = (dash_opacity == -1.0) ? u_dash_opacity : dash_opacity;\n\n if (is3D) {\n interpolation = float(gl_VertexID) / ").concat(GLOBE_MIDPOINT_COUNT - 1, ".0;\n vec3 cartesian = slerp(start_position3d, end_position3d, interpolation);\n gl_Position = cartesian3DToGLPosition(cartesian);\n v_limp = vec2(0.0, 0.0);\n } else {\n if ( distance( start_position, end_position) > 30000000.0) { return; }\n interpolation = float(gl_VertexID);\n if (gl_VertexID % 2 == 0) {\n longLat = start_position;\n } else {\n longLat = end_position;\n }\n v_limp = longLat;\n gl_Position = mercatorXYToGLPosition(longLat);\n }\n}\n");
24
+ var fragmentShader = "#version 300 es\n".concat(geometrytransformations_1.POLE, "\nprecision highp float;\n\nuniform float opacity;\n\nin float interpolation;\nin vec2 v_limp;\nin vec4 v_color;\nin float v_dash_ratio;\nin float v_dash_opacity;\n\nout vec4 color;\n\nvoid main() {\n if (v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE) { discard; }\n color = v_color;\n color.a *= opacity;\n if ( v_dash_ratio >= 1.0 ) { return; }\n if (interpolation > 0.95) { return; }\n if (fract(interpolation / (2.0 * v_dash_ratio)) < 0.5) { color.a *= v_dash_opacity; }\n\n}\n");
25
+ var Logic = /** @class */ (function () {
26
+ function Logic(globe) {
101
27
  this.vaosPublished = [];
102
28
  this.isFreed = false;
103
29
  this.globe = globe;
104
30
  this.gl = globe.gl;
105
31
  this.program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
106
32
  this._lastOpacity = 1.0;
107
- const { gl, program } = this;
108
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
33
+ var _a = this, gl = _a.gl, program = _a.program;
34
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
109
35
  gl.useProgram(program);
110
36
  // assign attribute locations
111
37
  gl.bindAttribLocation(program, 0, "start_position");
@@ -134,8 +60,9 @@ class Logic {
134
60
  * @param {number} flexibleOptions.dash_opacity
135
61
  * @param {number} flexibleOptions.dash_ratio
136
62
  */
137
- draw(vao, drawOptions, opacity, flexibleUBO = null) {
138
- const { gl, program, globe, cameraBlockTotem, _defaultFlexibleUBO } = this;
63
+ Logic.prototype.draw = function (vao, drawOptions, opacity, flexibleUBO) {
64
+ if (flexibleUBO === void 0) { flexibleUBO = null; }
65
+ var _a = this, gl = _a.gl, program = _a.program, globe = _a.globe, cameraBlockTotem = _a.cameraBlockTotem, _defaultFlexibleUBO = _a._defaultFlexibleUBO;
139
66
  gl.useProgram(program);
140
67
  cameraBlockTotem.bind(uniformBindingPoints.camera);
141
68
  gl.bindVertexArray(vao);
@@ -144,16 +71,17 @@ class Logic {
144
71
  this._lastOpacity = opacity;
145
72
  }
146
73
  // this._setFlexibleUniforms(flexibleOptions);
147
- const vertexCount = globe.api_GetCurrentGeometry() === 0 ? GLOBE_MIDPOINT_COUNT : 2;
148
- const ubo = flexibleUBO || _defaultFlexibleUBO;
74
+ var vertexCount = globe.api_GetCurrentGeometry() === 0 ? GLOBE_MIDPOINT_COUNT : 2;
75
+ var ubo = flexibleUBO || _defaultFlexibleUBO;
149
76
  ubo.bind();
150
77
  (0, methods_1.drawInstanced)(gl, gl.LINE_STRIP, drawOptions, vertexCount);
151
78
  ubo.unbind();
152
79
  gl.bindVertexArray(null);
153
80
  cameraBlockTotem.unbind(uniformBindingPoints.camera);
154
- }
155
- createUBO(bufferReadType = "STATIC_DRAW") {
156
- const ubo = uniformBlockManager.createUBO(this.gl, bufferReadType);
81
+ };
82
+ Logic.prototype.createUBO = function (bufferReadType) {
83
+ if (bufferReadType === void 0) { bufferReadType = "STATIC_DRAW"; }
84
+ var ubo = uniformBlockManager.createUBO(this.gl, bufferReadType);
157
85
  this._ubosPublished.push(ubo);
158
86
  ubo.update(new Map([
159
87
  ["u_color", [1, 1, 1, 1]],
@@ -161,35 +89,37 @@ class Logic {
161
89
  ["u_dash_opacity", [1]]
162
90
  ]));
163
91
  return ubo;
164
- }
165
- createVAO(startPotision2DBufferObj, startPotision3DBufferObj, endPosition2DBufferObj, endPosition3DBufferObj, dashRatioBufferObj, dashOpacityBufferObj, colorBufferObj) {
166
- const { gl } = this;
167
- const vao = gl.createVertexArray();
92
+ };
93
+ Logic.prototype.createVAO = function (startPotision2DBufferObj, startPotision3DBufferObj, endPosition2DBufferObj, endPosition3DBufferObj, dashRatioBufferObj, dashOpacityBufferObj, colorBufferObj) {
94
+ var gl = this.gl;
95
+ var vao = gl.createVertexArray();
168
96
  gl.bindVertexArray(vao);
169
- const divisor = 1;
170
- (0, attribute_loader_1.attributeLoader)(gl, startPotision2DBufferObj, 0, 2, { divisor });
171
- (0, attribute_loader_1.attributeLoader)(gl, startPotision3DBufferObj, 1, 3, { divisor });
172
- (0, attribute_loader_1.attributeLoader)(gl, endPosition2DBufferObj, 2, 2, { divisor });
173
- (0, attribute_loader_1.attributeLoader)(gl, endPosition3DBufferObj, 3, 3, { divisor });
174
- (0, attribute_loader_1.attributeLoader)(gl, dashRatioBufferObj, 4, 1, { divisor, escapeValues: [escapeValue] });
175
- (0, attribute_loader_1.attributeLoader)(gl, dashOpacityBufferObj, 5, 1, { divisor, escapeValues: [escapeValue] });
176
- (0, attribute_loader_1.attributeLoader)(gl, colorBufferObj, 6, 4, { divisor, escapeValues: [escapeValue, escapeValue, escapeValue, escapeValue] });
97
+ var divisor = 1;
98
+ (0, attribute_loader_1.attributeLoader)(gl, startPotision2DBufferObj, 0, 2, { divisor: divisor });
99
+ (0, attribute_loader_1.attributeLoader)(gl, startPotision3DBufferObj, 1, 3, { divisor: divisor });
100
+ (0, attribute_loader_1.attributeLoader)(gl, endPosition2DBufferObj, 2, 2, { divisor: divisor });
101
+ (0, attribute_loader_1.attributeLoader)(gl, endPosition3DBufferObj, 3, 3, { divisor: divisor });
102
+ (0, attribute_loader_1.attributeLoader)(gl, dashRatioBufferObj, 4, 1, { divisor: divisor, escapeValues: [escapeValue] });
103
+ (0, attribute_loader_1.attributeLoader)(gl, dashOpacityBufferObj, 5, 1, { divisor: divisor, escapeValues: [escapeValue] });
104
+ (0, attribute_loader_1.attributeLoader)(gl, colorBufferObj, 6, 4, { divisor: divisor, escapeValues: [escapeValue, escapeValue, escapeValue, escapeValue] });
177
105
  gl.bindVertexArray(null);
178
106
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
179
107
  this.vaosPublished.push(vao);
180
108
  return vao;
181
- }
182
- free() {
109
+ };
110
+ Logic.prototype.free = function () {
111
+ var _this = this;
183
112
  if (this.isFreed)
184
113
  return;
185
114
  totems_1.CameraUniformBlockTotemCache.release(this.globe);
186
115
  this.gl.deleteProgram(this.program);
187
- this.vaosPublished.forEach(vao => this.gl.deleteVertexArray(vao));
188
- this._ubosPublished.forEach(ubo => ubo.free());
116
+ this.vaosPublished.forEach(function (vao) { return _this.gl.deleteVertexArray(vao); });
117
+ this._ubosPublished.forEach(function (ubo) { return ubo.free(); });
189
118
  this.isFreed = true;
190
- }
191
- }
119
+ };
120
+ return Logic;
121
+ }());
192
122
  exports.LineOnGlobeCache = Object.freeze({
193
- get: (globe) => { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
194
- release: (globe) => { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
123
+ get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
124
+ release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
195
125
  });
@@ -1,51 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const util_1 = require("./util");
4
- const totems_1 = require("../totems");
5
- const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
6
- const programcache_1 = require("../programcache");
7
- const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
3
+ var util_1 = require("./util");
4
+ var totems_1 = require("../totems");
5
+ var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
6
+ var programcache_1 = require("../programcache");
7
+ var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
8
8
  require("../draw-options/types");
9
- const methods_1 = require("../draw-options/methods");
10
- const vs = `#version 300 es
11
- ${geometrytransformations_1.R_3D}
12
- ${totems_1.CameraUniformBlockString}
13
- ${geometrytransformations_1.cartesian3DToGLPosition}
14
- in vec3 pos3D
15
- in vec4 color;
16
- out float ratio;
17
- out flat vec4 vColor;
18
- void main(){
19
- if ( gl_VertexID == 0) {
20
- gl_Position = cartesian3DToGLPosition(pos3D);
21
- ratio =0.0;
22
- } else {
23
- vec3 sea_level_pos3D = norm(pos3D) * R_3D;
24
- gl_Position = cartesian3DToGLPosition(pos3D);
25
- ratio = 1.0;
26
- }
27
- vColor = color;
28
- }`;
29
- const fs = `#version 300 es
30
- uniform float opacity;
31
- uniform float phase;
32
- uniform float fadeOpacity;
33
- in flat vec4 vColor;
34
- in float ratio;
35
- out vec4 fragColor;
36
- void main(){
37
- fragColor = vec4( vColor.rgb, vColor.a * opacity);
38
- if (fadeOpacity < 1.0) {
39
- float alpha= mix( fadeOpacity, vColor.a, fract( ratio + phase ));
40
- fragColor.a *= alpha;
41
- }
42
- }`;
43
- class Logic {
44
- constructor(globe) {
9
+ var methods_1 = require("../draw-options/methods");
10
+ var vs = "#version 300 es\n".concat(geometrytransformations_1.R_3D, "\n").concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\nin vec3 pos3D\nin vec4 color;\nout float ratio;\nout flat vec4 vColor;\nvoid main(){\n if ( gl_VertexID == 0) {\n gl_Position = cartesian3DToGLPosition(pos3D);\n ratio =0.0;\n } else {\n vec3 sea_level_pos3D = norm(pos3D) * R_3D;\n gl_Position = cartesian3DToGLPosition(pos3D);\n ratio = 1.0;\n }\n vColor = color; \n}");
11
+ var fs = "#version 300 es\nuniform float opacity;\nuniform float phase;\nuniform float fadeOpacity;\nin flat vec4 vColor;\nin float ratio;\nout vec4 fragColor;\nvoid main(){\n fragColor = vec4( vColor.rgb, vColor.a * opacity);\n if (fadeOpacity < 1.0) {\n float alpha= mix( fadeOpacity, vColor.a, fract( ratio + phase ));\n fragColor.a *= alpha;\n } \n}";
12
+ var Logic = /** @class */ (function () {
13
+ function Logic(globe) {
45
14
  this.globe = globe;
46
15
  this.gl = globe.gl;
47
16
  this.program = (0, util_1.createProgram)(this.gl, vs, fs);
48
- const { gl, program } = this;
17
+ var _a = this, gl = _a.gl, program = _a.program;
49
18
  this._opacity = {
50
19
  lastValue: 1.0,
51
20
  location: gl.getUniformLocation(program, 'opacity')
@@ -58,36 +27,37 @@ class Logic {
58
27
  lastValue: 1.0,
59
28
  location: gl.getUniformBlockLocation(program, 'fadeOpacity')
60
29
  };
61
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
30
+ var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
62
31
  gl.useProgram(program);
63
- [this._opacity, this._phase, this._fadeOpacity].forEach((wrapper) => gl.uniform1f(wrapper.location, wrapper.lastValue));
32
+ [this._opacity, this._phase, this._fadeOpacity].forEach(function (wrapper) { return gl.uniform1f(wrapper.location, wrapper.lastValue); });
64
33
  gl.useProgram(currentProgram);
65
34
  gl.useProgram(program);
66
35
  gl.bindAttribLocation(program, 0, 'pos3D');
67
36
  gl.bindAttribLocation(program, 1, 'color');
68
37
  this.cameraUniformBlockTotem = new totems_1.CameraUniformBlockTotemCache.get(globe);
69
38
  this.cameraBlockBindingPoint = 0;
70
- const cameraBlockIndex = gl.getUniformBlockLocation(program, 'CameraUniformBlock');
39
+ var cameraBlockIndex = gl.getUniformBlockLocation(program, 'CameraUniformBlock');
71
40
  gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBindingPoint);
72
41
  }
73
- createVao(pos3DObj, colorObj) {
74
- const { gl } = this;
75
- const vao = gl.createVertexArray();
76
- const divisor = 1;
42
+ Logic.prototype.createVao = function (pos3DObj, colorObj) {
43
+ var gl = this.gl;
44
+ var vao = gl.createVertexArray();
45
+ var divisor = 1;
77
46
  gl.bindVertexArray(vao);
78
- (0, attribute_loader_1.attributeLoader)(gl, pos3DObj, 0, 3, { divisor });
79
- (0, attribute_loader_1.attributeLoader)(gl, colorObj, 1, 4, { divisor, escapeValue: [-1, -1, -1, -1] });
47
+ (0, attribute_loader_1.attributeLoader)(gl, pos3DObj, 0, 3, { divisor: divisor });
48
+ (0, attribute_loader_1.attributeLoader)(gl, colorObj, 1, 4, { divisor: divisor, escapeValue: [-1, -1, -1, -1] });
80
49
  gl.bindVertexArray(null);
81
50
  this._vaoCache.push(vao);
82
51
  return vao;
83
- }
52
+ };
84
53
  /**
85
54
  *
86
55
  * @param {WebGL2RenderingContext.vertexArrayObject} vao
87
56
  * @param {Render} drawOptions
88
57
  */
89
- draw(vao, drawOptions, { opacity = 1.0, fadeOpacity = 1.0, }) {
90
- const { globe, gl, program, _opacity, _fadeOpacity } = this;
58
+ Logic.prototype.draw = function (vao, drawOptions, _a) {
59
+ var _b = _a.opacity, opacity = _b === void 0 ? 1.0 : _b, _c = _a.fadeOpacity, fadeOpacity = _c === void 0 ? 1.0 : _c;
60
+ var _d = this, globe = _d.globe, gl = _d.gl, program = _d.program, _opacity = _d._opacity, _fadeOpacity = _d._fadeOpacity;
91
61
  gl.useProgram(program);
92
62
  gl.bindVertexArray(vao);
93
63
  if (fadeOpacity < 1.0) {
@@ -103,9 +73,10 @@ class Logic {
103
73
  gl.uniform1f(_opacity.location, opacity);
104
74
  }
105
75
  (0, methods_1.drawInstanced)(gl, gl.TRIANGLE_FAN, drawOptions);
106
- }
107
- _updatePhase() {
76
+ };
77
+ Logic.prototype._updatePhase = function () {
108
78
  this._phase.lastValue = (Date.now() / 3.0) % 1000;
109
79
  gl.uniform1f(_phase.location, _phase.lastValue);
110
- }
111
- }
80
+ };
81
+ return Logic;
82
+ }());
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Z_ALPHA_MODE = void 0;
4
- const Z_ALPHA_MODE = Object.freeze({
4
+ var Z_ALPHA_MODE = Object.freeze({
5
5
  ON: 1,
6
6
  OFF: 0
7
7
  });
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PickableRendererProgramCache = void 0;
4
- const util_1 = require("../../util");
5
- const totems_1 = require("../totems");
6
- const geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
7
- const programcache_1 = require("../programcache");
4
+ var util_1 = require("../../util");
5
+ var totems_1 = require("../totems");
6
+ var geometrytransformations_1 = require("../../util/shaderfunctions/geometrytransformations");
7
+ var programcache_1 = require("../programcache");
8
8
  require("../../util/gl-util/draw-options/types");
9
- const methods_1 = require("../../util/gl-util/draw-options/methods");
10
- const attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
11
- const manager_1 = require("../../util/gl-util/uniform-block/manager");
12
- const uniformBindingPoints = {
9
+ var methods_1 = require("../../util/gl-util/draw-options/methods");
10
+ var attribute_loader_1 = require("../../util/gl-util/buffer/attribute-loader");
11
+ var manager_1 = require("../../util/gl-util/uniform-block/manager");
12
+ var uniformBindingPoints = {
13
13
  camera: 0,
14
14
  flexible: 1
15
15
  };
16
- const uniformBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
16
+ var uniformBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
17
17
  { name: "u_rgba", type: "vec4", value: new Float32Array([1, 1, 1, 1]) },
18
18
  { name: "u_opacity", type: "float", value: new Float32Array([1.0]) },
19
19
  { name: "u_size_multiplier", type: "float", value: new Float32Array([1.0]) },
@@ -25,101 +25,15 @@ const uniformBlockManager = new manager_1.UniformBlockManager("FlexibleBlock", [
25
25
  { name: "u_dash_opacity_multiplier", type: "float", value: new Float32Array([1.0]) },
26
26
  { name: "u_dash_phase", type: "float", value: new Float32Array([0.0]) },
27
27
  ], uniformBindingPoints.flexible);
28
- const vs = `#version 300 es
29
- ${geometrytransformations_1.R}
30
- ${geometrytransformations_1.R_3D}
31
- ${totems_1.CameraUniformBlockString}
32
- ${geometrytransformations_1.mercatorXYToGLPosition}
33
- ${geometrytransformations_1.cartesian3DToGLPosition}
34
-
35
- ${uniformBlockManager.glslCode()}
36
-
37
- precision highp float;
38
- precision highp int;
39
-
40
- in vec3 pos3D;
41
- in vec2 pos2D;
42
- in vec4 rgba;
43
- in float size;
44
-
45
-
46
- flat out highp int vVertexID;
47
-
48
- out vec4 v_rgba;
49
-
50
- out float v_length;
51
-
52
- void main() {
53
-
54
- v_rgba = (rgba.r == -1.0) ? u_rgba : rgba;
55
- v_rgba.a *= u_opacity;
56
- gl_PointSize = max(((size == -1.0) ? u_size : size) * u_size_multiplier, u_minimum_size);
57
-
58
- float size_fixer;
59
- if(is3D){
60
- gl_Position = cartesian3DToGLPosition(pos3D);
61
- size_fixer = smoothstep(0.15, 1.0, 0.5 * R_3D / gl_Position.w) ;
62
- } else {
63
- gl_Position = mercatorXYToGLPosition(pos2D);
64
- size_fixer = smoothstep(2.0, 5.2, z_level);
65
- }
66
- gl_PointSize *= size_fixer;
67
- switch (u_draw_mode) {
68
- case 0:
69
- vVertexID = gl_VertexID;
70
- break;
71
- case 1:
72
- v_length = float(gl_VertexID % 2);
73
- vVertexID = (gl_VertexID - gl_VertexID % 2) / 2; // a line takes two points
74
- break;
75
- default:
76
- break;
77
- }
78
- }`;
79
- const fs = `#version 300 es
80
- precision highp float;
81
- precision highp int;
82
-
83
- ${uniformBlockManager.glslCode()}
84
-
85
- flat in highp int vVertexID;
86
-
87
- in vec4 v_rgba;
88
- in float v_length;
89
-
90
- layout(location = 0) out vec4 fragColor;
91
- layout(location = 1) out int vertexID;
92
-
93
- void main() {
94
- vertexID = vVertexID;
95
- fragColor = v_rgba;
96
-
97
- switch (u_draw_mode) {
98
- case 0:
99
- float d = distance(gl_PointCoord, vec2(0.5, 0.5));
100
- if (u_is_circle) {
101
- if (d > 0.5) discard;
102
- fragColor.a *= smoothstep(0.5, 0.45, d);
103
- }
104
- if (u_dash_opacity_multiplier < 1.0) {
105
- float dash = sin(d * 3.14159 * 2.0 * u_dash_count + u_dash_phase) * (1.0 - u_dash_opacity_multiplier) + u_dash_opacity_multiplier;
106
- fragColor.a *= dash;
107
- }
108
- break;
109
- case 1:
110
- if (u_dash_opacity_multiplier < 1.0 && fract((v_length + u_dash_phase) * u_dash_count) < 0.5) {
111
- fragColor.a *= u_dash_opacity_multiplier;
112
- }
113
- break;
114
- }
115
- }`;
116
- class PointOnGlobeProgram {
117
- constructor(globe) {
28
+ var vs = "#version 300 es\n".concat(geometrytransformations_1.R, "\n").concat(geometrytransformations_1.R_3D, "\n").concat(totems_1.CameraUniformBlockString, "\n").concat(geometrytransformations_1.mercatorXYToGLPosition, "\n").concat(geometrytransformations_1.cartesian3DToGLPosition, "\n\n").concat(uniformBlockManager.glslCode(), "\n\nprecision highp float;\nprecision highp int;\n\nin vec3 pos3D;\nin vec2 pos2D;\nin vec4 rgba;\nin float size;\n\n\nflat out highp int vVertexID;\n\nout vec4 v_rgba;\n\nout float v_length;\n\nvoid main() {\n \n v_rgba = (rgba.r == -1.0) ? u_rgba : rgba;\n v_rgba.a *= u_opacity;\n gl_PointSize = max(((size == -1.0) ? u_size : size) * u_size_multiplier, u_minimum_size);\n \n float size_fixer; \n if(is3D){\n gl_Position = cartesian3DToGLPosition(pos3D);\n size_fixer = smoothstep(0.15, 1.0, 0.5 * R_3D / gl_Position.w) ;\n } else {\n gl_Position = mercatorXYToGLPosition(pos2D);\n size_fixer = smoothstep(2.0, 5.2, z_level);\n }\n gl_PointSize *= size_fixer;\n switch (u_draw_mode) {\n case 0:\n vVertexID = gl_VertexID;\n break;\n case 1:\n v_length = float(gl_VertexID % 2);\n vVertexID = (gl_VertexID - gl_VertexID % 2) / 2; // a line takes two points\n break;\n default:\n break;\n }\n}");
29
+ var fs = "#version 300 es\nprecision highp float;\nprecision highp int;\n\n".concat(uniformBlockManager.glslCode(), "\n\nflat in highp int vVertexID;\n\nin vec4 v_rgba;\nin float v_length;\n\nlayout(location = 0) out vec4 fragColor;\nlayout(location = 1) out int vertexID;\n\nvoid main() {\n vertexID = vVertexID; \n fragColor = v_rgba;\n\n switch (u_draw_mode) {\n case 0:\n float d = distance(gl_PointCoord, vec2(0.5, 0.5));\n if (u_is_circle) {\n if (d > 0.5) discard;\n fragColor.a *= smoothstep(0.5, 0.45, d);\n }\n if (u_dash_opacity_multiplier < 1.0) {\n float dash = sin(d * 3.14159 * 2.0 * u_dash_count + u_dash_phase) * (1.0 - u_dash_opacity_multiplier) + u_dash_opacity_multiplier;\n fragColor.a *= dash;\n }\n break;\n case 1:\n if (u_dash_opacity_multiplier < 1.0 && fract((v_length + u_dash_phase) * u_dash_count) < 0.5) {\n fragColor.a *= u_dash_opacity_multiplier;\n }\n break;\n }\n}");
30
+ var PointOnGlobeProgram = /** @class */ (function () {
31
+ function PointOnGlobeProgram(globe) {
118
32
  this.globe = globe;
119
33
  this.gl = globe.gl;
120
34
  this._isFreed = false;
121
35
  this.program = (0, util_1.createProgram)(this.gl, vs, fs);
122
- const { gl, program } = this;
36
+ var _a = this, gl = _a.gl, program = _a.program;
123
37
  // assign opacity
124
38
  // assign attribute locations
125
39
  gl.bindAttribLocation(program, 0, "pos3D");
@@ -139,13 +53,13 @@ class PointOnGlobeProgram {
139
53
  ["u_is_circle", [1.0]],
140
54
  ]));
141
55
  }
142
- createUBO() {
143
- const ubo = uniformBlockManager.createUBO(this.gl);
56
+ PointOnGlobeProgram.prototype.createUBO = function () {
57
+ var ubo = uniformBlockManager.createUBO(this.gl);
144
58
  return ubo;
145
- }
146
- createVAO(pos3DBufferObj, pos2DBufferObj, rgbaBufferObj, sizeBufferObj) {
147
- const { gl } = this;
148
- const vao = gl.createVertexArray();
59
+ };
60
+ PointOnGlobeProgram.prototype.createVAO = function (pos3DBufferObj, pos2DBufferObj, rgbaBufferObj, sizeBufferObj) {
61
+ var gl = this.gl;
62
+ var vao = gl.createVertexArray();
149
63
  gl.bindVertexArray(vao);
150
64
  (0, attribute_loader_1.attributeLoader)(gl, pos3DBufferObj, 0, 3);
151
65
  (0, attribute_loader_1.attributeLoader)(gl, pos2DBufferObj, 1, 2);
@@ -154,14 +68,15 @@ class PointOnGlobeProgram {
154
68
  gl.bindVertexArray(null);
155
69
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
156
70
  return vao;
157
- }
71
+ };
158
72
  /**
159
73
  *
160
74
  * @param {vertexArrayObject} vao
161
75
  * @param {DrawRangeIndexParams} drawOptions
162
76
  */
163
- draw(vao, drawOptions, ubo = null) {
164
- const { gl, program } = this;
77
+ PointOnGlobeProgram.prototype.draw = function (vao, drawOptions, ubo) {
78
+ if (ubo === void 0) { ubo = null; }
79
+ var _a = this, gl = _a.gl, program = _a.program;
165
80
  gl.useProgram(program);
166
81
  gl.bindVertexArray(vao);
167
82
  this.cameraBlockTotem.bind(uniformBindingPoints.camera);
@@ -171,18 +86,19 @@ class PointOnGlobeProgram {
171
86
  ubo.unbind();
172
87
  this.cameraBlockTotem.unbind(uniformBindingPoints.camera);
173
88
  gl.bindVertexArray(null);
174
- }
175
- free() {
89
+ };
90
+ PointOnGlobeProgram.prototype.free = function () {
176
91
  if (this._isFreed)
177
92
  return;
178
- const { gl, globe } = this;
93
+ var _a = this, gl = _a.gl, globe = _a.globe;
179
94
  totems_1.CameraUniformBlockTotemCache.release(globe);
180
95
  gl.deleteProgram(this.program);
181
96
  this._isFreed = true;
182
- }
183
- }
184
- const PickableRendererProgramCache = Object.freeze({
185
- get: (globe) => programcache_1.noRegisterGlobeProgramCache.getProgram(globe, PointOnGlobeProgram),
186
- release: (globe) => programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, PointOnGlobeProgram)
97
+ };
98
+ return PointOnGlobeProgram;
99
+ }());
100
+ var PickableRendererProgramCache = Object.freeze({
101
+ get: function (globe) { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, PointOnGlobeProgram); },
102
+ release: function (globe) { return programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, PointOnGlobeProgram); }
187
103
  });
188
104
  exports.PickableRendererProgramCache = PickableRendererProgramCache;