@pirireis/webglobeplugins 0.9.5 → 0.9.7

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 (226) hide show
  1. package/package.json +8 -2
  2. package/Math/angle-calculation.js +0 -14
  3. package/Math/arc.ts +0 -76
  4. package/Math/bounds/line-bbox.js +0 -225
  5. package/Math/constants.ts +0 -11
  6. package/Math/frustum/camera.ts +0 -32
  7. package/Math/frustum/from-globeinfo.ts +0 -63
  8. package/Math/frustum/types.ts +0 -11
  9. package/Math/globe-util/horizon-plane.ts +0 -137
  10. package/Math/index.js +0 -0
  11. package/Math/juction/arc-plane.ts +0 -114
  12. package/Math/juction/line-sphere.ts +0 -30
  13. package/Math/juction/plane-plane.ts +0 -66
  14. package/Math/line.ts +0 -70
  15. package/Math/matrix4.ts +0 -0
  16. package/Math/methods.js +0 -237
  17. package/Math/plane.ts +0 -86
  18. package/Math/quaternion.ts +0 -120
  19. package/Math/roadmap.md +0 -10
  20. package/Math/types.ts +0 -45
  21. package/Math/utils.js +0 -3
  22. package/Math/vec3.ts +0 -155
  23. package/algorithms/search-binary.js +0 -14
  24. package/altitude-locator/adaptors.js +0 -0
  25. package/altitude-locator/draw-subset-obj.js +0 -27
  26. package/altitude-locator/keymethod.js +0 -0
  27. package/altitude-locator/plugin.js +0 -439
  28. package/altitude-locator/types.js +0 -26
  29. package/arrowfield/adaptor.js +0 -11
  30. package/arrowfield/index.js +0 -3
  31. package/arrowfield/plugin.js +0 -128
  32. package/bearing-line/index.js +0 -2
  33. package/bearing-line/plugin.js +0 -512
  34. package/circle-line-chain/chain-list-map.js +0 -221
  35. package/circle-line-chain/init.js +0 -0
  36. package/circle-line-chain/plugin.js +0 -469
  37. package/circle-line-chain/readme.md +0 -57
  38. package/circle-line-chain/util.js +0 -1
  39. package/compass-rose/compass-rose-padding-flat.js +0 -266
  40. package/compass-rose/compass-text-writer.js +0 -173
  41. package/compass-rose/index.js +0 -3
  42. package/compassrose/compassrose.js +0 -341
  43. package/compassrose/index.js +0 -2
  44. package/depth-locator/readme.md +0 -26
  45. package/globe-types.ts +0 -13
  46. package/heatwave/index.js +0 -4
  47. package/heatwave/isobar/objectarraylabels.js +0 -247
  48. package/heatwave/isobar/plugin.js +0 -340
  49. package/heatwave/isobar/quadtreecontours.js +0 -336
  50. package/heatwave/plugins/heatwaveglobeshell.js +0 -258
  51. package/jest.config.js +0 -6
  52. package/partialrings/buffer-manager.js +0 -89
  53. package/partialrings/goals.md +0 -17
  54. package/partialrings/index.js +0 -3
  55. package/partialrings/plugin.js +0 -160
  56. package/partialrings/program.js +0 -324
  57. package/pin/pin-object-array.js +0 -381
  58. package/pin/pin-point-totem.js +0 -77
  59. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
  60. package/point-heat-map/index.js +0 -0
  61. package/point-heat-map/plugin-webworker.js +0 -151
  62. package/point-heat-map/point-to-heat-map-flow.js +0 -150
  63. package/point-heat-map/readme.md +0 -15
  64. package/point-tracks/key-methods.js +0 -3
  65. package/point-tracks/plugin.js +0 -394
  66. package/programs/arrowfield/index.js +0 -2
  67. package/programs/arrowfield/logic.js +0 -286
  68. package/programs/arrowfield/object.js +0 -89
  69. package/programs/data2legend/density-to-legend.js +0 -115
  70. package/programs/data2legend/point-to-density-texture.js +0 -114
  71. package/programs/float2legendwithratio/index.js +0 -3
  72. package/programs/float2legendwithratio/logic.js +0 -194
  73. package/programs/float2legendwithratio/object.js +0 -141
  74. package/programs/globe-util/is-globe-moved.js +0 -27
  75. package/programs/globeshell/index.js +0 -2
  76. package/programs/globeshell/noise/noises.js +0 -0
  77. package/programs/globeshell/wiggle/index.js +0 -6
  78. package/programs/globeshell/wiggle/logic.js +0 -371
  79. package/programs/globeshell/wiggle/object.js +0 -93
  80. package/programs/helpers/blender/index.js +0 -0
  81. package/programs/helpers/blender/program.js +0 -91
  82. package/programs/helpers/fadeaway/index.js +0 -3
  83. package/programs/helpers/fadeaway/logic.js +0 -76
  84. package/programs/helpers/fadeaway/object.js +0 -20
  85. package/programs/helpers/index.js +0 -2
  86. package/programs/index.js +0 -21
  87. package/programs/interface.ts +0 -7
  88. package/programs/line-on-globe/angled-line.js +0 -206
  89. package/programs/line-on-globe/circle-accurate-3d.js +0 -167
  90. package/programs/line-on-globe/circle-accurate-flat.js +0 -262
  91. package/programs/line-on-globe/circle-accurate.js +0 -202
  92. package/programs/line-on-globe/circle.js +0 -191
  93. package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
  94. package/programs/line-on-globe/index.js +0 -0
  95. package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
  96. package/programs/line-on-globe/linestrip.ts +0 -228
  97. package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
  98. package/programs/line-on-globe/to-the-surface.js +0 -129
  99. package/programs/line-on-globe/util.js +0 -8
  100. package/programs/picking/pickable-renderer.js +0 -216
  101. package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
  102. package/programs/point-on-globe/element-point-glow.js +0 -184
  103. package/programs/point-on-globe/square-pixel-point.js +0 -189
  104. package/programs/programcache.ts +0 -131
  105. package/programs/rings/distancering/circleflatprogram.js +0 -136
  106. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
  107. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
  108. package/programs/rings/distancering/index.js +0 -5
  109. package/programs/rings/distancering/paddyflatprogram.js +0 -146
  110. package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
  111. package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
  112. package/programs/rings/distancering/shader.js +0 -0
  113. package/programs/rings/index.js +0 -1
  114. package/programs/rings/partial-ring/piece-of-pie.js +0 -315
  115. package/programs/totems/camerauniformblock.d.ts +0 -48
  116. package/programs/totems/camerauniformblock.js +0 -197
  117. package/programs/totems/canvas-webglobe-info.js +0 -136
  118. package/programs/totems/gpu-selection-uniform-block.js +0 -132
  119. package/programs/totems/index.ts +0 -2
  120. package/programs/two-d/pixel-circle.js +0 -0
  121. package/programs/two-d/pixel-padding-for-compass.js +0 -174
  122. package/programs/util.js +0 -20
  123. package/programs/vectorfields/index.js +0 -3
  124. package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
  125. package/programs/vectorfields/logics/index.js +0 -5
  126. package/programs/vectorfields/logics/pixelbased.js +0 -161
  127. package/programs/vectorfields/logics/ubo.js +0 -64
  128. package/programs/vectorfields/pingpongbuffermanager.js +0 -80
  129. package/publish.bat +0 -60
  130. package/rangerings/enum.js +0 -3
  131. package/rangerings/index.js +0 -5
  132. package/rangerings/plugin.js +0 -649
  133. package/rangerings/rangeringangletext.js +0 -368
  134. package/rangerings/ring-account.js +0 -129
  135. package/shaders/fragment-toy/firework.js +0 -55
  136. package/shaders/fragment-toy/singularity.js +0 -59
  137. package/shape-on-terrain/arc/naive/plugin.ts +0 -304
  138. package/shape-on-terrain/goal.md +0 -12
  139. package/tests/Math/junction/arc-plane.test.ts +0 -133
  140. package/tests/Math/junction/plane-plane.test.ts +0 -82
  141. package/tests/Math/plane.test.ts +0 -43
  142. package/tests/Math/vec3.test.ts +0 -14
  143. package/timetracks/adaptors-line-strip.js +0 -80
  144. package/timetracks/adaptors.js +0 -133
  145. package/timetracks/index.js +0 -6
  146. package/timetracks/plugin-line-strip.js +0 -295
  147. package/timetracks/plugin.js +0 -304
  148. package/timetracks/program-line-strip.js +0 -688
  149. package/timetracks/program.js +0 -850
  150. package/timetracks/programpoint-line-strip.js +0 -175
  151. package/timetracks/programpoint.js +0 -168
  152. package/timetracks/readme.md +0 -1
  153. package/tsconfig.json +0 -21
  154. package/types.ts +0 -17
  155. package/util/account/bufferoffsetmanager.js +0 -209
  156. package/util/account/index.js +0 -6
  157. package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
  158. package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
  159. package/util/account/single-attribute-buffer-management/index.ts +0 -13
  160. package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
  161. package/util/account/single-attribute-buffer-management/types.ts +0 -39
  162. package/util/account/util.js +0 -22
  163. package/util/algorithms/index.js +0 -0
  164. package/util/algorithms/search-binary.js +0 -26
  165. package/util/check/get.js +0 -13
  166. package/util/check/index.js +0 -0
  167. package/util/check/typecheck.js +0 -39
  168. package/util/geometry/index.js +0 -53
  169. package/util/gl-util/buffer/attribute-loader.ts +0 -85
  170. package/util/gl-util/buffer/index.ts +0 -6
  171. package/util/gl-util/buffer/types.ts +0 -13
  172. package/util/gl-util/draw-options/methods.ts +0 -66
  173. package/util/gl-util/draw-options/types.ts +0 -28
  174. package/util/gl-util/uniform-block/manager.ts +0 -187
  175. package/util/gl-util/uniform-block/roadmap.md +0 -70
  176. package/util/gl-util/uniform-block/shader.js +0 -0
  177. package/util/gl-util/uniform-block/types.ts +0 -27
  178. package/util/heatwavedatamanager/datamanager.js +0 -168
  179. package/util/heatwavedatamanager/index.js +0 -3
  180. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
  181. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  182. package/util/index.js +0 -13
  183. package/util/interpolation/index.js +0 -0
  184. package/util/interpolation/timetrack/index.js +0 -9
  185. package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
  186. package/util/interpolation/timetrack/web-worker-str.js +0 -180
  187. package/util/interpolation/timetrack/web-worker.js +0 -51
  188. package/util/jshelpers/data-filler.js +0 -19
  189. package/util/jshelpers/equality.js +0 -17
  190. package/util/jshelpers/index.js +0 -1
  191. package/util/jshelpers/timefilters.js +0 -32
  192. package/util/picking/fence.js +0 -46
  193. package/util/picking/picker-displayer.js +0 -177
  194. package/util/programs/draw-texture-on-canvas.js +0 -102
  195. package/util/programs/index.js +0 -1
  196. package/util/programs/shapesonglobe.js +0 -246
  197. package/util/programs/supersampletotextures.js +0 -142
  198. package/util/programs/texturetoglobe.js +0 -203
  199. package/util/shaderfunctions/geometrytransformations.ts +0 -388
  200. package/util/shaderfunctions/index.js +0 -2
  201. package/util/shaderfunctions/nodata.js +0 -10
  202. package/util/shaderfunctions/noisefunctions.js +0 -44
  203. package/util/surface-line-data/arc-bboxes.ts +0 -42
  204. package/util/surface-line-data/arcs-to-cuts.js +0 -74
  205. package/util/surface-line-data/cut-arc.js +0 -0
  206. package/util/surface-line-data/flow.ts +0 -52
  207. package/util/surface-line-data/rbush-manager.js +0 -0
  208. package/util/surface-line-data/types.ts +0 -27
  209. package/util/surface-line-data/web-worker.js +0 -0
  210. package/util/webglobe/gldefaultstates.js +0 -5
  211. package/util/webglobe/index.js +0 -2
  212. package/util/webglobe/rasteroverlay.js +0 -96
  213. package/util/webglobjectbuilders.ts +0 -456
  214. package/util/webglobjectbuilders1.js +0 -271
  215. package/waveparticles/adaptor.js +0 -16
  216. package/waveparticles/index.js +0 -3
  217. package/waveparticles/plugin.js +0 -313
  218. package/wind/imagetovectorfieldandmagnitude.js +0 -39
  219. package/wind/index.js +0 -5
  220. package/wind/plugin.js +0 -1057
  221. package/wind/vectorfieldimage.js +0 -27
  222. package/write-text/attached-text-writer.js +0 -105
  223. package/write-text/context-text.js +0 -125
  224. package/write-text/context-text3.js +0 -178
  225. package/write-text/index.js +0 -1
  226. package/write-text/writer-plugin.js +0 -7
@@ -1,89 +0,0 @@
1
- // this contains vao, drawCount, ArrowBufferBlock, vao,
2
- // how to, where to set instanced parameters
3
- // the vectorfield buffer should be managed outside, since it can be static or dynamic.
4
-
5
- import Logic from './logic';
6
- import { globeProgramCache } from '../programcache';
7
- import { longlatbbox2normalbbox } from "../util";
8
-
9
- export default class ArrowField {
10
- constructor(gl, globe, {
11
- minLon = -180,
12
- maxLon = 180,
13
- minLat = -90,
14
- maxLat = 90,
15
- height = 0,
16
- opacity = 1,
17
- color = [0.04, 0.2, 0.8],
18
- targetWidth = 100,
19
- targetHeight = 100,
20
- dataWidth = null,
21
- dataHeight = null,
22
- tailLengthRatio = 1,
23
- wingLengthRatio = 0.5,
24
- noDataValue = null,
25
- // maxMagnitude = null
26
- } = {}) {
27
- this.gl = gl;
28
- this.globe = globe;
29
-
30
- this.program = globeProgramCache.getProgram(globe, Logic);
31
- this.arrowBlockManager = this.program.getArrowBlockBufferManager();
32
- this.instanceCount = targetWidth * targetHeight;
33
- this.arrowBlockManager.update({ resolution: [targetWidth, targetHeight] });
34
- this.textureManager = this.program.getTextureManager(dataWidth, dataHeight);
35
- this.setBBox({ minLon, maxLon, minLat, maxLat });
36
- this.update({ height, opacity, color, tailLengthRatio, wingLengthRatio, noDataValue });
37
- }
38
-
39
-
40
- setBBox({ minLon = -180, maxLon = 180, minLat = -90, maxLat = 90 } = {}) {
41
- this.bbox = { minLon, maxLon, minLat, maxLat };
42
- const { bboxSizeRad, bboxOffsetRad } = longlatbbox2normalbbox(this.bbox);
43
- this.arrowBlockManager.update({ bboxSizeRad, bboxOffsetRad });
44
- this.globe.DrawRender();
45
- }
46
-
47
-
48
- update({ height, opacity, color, resolution, tailLengthRatio, wingLengthRatio, noDataValue } = {}) {
49
- if (resolution) {
50
- this.instanceCount = resolution[0] * resolution[1];
51
- }
52
- this.arrowBlockManager.update({
53
- color,
54
- resolution,
55
- height,
56
- opacity,
57
- tailLengthRatio,
58
- wingLengthRatio,
59
- noDataValue,
60
- });
61
- this.globe.DrawRender();
62
- }
63
-
64
- setTargetResolution(width, height) {
65
- this.instanceCount = width * height;
66
- this.arrowBlockManager.update({ resolution: [width, height] });
67
-
68
- this.globe.DrawRender();
69
- }
70
-
71
- draw() {
72
- const { program, arrowBlockManager, textureManager, instanceCount } = this;
73
- program.draw(arrowBlockManager, textureManager, instanceCount);
74
- }
75
-
76
-
77
- setData(rotation) {
78
- this.textureManager.setData(rotation);
79
- this.globe.DrawRender();
80
- }
81
-
82
-
83
- free() {
84
- this.arrowBlockManager.free();
85
- this.textureManager.free();
86
- globeProgramCache.releaseProgram(this.gl, Logic);
87
- }
88
- }
89
-
@@ -1,115 +0,0 @@
1
- import { createProgram } from "../../util/";
2
- import { noRegisterGlobeProgramCache } from "../programcache";
3
-
4
-
5
- const vs = `#version 300 es
6
- precision highp float;
7
-
8
- uniform sampler2D u_density_texture;
9
- in vec2 a_position;
10
-
11
- out vec2 v_texcoord;
12
-
13
- void main() {
14
- gl_Position = vec4(a_position, 0.0, 1.0);
15
- v_texcoord = a_position * 0.5 + 0.5;
16
- }`;
17
-
18
-
19
- const fs = `#version 300 es
20
- precision highp float;
21
-
22
- uniform sampler2D u_legend_texture;
23
- uniform sampler2D u_density_texture;
24
-
25
- uniform float u_opacity;
26
- in vec2 v_texcoord;
27
- out vec4 fragColor;
28
-
29
- void main() {
30
- float density = texture(u_density_texture, v_texcoord).r;
31
- fragColor = texture(u_legend_texture, vec2(density, 0.5));
32
- fragColor.a *= u_opacity * sqrt(density);
33
- }`;
34
-
35
-
36
-
37
-
38
- class DensityToLegendProgram {
39
- constructor(globe) {
40
- this.globe = globe;
41
- this.gl = globe.gl;
42
- this.program = createProgram(globe.gl, vs, fs);
43
- const { gl, program } = this;
44
- this.uniforms = {
45
- densityTexture: gl.getUniformLocation(program, "u_density_texture"),
46
- legendTexture: gl.getUniformLocation(program, "u_legend_texture"),
47
- opacity: gl.getUniformLocation(program, "u_opacity"),
48
- }
49
- { // assign attribute locations
50
- gl.bindAttribLocation(program, 0, "a_position");
51
- }
52
- {
53
- this.vao = gl.createVertexArray();
54
- const a_positionLocation = gl.getAttribLocation(program, "a_position");
55
- gl.bindVertexArray(this.vao);
56
-
57
- const buffer = gl.createBuffer();
58
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
59
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
60
- -1, -1,
61
- 1, -1,
62
- 1, 1,
63
- -1, 1,
64
- ]), gl.STATIC_DRAW);
65
- gl.enableVertexAttribArray(a_positionLocation);
66
- gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
67
- gl.bindVertexArray(null);
68
- // gl.bindBuffer(gl.ARRAY_BUFFER, null);
69
- this._buffer = buffer;
70
- }
71
-
72
- {
73
- this._lastOpacity = 1;
74
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
75
- gl.useProgram(program);
76
- gl.uniform1f(this.uniforms.opacity, this._lastOpacity);
77
- gl.useProgram(currentProgram);
78
- }
79
- }
80
-
81
-
82
- draw(densityTexture, legendTexture, opacity) {
83
- const { gl, program, uniforms } = this;
84
- gl.useProgram(program);
85
- gl.bindVertexArray(this.vao);
86
- gl.activeTexture(gl.TEXTURE1);
87
- gl.bindTexture(gl.TEXTURE_2D, legendTexture);
88
- gl.uniform1i(uniforms.legendTexture, 1);
89
- gl.activeTexture(gl.TEXTURE0);
90
- gl.bindTexture(gl.TEXTURE_2D, densityTexture);
91
- gl.uniform1i(uniforms.densityTexture, 0);
92
- if (this._lastOpacity !== opacity) {
93
- gl.uniform1f(uniforms.opacity, opacity);
94
- this._lastOpacity = opacity;
95
- }
96
- gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
97
- gl.bindVertexArray(null);
98
- }
99
-
100
-
101
- free() {
102
- const gl = this.gl;
103
- gl.deleteVertexArray(this.vao);
104
- gl.deleteBuffer(this._buffer);
105
- gl.deleteProgram(this.program);
106
- }
107
- }
108
-
109
-
110
- const densityToLegendProgramCache = {
111
- get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, DensityToLegendProgram),
112
- release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, DensityToLegendProgram)
113
- }
114
-
115
- export { densityToLegendProgramCache };
@@ -1,114 +0,0 @@
1
- import { createProgram } from "../../util/";
2
- import { noRegisterGlobeProgramCache } from "../programcache";
3
- import { CameraUniformBlockTotemCache, CameraUniformBlockString } from "../totems/camerauniformblock";
4
- import { mercatorXYToGLPosition, cartesian3DToGLPosition } from "../../util/shaderfunctions/geometrytransformations";
5
-
6
-
7
- const vs = `#version 300 es
8
- precision highp float;
9
-
10
- ${CameraUniformBlockString}
11
- ${mercatorXYToGLPosition}
12
- ${cartesian3DToGLPosition}
13
-
14
- in vec3 position;
15
- uniform float pointSize;
16
-
17
- void main() {
18
- if (is3D) {
19
- gl_Position = cartesian3DToGLPosition(position);
20
- } else {
21
- gl_Position = mercatorXYToGLPosition(position.xy);
22
- }
23
- gl_PointSize = pointSize;
24
- }
25
- `;
26
-
27
-
28
- const fs = `#version 300 es
29
- precision highp float;
30
- out vec4 fragColor;
31
-
32
- void main() {
33
- float r = length(gl_PointCoord - 0.5) * 2.0;
34
- if (r > 1.0) discard;
35
- // float density = smoothstep(0.1, 1.0, 1.0 - r);
36
- fragColor = vec4((15.0/16.0)*sqrt(1.0-sqrt(r)));
37
- }`;
38
-
39
-
40
-
41
- class PointHeatmapProgram {
42
-
43
- constructor(globe) {
44
- this.globe = globe;
45
- this.gl = globe.gl;
46
- this._isFreed = false;
47
- this.program = createProgram(globe.gl, vs, fs);
48
-
49
- const { gl, program } = this;
50
- this.uniforms = {
51
- pointSize: gl.getUniformLocation(this.program, "pointSize"),
52
- }
53
- { // assign attribute locations
54
- gl.bindAttribLocation(program, 0, "position");
55
- }
56
-
57
- { // arrange camera uniform block
58
- this.cameraBlockBingingPoint = 0;
59
- this.cameraBlockTotem = CameraUniformBlockTotemCache.get(globe);
60
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "CameraUniformBlock");
61
- gl.uniformBlockBinding(program, cameraBlockIndex, this.cameraBlockBingingPoint);
62
- }
63
-
64
- { // last values
65
- this._lastPointSize = 0;
66
-
67
- const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
68
- gl.useProgram(program);
69
- gl.uniform1f(this.uniforms.pointSize, this._lastPointSize);
70
- gl.useProgram(currentProgram);
71
- }
72
- }
73
-
74
-
75
- createVAO(positionBuffer, vectorSize) {
76
- const gl = this.gl;
77
- const vao = gl.createVertexArray();
78
- gl.bindVertexArray(vao);
79
- gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
80
- gl.enableVertexAttribArray(0);
81
- gl.vertexAttribPointer(0, vectorSize, gl.FLOAT, false, 0, 0);
82
- gl.bindVertexArray(null);
83
- return vao;
84
- }
85
-
86
- draw(vao, length, pointSize = 5.0) {
87
- const gl = this.gl;
88
- gl.useProgram(this.program);
89
- if (pointSize !== this._lastPointSize) {
90
- gl.uniform1f(this.uniforms.pointSize, pointSize);
91
- this._lastPointSize = pointSize;
92
- }
93
- gl.bindVertexArray(vao);
94
- this.cameraBlockTotem.bind(this.cameraBlockBingingPoint);
95
- gl.drawArrays(gl.POINTS, 0, length);
96
- this.cameraBlockTotem.unbind(this.cameraBlockBingingPoint);
97
- gl.bindVertexArray(null);
98
- }
99
-
100
- free() {
101
- if (this._isFreed) return;
102
- const { gl, globe } = this;
103
- CameraUniformBlockTotemCache.release(globe);
104
- gl.deleteProgram(this.program);
105
- this._isFreed = true;
106
- }
107
- }
108
-
109
- const pointToDensityTextureCache = {
110
- get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, PointHeatmapProgram),
111
- release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, PointHeatmapProgram)
112
- }
113
-
114
- export { pointToDensityTextureCache };
@@ -1,3 +0,0 @@
1
- import Float2LegendWithRatio from './object';
2
-
3
- export { Float2LegendWithRatio };
@@ -1,194 +0,0 @@
1
- import { createProgram } from "../../util";
2
-
3
- export default class {
4
-
5
-
6
- constructor(gl) {
7
- this.gl = gl;
8
- // console.log("Float2LegendWithRatioProgram gl:", gl);
9
- this._width = 1;
10
- this._height = 1;
11
-
12
- this._blendRatio = 0.0;
13
- this.programWrapper = this._createProgramWrapper();
14
- }
15
-
16
-
17
- _createProgramWrapper() {
18
- const vertexShaderSource = `#version 300 es
19
- precision highp float;
20
-
21
- in vec2 a_position;
22
- out vec2 v_texcoord;
23
-
24
- void main() {
25
- gl_Position = vec4(a_position, 0.0, 1.0);
26
- v_texcoord = a_position * 0.5 + 0.5;
27
- v_texcoord.y = 1.0 - v_texcoord.y;
28
- }
29
- `;
30
-
31
- const fragmentShaderSource = `#version 300 es
32
- precision highp float;
33
-
34
- in vec2 v_texcoord;
35
- uniform sampler2D u_float_texture0;
36
- uniform sampler2D u_float_texture1;
37
- uniform sampler2D u_color_texture;
38
-
39
- layout(std140) uniform HeatParametersBlock {
40
- vec2 u_color_ramp_range; // x is min, y is range ( max - min)
41
- vec2 u_min_max;
42
- float u_escape_value;
43
- float u_blend_ratio;
44
- };
45
-
46
- out vec4 outColor;
47
-
48
- void main() {
49
- if ( u_blend_ratio < 0.0) {
50
- outColor = vec4(0.0, 0.0, 0.0, 0.0);
51
- return;
52
- }
53
- float f0 = texture(u_float_texture0, v_texcoord).r;
54
- float f1 = texture(u_float_texture1, v_texcoord).r;
55
- // outColor = vec4(
56
-
57
- if (f0 == u_escape_value || f1 == u_escape_value) {
58
- outColor = vec4(0.0, 0.0, 0.0, 0.0);
59
- return;
60
- }
61
- float x = mix(f0, f1, u_blend_ratio);
62
- if ( x < u_min_max.x || x > u_min_max.y) {
63
- outColor = vec4(0.0, 0.0, 0.0, 0.0);
64
- return;
65
- }
66
- x = (x - u_color_ramp_range.x) / u_color_ramp_range.y;
67
- outColor = texture(u_color_texture, vec2(x, 0.5));
68
- }
69
- `;
70
-
71
- const gl = this.gl;
72
- const program = createProgram(gl, vertexShaderSource, fragmentShaderSource);
73
- const vao = gl.createVertexArray();
74
- gl.bindVertexArray(vao);
75
- const buffer = gl.createBuffer();
76
- this._buffer = buffer;
77
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
78
- gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
79
- -1, -1,
80
- 1, -1,
81
- 1, 1,
82
- -1, 1
83
- ]), gl.STATIC_DRAW);
84
- const positionLocation = gl.getAttribLocation(program, "a_position");
85
- gl.enableVertexAttribArray(positionLocation);
86
- gl.vertexAttribPointer(positionLocation, 2, gl.FLOAT, false, 0, 0);
87
- gl.bindVertexArray(null);
88
-
89
- this.heatParametersBlockBindingPoint = 0;
90
-
91
- const heatParametersBlockIndex = gl.getUniformBlockIndex(program, "HeatParametersBlock");
92
- gl.uniformBlockBinding(program, heatParametersBlockIndex, this.heatParametersBlockBindingPoint);
93
-
94
-
95
- return {
96
- program,
97
- vao,
98
- u_float_texture0: gl.getUniformLocation(program, "u_float_texture0"),
99
- u_float_texture1: gl.getUniformLocation(program, "u_float_texture1"),
100
- u_color_texture: gl.getUniformLocation(program, "u_color_texture"),
101
- u_blend_ratio: gl.getUniformLocation(program, "u_blend_ratio"),
102
- u_color_ramp_range: gl.getUniformLocation(program, "u_color_ramp_range"),
103
- u_min_max: gl.getUniformLocation(program, "u_min_max"),
104
- u_escape_value: gl.getUniformLocation(program, "u_escape_value")
105
- };
106
- }
107
-
108
-
109
- getUniformBlockManager() {
110
- return new HeatParametersBlockManager(this.gl);
111
- }
112
- draw(texture0, texture1, colorRampTexture, heatParametersBlockManager) {
113
- const { gl, programWrapper } = this;
114
- const { program, u_float_texture0, u_float_texture1, u_color_texture } = programWrapper;
115
-
116
- gl.useProgram(program);
117
- gl.bindVertexArray(programWrapper.vao);
118
- gl.activeTexture(gl.TEXTURE1);
119
- gl.bindTexture(gl.TEXTURE_2D, texture1);
120
- gl.uniform1i(u_float_texture1, 1);
121
- gl.activeTexture(gl.TEXTURE2);
122
- gl.bindTexture(gl.TEXTURE_2D, colorRampTexture);
123
- gl.uniform1i(u_color_texture, 2);
124
- gl.activeTexture(gl.TEXTURE0);
125
- gl.bindTexture(gl.TEXTURE_2D, texture0);
126
- gl.uniform1i(u_float_texture0, 0);
127
- heatParametersBlockManager.bind();
128
- // clear output texture
129
- gl.clearColor(0, 0, 0, 0);
130
- gl.drawArrays(gl.TRIANGLE_FAN, 0, 4);
131
- gl.bindVertexArray(null);
132
- heatParametersBlockManager.unbind();
133
- }
134
-
135
-
136
- free() {
137
- const gl = this.gl;
138
- gl.deleteBuffer(this._buffer);
139
- gl.deleteProgram(this.programWrapper.program);
140
- gl.deleteVertexArray(this.programWrapper.vao);
141
- }
142
-
143
- }
144
-
145
-
146
- class HeatParametersBlockManager {
147
- constructor(gl) {
148
- this.gl = gl;
149
- this.buffer = gl.createBuffer();
150
- gl.bindBuffer(gl.UNIFORM_BUFFER, this.buffer);
151
- gl.bufferData(gl.UNIFORM_BUFFER, 24, gl.DYNAMIC_DRAW);
152
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
153
- }
154
-
155
-
156
- /*
157
- * @param {Array<number>} color_ramp_range [minValue,( maxValue - minValue)]
158
- * @param {Array<number>} min_max [minEdge, maxEdge]
159
- * @param {number} escape_value // value that will be ignored
160
- * @param {number} blend_ratio // ratio of blending between two textures
161
- * */
162
- update({ color_ramp_range = null, min_max = null, escape_value = null, blend_ratio = null }) {
163
- const { gl, buffer } = this;
164
- gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
165
- if (color_ramp_range) {
166
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array(color_ramp_range));
167
- }
168
- if (min_max) {
169
- gl.bufferSubData(gl.UNIFORM_BUFFER, 8, new Float32Array(min_max));
170
- }
171
- if (escape_value) {
172
- gl.bufferSubData(gl.UNIFORM_BUFFER, 16, new Float32Array([escape_value]));
173
- }
174
- if (blend_ratio) {
175
- gl.bufferSubData(gl.UNIFORM_BUFFER, 20, new Float32Array([blend_ratio]));
176
- }
177
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
178
- }
179
-
180
- bind() {
181
- const { gl, buffer } = this;
182
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this.heatParametersBlockBindingPoint, buffer);
183
- }
184
-
185
- free() {
186
- this.gl.deleteBuffer(this.buffer);
187
- }
188
-
189
- unbind() {
190
- const { gl } = this;
191
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this.heatParametersBlockBindingPoint, null);
192
- }
193
-
194
- }
@@ -1,141 +0,0 @@
1
- import Float2LegentWithRatioProgram from './logic';
2
- import { glProgramCache } from '../programcache';
3
-
4
- // Uniform Buffer Objects use this
5
-
6
- export default class DataObject {
7
- constructor(gl, {
8
- width = 1,
9
- height = 1,
10
- texture0 = null,
11
- texture1 = null,
12
- colorRampTexture = null,
13
- colorRampRange = null,
14
- escapeValue = 99999,
15
- blendRatio = 0.0,
16
- minMaxEdges = null,
17
- } = {}) {
18
- this.gl = gl;
19
- this.programlogic = glProgramCache.getProgram(gl, Float2LegentWithRatioProgram);
20
- this.heatParametersBlockManager = this.programlogic.getUniformBlockManager();
21
- this.width = width;
22
- this.height = height;
23
- this.texture0 = texture0 || this._createColorRampTexture(width, height);
24
- this.texture1 = texture1 || this._createColorRampTexture(width, height);
25
- this.colorRampTexture = colorRampTexture || this._createColorRampTexture();
26
- this.minMaxEdges = minMaxEdges || new Float32Array([-99999, 99999]);
27
- this.heatParametersBlockManager.update({
28
- escape_value: escapeValue,
29
- blend_ratio: blendRatio,
30
- min_max: minMaxEdges,
31
- color_ramp_range: colorRampRange
32
-
33
- });
34
-
35
- }
36
-
37
-
38
- _bindBlock() {
39
- const gl = this.gl;
40
- const program = this.programlogic.programWrapper.program;
41
- gl.uniformBlockBinding(program, gl.getUniformBlockIndex(program, 'Block'), 0);
42
-
43
- }
44
-
45
-
46
- _createColorRampTexture() {
47
- const { gl } = this;
48
- const texture = gl.createTexture();
49
- gl.bindTexture(gl.TEXTURE_2D, texture);
50
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
51
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
52
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
53
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
54
- gl.bindTexture(gl.TEXTURE_2D, null);
55
- return texture;
56
- }
57
-
58
- setBlendRatio(ratio) {
59
- if (ratio < 0 || ratio > 1) {
60
- console.warn('Invalid blend ratio');
61
- return;
62
- }
63
- this.heatParametersBlockManager.update({ blend_ratio: ratio });
64
- }
65
-
66
- setEscapeValue(value) {
67
- this.heatParametersBlockManager.update({ escape_value: value });
68
- }
69
-
70
-
71
- setTexture0(texture) {
72
- this.texture0 = texture;
73
- }
74
-
75
- setTexture1(texture) {
76
- this.texture1 = texture;
77
- }
78
-
79
- setColorRampTexture(texture) {
80
- this.colorRampTexture = texture;
81
- }
82
-
83
-
84
- setDataWidthHeight(width, height) {
85
- this.width = width;
86
- this.height = height;
87
- }
88
-
89
-
90
- setFloatTextureData(data0, data1, width, height, yFlip = false) {
91
- const { texture0, texture1, gl } = this;
92
-
93
- gl.bindTexture(gl.TEXTURE_2D, texture0);
94
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, yFlip);
95
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, width, height, 0, gl.RED, gl.FLOAT, data0);
96
- gl.bindTexture(gl.TEXTURE_2D, texture1);
97
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, width, height, 0, gl.RED, gl.FLOAT, data1);
98
- gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
99
- }
100
-
101
-
102
- discard() {
103
- this.heatParametersBlockManager.update({ blend_ratio: -1 });
104
- }
105
-
106
-
107
- setColorRampTextureData(data, size) {
108
- const { gl, colorRampTexture } = this;
109
- gl.bindTexture(gl.TEXTURE_2D, colorRampTexture);
110
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, size, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);
111
- }
112
-
113
- setColorRampRange(min, max) {
114
- if (min > max) {
115
- console.warn('Invalid min max values');
116
- return;
117
- }
118
- const range = max - min;
119
- this.heatParametersBlockManager.update({ color_ramp_range: new Float32Array([min, range]) });
120
- }
121
-
122
- setMinMaxEdges(min, max) {
123
- if (min) this.minMaxEdges[0] = min;
124
- if (max) this.minMaxEdges[1] = max;
125
- this.heatParametersBlockManager.update({ min_max: this.minMaxEdges });
126
- }
127
-
128
- draw() {
129
- this.programlogic.draw(this.texture0, this.texture1, this.colorRampTexture, this.heatParametersBlockManager);
130
- }
131
-
132
- free() {
133
- const { gl, texture0, texture1, colorRampTexture } = this;
134
- gl.deleteTexture(texture0);
135
- gl.deleteTexture(texture1);
136
- gl.deleteTexture(colorRampTexture);
137
- glProgramCache.releaseProgram(this.gl, Float2LegentWithRatioProgram);
138
- this.heatParametersBlockManager.free();
139
-
140
- }
141
- }
@@ -1,27 +0,0 @@
1
- import { noRegisterGlobeProgramCache } from "../programcache";
2
-
3
- class IsGlobeMoved {
4
- constructor(globe) {
5
- this.globe = globe;
6
-
7
- this._lastLOD = globe.api_GetCurrentLODWithDecimal();
8
- }
9
-
10
- isMoved() {
11
- const globe = this.globe;
12
- if (globe.api_IsScreenMoving() || this._lastLOD != globe.api_GetCurrentLODWithDecimal()) {
13
- this._lastLOD = globe.api_GetCurrentLODWithDecimal();
14
- return true;
15
- }
16
- return false;
17
- }
18
-
19
-
20
- }
21
-
22
-
23
-
24
- const IsGlobeMovedCache = Object.freeze({
25
- get: (globe) => noRegisterGlobeProgramCache.getProgram(globe, IsGlobeMoved),
26
- release: (globe) => noRegisterGlobeProgramCache.releaseProgram(globe, IsGlobeMoved)
27
- });
@@ -1,2 +0,0 @@
1
- import GlobeShellWiggle from "./globeshell/wiggle";
2
- export { GlobeShellWiggle };
File without changes
@@ -1,6 +0,0 @@
1
- import GlobeShellWiggle from './object'
2
-
3
- export {
4
- GlobeShellWiggle
5
-
6
- }