@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,22 +0,0 @@
1
- export default class PointCoordsMeta {
2
-
3
- constructor(bbox, width, height) {
4
- this._bbox = bbox;
5
- this._width = width;
6
- this._height = height;
7
- this._xRatio = this._width / (this._bbox[2] - this._bbox[0]);
8
- this._yRatio = this._height / (this._bbox[3] - this._bbox[1]);
9
-
10
- }
11
-
12
- getFlooredMeta(long, lat) {
13
- let x = (long - this._bbox[0]) * this._xRatio;
14
- let y = (this._bbox[3] - lat) * this._yRatio;
15
- x = x > 0 ? x - 1 : 0;
16
- y = y > 0 ? y - 1 : 0;
17
- const index = Math.floor(y) * this._width + Math.floor(x);
18
- return { index };
19
- }
20
- }
21
-
22
-
package/util/index.js DELETED
@@ -1,13 +0,0 @@
1
- import * as webglobjectbuilders from './webglobjectbuilders';
2
- import * as shaderfunctions from './shaderfunctions';
3
- import * as geometry from './geometry';
4
- import * as webglobe from './webglobe';
5
- import * as programs from './programs';
6
- import * as heatwavedatamanager from './heatwavedatamanager';
7
- export { webglobjectbuilders, shaderfunctions, geometry, webglobe, programs, heatwavedatamanager };
8
- export * from './webglobe';
9
- export * from './webglobjectbuilders';
10
- export * from './shaderfunctions';
11
- export * from './geometry';
12
- export * from './programs';
13
- export * from './heatwavedatamanager';
File without changes
@@ -1,9 +0,0 @@
1
- const createWorker = () => new Worker(
2
- new URL(
3
- './web-worker.js',
4
- import.meta.url
5
- ), { type: 'module' }
6
- );
7
-
8
-
9
- export {createWorker}
@@ -1,88 +0,0 @@
1
- import { findFirstIndexInRange } from '../../algorithms/search-binary';
2
- import {
3
- sphericalLinearInterpolation_Cartesian3d,
4
- sphericalLinearInterpolation_Mercator,
5
- } from '../../../Math/methods';
6
-
7
-
8
- /**
9
- * @typedef {Array<number>} vec3 [x, y, z]
10
- * @typedef {Array<number>} vec2 [x, y]
11
- * @typedef {Array<number>} vec4 [x, y, z, w]
12
- * @typedef {number} fraction a number between 0 and 1
13
- * @typedef {Array<number>} wgs84 [long, lat]
14
- */
15
-
16
- const GEOMETRY = Object.freeze({
17
- CARTESIAN3D: 0,
18
- MERCATOR: 1,
19
- });
20
-
21
- class TimeTrackInterpolator {
22
- /**
23
- * @typedef Timetrack
24
- * @property {Array<vec4>}} coordinates [x,y,z, length]
25
- * @property {Array<Number>} times
26
- * @param {Array<Timetrack>} timeTracks
27
- */
28
- constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
29
- this.timeTracks = null;
30
- this.timeTracksStartTimes = null;
31
- this.geometry = geometry;
32
- if (timeTracks) this.setTimetracks(timeTracks);
33
- if (bbox) this.setBbox(bbox);
34
- }
35
-
36
-
37
- setGeometry(geometry) {
38
- if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
39
- throw new Error('Invalid geometry');
40
- }
41
- this.geometry = geometry;
42
- }
43
-
44
- setTimetracks(timeTracks) {
45
- this.timeTracks = timeTracks;
46
- }
47
-
48
-
49
- interpolate(time) {
50
- const { timeTracks, geometry } = this;
51
- if (!timeTracks) { return null; }
52
- const resultArray = [];
53
- const info = {
54
- outOfRange: 0,
55
- processed: 0,
56
- }
57
- for (let i = 0; i < timeTracks.length; i++) {
58
- const { times, coordinates } = timeTracks[i];
59
-
60
- if (times[times.length - 1] < time) continue;
61
- info.processed++;
62
- const timeIndex = findFirstIndexInRange(times, time);
63
- if (timeIndex === null) { info.outOfRange++; continue; }
64
- const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
65
- const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
66
- sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
67
- sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
68
- resultArray.push(...interpolated);
69
- }
70
- return new Float32Array(resultArray);
71
- }
72
-
73
-
74
- // implicit methods
75
-
76
- _orderTimeTracks() {
77
- this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
78
- }
79
-
80
- _setStartTimes() {
81
- this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
82
- }
83
-
84
-
85
- }
86
-
87
-
88
- export { TimeTrackInterpolator, GEOMETRY };
@@ -1,180 +0,0 @@
1
- const webworkerStr = `
2
-
3
- const WORLD_RADIUS_3D = 6378.137;
4
- const WORLD_RADIUS_MERCATOR = 6378136.99911;
5
-
6
- const dot3 = (a, b) => {
7
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
8
- }
9
-
10
- const sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {
11
- const theta = Math.acos(dot3(normalizedA, normalizedB));
12
- if (theta < 0.000001) return normalizedA; // CALIBRATE?
13
- const sinTheta = Math.sin(theta);
14
- const result = [
15
- (Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,
16
- (Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,
17
- (Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta
18
- ];
19
- return result;
20
- }
21
-
22
- const radianToMercator = (xy) => {
23
- return [WORLD_RADIUS_MERCATOR * xy[0], WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
24
- }
25
-
26
-
27
- const cartesian3dToRadian = (cartesian) => {
28
- const x = cartesian[0];
29
- const y = cartesian[1];
30
- const z = cartesian[2];
31
- // const length = Math.sqrt(x * x + y * y + z * z);
32
- const long = Math.atan2(y, x);
33
- const lat = Math.asin(z)// length);
34
- return [long, lat];
35
- }
36
-
37
-
38
- const sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {
39
- const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);
40
- const angles = cartesian3dToRadian(unitVector);
41
- return radianToMercator(angles);
42
- }
43
-
44
- const sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {
45
- const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);
46
- const height = a[3] + (b[3] - a[3]) * ratio;
47
- return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];
48
- }
49
-
50
- const findFirstIndexInRange = (container, value) => {
51
- let start = 0;
52
- let end = container.length - 1;
53
- let mid = 0;
54
- while (start <= end) {
55
- mid = Math.floor((start + end) / 2);
56
- if (container[mid] <= value && value <= container[mid + 1]) return mid;
57
- if (container[mid] < value) start = mid + 1;
58
- else end = mid - 1;
59
- }
60
- return null;
61
- }
62
-
63
- const GEOMETRY = Object.freeze({
64
- CARTESIAN3D: 0,
65
- MERCATOR: 1,
66
- });
67
-
68
- class TimeTrackInterpolator {
69
- /**
70
- * @typedef Timetrack
71
- * @property {Array<vec4>}} coordinates [x,y,z, length]
72
- * @property {Array<Number>} times
73
- * @param {Array<Timetrack>} timeTracks
74
- */
75
- constructor({ timeTracks, bbox = null, geometry = GEOMETRY.CARTESIAN3D } = {}) {
76
- this.timeTracks = null;
77
- this.timeTracksStartTimes = null;
78
- this.geometry = geometry;
79
- if (timeTracks) this.setTimetracks(timeTracks);
80
- if (bbox) this.setBbox(bbox);
81
- }
82
-
83
-
84
- setGeometry(geometry) {
85
- if (geometry !== GEOMETRY.CARTESIAN3D && geometry !== GEOMETRY.MERCATOR) {
86
- throw new Error('Invalid geometry');
87
- }
88
- this.geometry = geometry;
89
- }
90
-
91
- setTimetracks(timeTracks) {
92
- this.timeTracks = timeTracks;
93
- }
94
-
95
-
96
- interpolate(time) {
97
- const { timeTracks, geometry } = this;
98
- if (!timeTracks) { return null; }
99
- const resultArray = [];
100
- const info = {
101
- outOfRange: 0,
102
- processed: 0,
103
- }
104
- for (let i = 0; i < timeTracks.length; i++) {
105
- const { times, coordinates } = timeTracks[i];
106
-
107
- if (times[times.length - 1] < time) continue;
108
- info.processed++;
109
- const timeIndex = findFirstIndexInRange(times, time);
110
- if (timeIndex === null) { info.outOfRange++; continue; }
111
- const timeFraction = (time - times[timeIndex]) / (times[timeIndex + 1] - times[timeIndex]);
112
- const interpolated = (geometry === GEOMETRY.CARTESIAN3D) ?
113
- sphericalLinearInterpolation_Cartesian3d(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction) :
114
- sphericalLinearInterpolation_Mercator(coordinates[timeIndex], coordinates[timeIndex + 1], timeFraction);
115
- resultArray.push(...interpolated);
116
- }
117
- return new Float32Array(resultArray);
118
- }
119
-
120
-
121
- // implicit methods
122
-
123
- _orderTimeTracks() {
124
- this.timeTracks.sort((a, b) => a.times[0] - b.times[0]);
125
- }
126
-
127
- _setStartTimes() {
128
- this.timeTracksStartTimes = this.timeTracks.map(tt => tt.times[0]);
129
- }
130
- }
131
-
132
- const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
133
-
134
- /* eslint-disable-next-line no-restricted-globals */
135
- self.onmessage = function (e) {
136
-
137
- const { geometry = null, timeTracks = null, time = null } = e.data;
138
-
139
- if (geometry !== null) {
140
- try {
141
- interpolator.setGeometry(geometry);
142
- } catch (error) {
143
- /* eslint-disable-next-line no-restricted-globals */
144
- self.postMessage({ error: error.message });
145
- return;
146
- }
147
- }
148
-
149
- if (timeTracks !== null) {
150
- try {
151
- interpolator.setTimetracks(timeTracks);
152
- } catch (error) {
153
- /* eslint-disable-next-line no-restricted-globals */
154
- self.postMessage({ error: error.message });
155
- return;
156
- }
157
- }
158
-
159
- if (time !== null) {
160
- try {
161
- const result = interpolator.interpolate(time);
162
- if(result === null) {
163
- /* eslint-disable-next-line no-restricted-globals */
164
- self.postMessage({ error: 'No TimeTracks Data' });
165
- return;
166
- }
167
- /* eslint-disable-next-line no-restricted-globals */
168
- self.postMessage(result, [result.buffer]);
169
- return;
170
- } catch (error) {
171
- /* eslint-disable-next-line no-restricted-globals */
172
- self.postMessage({ error: error.message });
173
- return;
174
- }
175
- }
176
- /* eslint-disable-next-line no-restricted-globals */
177
- self.postMessage(true);
178
- }
179
- `;
180
- export { webworkerStr };
@@ -1,51 +0,0 @@
1
- import { TimeTrackInterpolator, GEOMETRY } from './timetrack-interpolator';
2
-
3
-
4
- const interpolator = new TimeTrackInterpolator({ geometry: GEOMETRY.CARTESIAN3D });
5
-
6
- /* eslint-disable-next-line no-restricted-globals */
7
- self.onmessage = function (e) {
8
-
9
- const { geometry = null, timeTracks = null, time = null } = e.data;
10
-
11
- if (geometry !== null) {
12
- try {
13
- interpolator.setGeometry(geometry);
14
- } catch (error) {
15
- /* eslint-disable-next-line no-restricted-globals */
16
- self.postMessage({ error: error.message });
17
- return;
18
- }
19
- }
20
-
21
- if (timeTracks !== null) {
22
- try {
23
- interpolator.setTimetracks(timeTracks);
24
- } catch (error) {
25
- /* eslint-disable-next-line no-restricted-globals */
26
- self.postMessage({ error: error.message });
27
- return;
28
- }
29
- }
30
-
31
- if (time !== null) {
32
- try {
33
- const result = interpolator.interpolate(time);
34
- if (result === null) {
35
- /* eslint-disable-next-line no-restricted-globals */
36
- self.postMessage({ error: 'No TimeTracks Data' });
37
- return;
38
- }
39
- /* eslint-disable-next-line no-restricted-globals */
40
- self.postMessage(result, [result.buffer]);
41
- return;
42
- } catch (error) {
43
- /* eslint-disable-next-line no-restricted-globals */
44
- self.postMessage({ error: error.message });
45
- return;
46
- }
47
- }
48
- /* eslint-disable-next-line no-restricted-globals */
49
- self.postMessage(true);
50
- }
51
-
@@ -1,19 +0,0 @@
1
- const populateFloat32Array = Object.freeze({
2
- fillFloat32Array: (length, data) => {
3
- const result = new Float32Array(length);
4
- result.fill(data);
5
- return result;
6
- },
7
-
8
- fillWithListData: (length, listdata) => {
9
- const result = new Float32Array(length * listdata.length);
10
- let offset = 0;
11
- for (let i = 0; i < length; i++) {
12
- result.set(listdata, offset);
13
- offset += listdata.length;
14
- }
15
- return result
16
- }
17
- });
18
-
19
- export { populateFloat32Array };
@@ -1,17 +0,0 @@
1
- function arraysEqual(a, b) {
2
- if (a === b) return true;
3
- if (a == null || b == null) return false;
4
- if (a.length !== b.length) return false;
5
-
6
- // If you don't care about the order of the elements inside
7
- // the array, you should sort both arrays here.
8
- // Please note that calling sort on an array will modify that array.
9
- // you might want to clone your array first.
10
-
11
- for (var i = 0; i < a.length; ++i) {
12
- if (a[i] !== b[i]) return false;
13
- }
14
- return true;
15
- }
16
-
17
- export { arraysEqual };
@@ -1 +0,0 @@
1
- export * as timefilters from './timefilters';
@@ -1,32 +0,0 @@
1
- // TODO: fix logic error in instantDebounce
2
- function instantDebounce(func, delay) {
3
- let timeout = null;
4
- let lastArgs = null;
5
- let runAtEnd = false;
6
-
7
- const timeoutMethod = () => {
8
- setTimeout(() => {
9
- if (runAtEnd) {
10
- func(...lastArgs);
11
- lastArgs = null;
12
- // console.log("processed with delay")
13
- runAtEnd = false;
14
- }
15
- timeout = null;
16
- }, delay);
17
- }
18
-
19
- return function () {
20
- if (timeout) {
21
- lastArgs = arguments;
22
- runAtEnd = true;
23
- return;
24
- } else {
25
- func(...args);
26
- // console.log("processed instantly")
27
- timeout = timeoutMethod();
28
- }
29
- }
30
- }
31
-
32
- export { instantDebounce };
@@ -1,46 +0,0 @@
1
- const fence = (gl) => new Promise((resolve, reject) => {
2
- // This will create a fence. If this follows a `readPixels()` call, then it
3
- // will signal to WebGL that the read instruction should be asynchronous.
4
- // This means JS can continue to work on other tasks while the read instruction
5
- // completes.
6
- const sync = gl.fenceSync(gl.SYNC_GPU_COMMANDS_COMPLETE, 0);
7
- gl.flush();
8
-
9
- // There are TWO possible ways to check on the status of a WebGLSync object.
10
-
11
- // 1. This will check it using clientWaitSync()
12
- const checkStatus_v1 = () => {
13
- const status = gl.clientWaitSync(sync, 0, 0);
14
-
15
- // There are four possible values for status:
16
- // a. ALREADY_SIGNALED and CONDITION_SATISFIED (done)
17
- // b. TIMEOUT_EXPIRED (check again later)
18
- // c. WAIT_FAILED (there was an error)
19
- if (status === gl.TIMEOUT_EXPIRED) {
20
- setTimeout(checkStatus_v1, 1);
21
- } else if (status === gl.ALREADY_SIGNALED || status === gl.CONDITION_SATISFIED) {
22
- gl.deleteSync(sync);
23
- resolve();
24
- } else {
25
- gl.deleteSync(sync);
26
- reject(new Error('Fence did not resolve normally for some reason'));
27
- }
28
- };
29
-
30
- // 2. This will check with getSyncParameter(s, gl.SYNC_STATUS)
31
- const checkStatus_v2 = () => {
32
- const status = gl.getSyncParameter(sync, gl.SYNC_STATUS);
33
-
34
- // There are only two possible values for status: SIGNALED and UNSIGNALED
35
- // Note that there is no `error` signal, so there is no reason to use `reject()` here
36
- if (status === gl.SIGNALED) {
37
- gl.deleteSync(sync);
38
- resolve();
39
- } else {
40
- setTimeout(checkStatus_v2, 1);
41
- }
42
- };
43
- setTimeout(checkStatus_v2, 1);
44
- });
45
-
46
- export { fence };
@@ -1,177 +0,0 @@
1
- /**
2
- * add implicit texture display program for color
3
- * add fence on query return and return id.
4
- */
5
-
6
- import { textureOnCanvasProgramCache } from "../programs/draw-texture-on-canvas";
7
- import { fence } from "./fence";
8
-
9
- const ESCAPE_VALUE = -1;
10
-
11
-
12
- class PickerDisplayer {
13
- constructor(globe) {
14
- this.globe = globe;
15
- this.gl = globe.gl;
16
- const gl = this.gl;
17
- this.colorTexture = gl.createTexture(); // bind to color attachment 0
18
- this.indexTexture = gl.createTexture(); // bind to color attachment 1
19
- this.fbo = gl.createFramebuffer();
20
-
21
- this._pbo = undefined;
22
- this._pboSize = 0;
23
- this.resize();
24
-
25
- this.displayer = textureOnCanvasProgramCache.get(this.gl);
26
-
27
- }
28
-
29
- resize(width = null, height = null) {
30
- if (width === null || height === null) {
31
- width = this.globe.api_ScrW();
32
- height = this.globe.api_ScrH();
33
- }
34
- const { gl, colorTexture, indexTexture } = this;
35
-
36
- gl.deleteTexture(colorTexture);
37
- gl.deleteTexture(indexTexture);
38
- const colorTextureNew = gl.createTexture();
39
- gl.bindTexture(gl.TEXTURE_2D, colorTextureNew);
40
- gl.texStorage2D(gl.TEXTURE_2D, 1, gl.RGBA8, width, height);
41
- const indexTextureNew = gl.createTexture();
42
- gl.bindTexture(gl.TEXTURE_2D, indexTextureNew);
43
- // gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R16I, width, height);
44
- gl.texStorage2D(gl.TEXTURE_2D, 1, gl.R32I, width, height);
45
- gl.bindTexture(gl.TEXTURE_2D, null);
46
-
47
- this.colorTexture = colorTextureNew;
48
- this.indexTexture = indexTextureNew;
49
- }
50
-
51
-
52
- clearTextures() {
53
- const { gl, colorTexture, indexTexture } = this;
54
- gl.activeTexture(gl.TEXTURE1);
55
- gl.bindTexture(gl.TEXTURE_2D, indexTexture);
56
- gl.clearBufferiv(gl.COLOR, 1, new Int32Array([-1, -1, -1, -1]));
57
-
58
- gl.activeTexture(gl.TEXTURE0);
59
- gl.bindTexture(gl.TEXTURE_2D, colorTexture);
60
- gl.clearBufferfv(gl.COLOR, 0, new Float32Array([0, 0, 0, 0]));
61
- }
62
-
63
-
64
- // call before drawing the scene with gl picker shader
65
- bindFBO() {
66
- const { gl, colorTexture, indexTexture, fbo } = this;
67
- gl.activeTexture(gl.TEXTURE1);
68
- gl.bindTexture(gl.TEXTURE_2D, indexTexture);
69
- gl.activeTexture(gl.TEXTURE0);
70
- gl.bindTexture(gl.TEXTURE_2D, colorTexture);
71
- { // bind framebuffer
72
- gl.bindFramebuffer(gl.FRAMEBUFFER, fbo);
73
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.colorTexture, 0);
74
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT1, gl.TEXTURE_2D, this.indexTexture, 0);
75
- gl.drawBuffers([gl.COLOR_ATTACHMENT0, gl.COLOR_ATTACHMENT1]);
76
- }
77
- }
78
-
79
-
80
- // call after drawing the scene with gl picker shader
81
- drawColorTexture() {
82
- const { colorTexture } = this;
83
- this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, null);
84
- this.displayer.draw(colorTexture);
85
- }
86
-
87
-
88
- pickXY(x, y, selectionPointFilling = 1, callback = () => { }) {
89
- const size = Math.pow(1 + 2 * selectionPointFilling, 2);
90
- this._pick(size,
91
- x - selectionPointFilling,
92
- y - selectionPointFilling,
93
- 1 + 2 * selectionPointFilling,
94
- 1 + 2 * selectionPointFilling,
95
- callback);
96
- }
97
-
98
-
99
-
100
- pickBbox(left, top, right, bottom, callback) {
101
- const size = (right - left) * (bottom - top) * 4;
102
- this._pick(size, left, top, right - left, bottom - top, callback);
103
- }
104
-
105
-
106
- _pick(size, startX, startY, lengthX, lengthY, callback) {
107
- if (this._inProgress) return false;
108
- this._inProgress = true;
109
-
110
- this._initHoldBuffer(size * 4);
111
- const { gl, _pbo } = this;
112
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, _pbo);
113
- this.bindFBO();
114
- gl.readBuffer(gl.COLOR_ATTACHMENT1); // This is the attachment we want to read
115
- gl.readPixels( // This will read the pixels to the buffer asynchronously
116
- startX, startY, lengthX, lengthY,
117
- gl.RED_INTEGER, gl.INT,
118
- 0
119
- );
120
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
121
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
122
- fence(this.gl).then(() => {
123
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, _pbo);
124
- // const data = new Int16Array(size);
125
- const data = new Int32Array(size);
126
- gl.getBufferSubData(gl.PIXEL_PACK_BUFFER, 0, data);
127
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
128
- const result = this._pickFromBuffer(data, size);
129
- callback(result);
130
- // gl.deleteBuffer(pbo);
131
- this._inProgress = false
132
- }
133
- );
134
- return true;
135
- }
136
-
137
-
138
- _pickFromBuffer(array, size) {
139
- const selectedObjects = new Set();
140
- for (let i = 0; i < size; i += 1) {
141
- const id = array[i];
142
- if (id !== ESCAPE_VALUE) {
143
- selectedObjects.add(id);
144
- }
145
- }
146
- return selectedObjects;
147
- }
148
-
149
-
150
- _initHoldBuffer(size) {
151
- if (this._pbo && this._pboSize >= size) {
152
- return
153
- }
154
- const { gl } = this;
155
- const pbo = gl.createBuffer();
156
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, pbo);
157
- gl.bufferData(gl.PIXEL_PACK_BUFFER, size, gl.STREAM_READ);
158
- gl.bindBuffer(gl.PIXEL_PACK_BUFFER, null);
159
- this._pboSize = size;
160
- if (this._pbo !== undefined) {
161
- gl.deleteBuffer(this._pbo);
162
- }
163
- this._pbo = pbo;
164
- }
165
-
166
-
167
- free() {
168
- const { gl, colorTexture, indexTexture, fbo } = this;
169
- gl.deleteTexture(colorTexture);
170
- gl.deleteTexture(indexTexture);
171
- gl.deleteFramebuffer(fbo);
172
- textureOnCanvasProgramCache.release(this.gl);
173
- }
174
- }
175
-
176
-
177
- export { PickerDisplayer };