@pirireis/webglobeplugins 0.9.6 → 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 +5 -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 -22
  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,77 +0,0 @@
1
- /**
2
- * This class registered as globe plugin one for each globe. to the head of plugin call stack.
3
- */
4
-
5
- class PinPointTotem {
6
- constructor(globe) {
7
-
8
- this.objectArrayMap = new Map()
9
- }
10
-
11
-
12
- /**
13
- * objectArray
14
- * callbacks ={
15
- * mouseDown,
16
- * mouseMove,
17
- * mouseUp,
18
- * mouseClick,
19
- * mouseDbClick,
20
- * keyDown,
21
- * keyUp
22
- * }
23
- */
24
- registerPinMap(objectArray, callbacks) {
25
- this.objectArrayMap.set(objectArray, callbacks);
26
- }
27
-
28
- unregisterPinMap(objectArray) {
29
- if (this.objectArrayMap.has(objectArray)) {
30
- this.objectArrayMap.delete(objectArray);
31
- } else {
32
- console.warn('PinPointTotem objectArrayMap does not contain the objectArray')
33
- }
34
- }
35
-
36
-
37
- // GlobeMethods
38
- // haritada sol butona basıldığında çağrılır
39
- mouseDown(x, y, event) {
40
-
41
- return false
42
- }
43
-
44
- // mouse'a basılıp hareket ettirildiğinde, mouseDown'dan true dönmüşse çağrılır
45
- mouseMove(x, y, event) {
46
-
47
- }
48
-
49
- // mouse up'ın left'i mouseDown'dan true dönmüşse çağrılır, edit mode içindir
50
- // right'i ise sağ tıka basılıp bırakıldığında çağrılır
51
- mouseUp(x, y, event) {
52
-
53
- }
54
-
55
- // harita üzerinde tıklandığında çağrılır
56
- mouseClick(x, y, event) {
57
-
58
- return false
59
- }
60
-
61
- // harita üzerinde çift tıklandığında çağrılır
62
- mouseDblClick(x, y, event) {
63
- return false
64
- }
65
-
66
- // klavyeden bir tuşa basıldığı anda ve tuşa basılı kalınmaya devam edildiği durumlarda çalışır
67
- keyDown(event) {
68
- return false
69
- }
70
-
71
- // klavyedeki bir tuştan parmak çekildiği anda çalışır
72
- keyUp(event) {
73
-
74
- return false
75
- }
76
-
77
- }
@@ -1,78 +0,0 @@
1
- /**
2
- * @typedef {Float32Array} TimeTrackMultiColorData | A linestring is representation, let A{a1, a2, a3}, B{b1, b2} be the points of the line.
3
- * TimeTrackMultiColorData is [
4
- * a1x, a1y, a1z, a1time, a1r, a1g, a1b, a1time, a3time,
5
- * a2x, a2y, a2z, a2time, a2r, a2g, a2b, a1time, a3time,
6
- * a3x, a3y, a3z, a3time, a3r, a3g, a3b, a1time, a3time,
7
- * 0, 0, 0, 0, -1, -1, -1, 0, 0,
8
- * b1x, b1y, b1z, b1time, b1r, b1g, b1b, b1time, b2time,
9
- * b2x, b2y, b2z, b2time, b2r, b2g, b2b, BstartTime, BendTime
10
- * ]
11
- * there is a cutting point between A and B
12
- *
13
- */
14
-
15
- /**
16
- * ABOVE
17
- * TO
18
- * BELOW
19
-
20
- /**
21
- * @typedef {Array<number>} vec3 [x, y, z]
22
- * @typedef {Array<number>} vec2 [x, y]
23
- * @typedef {Array<number>} vec4 [x, y, z, w]
24
- * @typedef {number} fraction a number between 0 and 1
25
- * @typedef {Array<number>} wgs84 [long, lat]
26
- */
27
-
28
-
29
- /**
30
- * @typedef Timetrack
31
- * @property {Array<vec4>}} coordinates [x,y,z, length]
32
- * @property {Array<Number>} times
33
- * @param {Array<Timetrack>} timeTracks
34
- */
35
-
36
-
37
-
38
- import { pixelXYLenghtToUnitVectorWithHeight } from "../../Math/methods";
39
-
40
-
41
-
42
- const processACut = (array, offset) => {
43
- // first 3 values of array
44
- const v3 = array.slice(offset, offset + 3);
45
- const v4 = pixelXYLenghtToUnitVectorWithHeight(v3);
46
- const time = array[offset + 3];
47
- return [v4, time];
48
- }
49
-
50
-
51
- const timeTrackPluginDataToPointHeatInterpolatorAdapter = (timeTrackPluginData) => {
52
- const timeTracks = []
53
-
54
- let offset = 0;
55
-
56
- let timeTrack = {
57
- coordinates: [],
58
- times: []
59
- }
60
- while (offset < timeTrackPluginData.length) {
61
- if (!timeTrackPluginData[offset]) {
62
- timeTracks.push(timeTrack);
63
- timeTrack = {
64
- coordinates: [],
65
- times: []
66
- }
67
- offset += 9;
68
- }
69
- const point = processACut(timeTrackPluginData, offset);
70
- offset += 9;
71
- timeTrack.coordinates.push(point[0]);
72
- timeTrack.times.push(point[1]);
73
- }
74
- return timeTracks;
75
- }
76
-
77
-
78
- export { timeTrackPluginDataToPointHeatInterpolatorAdapter };
File without changes
@@ -1,151 +0,0 @@
1
- import { PointHeatmapFlow } from "./point-to-heat-map-flow";
2
- // import { webworkerStr } from "../util/interpolation/timetrack/web-worker-str"; // TODO: Delete When this plugin is tested on production
3
- import { createWorker } from "../util/interpolation/timetrack/index";
4
- import { createTexture, getColorRampModed } from "../util";
5
- import { opacityCheck, constraintFloat } from "../util/check/typecheck";
6
-
7
- class PointHeatmapPlugin {
8
-
9
- constructor(id, { opacity = 1.0, pointSize = 5.0, onInterpolationComplete = () => { } } = {}) {
10
- this.id = id;
11
- this.globe = null;
12
- this.gl = null;
13
- this.densityToLegendProgram = null;
14
- this._time = null;
15
-
16
- this._opacity = opacity;
17
- this._pointSize = pointSize;
18
- this._legendTexture = null;
19
-
20
- this._throttleListener = null;
21
- this._timeTracksAreSet = false;
22
- // const blob = new Blob([webworkerStr], { type: 'application/javascript' });
23
- // this.timeTrackInterpolationWorker = new Worker(URL.createObjectURL(blob), { type: 'module' });
24
- this.timeTrackInterpolationWorker = createWorker();
25
- this.timeTrackInterpolationWorker.onmessage = (e) => {
26
- if (e.data.error) {
27
- throw new Error(e.data.error);
28
- }
29
- if (e.data === true) {
30
- onInterpolationComplete();
31
- }
32
- if (e.data instanceof Float32Array) {
33
- this.flow.setData(e.data);
34
- this._throttleListener = null;
35
- onInterpolationComplete();
36
- }
37
- }
38
- }
39
-
40
- // globe interaction
41
-
42
- init(globe, gl) {
43
- this.globe = globe;
44
- this.gl = gl;
45
- this.flow = new PointHeatmapFlow(globe);
46
- this.setGeometry();
47
- this.resize();
48
- }
49
-
50
-
51
- setPointSize(pointSize) {
52
- constraintFloat(pointSize, 1);
53
- this._pointSize = pointSize;
54
- this.globe.DrawRender();
55
- }
56
-
57
-
58
- /**
59
- * @param {Array<string>}
60
- * @param {string} mode "interpolated" | "discrete"
61
- */
62
-
63
- setColorRamp(values, thresholds, mode = "interpolated") {
64
- const gl = this.gl
65
- if (this.gl === null) {
66
- throw new Error('Plugin not initialized');
67
- };
68
- const rampData = getColorRampModed(values, thresholds, mode);
69
- const texture = createTexture(gl, gl.LINEAR, rampData, 256, 1);
70
- if (this._legendTexture) {
71
- this.gl.deleteTexture(this._legendTexture);
72
- }
73
- this._legendTexture = texture;
74
- this.globe.DrawRender();
75
- }
76
-
77
-
78
- setTime(time) {
79
- // TODO: WORK ON THIS
80
- this._time = time;
81
- if (this.isReady() && this._throttleListener === null) {
82
- this._throttleListener = setTimeout(() => {
83
- this.timeTrackInterpolationWorker.postMessage({ time: this._time });
84
- }, 0);
85
- }
86
- }
87
-
88
-
89
- setTimetracks(timeTracks) {
90
- this._timeTracksAreSet = true;
91
- this.timeTrackInterpolationWorker.postMessage({ timeTracks });
92
- if (this._time !== null) {
93
- this.setTime(this._time);
94
- }
95
- this.globe.DrawRender();
96
- }
97
-
98
-
99
- setOpacity(opacity) {
100
- opacityCheck(opacity);
101
- this._opacity = opacity;
102
- this.globe.DrawRender();
103
- }
104
-
105
-
106
-
107
- setGeometry() {
108
- const geometry = this.globe.api_GetCurrentGeometry();
109
- this.timeTrackInterpolationWorker.postMessage({ geometry });
110
- if (this._time !== null) {
111
- this.setTime(this._time);
112
- }
113
- }
114
-
115
-
116
- draw3D() {
117
- if (this.isReady()) {
118
- this.flow.draw(this._legendTexture, this._pointSize, this._opacity);
119
- }
120
- }
121
-
122
-
123
- resize() {
124
- this.flow.resize();
125
- if (this._time !== null) {
126
- this.setTime(this._time);
127
- }
128
- }
129
-
130
-
131
- isReady() {
132
- return (this.gl !== null && this._legendTexture !== null && this._timeTracksAreSet);
133
- }
134
-
135
- free() {
136
- if (this._isFreed) return;
137
- this.gl.deleteTexture(this._legendTexture);
138
- this.flow.free();
139
- this.flow = null;
140
- this.gl = null;
141
- this._isFreed = true;
142
- this.timeTrackInterpolator = null;
143
- this._legendTexture = null;
144
- this.timeTrackInterpolationWorker.terminate();
145
- this.timeTrackInterpolationWorker = null;
146
- }
147
- }
148
-
149
-
150
- export { PointHeatmapPlugin };
151
-
@@ -1,150 +0,0 @@
1
- import { densityToLegendProgramCache } from "../programs/data2legend/density-to-legend";
2
- import { pointToDensityTextureCache } from "../programs/data2legend/point-to-density-texture";
3
- // import { textureOnCanvasProgramCache } from "../util/programs/draw-texture-on-canvas";
4
- import { defaultblendfunction } from "../util/webglobe/gldefaultstates";
5
- class PointHeatmapFlow {
6
-
7
- constructor(globe) {
8
- this.globe = null;
9
- this.gl = null;
10
- this.program = null;
11
- this.densityToLegendProgram = null;
12
- this.globe = globe;
13
- this.gl = globe.gl;
14
- this.pointToDensityProgram = pointToDensityTextureCache.get(globe);
15
- this.densityToLegendProgram = densityToLegendProgramCache.get(globe);
16
- // this.testTextureProgram = textureOnCanvasProgramCache.get(globe.gl);
17
- this._lookInfo = globe.api_GetCurrentLookInfo();
18
- const { gl } = this;
19
- {
20
- this.buffer = gl.createBuffer();
21
- this.vao2D = this.pointToDensityProgram.createVAO(this.buffer, 2);
22
- this.vao3D = this.pointToDensityProgram.createVAO(this.buffer, 3);
23
- }
24
- { // framebuffer and texture
25
- this.framebuffer = gl.createFramebuffer();
26
- this.densityTexture = this._createDensityTexture();
27
- this._bindTextureToFramebuffer();
28
- }
29
- }
30
-
31
- _bindTextureToFramebuffer() {
32
- const { gl, densityTexture, framebuffer } = this;
33
- gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
34
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, densityTexture, 0);
35
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
36
- }
37
-
38
-
39
- draw(legendTexture, pointSize, opacity = 1.0) {
40
- const { gl, globe, framebuffer } = this;
41
- if (this._drawDensityRequired || this._isVisionChanged()) {
42
- gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
43
- gl.clearColor(0, 0, 0, 0);
44
- gl.viewport(
45
- 0, 0,
46
- Math.floor(globe.api_ScrW()), Math.floor(globe.api_ScrH())
47
- );
48
- gl.clear(gl.COLOR_BUFFER_BIT);
49
- this._drawDensity(pointSize);
50
- gl.bindFramebuffer(gl.FRAMEBUFFER, null);
51
- }
52
- defaultblendfunction(gl);
53
- this._drawLegend(legendTexture, opacity);
54
- }
55
-
56
-
57
- resize() {
58
- const { gl, densityTexture } = this;
59
- gl.deleteTexture(densityTexture);
60
- this.densityTexture = this._createDensityTexture();
61
- this._bindTextureToFramebuffer();
62
- this._drawDensityRequired = true;
63
- }
64
-
65
-
66
- // USER API
67
-
68
- /**
69
- * @param {Float32Array} data
70
- * @format [x, y, z, height] x,y,z is normalized 3d cartesian coordinates. Height in kilometers. Set 6378.137 for ground level.
71
- */
72
- setData(data) {
73
- const { gl, buffer } = this;
74
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
75
- gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
76
- // use program
77
- this.dataLength = data.length;
78
- this._drawDensityRequired = true;
79
- this.globe.DrawRender();
80
- }
81
-
82
- // implicit Methods
83
-
84
- _createDensityTexture() {
85
- const { gl, globe } = this;
86
- const width = Math.floor(globe.api_ScrW())
87
- const height = Math.floor(globe.api_ScrH());
88
- const texture = gl.createTexture();
89
- gl.bindTexture(gl.TEXTURE_2D, texture);
90
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
91
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
92
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
93
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
94
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
95
- return texture;
96
- }
97
-
98
-
99
- _drawDensity(pointSize) {
100
- const { gl, globe, pointToDensityProgram, vao2D, vao3D, dataLength } = this;
101
- const is3D = globe.api_GetCurrentGeometry() === 0;
102
- const vao = is3D ? vao3D : vao2D;
103
- const length = dataLength / (is3D ? 3 : 2);
104
- gl.blendEquation(gl.FUNC_ADD);
105
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE, gl.SRC_ALPHA, gl.ONE);
106
- pointToDensityProgram.draw(vao, length, pointSize);
107
-
108
- this._drawDensityRequired = false;
109
- }
110
-
111
-
112
- _drawLegend(legendTexture, opacity) {
113
- const { densityToLegendProgram, densityTexture } = this;
114
- densityToLegendProgram.draw(densityTexture, legendTexture, opacity);
115
- }
116
-
117
-
118
- _isVisionChanged() {
119
- const currentLookInfo = this.globe.api_GetCurrentLookInfo();
120
- const _lookInfo = this._lookInfo;
121
- if (
122
- currentLookInfo.CenterLong !== _lookInfo.CenterLong ||
123
- currentLookInfo.CenterLat !== _lookInfo.CenterLat ||
124
- currentLookInfo.Distance !== _lookInfo.Distance ||
125
- currentLookInfo.Tilt !== _lookInfo.Tilt ||
126
- currentLookInfo.NorthAng !== _lookInfo.NorthAng
127
- ) {
128
- this._lookInfo = currentLookInfo;
129
- return true;
130
- }
131
- return false;
132
- }
133
-
134
-
135
- free() {
136
- if (this._isFreed) return;
137
- this._isFreed = true;
138
- densityToLegendProgramCache.release(this.globe);
139
- pointToDensityTextureCache.release(this.globe);
140
- // textureOnCanvasProgramCache.release(this.gl);
141
- this.gl.deleteTexture(this.densityTexture);
142
- this.gl.deleteFramebuffer(this.framebuffer);
143
- this.gl.deleteBuffer(this.buffer);
144
- this.gl.deleteVertexArray(this.vao2D);
145
- this.gl.deleteVertexArray(this.vao3D);
146
- }
147
- }
148
-
149
-
150
- export { PointHeatmapFlow };
@@ -1,15 +0,0 @@
1
- # Content
2
-
3
- point-heat-map/
4
- ├── plugin.js
5
- └── point-to-heat-flow.js
6
-
7
- ## plugin.js
8
-
9
- Contains plugin plugin that calculates data on main thread.
10
-
11
- ## point-to-heat-flow.js
12
-
13
- Contains a wrapper around point-to-density and density-to-color-ramp programs.
14
-
15
- The reason behind seperation of program flow and plugin is to explore web-worker version of interpolation and compare it with main thread version.
@@ -1,3 +0,0 @@
1
- const pointKeyMeyhod = (trackId, pointID) => `${trackId}-${pointID}`;
2
-
3
- export { pointKeyMeyhod };