@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,119 +0,0 @@
1
- /**
2
- * BufferOffsetManager
3
- * Purpose: To manage the offset of the buffer. Plus extend and defrag the buffer.
4
- * ------------------------------------------------------------------------------------------------------------------------------------------- * Functions:
5
- * 1. getOffet(key) : return the offset of the key if not found return false.
6
- * 2. setOffset(key, offset) : set the offset of the key.
7
- * 3. nextOffset() : return the next available offset if not return false.
8
- * 4. delete(key) : delete the key and return true if not found return false.
9
- * 5. defragBuffer(gl, buffer, bufferType, newCapacity = null) : defrag the buffer. if newCapacity is not provided the buffer is vacumed.
10
- * 6. extendBuffer(gl, buffer, bufferType, newCapacity) : extend the buffer.
11
- * -------------------------------------------------------------------------------------------------------------------------------------------
12
- * What this class does NOT do:
13
- * ADD, DELETE, READ
14
- * ADD, inputs needs to be turn into a block and put into buffer. Bulk will be more performant.
15
- * DELETE, might be a set to single byte to indicate the tombstone.
16
- * READ, most of the time is not needed to be read, unless for defraging.
17
- * This unpredicatable behavior is not handled by this class.
18
- */
19
-
20
- export class BufferManager {
21
- gl: WebGL2RenderingContext;
22
- buffer: WebGLBuffer;
23
- itemSize: number;
24
- bufferType: string;
25
- isFreed: boolean = false;
26
-
27
- constructor(gl: WebGL2RenderingContext, itemSize: number, { bufferType = "STATIC_DRAW", buffer = null, initialCapacity = null } = {}) {
28
- this.gl = gl;
29
- this.itemSize = itemSize;
30
- this.bufferType = bufferType;
31
- this.buffer = buffer === null ? gl.createBuffer() : buffer;
32
- if (initialCapacity !== null) this.resetWithCapacity(initialCapacity);
33
- }
34
-
35
- resetWithCapacity(capacity: number) {
36
- const { gl, buffer, bufferType, itemSize } = this;
37
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
38
- // @ts-ignore
39
- gl.bufferData(gl.ARRAY_BUFFER, capacity * itemSize * 4, gl[bufferType]);
40
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
41
- }
42
-
43
- deleteBulk(offsets: number[]) {
44
- const { gl, buffer, itemSize } = this;
45
- const emptyBlock = new Float32Array(this.itemSize).fill(NaN)
46
- const offsetMultiplier = itemSize * 4;
47
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
48
- for (let offset of offsets) {
49
- if (offset !== undefined) {
50
- gl.bufferSubData(gl.ARRAY_BUFFER, offset * offsetMultiplier, emptyBlock);
51
- }
52
- }
53
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
54
- }
55
-
56
-
57
- insertBulk(blocks: any[], offsets: number[]) {
58
- const { gl, buffer, itemSize } = this;
59
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
60
- const offsetMultiplier = itemSize * 4;
61
- for (let i = 0; i < blocks.length; i++) {
62
- const block = blocks[i];
63
- const offset = offsets[i] * offsetMultiplier;
64
- if (offset !== undefined) gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
65
- }
66
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
67
- }
68
-
69
-
70
- // TODO: this is broken
71
- defrag(offsetValues: MapIterator<number> | number[], occupiedCapacity: number, newCapacity: number) {
72
- const { gl, buffer, bufferType, itemSize } = this;
73
-
74
- const newArray = new Float32Array(newCapacity * itemSize);
75
- const bufferData = this._getBufferData(occupiedCapacity);
76
- let newOffset = 0;
77
- for (const offset of offsetValues) {
78
- const itemOffset = offset * itemSize;
79
- newArray.set(bufferData.slice(itemOffset, itemOffset + itemSize), newOffset);
80
- newOffset += itemSize;
81
- }
82
-
83
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
84
- // @ts-ignore
85
- gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
86
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, newArray);
87
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
88
-
89
- }
90
-
91
- extendBuffer(occupiedCapacity: number, newCapacity: number) {
92
- const { gl, buffer, bufferType } = this;
93
- const itemSize = this.itemSize;
94
- const bufferData = this._getBufferData(occupiedCapacity);
95
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
96
- // @ts-ignore
97
- gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
98
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
99
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
100
- }
101
-
102
- _getBufferData(occupiedCapacity: number): Float32Array {
103
- const { gl, buffer } = this;
104
- const size = occupiedCapacity * this.itemSize;
105
- const bufferData = new Float32Array(size);
106
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
107
- gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
108
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
109
- return bufferData;
110
- }
111
-
112
- free() {
113
- if (this.isFreed) return;
114
- this.gl.deleteBuffer(this.buffer);
115
- // this.buffer = null;
116
- // this.gl = null;
117
- this.isFreed = true;
118
- }
119
- }
@@ -1,173 +0,0 @@
1
- import { BufferOrchestrator as BufferOrchestratorI, BufferManagersMap, BufferManager } from "./types";
2
-
3
- const EXTRA_SIZE = 10;
4
-
5
- export class BufferOrchestrator implements BufferOrchestratorI {
6
- _capacity: number;
7
- offsetMap: Map<string, number>;
8
- tombstoneOffsets: number[];
9
- _length: number;
10
-
11
- constructor({ capacity = 10 } = {}) {
12
- this._capacity = capacity;
13
- this.offsetMap = new Map();
14
- this.tombstoneOffsets = [];
15
- this._length = 0;
16
- }
17
-
18
-
19
- resetWithCapacity(bufferManagersMap: BufferManagersMap, capacity: number | null = null) {
20
- this._capacity = capacity !== null ? capacity : this._capacity;
21
- for (const [key, { bufferManager }] of bufferManagersMap) {
22
- bufferManager.resetWithCapacity(this._capacity);
23
- }
24
- this.offsetMap.clear();
25
- this.tombstoneOffsets = [];
26
- this._length = 0;
27
- }
28
-
29
- insertBulk(items: any[], bufferManagersMap: BufferManagersMap) {
30
- this.autoExtendBuffers(items.length, bufferManagersMap);
31
- const { offsetMap } = this;
32
- const offsets = [];
33
- for (const item of items) {
34
- let o = offsetMap.get(item.key);
35
- const offset = o !== undefined ? o : this.nextOffset() as number;
36
- offsetMap.set(item.key, offset);
37
- offsets.push(offset);
38
- }
39
- for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
40
- bufferManager.insertBulk(items.map(adaptor), offsets);
41
- }
42
- }
43
-
44
-
45
- // does not assign offset to the new items.
46
- updateBulk(items: any[], bufferManagersMap: BufferManagersMap, bufferKeys: string[] | null = null) {
47
- const { offsetMap } = this;
48
- const offsets = [];
49
- for (const item of items) {
50
- const offset = offsetMap.get(item.key);
51
- if (offset !== undefined) {
52
- offsets.push(offset);
53
- } else {
54
- throw new Error("updateBulk item Key does not exist");
55
- }
56
- }
57
- if (bufferKeys) {
58
- for (const key of bufferKeys) {
59
- const bufferManagerComp = bufferManagersMap.get(key);
60
- if (bufferManagerComp === undefined) throw new Error("updateBulk bufferKey does not exist");
61
- const { bufferManager, adaptor } = bufferManagerComp;
62
- bufferManager.insertBulk(items.map(adaptor), offsets);
63
- }
64
- } else {
65
- for (const [key, { bufferManager, adaptor }] of bufferManagersMap) {
66
- bufferManager.insertBulk(items.map(adaptor), offsets);
67
- }
68
- }
69
-
70
- }
71
-
72
-
73
- deleteBulk(keys: string[], bufferManagersMap: BufferManagersMap) {
74
- const offsets = [];
75
- for (const key of keys) {
76
- const offset = this.getOffset(key);
77
- if (offset !== undefined) {
78
- offsets.push(offset);
79
- this.offsetMap.delete(key);
80
- this.tombstoneOffsets.push(offset);
81
- }
82
- }
83
- for (const [key, { bufferManager }] of bufferManagersMap) {
84
- bufferManager.deleteBulk(offsets);
85
- }
86
- }
87
-
88
-
89
- getOffset(key: string) {
90
- return this.offsetMap.get(key);
91
- }
92
-
93
- nextOffset(): number | boolean {
94
- if (this.tombstoneOffsets.length > 0) {
95
- const offset = this.tombstoneOffsets.pop() as number;
96
- return offset;
97
- }
98
- if (this._length < this._capacity) {
99
- return this._length++;
100
- }
101
- return false;
102
- }
103
-
104
-
105
- autoExtendBuffers(itemsLength: number, bufferManagersMap: BufferManagersMap) {
106
- if (itemsLength <= this.emptySpace) return;
107
- const newCapacity = this.length + itemsLength;
108
- for (const [key, { bufferManager }] of bufferManagersMap) {
109
- bufferManager.extendBuffer(this.length, newCapacity);
110
- }
111
- this._capacity = newCapacity;
112
- }
113
-
114
-
115
- defrag(bufferManagers: BufferManagersMap, bufferKeys: string[]) { // TODO defrag and leave some empty space
116
- const offsetMap = this.offsetMap;
117
- const newCapacity = offsetMap.size + EXTRA_SIZE;
118
- if (bufferKeys) {
119
- for (const key of bufferKeys) {
120
- const offset = offsetMap.get(key);
121
- if (offset !== undefined) {
122
- for (const [key, { bufferManager }] of bufferManagers) {
123
- bufferManager.defrag([offset], this.length, newCapacity);
124
- }
125
- }
126
- }
127
- } else {
128
- for (const [key, { bufferManager }] of bufferManagers) {
129
- bufferManager.defrag(offsetMap.values(), this.length, newCapacity);
130
- }
131
- }
132
- this._defrag();
133
- this._length = offsetMap.size;
134
- this._capacity = newCapacity;
135
- this.tombstoneOffsets = [];
136
- }
137
-
138
-
139
- /**
140
- * Flushes metadata and sets length to 0 without actualize change on buffers
141
- * This method created for cases in which data is loaded on each frame
142
- */
143
- flush({ capacity = 10 } = {}) {
144
- this._length = 0;
145
- this._capacity = capacity;
146
- this.tombstoneOffsets = []
147
- this.offsetMap.clear();
148
- }
149
-
150
- _defrag() {
151
- const newOffsetMap = new Map();
152
- let newOffset = 0;
153
- for (const [key, offset] of this.offsetMap) {
154
- newOffsetMap.set(key, newOffset++);
155
- }
156
- this.offsetMap = newOffsetMap
157
- }
158
-
159
- get length() {
160
- return this._length;
161
- }
162
-
163
- get emptySpace() {
164
- return this._capacity - this.offsetMap.size;
165
- }
166
-
167
- get capacity() {
168
- return this._capacity;
169
- }
170
- }
171
-
172
-
173
-
@@ -1,13 +0,0 @@
1
- import { BufferOrchestrator } from "./buffer-orchestrator";
2
- import { BufferManager } from "./buffer-manager";
3
- import { ObjectStore } from "./object-store";
4
-
5
- type BufferManagement = Map<string, {
6
- bufferManager: BufferManager,
7
- adaptor: (item: any) => Float32Array,
8
- }>;
9
-
10
-
11
- export { BufferOrchestrator, BufferManager, ObjectStore, BufferManagement };
12
-
13
-
@@ -1,65 +0,0 @@
1
-
2
- export class ObjectStore {
3
- _container;
4
-
5
-
6
- constructor({ initialCapcity = 10 } = {}) {
7
- this._container = this._createEmptyList(initialCapcity);
8
- }
9
-
10
-
11
- resetWithCapacity(capacity: number) {
12
- this._container = this._createEmptyList(capacity);
13
- }
14
-
15
-
16
- deleteBulk(offsets: number[]) {
17
- for (let i = 0; i < offsets.length; i++) {
18
- const offset = offsets[i];
19
- if (offset !== undefined) {
20
- this._container[offset] = null;
21
- }
22
- }
23
- }
24
-
25
-
26
- insertBulk(objects: any[], offsets: number[]) {
27
- for (let i = 0; i < objects.length; i++) {
28
- const object = objects[i];
29
- const offset = offsets[i];
30
- if (offset !== undefined) {
31
- this._container[offset] = object;
32
- }
33
- }
34
- }
35
-
36
- defrag(offsetValues: number[], occupiedCapacity: number, newCapacity: number) {
37
-
38
- const hold = this._createEmptyList(newCapacity);
39
- for (let i = 0; i < offsetValues.length; i++) {
40
- const offset = offsetValues[i];
41
- if (offset !== undefined) {
42
- hold[i] = this._container[offset];
43
- }
44
- }
45
- this._container = hold;
46
- }
47
-
48
- extendBuffer(occupiedCapacity: number, newCapacity: number) {
49
- const oldCapacity = this._container.length;
50
- this._container = this._container.concat(this._createEmptyList(newCapacity - oldCapacity));
51
- }
52
-
53
- _createEmptyList(size: number) {
54
- return new Array(size).fill(null);
55
- }
56
-
57
- get(index: number) {
58
- return this._container[index];
59
- }
60
-
61
-
62
- free() {
63
-
64
- }
65
- }
@@ -1,39 +0,0 @@
1
- type BufferManagersMap = Map<string, {
2
- bufferManager: BufferManager;
3
- adaptor: (item: any) => Float32Array;
4
- }>;
5
-
6
- interface BufferManager {
7
- gl: WebGL2RenderingContext;
8
- buffer: WebGLBuffer;
9
- itemSize: number;
10
- bufferType: string;
11
- isFreed: boolean;
12
-
13
- insertBulk(blocks: any[], offsets: number[]): void;
14
- deleteBulk(offsets: number[]): void;
15
- resetWithCapacity(capacity: number): void;
16
- defrag(offsetValues: MapIterator<number> | number[], occupiedCapacity: number, newCapacity: number): void;
17
- extendBuffer(occupiedCapacity: number, newCapacity: number): void;
18
- free(): void;
19
- }
20
-
21
- interface BufferOrchestrator {
22
- offsetMap: Map<string, number>;
23
- tombstoneOffsets: number[];
24
- _length: number;
25
- _capacity: number;
26
- getOffset(key: string): number | undefined;
27
- nextOffset(): number | boolean;
28
- autoExtendBuffers(itemsLength: number, bufferManagersMap: BufferManagersMap): void;
29
- updateBulk(items: any[], bufferManagersMap: BufferManagersMap, bufferKeys?: string[]): void;
30
- deleteBulk(keys: string[], bufferManagersMap: BufferManagersMap): void;
31
- resetWithCapacity(bufferManagersMap: BufferManagersMap, capacity: number | null): void;
32
- }
33
-
34
-
35
- export {
36
- BufferManagersMap,
37
- BufferManager,
38
- BufferOrchestrator
39
- }
@@ -1,22 +0,0 @@
1
- export const vaoAttributeLoader = (gl, buffer, index, size, stride, offset, divisor = null, type = null) => {
2
- if (!gl || !buffer) {
3
- throw new Error("Invalid WebGL context or buffer");
4
- }
5
- if (index < 0) {
6
- throw new Error("Attribute index must be non-negative");
7
- }
8
- if (stride < 0 || offset < 0) {
9
- throw new Error("Stride and offset must be non-negative");
10
- }
11
-
12
- const attribType = type === null ? gl.FLOAT : type;
13
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
14
- gl.enableVertexAttribArray(index);
15
- gl.vertexAttribPointer(index, size, attribType, false, stride, offset);
16
- if (divisor !== null) {
17
- gl.vertexAttribDivisor(index, divisor);
18
- }
19
-
20
- }
21
-
22
-
File without changes
@@ -1,26 +0,0 @@
1
- /**
2
- * @typedef {Array<number>} ListLike
3
- * @typedef {number || null} Index
4
- */
5
-
6
- /**
7
- * @param {ListLike} container
8
- * @param {number} value
9
- * @returns {Index}
10
- */
11
- const findFirstIndexInRange = (container, value) => {
12
- let start = 0;
13
- let end = container.length - 1;
14
- let mid = 0;
15
- while (start <= end) {
16
- mid = Math.floor((start + end) / 2);
17
- if (container[mid] <= value && value <= container[mid + 1]) return mid;
18
- if (container[mid] < value) start = mid + 1;
19
- else end = mid - 1;
20
- }
21
- return null;
22
- }
23
-
24
-
25
- export { findFirstIndexInRange };
26
-
package/util/check/get.js DELETED
@@ -1,13 +0,0 @@
1
-
2
- export const mapGetOrThrow = (errorNote) => {
3
- return (mapInstance, ids) => {
4
- if (!ids) throw new Error("There is no map keys to get");
5
- const result = [];
6
- for (let i = 0; i < ids.length; i++) {
7
- const e = mapInstance.get(ids[i]);
8
- if (e === undefined) throw new Error(errorNote + " " + ids[i]);
9
- result.push(e);
10
- }
11
- return result;
12
- }
13
- }
File without changes
@@ -1,39 +0,0 @@
1
- // Generic
2
-
3
- const doesOwnProperties = (properties, errorMessage) => {
4
- return (object) => {
5
- properties.forEach(element => {
6
- if (!Object.hasOwn(object, element)) throw new TypeError(errorMessage + ':' + element);
7
- });
8
- }
9
- }
10
-
11
- export const isHexColor = (hexColor) => /^#[0-9A-F]{6}$/i.test(hexColor);
12
- export const isHexColorWithOpacity = (hexColor) => /^#[0-9A-F]{6}[0-9a-f]{0,2}$/i.test(hexColor);
13
-
14
- export const opacityCheck = (opacity) => {
15
- if (typeof opacity !== "number") throw new TypeError("style.opacity must a number");
16
- if (opacity < 0 || 1 < opacity) throw new RangeError("Opacity Range Must be 0-1");
17
- }
18
- // Text Related
19
-
20
- const fontCheckTypes = doesOwnProperties(["name", "textColor", "hollowColor", "size", "bold", "italic"], "font does not have");
21
- const fontCheckColors = (textColor, hollowColor) => isHexColor(textColor) && isHexColor(hollowColor);
22
- export const isTextFont = (textFont) => {
23
- fontCheckTypes(textFont);
24
- fontCheckColors(textFont.textColor, textFont.hollowColor);
25
- if (typeof textFont.size !== "number") throw new TypeError("textFont size is not a number");
26
-
27
- }
28
-
29
- export const constraintFloat = (x, lowerBound = null, upperBound = null) => {
30
- if (typeof x !== "number") throw new Error("type must be numberic");
31
- if (lowerBound === null && upperBound === null) return;
32
- if (lowerBound !== null && lowerBound > x) throw new Error(`input must be greater than ${lowerBound}`);
33
- if (upperBound !== null && x > upperBound) throw new Error(`input must be less than ${upperBound}`);
34
- }
35
-
36
-
37
- export const isBoolean = (x) => {
38
- if (typeof x !== "boolean") throw new TypeError("type must be boolean");
39
- }
@@ -1,53 +0,0 @@
1
- function latLongToPixelXY(latitude, longitude) {
2
- return {
3
- x: (longitude + 180) / 360,
4
- y: (90 - latitude) / 180
5
- };
6
- }
7
-
8
- /**
9
- * createBBoxMatrix( minX, maxX, minY, maxY)
10
- * use this matrix to transform a point from 0 to 1 range to the bounding box
11
- * for example: Transform image coordinates to map coordinates
12
- * glsl`vec3 pos = u_bbox_matrix * vec3(v_particle_pos.x, v_particle_pos.y, 1.0);`
13
- */
14
- function createBBoxMatrix(minX, maxX, minY, maxY) {
15
- return new Float32Array([
16
- maxX - minX, 0, 0,
17
- 0, maxY - minY, 0,
18
- minX, minY, 1
19
- ])
20
- }
21
-
22
- function latLongBboxtoPixelXYBbox(minX, minY, maxX, maxY) {
23
- const minXY = latLongToPixelXY(minY, minX);
24
- const maxXY = latLongToPixelXY(maxY, maxX);
25
- return createBBoxMatrix(minXY.x, maxXY.x, minXY.y, maxXY.y);
26
- }
27
-
28
-
29
- /**
30
- *
31
- * @param {Float32List} array
32
- * @returns {Float32Array}
33
- */
34
- function normalize(array, newLength = 1) {
35
- let total = 0;
36
- for (let i = 0; i < array.length; i++) {
37
- total += array[i] * array[i];
38
- }
39
- const len = newLength / Math.sqrt(total);
40
- const result = new Float32Array(array.length);
41
- for (let i = 0; i < array.length; i++) {
42
- result[i] = array[i] * len;
43
- }
44
- return result;
45
- }
46
-
47
-
48
- function sphereCoord(long, lat, globe, height = 0) {
49
- return normalize(globe.api_GetCartesian3DPoint(long, lat, 0, 0), 6378.137 + height);
50
- }
51
-
52
-
53
- export { createBBoxMatrix, latLongToPixelXY, latLongBboxtoPixelXYBbox, sphereCoord, normalize };
@@ -1,85 +0,0 @@
1
- import './types';
2
-
3
-
4
- /**
5
- * @typedef BufferAndReadInfo Buffers can be intertwined or interleaved.
6
- * This object forces user to adapt generic convention of buffer and read information.
7
- * @type {Object}
8
- * @property {WebGLBuffer} buffer
9
- * @property {number} stride
10
- * @property {number} offset
11
- */
12
-
13
- /**
14
- *
15
- * @param {WebGLBuffer} gl
16
- * @param {BufferAndReadInfo} bufferAndReadInfo
17
- * @param {number} index
18
- * @param {number} size
19
- * @param {Object} options
20
- * @param {*} options.type | default gl.FLOAT, gl.UNSIGNED_BYTE, gl.SHORT, gl.UNSIGNED_SHORT, gl.INT, gl.UNSIGNED_INT
21
- * @param {number} options.divisor
22
- * @param {Array<number>} options.escapeValues
23
- * @returns
24
- */
25
-
26
-
27
-
28
- const attributeLoader = (
29
- gl: WebGL2RenderingContext,
30
- bufferAndReadInfo: BufferAndReadInfo | null,
31
- index: number,
32
- size: number,
33
- {
34
- divisor = null,
35
- type = null,
36
- escapeValues = null,
37
- normalized = false
38
- }: AttributeLoaderOptions = {}) => {
39
- if (size < 1 || size > 4) throw new Error("Size must be between 1 and 4");
40
- if (bufferAndReadInfo == null) {
41
- if (escapeValues !== null) constantFunction(gl, index, size, escapeValues);
42
- return;
43
- }
44
-
45
- const { buffer, stride, offset } = bufferAndReadInfo;
46
- if (!gl || !buffer) {
47
- throw new Error("Invalid WebGL context or buffer");
48
- }
49
- if (index < 0) {
50
- throw new Error("Attribute index must be non-negative");
51
- }
52
- if (stride < 0 || offset < 0) {
53
- throw new Error("Stride and offset must be non-negative");
54
- }
55
- const attribType = type === null ? gl.FLOAT : type;
56
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
57
- gl.enableVertexAttribArray(index);
58
- gl.vertexAttribPointer(index, size, attribType, normalized, stride, offset);
59
- if (divisor !== null) {
60
- gl.vertexAttribDivisor(index, divisor);
61
- }
62
- }
63
-
64
- /**
65
- *
66
- * @param {WebGLBuffer} buffer
67
- * @param {number} stride
68
- * @param {number} offset
69
- * @returns {BufferAndReadInfo}
70
- */
71
- const createBufferAndReadInfo = (buffer: WebGLBuffer, stride: number = 0, offset: number = 0): BufferAndReadInfo | null => {
72
- if (buffer == null) return null;
73
- return { buffer, stride, offset };
74
- }
75
-
76
-
77
-
78
- const constantFunction = (gl: WebGL2RenderingContext, index: number, size: number, escapeValues: Array<number>) => {
79
- const func = `vertexAttrib${size}f`;
80
- // @ts-ignore
81
- gl[func](index, ...escapeValues);
82
- }
83
-
84
-
85
- export { attributeLoader, createBufferAndReadInfo };
@@ -1,6 +0,0 @@
1
- // import './types';
2
-
3
- import { attributeLoader } from './attribute-loader';
4
-
5
-
6
- export { attributeLoader };
@@ -1,13 +0,0 @@
1
-
2
- type BufferAndReadInfo = {
3
- buffer: WebGLBuffer;
4
- stride: number;
5
- offset: number;
6
- }
7
-
8
- type AttributeLoaderOptions = {
9
- divisor?: number | null;
10
- type?: number | null;
11
- escapeValues?: Array<number> | null;
12
- normalized?: boolean;
13
- }