@pirireis/webglobeplugins 0.9.11 → 0.9.13

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 (179) hide show
  1. package/Math/angle-calculation.js +9 -11
  2. package/Math/arc.js +38 -41
  3. package/Math/bounds/line-bbox.js +79 -83
  4. package/Math/constants.js +4 -9
  5. package/Math/frustum/types.js +1 -2
  6. package/Math/juction/arc-plane.js +33 -36
  7. package/Math/juction/line-sphere.js +15 -18
  8. package/Math/juction/plane-plane.js +20 -23
  9. package/Math/line.js +42 -47
  10. package/Math/methods.js +69 -92
  11. package/Math/plane.js +33 -38
  12. package/Math/quaternion.js +48 -55
  13. package/Math/types.js +1 -2
  14. package/Math/utils.js +2 -4
  15. package/Math/vec3.js +46 -52
  16. package/algorithms/search-binary.js +5 -8
  17. package/altitude-locator/draw-subset-obj.js +8 -11
  18. package/altitude-locator/plugin.js +114 -133
  19. package/altitude-locator/types.js +1 -3
  20. package/arrowfield/adaptor.js +3 -7
  21. package/arrowfield/index.js +3 -10
  22. package/arrowfield/plugin.js +63 -69
  23. package/bearing-line/index.js +2 -8
  24. package/bearing-line/plugin.js +218 -248
  25. package/circle-line-chain/chain-list-map.js +82 -92
  26. package/circle-line-chain/plugin.js +147 -182
  27. package/circle-line-chain/util.js +1 -5
  28. package/compass-rose/compass-rose-padding-flat.js +111 -140
  29. package/compass-rose/compass-text-writer.js +63 -75
  30. package/compass-rose/index.js +3 -7
  31. package/compassrose/compassrose.js +50 -57
  32. package/compassrose/index.js +2 -8
  33. package/heatwave/index.js +3 -10
  34. package/heatwave/isobar/objectarraylabels.js +50 -56
  35. package/heatwave/isobar/plugin.js +111 -170
  36. package/heatwave/isobar/quadtreecontours.js +78 -96
  37. package/heatwave/plugins/heatwaveglobeshell.js +73 -94
  38. package/index.js +12 -58
  39. package/package.json +1 -1
  40. package/partialrings/buffer-manager.js +32 -70
  41. package/partialrings/index.js +2 -41
  42. package/partialrings/plugin.js +55 -98
  43. package/partialrings/program.js +141 -59
  44. package/pin/pin-object-array.js +89 -97
  45. package/pin/pin-point-totem.js +21 -22
  46. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
  47. package/point-heat-map/plugin-webworker.js +45 -53
  48. package/point-heat-map/point-to-heat-map-flow.js +46 -51
  49. package/point-tracks/key-methods.js +2 -5
  50. package/point-tracks/plugin.js +141 -170
  51. package/programs/arrowfield/index.js +2 -7
  52. package/programs/arrowfield/logic.js +172 -67
  53. package/programs/arrowfield/object.js +35 -43
  54. package/programs/data2legend/density-to-legend.js +47 -26
  55. package/programs/data2legend/point-to-density-texture.js +56 -34
  56. package/programs/float2legendwithratio/index.js +2 -8
  57. package/programs/float2legendwithratio/logic.js +88 -45
  58. package/programs/float2legendwithratio/object.js +45 -54
  59. package/programs/globe-util/is-globe-moved.js +10 -13
  60. package/programs/globeshell/index.js +2 -8
  61. package/programs/globeshell/wiggle/index.js +2 -8
  62. package/programs/globeshell/wiggle/logic.js +191 -101
  63. package/programs/globeshell/wiggle/object.js +35 -43
  64. package/programs/helpers/blender/program.js +36 -22
  65. package/programs/helpers/fadeaway/index.js +2 -7
  66. package/programs/helpers/fadeaway/logic.js +36 -17
  67. package/programs/helpers/fadeaway/object.js +11 -18
  68. package/programs/helpers/index.js +2 -8
  69. package/programs/index.js +9 -58
  70. package/programs/line-on-globe/angled-line.js +95 -39
  71. package/programs/line-on-globe/circle-accurate-3d.js +86 -39
  72. package/programs/line-on-globe/circle-accurate-flat.js +116 -64
  73. package/programs/line-on-globe/circle-accurate.js +113 -46
  74. package/programs/line-on-globe/circle.js +106 -44
  75. package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
  76. package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
  77. package/programs/line-on-globe/linestrip.js +126 -63
  78. package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
  79. package/programs/line-on-globe/to-the-surface.js +62 -35
  80. package/programs/line-on-globe/util.js +2 -5
  81. package/programs/picking/pickable-renderer.js +127 -46
  82. package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
  83. package/programs/point-on-globe/element-point-glow.js +112 -47
  84. package/programs/point-on-globe/square-pixel-point.js +80 -34
  85. package/programs/programcache.js +14 -19
  86. package/programs/rings/distancering/circleflatprogram.js +76 -70
  87. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
  88. package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
  89. package/programs/rings/distancering/index.js +5 -14
  90. package/programs/rings/distancering/paddyflatprogram.js +87 -70
  91. package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
  92. package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
  93. package/programs/rings/index.js +1 -17
  94. package/programs/rings/partial-ring/piece-of-pie.js +144 -44
  95. package/programs/totems/camerauniformblock.js +65 -56
  96. package/programs/totems/canvas-webglobe-info.js +49 -45
  97. package/programs/totems/gpu-selection-uniform-block.js +45 -45
  98. package/programs/totems/index.js +2 -40
  99. package/programs/two-d/pixel-padding-for-compass.js +94 -36
  100. package/programs/util.js +7 -10
  101. package/programs/vectorfields/index.js +3 -23
  102. package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
  103. package/programs/vectorfields/logics/index.js +4 -12
  104. package/programs/vectorfields/logics/pixelbased.js +94 -41
  105. package/programs/vectorfields/logics/ubo.js +32 -32
  106. package/programs/vectorfields/pingpongbuffermanager.js +30 -37
  107. package/rangerings/enum.js +2 -5
  108. package/rangerings/index.js +5 -15
  109. package/rangerings/plugin.js +223 -286
  110. package/rangerings/rangeringangletext.js +122 -137
  111. package/rangerings/ring-account.js +53 -75
  112. package/shaders/fragment-toy/firework.js +55 -4
  113. package/shaders/fragment-toy/singularity.js +56 -5
  114. package/timetracks/adaptors-line-strip.js +27 -44
  115. package/timetracks/adaptors.js +48 -67
  116. package/timetracks/index.js +5 -19
  117. package/timetracks/plugin-line-strip.js +65 -79
  118. package/timetracks/plugin.js +71 -85
  119. package/timetracks/program-line-strip.js +297 -107
  120. package/timetracks/program.js +421 -118
  121. package/timetracks/programpoint-line-strip.js +98 -48
  122. package/timetracks/programpoint.js +91 -48
  123. package/util/account/bufferoffsetmanager.js +72 -98
  124. package/util/account/index.js +3 -23
  125. package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
  126. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
  127. package/util/account/single-attribute-buffer-management/index.js +4 -9
  128. package/util/account/single-attribute-buffer-management/object-store.js +29 -34
  129. package/util/account/single-attribute-buffer-management/types.js +1 -2
  130. package/util/account/util.js +2 -8
  131. package/util/algorithms/search-binary.js +5 -8
  132. package/util/check/get.js +5 -9
  133. package/util/check/typecheck.js +13 -24
  134. package/util/geometry/index.js +10 -18
  135. package/util/gl-util/buffer/attribute-loader.js +10 -26
  136. package/util/gl-util/buffer/index.js +2 -5
  137. package/util/gl-util/draw-options/methods.js +10 -15
  138. package/util/gl-util/uniform-block/manager.js +69 -72
  139. package/util/heatwavedatamanager/datamanager.js +56 -119
  140. package/util/heatwavedatamanager/index.js +3 -10
  141. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
  142. package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
  143. package/util/index.js +13 -57
  144. package/util/interpolation/timetrack/index.js +2 -5
  145. package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
  146. package/util/interpolation/timetrack/web-worker-str.js +180 -5
  147. package/util/interpolation/timetrack/web-worker.js +4 -6
  148. package/util/jshelpers/data-filler.js +8 -11
  149. package/util/jshelpers/equality.js +1 -3
  150. package/util/jshelpers/index.js +2 -37
  151. package/util/jshelpers/timefilters.js +8 -10
  152. package/util/picking/fence.js +8 -11
  153. package/util/picking/picker-displayer.js +49 -58
  154. package/util/programs/draw-texture-on-canvas.js +41 -26
  155. package/util/programs/index.js +1 -17
  156. package/util/programs/shapesonglobe.js +104 -68
  157. package/util/programs/supersampletotextures.js +45 -43
  158. package/util/programs/texturetoglobe.js +99 -52
  159. package/util/shaderfunctions/geometrytransformations.js +323 -35
  160. package/util/shaderfunctions/index.js +2 -18
  161. package/util/shaderfunctions/nodata.js +8 -5
  162. package/util/shaderfunctions/noisefunctions.js +40 -12
  163. package/util/surface-line-data/arcs-to-cuts.js +20 -23
  164. package/util/webglobe/gldefaultstates.js +1 -4
  165. package/util/webglobe/index.js +2 -18
  166. package/util/webglobe/rasteroverlay.js +36 -41
  167. package/util/webglobjectbuilders.js +70 -93
  168. package/util/webglobjectbuilders1.js +63 -82
  169. package/waveparticles/adaptor.js +7 -10
  170. package/waveparticles/index.js +3 -10
  171. package/waveparticles/plugin.js +82 -90
  172. package/wind/imagetovectorfieldandmagnitude.js +16 -19
  173. package/wind/index.js +5 -14
  174. package/wind/plugin.js +454 -291
  175. package/wind/vectorfieldimage.js +6 -8
  176. package/write-text/attached-text-writer.js +48 -54
  177. package/write-text/context-text.js +52 -63
  178. package/write-text/context-text3.js +71 -80
  179. package/write-text/index.js +1 -5
@@ -1,27 +1,83 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var util_1 = require("../../../util");
4
- var ubo_js_1 = require("./ubo.js");
5
- var programcache_1 = require("../../programcache");
1
+ import { createShader } from "../../../util";
2
+ import { UBO_SIZE, UBO_BINDING_POINT, shaderUboSource } from "./ubo.js";
3
+ import { glProgramCache } from "../../programcache";
6
4
  // program output is buffer
7
5
  // TODO: Mechanism for randomness
8
6
  // drop out mechanism
9
7
  // random particle position mechanism
10
- var vertexShaderSource = "#version 300 es\n" + ubo_js_1.shaderUboSource + "\n\nuniform sampler2D vector_field;\nin vec2 in_position;\nout vec2 out_position;\n\n// float random(vec2 st){\n// float t = dot(st, vec2(12.9898,78.233));\n// return fract(sin(t) * (t+43758.5453123));\n// }\n\n\nconst vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);\nfloat random(const vec2 co) {\n float t = dot(rand_constants.xy, co);\n return fract(sin(t) * (rand_constants.z + t));\n}\n\nvec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor\n // return texture(vector_field, uv).rg; // lower-res hardware filtering\n vec2 res = vec2(textureSize(vector_field, 0));\n if (res.x == 0.0 || res.y == 0.0){ return vec2(0.0);}\n vec2 px = 1.0 / res;\n vec2 vc = (floor(uv * res)) * px;\n vec2 f = fract(uv * res);\n vec2 tl = texture(vector_field, vc).rg;\n vec2 tr = texture(vector_field, vc + vec2(px.x, 0)).rg;\n vec2 bl = texture(vector_field, vc + vec2(0, px.y)).rg;\n vec2 br = texture(vector_field, vc + px).rg;\n if (tl.x == 0.0 && tl.y == 0.0){ return vec2(0.0);}\n if (tr.x == 0.0 && tr.y == 0.0){ return vec2(0.0);}\n if (bl.x == 0.0 && bl.y == 0.0){ return vec2(0.0);}\n if (br.x == 0.0 && br.y == 0.0){ return vec2(0.0);}\n return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);\n}\n\n\nvec2 random_position(vec2 st){\n return vec2(random(st), random(st + 1.0));\n}\n\n\nvoid main(){\n vec2 vec = lookup_wind(in_position).xy;\n if (vec.x == 0.0 && vec.y == 0.0){\n out_position = random_position(in_position);\n return;\n }\n float random_value = random(in_position + random_seed);\n if (random_value < drop_rate){ //TODO: more sophisticated drop out mechanism mi\n out_position = random_position(in_position);\n return;\n }\n out_position = in_position - (vec / draw_texture_size) * range; //*0.0014\n}\n";
11
- var fragmentShaderSource = "#version 300 es\nprecision highp float;\nvoid main(){\n}";
12
- var Logic = /** @class */ (function () {
13
- function Logic(gl) {
14
- var _a;
8
+ const vertexShaderSource = `#version 300 es
9
+ ` + shaderUboSource + `
10
+
11
+ uniform sampler2D vector_field;
12
+ in vec2 in_position;
13
+ out vec2 out_position;
14
+
15
+ // float random(vec2 st){
16
+ // float t = dot(st, vec2(12.9898,78.233));
17
+ // return fract(sin(t) * (t+43758.5453123));
18
+ // }
19
+
20
+
21
+ const vec3 rand_constants = vec3(12.9898, 78.233, 4375.85453);
22
+ float random(const vec2 co) {
23
+ float t = dot(rand_constants.xy, co);
24
+ return fract(sin(t) * (rand_constants.z + t));
25
+ }
26
+
27
+ vec2 lookup_wind(const vec2 uv) { // gerek kalmayabilir. sampler linear methodu ayni isi yapiyor
28
+ // return texture(vector_field, uv).rg; // lower-res hardware filtering
29
+ vec2 res = vec2(textureSize(vector_field, 0));
30
+ if (res.x == 0.0 || res.y == 0.0){ return vec2(0.0);}
31
+ vec2 px = 1.0 / res;
32
+ vec2 vc = (floor(uv * res)) * px;
33
+ vec2 f = fract(uv * res);
34
+ vec2 tl = texture(vector_field, vc).rg;
35
+ vec2 tr = texture(vector_field, vc + vec2(px.x, 0)).rg;
36
+ vec2 bl = texture(vector_field, vc + vec2(0, px.y)).rg;
37
+ vec2 br = texture(vector_field, vc + px).rg;
38
+ if (tl.x == 0.0 && tl.y == 0.0){ return vec2(0.0);}
39
+ if (tr.x == 0.0 && tr.y == 0.0){ return vec2(0.0);}
40
+ if (bl.x == 0.0 && bl.y == 0.0){ return vec2(0.0);}
41
+ if (br.x == 0.0 && br.y == 0.0){ return vec2(0.0);}
42
+ return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);
43
+ }
44
+
45
+
46
+ vec2 random_position(vec2 st){
47
+ return vec2(random(st), random(st + 1.0));
48
+ }
49
+
50
+
51
+ void main(){
52
+ vec2 vec = lookup_wind(in_position).xy;
53
+ if (vec.x == 0.0 && vec.y == 0.0){
54
+ out_position = random_position(in_position);
55
+ return;
56
+ }
57
+ float random_value = random(in_position + random_seed);
58
+ if (random_value < drop_rate){ //TODO: more sophisticated drop out mechanism mi
59
+ out_position = random_position(in_position);
60
+ return;
61
+ }
62
+ out_position = in_position - (vec / draw_texture_size) * range; //*0.0014
63
+ }
64
+ `;
65
+ const fragmentShaderSource = `#version 300 es
66
+ precision highp float;
67
+ void main(){
68
+ }`;
69
+ class Logic {
70
+ constructor(gl) {
15
71
  this.gl = gl;
16
- _a = this._createProgram(), this.program = _a[0], this._vector_field_location = _a[1];
72
+ [this.program, this._vector_field_location] = this._createProgram();
17
73
  }
18
74
  /**
19
75
  * @param {*} bufferManager | PingPongBufferManager
20
76
  * @param {*} vectorTexture RG32F texture R: x, G: y
21
77
  * @param {*} uboManager | WaveParticalUboManager under ubo.js
22
78
  */
23
- Logic.prototype.move = function (bufferManager, vectorTexture, uboManager) {
24
- var _a = this, gl = _a.gl, program = _a.program, _vector_field_location = _a._vector_field_location;
79
+ move(bufferManager, vectorTexture, uboManager) {
80
+ const { gl, program, _vector_field_location } = this;
25
81
  gl.useProgram(program);
26
82
  gl.enable(gl.RASTERIZER_DISCARD);
27
83
  gl.bindVertexArray(bufferManager.getSourceVao());
@@ -37,13 +93,13 @@ var Logic = /** @class */ (function () {
37
93
  gl.bindVertexArray(null);
38
94
  uboManager.unbind();
39
95
  gl.disable(gl.RASTERIZER_DISCARD);
40
- };
96
+ }
41
97
  // -- private methods
42
- Logic.prototype._createProgram = function () {
43
- var gl = this.gl;
44
- var vertexShader = (0, util_1.createShader)(gl, gl.VERTEX_SHADER, vertexShaderSource);
45
- var fragmentShader = (0, util_1.createShader)(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);
46
- var program = gl.createProgram();
98
+ _createProgram() {
99
+ const gl = this.gl;
100
+ const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource);
101
+ const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource);
102
+ const program = gl.createProgram();
47
103
  gl.attachShader(program, vertexShader);
48
104
  gl.attachShader(program, fragmentShader);
49
105
  gl.transformFeedbackVaryings(program, ["out_position"], gl.SEPARATE_ATTRIBS);
@@ -51,36 +107,33 @@ var Logic = /** @class */ (function () {
51
107
  if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
52
108
  throw new Error(gl.getProgramParameter(program));
53
109
  }
54
- var ubo_location = gl.getUniformBlockIndex(program, 'UBO');
55
- gl.uniformBlockBinding(program, ubo_location, ubo_js_1.UBO_BINDING_POINT);
110
+ const ubo_location = gl.getUniformBlockIndex(program, 'UBO');
111
+ gl.uniformBlockBinding(program, ubo_location, UBO_BINDING_POINT);
56
112
  return [program, gl.getUniformLocation(program, 'vector_field')];
57
113
  ;
58
- };
59
- Logic.prototype.free = function () {
114
+ }
115
+ free() {
60
116
  this.gl.deleteProgram(this.program);
61
117
  this.program = null;
62
- };
63
- Logic.prototype.getInPositionLocation = function () {
118
+ }
119
+ getInPositionLocation() {
64
120
  return this.gl.getAttribLocation(this.program, 'in_position');
65
- };
66
- return Logic;
67
- }());
68
- var default_1 = /** @class */ (function () {
69
- function default_1(gl) {
121
+ }
122
+ }
123
+ export default class {
124
+ constructor(gl) {
70
125
  this.gl = gl;
71
- this.logic = programcache_1.glProgramCache.getProgram(gl, Logic);
126
+ this.logic = glProgramCache.getProgram(gl, Logic);
72
127
  }
73
- default_1.prototype.move = function (bufferManager, vectorTexture, uboManager) {
128
+ move(bufferManager, vectorTexture, uboManager) {
74
129
  this.logic.move(bufferManager, vectorTexture, uboManager);
75
- };
76
- default_1.prototype.free = function () {
77
- programcache_1.glProgramCache.releaseProgram(this.gl, Logic);
130
+ }
131
+ free() {
132
+ glProgramCache.releaseProgram(this.gl, Logic);
78
133
  this.program = null;
79
134
  this.gl = null;
80
- };
81
- default_1.prototype.getInPositionLocation = function () {
135
+ }
136
+ getInPositionLocation() {
82
137
  return this.logic.getInPositionLocation();
83
- };
84
- return default_1;
85
- }());
86
- exports.default = default_1;
138
+ }
139
+ }
@@ -1,22 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shaderUboSource = exports.UBO_BINDING_POINT = exports.UBO_SIZE = exports.WaveParticalUboManager = void 0;
4
- var UBO_BINDING_POINT = 0;
5
- exports.UBO_BINDING_POINT = UBO_BINDING_POINT;
6
- var INITIAL_UBO_DATA = new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000]);
7
- var shaderUboSource = "\nlayout(std140) uniform UBO {\n float random_seed;\n float range;\n vec2 tail_wing_base_limp;\n vec3 color;\n float drop_rate;\n vec2 draw_texture_size;\n};";
8
- exports.shaderUboSource = shaderUboSource;
9
- var UBO_SIZE = 40;
10
- exports.UBO_SIZE = UBO_SIZE;
11
- var WaveParticalUboManager = /** @class */ (function () {
12
- function WaveParticalUboManager(gl) {
1
+ const UBO_BINDING_POINT = 0;
2
+ const INITIAL_UBO_DATA = new Float32Array([93.17, 0.2, 1.0, 7.0, 1.0, 1.0, 1.0, 0.05, 2000, 2000]);
3
+ const shaderUboSource = `
4
+ layout(std140) uniform UBO {
5
+ float random_seed;
6
+ float range;
7
+ vec2 tail_wing_base_limp;
8
+ vec3 color;
9
+ float drop_rate;
10
+ vec2 draw_texture_size;
11
+ };`;
12
+ const UBO_SIZE = 40;
13
+ class WaveParticalUboManager {
14
+ constructor(gl) {
13
15
  this.gl = gl;
14
16
  this.ubo = this._createBuffer();
15
17
  this._data = null;
16
18
  }
17
- WaveParticalUboManager.prototype.update = function (_a) {
18
- var range = _a.range, random_seed = _a.random_seed, tail_wing_base_limp = _a.tail_wing_base_limp, draw_texture_size = _a.draw_texture_size, drop_rate = _a.drop_rate, color = _a.color;
19
- var _b = this, gl = _b.gl, ubo = _b.ubo;
19
+ update({ range, random_seed, tail_wing_base_limp, draw_texture_size, drop_rate, color }) {
20
+ const { gl, ubo } = this;
20
21
  gl.bindBuffer(gl.UNIFORM_BUFFER, ubo);
21
22
  if (random_seed !== undefined)
22
23
  gl.bufferSubData(gl.UNIFORM_BUFFER, 0, new Float32Array([random_seed]));
@@ -31,27 +32,26 @@ var WaveParticalUboManager = /** @class */ (function () {
31
32
  if (draw_texture_size !== undefined)
32
33
  gl.bufferSubData(gl.UNIFORM_BUFFER, 32, new Float32Array(draw_texture_size));
33
34
  gl.bindBuffer(gl.UNIFORM_BUFFER, null);
34
- };
35
- WaveParticalUboManager.prototype._createBuffer = function () {
36
- var gl = this.gl;
37
- var buffer = gl.createBuffer();
35
+ }
36
+ _createBuffer() {
37
+ const gl = this.gl;
38
+ const buffer = gl.createBuffer();
38
39
  gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
39
40
  gl.bufferData(gl.UNIFORM_BUFFER, INITIAL_UBO_DATA, gl.STATIC_DRAW);
40
41
  gl.bindBuffer(gl.UNIFORM_BUFFER, null);
41
42
  return buffer;
42
- };
43
- WaveParticalUboManager.prototype.bind = function () {
44
- var _a = this, gl = _a.gl, ubo = _a.ubo;
43
+ }
44
+ bind() {
45
+ const { gl, ubo } = this;
45
46
  gl.bindBufferBase(gl.UNIFORM_BUFFER, UBO_BINDING_POINT, ubo);
46
- };
47
- WaveParticalUboManager.prototype.unbind = function () {
48
- var gl = this.gl;
47
+ }
48
+ unbind() {
49
+ const gl = this.gl;
49
50
  gl.bindBufferBase(gl.UNIFORM_BUFFER, UBO_BINDING_POINT, null);
50
- };
51
- WaveParticalUboManager.prototype.free = function () {
52
- var _a = this, gl = _a.gl, _buffer = _a._buffer;
51
+ }
52
+ free() {
53
+ const { gl, _buffer } = this;
53
54
  gl.deleteBuffer(_buffer);
54
- };
55
- return WaveParticalUboManager;
56
- }());
57
- exports.WaveParticalUboManager = WaveParticalUboManager;
55
+ }
56
+ }
57
+ export { WaveParticalUboManager, UBO_SIZE, UBO_BINDING_POINT, shaderUboSource };
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Manages PingPong Buffers.
4
3
  * Updated positions are written to the target buffer.
@@ -6,10 +5,8 @@
6
5
  *
7
6
  * update coords and draw particles programs will use this class.
8
7
  */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- var default_1 = /** @class */ (function () {
11
- function default_1(gl, particleCount, inPositionLocation) {
12
- if (inPositionLocation === void 0) { inPositionLocation = 0; }
8
+ export default class {
9
+ constructor(gl, particleCount, inPositionLocation = 0) {
13
10
  this.gl = gl;
14
11
  this._inPositionLocation = inPositionLocation;
15
12
  this._buffers = [gl.createBuffer(), gl.createBuffer()];
@@ -18,8 +15,8 @@ var default_1 = /** @class */ (function () {
18
15
  this.setParticleCount(particleCount);
19
16
  this._index = 0;
20
17
  }
21
- default_1.prototype.setParticleCount = function (count) {
22
- var gl = this.gl;
18
+ setParticleCount(count) {
19
+ const gl = this.gl;
23
20
  this.length = count;
24
21
  gl.bindBuffer(gl.ARRAY_BUFFER, this._buffers[0]);
25
22
  gl.bufferData(gl.ARRAY_BUFFER, randomNumbers(this.length * 2), gl.DYNAMIC_DRAW);
@@ -27,53 +24,49 @@ var default_1 = /** @class */ (function () {
27
24
  gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(this.length * 2), gl.DYNAMIC_DRAW);
28
25
  gl.bindBuffer(gl.ARRAY_BUFFER, null);
29
26
  this._index = 0;
30
- };
31
- default_1.prototype._createTransformFeedbacksAndBindBuffers = function () {
32
- var _this = this;
33
- var gl = this.gl;
34
- var tfs = [gl.createTransformFeedback(), gl.createTransformFeedback()];
35
- tfs.forEach(function (tf, idx) {
27
+ }
28
+ _createTransformFeedbacksAndBindBuffers() {
29
+ const gl = this.gl;
30
+ const tfs = [gl.createTransformFeedback(), gl.createTransformFeedback()];
31
+ tfs.forEach((tf, idx) => {
36
32
  gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, tf);
37
- gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, _this._buffers[idx]);
33
+ gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, this._buffers[idx]);
38
34
  });
39
35
  gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, null);
40
36
  return tfs;
41
- };
42
- default_1.prototype._createVaos = function () {
43
- var _this = this;
44
- var gl = this.gl;
45
- var vaos = [gl.createVertexArray(), gl.createVertexArray()];
46
- vaos.forEach(function (vao, idx) {
37
+ }
38
+ _createVaos() {
39
+ const gl = this.gl;
40
+ const vaos = [gl.createVertexArray(), gl.createVertexArray()];
41
+ vaos.forEach((vao, idx) => {
47
42
  gl.bindVertexArray(vao);
48
- gl.bindBuffer(gl.ARRAY_BUFFER, _this._buffers[idx]);
43
+ gl.bindBuffer(gl.ARRAY_BUFFER, this._buffers[idx]);
49
44
  gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
50
45
  gl.vertexAttribDivisor(0, 1);
51
- gl.enableVertexAttribArray(_this._inPositionLocation);
46
+ gl.enableVertexAttribArray(this._inPositionLocation);
52
47
  gl.bindVertexArray(null);
53
48
  });
54
49
  return vaos;
55
- };
56
- default_1.prototype.getSourceVao = function () { return this._vaos[this._index]; };
57
- default_1.prototype.getTargetVao = function () { return this._vaos[1 - this._index]; };
58
- default_1.prototype.sourceBuffer = function () { return this._buffers[this._index]; };
59
- default_1.prototype.targetBuffer = function () { return this._buffers[1 - this._index]; };
60
- default_1.prototype.getTargetTF = function () { return this._tfs[1 - this._index]; };
61
- default_1.prototype.swap = function () { this._index = 1 - this._index; };
62
- default_1.prototype.free = function () {
50
+ }
51
+ getSourceVao() { return this._vaos[this._index]; }
52
+ getTargetVao() { return this._vaos[1 - this._index]; }
53
+ sourceBuffer() { return this._buffers[this._index]; }
54
+ targetBuffer() { return this._buffers[1 - this._index]; }
55
+ getTargetTF() { return this._tfs[1 - this._index]; }
56
+ swap() { this._index = 1 - this._index; }
57
+ free() {
63
58
  this.gl.deleteBuffer(this._buffers[0]);
64
59
  this.gl.deleteBuffer(this._buffers[1]);
65
60
  this.gl.deleteTransformFeedback(this._tfs[0]);
66
61
  this.gl.deleteTransformFeedback(this._tfs[1]);
67
62
  this.gl.deleteVertexArray(this._vaos[0]);
68
63
  this.gl.deleteVertexArray(this._vaos[1]);
69
- };
70
- return default_1;
71
- }());
72
- exports.default = default_1;
64
+ }
65
+ }
73
66
  function randomNumbers(count) {
74
- var result = new Float32Array(count);
75
- var random = Math.random;
76
- for (var i = 0; i < count; i++) {
67
+ const result = new Float32Array(count);
68
+ const random = Math.random;
69
+ for (let i = 0; i < count; i++) {
77
70
  result[i] = random() * 2 - 1;
78
71
  }
79
72
  return result;
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ENUM_TEXT_HIDE = exports.ENUM_HIDE = void 0;
4
- exports.ENUM_HIDE = Object.freeze({ SHOW: 0, HIDE: 1, HIDE_1_DEGREE_PADDINGS: 2 });
5
- exports.ENUM_TEXT_HIDE = Object.freeze({ SHOW: 0, HIDE: 1 });
1
+ export const ENUM_HIDE = Object.freeze({ SHOW: 0, HIDE: 1, HIDE_1_DEGREE_PADDINGS: 2 });
2
+ export const ENUM_TEXT_HIDE = Object.freeze({ SHOW: 0, HIDE: 1 });
@@ -1,15 +1,5 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ringKeyMethod = exports.RangeRingAngleText = exports.ENUM_TEXT_HIDE = exports.ENUM_HIDE = exports.RangeRings = void 0;
7
- var plugin_1 = require("./plugin");
8
- Object.defineProperty(exports, "RangeRings", { enumerable: true, get: function () { return plugin_1.RangeRings; } });
9
- var ring_account_1 = require("./ring-account");
10
- Object.defineProperty(exports, "ringKeyMethod", { enumerable: true, get: function () { return ring_account_1.ringKeyMethod; } });
11
- var rangeringangletext_1 = __importDefault(require("./rangeringangletext"));
12
- exports.RangeRingAngleText = rangeringangletext_1.default;
13
- var enum_1 = require("./enum");
14
- Object.defineProperty(exports, "ENUM_HIDE", { enumerable: true, get: function () { return enum_1.ENUM_HIDE; } });
15
- Object.defineProperty(exports, "ENUM_TEXT_HIDE", { enumerable: true, get: function () { return enum_1.ENUM_TEXT_HIDE; } });
1
+ import { RangeRings } from "./plugin";
2
+ import { ringKeyMethod } from "./ring-account";
3
+ import RangeRingAngleText from './rangeringangletext';
4
+ import { ENUM_HIDE, ENUM_TEXT_HIDE } from './enum';
5
+ export { RangeRings, ENUM_HIDE, ENUM_TEXT_HIDE, RangeRingAngleText, ringKeyMethod };