@pirireis/webglobeplugins 0.9.8 → 0.9.9

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 (213) hide show
  1. package/index.js +58 -15
  2. package/package.json +1 -1
  3. package/dist/Math/angle-calculation.js +0 -15
  4. package/dist/Math/arc.js +0 -65
  5. package/dist/Math/bounds/line-bbox.js +0 -188
  6. package/dist/Math/constants.js +0 -9
  7. package/dist/Math/frustum/camera.js +0 -24
  8. package/dist/Math/frustum/from-globeinfo.js +0 -48
  9. package/dist/Math/frustum/types.js +0 -2
  10. package/dist/Math/globe-util/horizon-plane.js +0 -112
  11. package/dist/Math/index.js +0 -1
  12. package/dist/Math/juction/arc-plane.js +0 -83
  13. package/dist/Math/juction/line-sphere.js +0 -25
  14. package/dist/Math/juction/plane-plane.js +0 -58
  15. package/dist/Math/line.js +0 -56
  16. package/dist/Math/matrix4.js +0 -1
  17. package/dist/Math/methods.js +0 -201
  18. package/dist/Math/plane.js +0 -60
  19. package/dist/Math/quaternion.js +0 -104
  20. package/dist/Math/types.js +0 -2
  21. package/dist/Math/utils.js +0 -4
  22. package/dist/Math/vec3.js +0 -126
  23. package/dist/algorithms/search-binary.js +0 -19
  24. package/dist/altitude-locator/adaptors.js +0 -1
  25. package/dist/altitude-locator/draw-subset-obj.js +0 -18
  26. package/dist/altitude-locator/keymethod.js +0 -1
  27. package/dist/altitude-locator/plugin.js +0 -341
  28. package/dist/altitude-locator/types.js +0 -23
  29. package/dist/arrowfield/adaptor.js +0 -14
  30. package/dist/arrowfield/index.js +0 -10
  31. package/dist/arrowfield/plugin.js +0 -86
  32. package/dist/bearing-line/index.js +0 -8
  33. package/dist/bearing-line/plugin.js +0 -449
  34. package/dist/circle-line-chain/chain-list-map.js +0 -205
  35. package/dist/circle-line-chain/init.js +0 -1
  36. package/dist/circle-line-chain/plugin.js +0 -424
  37. package/dist/circle-line-chain/util.js +0 -5
  38. package/dist/compass-rose/compass-rose-padding-flat.js +0 -225
  39. package/dist/compass-rose/compass-text-writer.js +0 -153
  40. package/dist/compass-rose/index.js +0 -7
  41. package/dist/compassrose/compassrose.js +0 -296
  42. package/dist/compassrose/index.js +0 -8
  43. package/dist/globe-types.js +0 -1
  44. package/dist/heatwave/index.js +0 -10
  45. package/dist/heatwave/isobar/objectarraylabels.js +0 -202
  46. package/dist/heatwave/isobar/plugin.js +0 -343
  47. package/dist/heatwave/isobar/quadtreecontours.js +0 -300
  48. package/dist/heatwave/plugins/heatwaveglobeshell.js +0 -206
  49. package/dist/index.js +0 -58
  50. package/dist/jest.config.js +0 -7
  51. package/dist/partialrings/buffer-manager.js +0 -81
  52. package/dist/partialrings/index.js +0 -41
  53. package/dist/partialrings/plugin.js +0 -135
  54. package/dist/partialrings/program.js +0 -286
  55. package/dist/pin/pin-object-array.js +0 -305
  56. package/dist/pin/pin-point-totem.js +0 -60
  57. package/dist/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -66
  58. package/dist/point-heat-map/index.js +0 -1
  59. package/dist/point-heat-map/plugin-webworker.js +0 -126
  60. package/dist/point-heat-map/point-to-heat-map-flow.js +0 -127
  61. package/dist/point-tracks/key-methods.js +0 -5
  62. package/dist/point-tracks/plugin.js +0 -338
  63. package/dist/programs/arrowfield/index.js +0 -7
  64. package/dist/programs/arrowfield/logic.js +0 -257
  65. package/dist/programs/arrowfield/object.js +0 -66
  66. package/dist/programs/data2legend/density-to-legend.js +0 -101
  67. package/dist/programs/data2legend/point-to-density-texture.js +0 -100
  68. package/dist/programs/float2legendwithratio/index.js +0 -8
  69. package/dist/programs/float2legendwithratio/logic.js +0 -171
  70. package/dist/programs/float2legendwithratio/object.js +0 -110
  71. package/dist/programs/globe-util/is-globe-moved.js +0 -21
  72. package/dist/programs/globeshell/index.js +0 -8
  73. package/dist/programs/globeshell/noise/noises.js +0 -1
  74. package/dist/programs/globeshell/wiggle/index.js +0 -8
  75. package/dist/programs/globeshell/wiggle/logic.js +0 -345
  76. package/dist/programs/globeshell/wiggle/object.js +0 -72
  77. package/dist/programs/helpers/blender/index.js +0 -1
  78. package/dist/programs/helpers/blender/program.js +0 -79
  79. package/dist/programs/helpers/fadeaway/index.js +0 -7
  80. package/dist/programs/helpers/fadeaway/logic.js +0 -72
  81. package/dist/programs/helpers/fadeaway/object.js +0 -20
  82. package/dist/programs/helpers/index.js +0 -8
  83. package/dist/programs/index.js +0 -58
  84. package/dist/programs/interface.js +0 -1
  85. package/dist/programs/line-on-globe/angled-line.js +0 -176
  86. package/dist/programs/line-on-globe/circle-accurate-3d.js +0 -141
  87. package/dist/programs/line-on-globe/circle-accurate-flat.js +0 -216
  88. package/dist/programs/line-on-globe/circle-accurate.js +0 -178
  89. package/dist/programs/line-on-globe/circle.js +0 -167
  90. package/dist/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -159
  91. package/dist/programs/line-on-globe/index.js +0 -1
  92. package/dist/programs/line-on-globe/lines-color-instanced-flat.js +0 -136
  93. package/dist/programs/line-on-globe/linestrip.js +0 -171
  94. package/dist/programs/line-on-globe/naive-accurate-flexible.js +0 -195
  95. package/dist/programs/line-on-globe/to-the-surface.js +0 -111
  96. package/dist/programs/line-on-globe/util.js +0 -8
  97. package/dist/programs/picking/pickable-renderer.js +0 -188
  98. package/dist/programs/point-on-globe/element-globe-surface-glow.js +0 -142
  99. package/dist/programs/point-on-globe/element-point-glow.js +0 -153
  100. package/dist/programs/point-on-globe/square-pixel-point.js +0 -174
  101. package/dist/programs/programcache.js +0 -131
  102. package/dist/programs/rings/distancering/circleflatprogram.js +0 -156
  103. package/dist/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -369
  104. package/dist/programs/rings/distancering/circlepaddysharedbuffer.js +0 -357
  105. package/dist/programs/rings/distancering/index.js +0 -14
  106. package/dist/programs/rings/distancering/paddyflatprogram.js +0 -172
  107. package/dist/programs/rings/distancering/paddyflatprogram2d.js +0 -174
  108. package/dist/programs/rings/distancering/paddyflatprogram3d.js +0 -172
  109. package/dist/programs/rings/distancering/shader.js +0 -1
  110. package/dist/programs/rings/index.js +0 -17
  111. package/dist/programs/rings/partial-ring/piece-of-pie.js +0 -275
  112. package/dist/programs/totems/camerauniformblock.js +0 -160
  113. package/dist/programs/totems/canvas-webglobe-info.js +0 -110
  114. package/dist/programs/totems/gpu-selection-uniform-block.js +0 -108
  115. package/dist/programs/totems/index.js +0 -40
  116. package/dist/programs/two-d/pixel-circle.js +0 -1
  117. package/dist/programs/two-d/pixel-padding-for-compass.js +0 -162
  118. package/dist/programs/util.js +0 -17
  119. package/dist/programs/vectorfields/index.js +0 -23
  120. package/dist/programs/vectorfields/logics/drawrectangleparticles.js +0 -107
  121. package/dist/programs/vectorfields/logics/index.js +0 -12
  122. package/dist/programs/vectorfields/logics/pixelbased.js +0 -142
  123. package/dist/programs/vectorfields/logics/ubo.js +0 -63
  124. package/dist/programs/vectorfields/pingpongbuffermanager.js +0 -76
  125. package/dist/rangerings/enum.js +0 -5
  126. package/dist/rangerings/index.js +0 -15
  127. package/dist/rangerings/plugin.js +0 -560
  128. package/dist/rangerings/rangeringangletext.js +0 -329
  129. package/dist/rangerings/ring-account.js +0 -117
  130. package/dist/shaders/fragment-toy/firework.js +0 -58
  131. package/dist/shaders/fragment-toy/singularity.js +0 -59
  132. package/dist/shape-on-terrain/arc/naive/plugin.js +0 -252
  133. package/dist/timetracks/adaptors-line-strip.js +0 -71
  134. package/dist/timetracks/adaptors.js +0 -122
  135. package/dist/timetracks/index.js +0 -19
  136. package/dist/timetracks/plugin-line-strip.js +0 -250
  137. package/dist/timetracks/plugin.js +0 -258
  138. package/dist/timetracks/program-line-strip.js +0 -611
  139. package/dist/timetracks/program.js +0 -772
  140. package/dist/timetracks/programpoint-line-strip.js +0 -154
  141. package/dist/timetracks/programpoint.js +0 -147
  142. package/dist/types.js +0 -15
  143. package/dist/util/account/bufferoffsetmanager.js +0 -179
  144. package/dist/util/account/index.js +0 -23
  145. package/dist/util/account/single-attribute-buffer-management/buffer-manager.js +0 -108
  146. package/dist/util/account/single-attribute-buffer-management/buffer-orchestrator.js +0 -150
  147. package/dist/util/account/single-attribute-buffer-management/index.js +0 -9
  148. package/dist/util/account/single-attribute-buffer-management/object-store.js +0 -51
  149. package/dist/util/account/single-attribute-buffer-management/types.js +0 -2
  150. package/dist/util/account/util.js +0 -22
  151. package/dist/util/algorithms/index.js +0 -1
  152. package/dist/util/algorithms/search-binary.js +0 -28
  153. package/dist/util/check/get.js +0 -18
  154. package/dist/util/check/index.js +0 -1
  155. package/dist/util/check/typecheck.js +0 -49
  156. package/dist/util/geometry/index.js +0 -51
  157. package/dist/util/gl-util/buffer/attribute-loader.js +0 -69
  158. package/dist/util/gl-util/buffer/index.js +0 -6
  159. package/dist/util/gl-util/buffer/types.js +0 -1
  160. package/dist/util/gl-util/draw-options/methods.js +0 -38
  161. package/dist/util/gl-util/draw-options/types.js +0 -15
  162. package/dist/util/gl-util/uniform-block/manager.js +0 -156
  163. package/dist/util/gl-util/uniform-block/shader.js +0 -1
  164. package/dist/util/gl-util/uniform-block/types.js +0 -8
  165. package/dist/util/heatwavedatamanager/datamanager.js +0 -152
  166. package/dist/util/heatwavedatamanager/index.js +0 -10
  167. package/dist/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -122
  168. package/dist/util/heatwavedatamanager/pointcoordsmeta.js +0 -20
  169. package/dist/util/index.js +0 -57
  170. package/dist/util/interpolation/index.js +0 -1
  171. package/dist/util/interpolation/timetrack/index.js +0 -5
  172. package/dist/util/interpolation/timetrack/timetrack-interpolator.js +0 -79
  173. package/dist/util/interpolation/timetrack/web-worker-str.js +0 -183
  174. package/dist/util/interpolation/timetrack/web-worker.js +0 -48
  175. package/dist/util/jshelpers/data-filler.js +0 -20
  176. package/dist/util/jshelpers/equality.js +0 -20
  177. package/dist/util/jshelpers/index.js +0 -37
  178. package/dist/util/jshelpers/timefilters.js +0 -32
  179. package/dist/util/picking/fence.js +0 -46
  180. package/dist/util/picking/picker-displayer.js +0 -139
  181. package/dist/util/programs/draw-texture-on-canvas.js +0 -89
  182. package/dist/util/programs/index.js +0 -17
  183. package/dist/util/programs/shapesonglobe.js +0 -214
  184. package/dist/util/programs/supersampletotextures.js +0 -113
  185. package/dist/util/programs/texturetoglobe.js +0 -182
  186. package/dist/util/shaderfunctions/geometrytransformations.js +0 -340
  187. package/dist/util/shaderfunctions/index.js +0 -18
  188. package/dist/util/shaderfunctions/nodata.js +0 -11
  189. package/dist/util/shaderfunctions/noisefunctions.js +0 -43
  190. package/dist/util/surface-line-data/arc-bboxes.js +0 -25
  191. package/dist/util/surface-line-data/arcs-to-cuts.js +0 -50
  192. package/dist/util/surface-line-data/cut-arc.js +0 -1
  193. package/dist/util/surface-line-data/flow.js +0 -28
  194. package/dist/util/surface-line-data/rbush-manager.js +0 -1
  195. package/dist/util/surface-line-data/types.js +0 -1
  196. package/dist/util/surface-line-data/web-worker.js +0 -1
  197. package/dist/util/webglobe/gldefaultstates.js +0 -7
  198. package/dist/util/webglobe/index.js +0 -18
  199. package/dist/util/webglobe/rasteroverlay.js +0 -78
  200. package/dist/util/webglobjectbuilders.js +0 -388
  201. package/dist/util/webglobjectbuilders1.js +0 -237
  202. package/dist/waveparticles/adaptor.js +0 -17
  203. package/dist/waveparticles/index.js +0 -10
  204. package/dist/waveparticles/plugin.js +0 -266
  205. package/dist/wind/imagetovectorfieldandmagnitude.js +0 -35
  206. package/dist/wind/index.js +0 -14
  207. package/dist/wind/plugin.js +0 -926
  208. package/dist/wind/vectorfieldimage.js +0 -25
  209. package/dist/write-text/attached-text-writer.js +0 -91
  210. package/dist/write-text/context-text.js +0 -98
  211. package/dist/write-text/context-text3.js +0 -155
  212. package/dist/write-text/index.js +0 -5
  213. package/dist/write-text/writer-plugin.js +0 -8
@@ -1,154 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const util_1 = require("../util");
4
- const programs_1 = require("../programs");
5
- const vertexShader = `#version 300 es
6
-
7
- layout(std140) uniform GlobeCamera {
8
- mat4 view; // 64 bytes 0
9
- mat4 projection; // 64 bytes 64
10
- vec3 translate; // 12 bytes 128
11
- bool is3D; // 4 bytes 140
12
- vec2 mapWH; // 8 bytes 144
13
- vec2 screenWH; // 8 bytes 152
14
- float z_level; // 4 bytes 160
15
- };
16
-
17
- layout(std140) uniform Globals {
18
- float head_time;
19
- float final_opacity;
20
- float point_size;
21
- };
22
-
23
- in vec3 start_position;
24
- in float start_time;
25
- in vec3 start_color;
26
- in vec3 end_position;
27
- in float end_time;
28
- in vec3 end_color;
29
- out vec4 v_color;
30
-
31
- ` + util_1.shaderfunctions.pixelXYToCartesian3DPoint + util_1.shaderfunctions.pixelXYToCartesian2DPoint + `
32
-
33
- void main() {
34
- if (head_time < start_time || head_time > end_time) { return; }
35
- if ( start_color.r < 0.0 || end_color.r < 0.0) { return; }
36
- float t = (head_time - start_time) / (end_time - start_time);
37
- vec3 position = mix(start_position, end_position, t);
38
- if (is3D){
39
- vec3 pos = pixelXYToCartesian3DPoint(position);
40
- gl_Position = projection * view * vec4(pos - translate, 1.0);
41
- } else {
42
- vec2 xy = pixelXYToCartesian2DPoint(position.xy, translate.xy, mapWH, screenWH);
43
- gl_Position = projection * vec4(xy.x, xy.y, 0.0, 1.0);
44
- }
45
- v_color = vec4(mix(start_color, end_color, t), final_opacity);
46
- gl_PointSize = point_size;
47
- }`;
48
- const fragmentShader = `#version 300 es
49
- precision highp float;
50
- in vec4 v_color;
51
- out vec4 outColor;
52
- void main() {
53
- // circle point
54
- vec2 cxy = 2.0 * gl_PointCoord - 1.0;
55
- float cc = dot(cxy, cxy);
56
- outColor = v_color;
57
- if (cc > 0.5) {
58
- outColor.a = 0.0;
59
- }
60
- }`;
61
- class default_1 {
62
- constructor(gl, globe, attrBuffer, options) {
63
- this.gl = gl;
64
- this._cameraBlockBindingPoint = 0;
65
- this._globalsBlockBindingPoint = 1;
66
- this.cameraUniformBlockTotem = programs_1.globeProgramCache.getProgram(globe, programs_1.CameraUniformBlockTotem);
67
- this._vao = gl.createVertexArray();
68
- this._attbuffer = attrBuffer;
69
- this.program = this._createProgram();
70
- this._drawCount = 0;
71
- this._globalsbuffer = gl.createBuffer();
72
- {
73
- const { gl, _globalsbuffer } = this;
74
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
75
- gl.bufferData(gl.UNIFORM_BUFFER, 12, gl.STREAM_DRAW);
76
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([0, options.opacity, options.pointSize]));
77
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this._globalsBlockBindingPoint, _globalsbuffer);
78
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
79
- }
80
- }
81
- _createProgram() {
82
- const gl = this.gl;
83
- const program = (0, util_1.createProgram)(gl, vertexShader, fragmentShader);
84
- const ubo = this.cameraUniformBlockTotem.getUBO(); // ubo bl
85
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "GlobeCamera");
86
- gl.uniformBlockBinding(program, cameraBlockIndex, this._cameraBlockBindingPoint);
87
- const globalsBlockIndex = gl.getUniformBlockIndex(program, "Globals");
88
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this._cameraBlockBindingPoint, ubo);
89
- gl.uniformBlockBinding(program, globalsBlockIndex, this._globalsBlockBindingPoint);
90
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this._globalsBlockBindingPoint, this._globalsbuffer);
91
- // numaralarda yanlışlık olabilir
92
- const start_position = gl.getAttribLocation(program, "start_position");
93
- const start_time = gl.getAttribLocation(program, "start_time");
94
- const start_color = gl.getAttribLocation(program, "start_color");
95
- const end_position = gl.getAttribLocation(program, "end_position");
96
- const end_time = gl.getAttribLocation(program, "end_time");
97
- const end_color = gl.getAttribLocation(program, "end_color");
98
- gl.bindVertexArray(this._vao);
99
- gl.bindBuffer(gl.ARRAY_BUFFER, this._attbuffer);
100
- gl.enableVertexAttribArray(start_position);
101
- gl.vertexAttribPointer(start_position, 3, gl.FLOAT, false, 36, 0);
102
- gl.enableVertexAttribArray(start_time);
103
- gl.vertexAttribPointer(start_time, 1, gl.FLOAT, false, 36, 12);
104
- gl.enableVertexAttribArray(start_color);
105
- gl.vertexAttribPointer(start_color, 3, gl.FLOAT, false, 36, 16);
106
- gl.enableVertexAttribArray(end_position);
107
- gl.vertexAttribPointer(end_position, 3, gl.FLOAT, false, 36, 36);
108
- gl.enableVertexAttribArray(end_time);
109
- gl.vertexAttribPointer(end_time, 1, gl.FLOAT, false, 36, 48);
110
- gl.enableVertexAttribArray(end_color);
111
- gl.vertexAttribPointer(end_color, 3, gl.FLOAT, false, 36, 52);
112
- gl.bindVertexArray(null);
113
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
114
- return program;
115
- }
116
- setOpacity(opacity) {
117
- const { gl, _globalsbuffer } = this;
118
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
119
- gl.bufferSubData(gl.UNIFORM_BUFFER, 4, new Float32Array([opacity]));
120
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
121
- }
122
- setDrawCount(count) {
123
- this._drawCount = count;
124
- }
125
- setPointSize(size) {
126
- const { gl, _globalsbuffer } = this;
127
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
128
- gl.bufferSubData(gl.UNIFORM_BUFFER, 8, new Float32Array([size]));
129
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
130
- }
131
- setHeadTime(time) {
132
- const { gl, _globalsbuffer } = this;
133
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
134
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([time]));
135
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
136
- }
137
- draw() {
138
- const { gl, program, _vao, _drawCount } = this;
139
- gl.useProgram(program);
140
- gl.bindVertexArray(_vao);
141
- gl.disable(gl.DEPTH_TEST);
142
- gl.drawArrays(gl.POINTS, 0, _drawCount);
143
- gl.enable(gl.DEPTH_TEST);
144
- gl.bindVertexArray(null);
145
- }
146
- free() {
147
- const { gl, _vao, _globalsbuffer, program } = this;
148
- gl.deleteVertexArray(_vao);
149
- // gl.deleteBuffer(_attbuffer);
150
- gl.deleteBuffer(_globalsbuffer);
151
- gl.deleteProgram(program);
152
- }
153
- }
154
- exports.default = default_1;
@@ -1,147 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const util_1 = require("../util");
4
- const programs_1 = require("../programs");
5
- const vertexShader = `#version 300 es
6
-
7
- layout(std140) uniform GlobeCamera {
8
- mat4 view; // 64 bytes 0
9
- mat4 projection; // 64 bytes 64
10
- vec3 translate; // 12 bytes 128
11
- bool is3D; // 4 bytes 140
12
- vec2 mapWH; // 8 bytes 144
13
- vec2 screenWH; // 8 bytes 152
14
- float z_level; // 4 bytes 160
15
- };
16
-
17
- layout(std140) uniform Globals {
18
- float head_time;
19
- float final_opacity;
20
- float point_size;
21
- };
22
-
23
- in vec3 start_position;
24
- in float start_time;
25
- in vec3 start_color;
26
- in vec3 end_position;
27
- in float end_time;
28
- in vec3 end_color;
29
- out vec4 v_color;
30
-
31
- ` + util_1.shaderfunctions.pixelXYToCartesian3DPoint + util_1.shaderfunctions.pixelXYToCartesian2DPoint + `
32
-
33
- void main() {
34
- if (head_time < start_time || head_time > end_time) { return; }
35
- float t = (head_time - start_time) / (end_time - start_time);
36
- vec3 position = mix(start_position, end_position, t);
37
- if (is3D){
38
- vec3 pos = pixelXYToCartesian3DPoint(position);
39
- gl_Position = projection * view * vec4(pos - translate, 1.0);
40
- } else {
41
- vec2 xy = pixelXYToCartesian2DPoint(position.xy, translate.xy, mapWH, screenWH);
42
- gl_Position = projection * vec4(xy.x, xy.y, 0.0, 1.0);
43
- }
44
- v_color = vec4(mix(start_color, end_color, t), final_opacity);
45
- gl_PointSize = point_size;
46
- }`;
47
- const fragmentShader = `#version 300 es
48
- precision highp float;
49
- in vec4 v_color;
50
- out vec4 outColor;
51
- void main() {
52
- outColor = v_color;
53
- }`;
54
- class default_1 {
55
- constructor(gl, globe, attrBuffer, options) {
56
- this.gl = gl;
57
- this._cameraBlockBindingPoint = 0;
58
- this._globalsBlockBindingPoint = 1;
59
- this.cameraUniformBlockTotem = programs_1.globeProgramCache.getProgram(globe, programs_1.CameraUniformBlockTotem);
60
- this._vao = gl.createVertexArray();
61
- this._attbuffer = attrBuffer;
62
- this.program = this._createProgram();
63
- this._drawCount = 0;
64
- this._globalsbuffer = gl.createBuffer();
65
- {
66
- const { gl, _globalsbuffer } = this;
67
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
68
- gl.bufferData(gl.UNIFORM_BUFFER, 12, gl.STREAM_DRAW);
69
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([0, options.opacity, options.pointSize]));
70
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this._globalsBlockBindingPoint, _globalsbuffer);
71
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
72
- }
73
- }
74
- _createProgram() {
75
- const gl = this.gl;
76
- const program = (0, util_1.createProgram)(gl, vertexShader, fragmentShader);
77
- const ubo = this.cameraUniformBlockTotem.getUBO(); // ubo bl
78
- const cameraBlockIndex = gl.getUniformBlockIndex(program, "GlobeCamera");
79
- gl.uniformBlockBinding(program, cameraBlockIndex, this._cameraBlockBindingPoint);
80
- const globalsBlockIndex = gl.getUniformBlockIndex(program, "Globals");
81
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this._cameraBlockBindingPoint, ubo);
82
- gl.uniformBlockBinding(program, globalsBlockIndex, this._globalsBlockBindingPoint);
83
- gl.bindBufferBase(gl.UNIFORM_BUFFER, this._globalsBlockBindingPoint, this._globalsbuffer);
84
- // numaralarda yanlışlık olabilir
85
- const start_position = gl.getAttribLocation(program, "start_position");
86
- const start_time = gl.getAttribLocation(program, "start_time");
87
- const start_color = gl.getAttribLocation(program, "start_color");
88
- const end_position = gl.getAttribLocation(program, "end_position");
89
- const end_time = gl.getAttribLocation(program, "end_time");
90
- const end_color = gl.getAttribLocation(program, "end_color");
91
- gl.bindVertexArray(this._vao);
92
- gl.bindBuffer(gl.ARRAY_BUFFER, this._attbuffer);
93
- gl.enableVertexAttribArray(start_position);
94
- gl.vertexAttribPointer(start_position, 3, gl.FLOAT, false, 72, 0);
95
- gl.enableVertexAttribArray(start_time);
96
- gl.vertexAttribPointer(start_time, 1, gl.FLOAT, false, 72, 12);
97
- gl.enableVertexAttribArray(start_color);
98
- gl.vertexAttribPointer(start_color, 3, gl.FLOAT, false, 72, 16);
99
- gl.enableVertexAttribArray(end_position);
100
- gl.vertexAttribPointer(end_position, 3, gl.FLOAT, false, 72, 36);
101
- gl.enableVertexAttribArray(end_time);
102
- gl.vertexAttribPointer(end_time, 1, gl.FLOAT, false, 72, 48);
103
- gl.enableVertexAttribArray(end_color);
104
- gl.vertexAttribPointer(end_color, 3, gl.FLOAT, false, 72, 52);
105
- gl.bindVertexArray(null);
106
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
107
- return program;
108
- }
109
- setOpacity(opacity) {
110
- const { gl, _globalsbuffer } = this;
111
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
112
- gl.bufferSubData(gl.UNIFORM_BUFFER, 4, new Float32Array([opacity]));
113
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
114
- }
115
- setDrawCount(count) {
116
- this._drawCount = count;
117
- }
118
- setPointSize(size) {
119
- const { gl, _globalsbuffer } = this;
120
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
121
- gl.bufferSubData(gl.UNIFORM_BUFFER, 8, new Float32Array([size]));
122
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
123
- }
124
- setHeadTime(time) {
125
- const { gl, _globalsbuffer } = this;
126
- gl.bindBuffer(gl.UNIFORM_BUFFER, _globalsbuffer);
127
- gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([time]));
128
- gl.bindBuffer(gl.UNIFORM_BUFFER, null);
129
- }
130
- draw() {
131
- const { gl, program, _vao, _drawCount } = this;
132
- gl.useProgram(program);
133
- gl.bindVertexArray(_vao);
134
- gl.disable(gl.DEPTH_TEST);
135
- gl.drawArrays(gl.POINTS, 0, _drawCount);
136
- gl.enable(gl.DEPTH_TEST);
137
- gl.bindVertexArray(null);
138
- }
139
- free() {
140
- const { gl, _vao, _globalsbuffer, program } = this;
141
- gl.deleteVertexArray(_vao);
142
- // gl.deleteBuffer(_attbuffer);
143
- gl.deleteBuffer(_globalsbuffer);
144
- gl.deleteProgram(program);
145
- }
146
- }
147
- exports.default = default_1;
package/dist/types.js DELETED
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /**
3
- * @typedef DrawRange
4
- * @type {Object}
5
- * @property {int} first
6
- * @property {int} count
7
- *
8
- * @typedef DrawRangeIndexParamsClient
9
- * @type {Object}
10
- * @property {null|DrawRange} drawRange
11
- * @property {null|Int32List} indexes
12
- */
13
- /**
14
- * * @typedef {Array<number>} Color rgba color 0-1 values
15
- */
@@ -1,179 +0,0 @@
1
- "use strict";
2
- /**
3
- * BufferOffsetManager
4
- * Purpose: To manage the offset of the buffer. Plus extend and defrag the buffer.
5
- * -------------------------------------------------------------------------------------------------------------------------------------------
6
- * Functions:
7
- * 1. getOffet(key) : return the offset of the key if not found return false.
8
- * 2. setOffset(key, offset) : set the offset of the key.
9
- * 3. nextOffset() : return the next available offset if not return false.
10
- * 4. delete(key) : delete the key and return true if not found return false.
11
- * 5. defragBuffer(gl, buffer, bufferType, newCapacity = null) : defrag the buffer. if newCapacity is not provided the buffer is vacumed.
12
- * 6. extendBuffer(gl, buffer, bufferType, newCapacity) : extend the buffer.
13
- * -------------------------------------------------------------------------------------------------------------------------------------------
14
- * What this class does NOT do:
15
- * ADD, DELETE, READ
16
- * ADD, inputs needs to be turn into a block and put into buffer. Bulk will be more performant.
17
- * DELETE, might be a set to single byte to indicate the tombstone.
18
- * READ, most of the time is not needed to be read, unless for defraging.
19
- * This unpredicatable behavior is not handled by this class.
20
- */
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- class default_1 {
23
- constructor(itemSize, { capacity = 10, bufferType = "STATIC_DRAW" } = {}) {
24
- this.itemSize = itemSize;
25
- this.bufferType = bufferType;
26
- this.offSetMap = new Map();
27
- this.tombstoneOffSet = [];
28
- this._capacity = capacity;
29
- this._length = 0;
30
- }
31
- get length() {
32
- return this._length;
33
- }
34
- get capacity() {
35
- return this._capacity;
36
- }
37
- getOffset(key) {
38
- return this.offSetMap.get(key);
39
- }
40
- setOffset(key, offset) {
41
- this.offSetMap.set(key, offset);
42
- }
43
- nextOffset() {
44
- if (this.tombstoneOffSet.length > 0) {
45
- const offset = this.tombstoneOffSet.pop();
46
- return offset;
47
- }
48
- if (this._length < this._capacity) {
49
- return this._length++ * this.itemSize * 4;
50
- }
51
- return false;
52
- }
53
- get spaceLeft() {
54
- return this._capacity - (this._length - this.tombstoneOffSet.length);
55
- }
56
- get itemCount() {
57
- return this._length - this.tombstoneOffSet.length;
58
- }
59
- deleteFromAccount(key) {
60
- const offSet = this.offSetMap.get(key);
61
- if (offSet !== undefined) {
62
- this.tombstoneOffSet.push(offSet);
63
- this.offSetMap.delete(key);
64
- return true;
65
- }
66
- else {
67
- return false;
68
- }
69
- }
70
- _deleteBulk(keys) {
71
- const { gl, buffer } = this;
72
- const emptyBlock = new Float32Array(this.itemSize).fill(0);
73
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
74
- for (let key of keys) {
75
- const offset = this.getOffset(key);
76
- if (offset !== undefined) {
77
- this.deleteFromAccount(key);
78
- gl.bufferSubData(gl.ARRAY_BUFFER, offset, emptyBlock);
79
- }
80
- }
81
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
82
- }
83
- offsetMapIterator() {
84
- return this.offSetMap.entries();
85
- }
86
- // TODO: this is broken
87
- defrag(newCapacity = null) {
88
- const { gl, buffer, bufferType } = this;
89
- if (gl === undefined || buffer === undefined || bufferType === undefined) {
90
- throw new Error("gl, buffer, bufferType are required");
91
- }
92
- const itemSize = this.itemSize;
93
- const itemCount = this.itemCount;
94
- const capacity = (newCapacity && newCapacity > itemCount) ? newCapacity : itemCount;
95
- const newArray = new Float32Array(itemCount * itemSize);
96
- const bufferData = this._getBufferData();
97
- let newOffSet = 0;
98
- const newOffSetMap = new Map();
99
- for (const [key, offSet] of this.offSetMap) {
100
- const itemOffSet = offSet / 4;
101
- newArray.set(bufferData.slice(itemOffSet, itemOffSet + itemSize), newOffSet);
102
- // this.offSetMap.set(key, newOffSet * 4);
103
- newOffSetMap.set(key, newOffSet * 4);
104
- newOffSet += itemSize;
105
- }
106
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
107
- gl.bufferData(gl.ARRAY_BUFFER, capacity * itemSize * 4, gl[bufferType]);
108
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, newArray);
109
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
110
- this._capacity = capacity;
111
- this.tombstoneOffSet = [];
112
- this._length = itemCount;
113
- this.offSetMap = newOffSetMap;
114
- }
115
- autoExtendBuffer(payloadSize) {
116
- if (payloadSize <= this.spaceLeft)
117
- return;
118
- const newCapacity = Math.ceil((payloadSize + this.length));
119
- this.extendBuffer(newCapacity);
120
- }
121
- extendBuffer(newCapacity) {
122
- const { gl, buffer, bufferType } = this;
123
- const itemSize = this.itemSize;
124
- const bufferData = this._getBufferData();
125
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
126
- gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
127
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
128
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
129
- this._capacity = newCapacity;
130
- }
131
- /** implicit methods to be used by the child class */
132
- /**
133
- * @typedef {Float32Array} payload
134
- * @param {Array<{key, payload}>} items
135
- * @param {number} partOffset
136
- * @returns
137
- */
138
- _updatePartial(items, partOffset) {
139
- const { gl, buffer } = this;
140
- const partStart = partOffset * 4;
141
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
142
- for (let { key, payload } of items) {
143
- let offset = this.getOffset(key);
144
- if (offset !== undefined) {
145
- gl.bufferSubData(gl.ARRAY_BUFFER, offset + partStart, payload);
146
- }
147
- }
148
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
149
- }
150
- _getBufferData() {
151
- const { gl, buffer } = this;
152
- const size = new Float32Array(this.length * this.itemSize);
153
- const bufferData = new Float32Array(size);
154
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
155
- gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
156
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
157
- return bufferData;
158
- }
159
- _removeFromBuffer(keys) {
160
- const { gl, buffer } = this;
161
- const emptyBlock = new Float32Array(this.itemSize).fill(0);
162
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
163
- for (let key of keys) {
164
- let offset = this.getOffset(key);
165
- if (offset !== undefined) {
166
- this.deleteFromAccount(key);
167
- gl.bufferSubData(gl.ARRAY_BUFFER, offset, emptyBlock);
168
- }
169
- }
170
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
171
- }
172
- free() {
173
- this.gl.deleteBuffer(this.buffer);
174
- this.buffer = null;
175
- this.vao = null;
176
- this.gl = null;
177
- }
178
- }
179
- exports.default = default_1;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.BufferOffsetManager = void 0;
21
- const bufferoffsetmanager_1 = __importDefault(require("./bufferoffsetmanager"));
22
- exports.BufferOffsetManager = bufferoffsetmanager_1.default;
23
- __exportStar(require("./single-attribute-buffer-management/index"), exports);
@@ -1,108 +0,0 @@
1
- "use strict";
2
- /**
3
- * BufferOffsetManager
4
- * Purpose: To manage the offset of the buffer. Plus extend and defrag the buffer.
5
- * ------------------------------------------------------------------------------------------------------------------------------------------- * Functions:
6
- * 1. getOffet(key) : return the offset of the key if not found return false.
7
- * 2. setOffset(key, offset) : set the offset of the key.
8
- * 3. nextOffset() : return the next available offset if not return false.
9
- * 4. delete(key) : delete the key and return true if not found return false.
10
- * 5. defragBuffer(gl, buffer, bufferType, newCapacity = null) : defrag the buffer. if newCapacity is not provided the buffer is vacumed.
11
- * 6. extendBuffer(gl, buffer, bufferType, newCapacity) : extend the buffer.
12
- * -------------------------------------------------------------------------------------------------------------------------------------------
13
- * What this class does NOT do:
14
- * ADD, DELETE, READ
15
- * ADD, inputs needs to be turn into a block and put into buffer. Bulk will be more performant.
16
- * DELETE, might be a set to single byte to indicate the tombstone.
17
- * READ, most of the time is not needed to be read, unless for defraging.
18
- * This unpredicatable behavior is not handled by this class.
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.BufferManager = void 0;
22
- class BufferManager {
23
- constructor(gl, itemSize, { bufferType = "STATIC_DRAW", buffer = null, initialCapacity = null } = {}) {
24
- this.isFreed = false;
25
- this.gl = gl;
26
- this.itemSize = itemSize;
27
- this.bufferType = bufferType;
28
- this.buffer = buffer === null ? gl.createBuffer() : buffer;
29
- if (initialCapacity !== null)
30
- this.resetWithCapacity(initialCapacity);
31
- }
32
- resetWithCapacity(capacity) {
33
- const { gl, buffer, bufferType, itemSize } = this;
34
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
35
- // @ts-ignore
36
- gl.bufferData(gl.ARRAY_BUFFER, capacity * itemSize * 4, gl[bufferType]);
37
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
38
- }
39
- deleteBulk(offsets) {
40
- const { gl, buffer, itemSize } = this;
41
- const emptyBlock = new Float32Array(this.itemSize).fill(NaN);
42
- const offsetMultiplier = itemSize * 4;
43
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
44
- for (let offset of offsets) {
45
- if (offset !== undefined) {
46
- gl.bufferSubData(gl.ARRAY_BUFFER, offset * offsetMultiplier, emptyBlock);
47
- }
48
- }
49
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
50
- }
51
- insertBulk(blocks, offsets) {
52
- const { gl, buffer, itemSize } = this;
53
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
54
- const offsetMultiplier = itemSize * 4;
55
- for (let i = 0; i < blocks.length; i++) {
56
- const block = blocks[i];
57
- const offset = offsets[i] * offsetMultiplier;
58
- if (offset !== undefined)
59
- gl.bufferSubData(gl.ARRAY_BUFFER, offset, block);
60
- }
61
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
62
- }
63
- // TODO: this is broken
64
- defrag(offsetValues, occupiedCapacity, newCapacity) {
65
- const { gl, buffer, bufferType, itemSize } = this;
66
- const newArray = new Float32Array(newCapacity * itemSize);
67
- const bufferData = this._getBufferData(occupiedCapacity);
68
- let newOffset = 0;
69
- for (const offset of offsetValues) {
70
- const itemOffset = offset * itemSize;
71
- newArray.set(bufferData.slice(itemOffset, itemOffset + itemSize), newOffset);
72
- newOffset += itemSize;
73
- }
74
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
75
- // @ts-ignore
76
- gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
77
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, newArray);
78
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
79
- }
80
- extendBuffer(occupiedCapacity, newCapacity) {
81
- const { gl, buffer, bufferType } = this;
82
- const itemSize = this.itemSize;
83
- const bufferData = this._getBufferData(occupiedCapacity);
84
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
85
- // @ts-ignore
86
- gl.bufferData(gl.ARRAY_BUFFER, newCapacity * itemSize * 4, gl[bufferType]);
87
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
88
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
89
- }
90
- _getBufferData(occupiedCapacity) {
91
- const { gl, buffer } = this;
92
- const size = occupiedCapacity * this.itemSize;
93
- const bufferData = new Float32Array(size);
94
- gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
95
- gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
96
- gl.bindBuffer(gl.ARRAY_BUFFER, null);
97
- return bufferData;
98
- }
99
- free() {
100
- if (this.isFreed)
101
- return;
102
- this.gl.deleteBuffer(this.buffer);
103
- // this.buffer = null;
104
- // this.gl = null;
105
- this.isFreed = true;
106
- }
107
- }
108
- exports.BufferManager = BufferManager;