@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.
- package/Math/angle-calculation.js +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- package/write-text/index.js +1 -5
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
import { createProgram, shaderfunctions } from "../../../util";
|
|
2
|
+
import { BufferOffsetManager } from "../../../util/account";
|
|
3
|
+
import CameraUniformBlockTotem, { CameraUniformBlockString } from "../../totems/camerauniformblock";
|
|
4
|
+
import { globeProgramCache, noRegisterGlobeProgramCache } from "../../programcache";
|
|
5
|
+
const vertexShader = `#version 300 es ` +
|
|
6
|
+
shaderfunctions.PI +
|
|
7
|
+
shaderfunctions.R +
|
|
8
|
+
shaderfunctions.POLE +
|
|
9
|
+
CameraUniformBlockString +
|
|
10
|
+
shaderfunctions.mercatorXYToGLPosition +
|
|
11
|
+
shaderfunctions.longLatRadToMercator +
|
|
12
|
+
shaderfunctions.longLatRadToCartesian3D +
|
|
13
|
+
shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
14
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
15
|
+
shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
16
|
+
|
|
17
|
+
in vec2 center;
|
|
18
|
+
in float radius;
|
|
19
|
+
in float pad_range;
|
|
20
|
+
in vec4 color;
|
|
21
|
+
in float flag;
|
|
22
|
+
in float pad_angle;
|
|
23
|
+
|
|
24
|
+
uniform int compass;
|
|
25
|
+
|
|
26
|
+
uniform float opacity;
|
|
27
|
+
|
|
28
|
+
out vec2 v_limp;
|
|
29
|
+
out vec4 v_color;
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
void main() {
|
|
33
|
+
if( flag == 1.0 || radius == 0.0 ) return; // 1.0 is hide
|
|
34
|
+
v_color = vec4(color.rgb, color.a * opacity);
|
|
35
|
+
|
|
36
|
+
if ( pad_angle == 0.0 ) v_color.rgb -= 0.2;
|
|
37
|
+
gl_PointSize = 2.0;
|
|
38
|
+
|
|
39
|
+
float odd = mod(float(gl_VertexID), 2.0);
|
|
40
|
+
float index = (float(gl_VertexID)- odd ) / 2.0;
|
|
41
|
+
float angle = pad_angle - 1.5707963267948966192313216916398;
|
|
42
|
+
float radius_ = radius - (pad_range * odd);
|
|
43
|
+
|
|
44
|
+
if (is3D){
|
|
45
|
+
gl_Position = projection * view * vec4(
|
|
46
|
+
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
47
|
+
v_limp = vec2(0.0, 0.0);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
vec2 limp;
|
|
51
|
+
if ( compass == 1 ){
|
|
52
|
+
limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
|
|
53
|
+
} else {
|
|
54
|
+
limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
55
|
+
}
|
|
56
|
+
v_limp = limp;
|
|
57
|
+
gl_Position = mercatorXYToGLPosition(limp);
|
|
58
|
+
}`;
|
|
59
|
+
const fragmentShader = `#version 300 es
|
|
60
|
+
precision highp float; ` +
|
|
61
|
+
shaderfunctions.POLE + `
|
|
62
|
+
in vec4 v_color;
|
|
63
|
+
in vec2 v_limp;
|
|
64
|
+
out vec4 outColor;
|
|
65
|
+
void main() {
|
|
66
|
+
if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
67
|
+
outColor = v_color;
|
|
68
|
+
}`;
|
|
69
|
+
class Logic {
|
|
70
|
+
constructor(globe) {
|
|
71
71
|
this.globe = globe;
|
|
72
72
|
this.gl = globe.gl;
|
|
73
|
-
this.program =
|
|
73
|
+
this.program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
74
74
|
{
|
|
75
|
-
|
|
75
|
+
const gl = this.gl;
|
|
76
76
|
// assign attribute locations
|
|
77
77
|
gl.bindAttribLocation(this.program, 0, "center");
|
|
78
78
|
gl.bindAttribLocation(this.program, 1, "radius");
|
|
@@ -82,14 +82,14 @@ var Logic = /** @class */ (function () {
|
|
|
82
82
|
gl.bindAttribLocation(this.program, 5, "pad_angle");
|
|
83
83
|
}
|
|
84
84
|
this.cameraBlockBindingPoint = 0;
|
|
85
|
-
|
|
85
|
+
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
86
86
|
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
87
|
-
this.cameraBlockTotem =
|
|
87
|
+
this.cameraBlockTotem = globeProgramCache.getProgram(globe, CameraUniformBlockTotem);
|
|
88
88
|
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
89
89
|
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
90
90
|
this._opacity = 1.0;
|
|
91
91
|
{
|
|
92
|
-
|
|
92
|
+
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
93
93
|
this.gl.useProgram(this.program);
|
|
94
94
|
this.gl.uniform1i(this._compassLocation, 1);
|
|
95
95
|
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
@@ -97,8 +97,8 @@ var Logic = /** @class */ (function () {
|
|
|
97
97
|
this.gl.useProgram(currentProgram);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
draw(attrBufferManager, compass, opacity) {
|
|
101
|
+
const { gl, program, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
102
102
|
gl.useProgram(program);
|
|
103
103
|
attrBufferManager.bindPaddingVAO();
|
|
104
104
|
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
@@ -115,33 +115,29 @@ var Logic = /** @class */ (function () {
|
|
|
115
115
|
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
116
116
|
gl.enable(gl.DEPTH_TEST);
|
|
117
117
|
gl.bindVertexArray(null);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.bufferType, bufferType = _c === void 0 ? "DYNAMIC_DRAW" : _c, _d = _b.initialRingCapacity, initialRingCapacity = _d === void 0 ? 10 : _d;
|
|
118
|
+
}
|
|
119
|
+
createBuffer({ bufferType = "DYNAMIC_DRAW", initialRingCapacity = 10 } = {}) {
|
|
121
120
|
return new BufferManager(this.gl, bufferType, initialRingCapacity);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
releaseProgram: function (globe) { return programcache_1.globeProgramCache.releaseProgram(globe, Logic); }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export const PaddingFreeAngleCache = Object.freeze({
|
|
124
|
+
getProgram: (globe) => noRegisterGlobeProgramCache.getProgram(globe, Logic),
|
|
125
|
+
releaseProgram: (globe) => globeProgramCache.releaseProgram(globe, Logic)
|
|
128
126
|
});
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, _this.buffer);
|
|
138
|
-
gl.bufferData(gl.ARRAY_BUFFER, _this.capacity * _this.itemSize * 4, gl[bufferType]);
|
|
127
|
+
export class BufferManager extends BufferOffsetManager {
|
|
128
|
+
constructor(gl, bufferType, initialRingCapacity = 10) {
|
|
129
|
+
super(10, { capacity: initialRingCapacity, bufferType });
|
|
130
|
+
this.gl = gl;
|
|
131
|
+
this.bufferType = bufferType;
|
|
132
|
+
this.buffer = gl.createBuffer();
|
|
133
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
134
|
+
gl.bufferData(gl.ARRAY_BUFFER, this.capacity * this.itemSize * 4, gl[bufferType]);
|
|
139
135
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
140
|
-
|
|
141
|
-
|
|
136
|
+
this._centerMaps = new Map();
|
|
137
|
+
this.vao = gl.createVertexArray();
|
|
142
138
|
{
|
|
143
|
-
gl.bindVertexArray(
|
|
144
|
-
gl.bindBuffer(gl.ARRAY_BUFFER,
|
|
139
|
+
gl.bindVertexArray(this.vao);
|
|
140
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
145
141
|
gl.enableVertexAttribArray(0);
|
|
146
142
|
gl.enableVertexAttribArray(1);
|
|
147
143
|
gl.enableVertexAttribArray(2);
|
|
@@ -164,26 +160,24 @@ var BufferManager = /** @class */ (function (_super) {
|
|
|
164
160
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
165
161
|
gl.bindVertexArray(null);
|
|
166
162
|
}
|
|
167
|
-
return _this;
|
|
168
163
|
}
|
|
169
|
-
|
|
164
|
+
__centerMapMethod(rings, paddingAngles) {
|
|
170
165
|
return new Map([
|
|
171
166
|
["rings", rings],
|
|
172
167
|
["paddingAngles", paddingAngles]
|
|
173
168
|
]);
|
|
174
|
-
}
|
|
175
|
-
|
|
169
|
+
}
|
|
170
|
+
bindPaddingVAO() {
|
|
176
171
|
this.gl.bindVertexArray(this.vao);
|
|
177
|
-
}
|
|
172
|
+
}
|
|
178
173
|
//TODO: implement this
|
|
179
174
|
// insertBulk is gone. no update feature
|
|
180
175
|
// addBulk is added.
|
|
181
176
|
// deletes old centers given
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
for (
|
|
186
|
-
var centerID = data_1[_i].centerID;
|
|
177
|
+
insertBulk(data) {
|
|
178
|
+
const { gl, buffer } = this;
|
|
179
|
+
const deleteCentersList = [];
|
|
180
|
+
for (const { centerID } of data) {
|
|
187
181
|
if (this._centerMaps.has(centerID)) {
|
|
188
182
|
deleteCentersList.push(centerID);
|
|
189
183
|
}
|
|
@@ -191,23 +185,20 @@ var BufferManager = /** @class */ (function (_super) {
|
|
|
191
185
|
if (deleteCentersList.length > 0) {
|
|
192
186
|
this.removeCenters(deleteCentersList);
|
|
193
187
|
}
|
|
194
|
-
|
|
195
|
-
|
|
188
|
+
const requiredSpace = this.__requiredSpaceForBulk(data);
|
|
189
|
+
const spaceLeft = this.spaceLeft;
|
|
196
190
|
// console.log("space left:", spaceLeft, "required space:", requiredSpace);
|
|
197
191
|
if (requiredSpace > spaceLeft) {
|
|
198
192
|
// console.log("new capacity:", this.capacity + requiredSpace - spaceLeft)
|
|
199
193
|
this.extendBuffer(this.capacity + requiredSpace - spaceLeft);
|
|
200
194
|
}
|
|
201
|
-
|
|
202
|
-
for (
|
|
203
|
-
var _c = data_2[_b], centerID = _c.centerID, x = _c.x, y = _c.y, rgba = _c.rgba, paddingAngles = _c.paddingAngles, _d = _c.hide, hide = _d === void 0 ? 0 : _d, rings = _c.rings;
|
|
195
|
+
const items = [];
|
|
196
|
+
for (const { centerID, x, y, rgba, paddingAngles, hide = 0, rings } of data) {
|
|
204
197
|
this._centerMaps.set(centerID, this.__centerMapMethod(rings, paddingAngles)); // x,y, rgba, hide prograbably not needed
|
|
205
|
-
for (
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
var _offsetMapKey = "".concat(centerID, "_").concat(ringID, "_").concat(paddingAngle);
|
|
210
|
-
var offset = this.getOffset(_offsetMapKey) | this.nextOffset();
|
|
198
|
+
for (const { ringID, radius, padding } of rings) {
|
|
199
|
+
for (const paddingAngle of paddingAngles) {
|
|
200
|
+
const _offsetMapKey = `${centerID}_${ringID}_${paddingAngle}`;
|
|
201
|
+
const offset = this.getOffset(_offsetMapKey) | this.nextOffset();
|
|
211
202
|
items.push({
|
|
212
203
|
offset: offset,
|
|
213
204
|
payload: new Float32Array([x, y, radius, padding, rgba[0], rgba[1], rgba[2], rgba[3], hide, paddingAngle])
|
|
@@ -217,117 +208,100 @@ var BufferManager = /** @class */ (function (_super) {
|
|
|
217
208
|
}
|
|
218
209
|
}
|
|
219
210
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
220
|
-
for (
|
|
221
|
-
var _j = items_1[_h], offset = _j.offset, payload = _j.payload;
|
|
211
|
+
for (let { offset, payload } of items) {
|
|
222
212
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset, payload);
|
|
223
213
|
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
for (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
var paddingAngle = paddingAngles_2[_d];
|
|
238
|
-
var offsetKey = offsetMapKey(centerID, ringID, paddingAngle);
|
|
239
|
-
items.push({ offset: this.getOffset(offsetKey), payload: payload });
|
|
214
|
+
}
|
|
215
|
+
updateCentersXY(data) {
|
|
216
|
+
const { gl, buffer } = this;
|
|
217
|
+
const items = [];
|
|
218
|
+
for (const { centerID, x, y } of data) {
|
|
219
|
+
const center = this._centerMaps.get(centerID);
|
|
220
|
+
const payload = new Float32Array([x, y]);
|
|
221
|
+
const paddingAngles = center.get("paddingAngles");
|
|
222
|
+
const rings = center.get("rings");
|
|
223
|
+
for (const { ringID } of rings) {
|
|
224
|
+
for (const paddingAngle of paddingAngles) {
|
|
225
|
+
const offsetKey = offsetMapKey(centerID, ringID, paddingAngle);
|
|
226
|
+
items.push({ offset: this.getOffset(offsetKey), payload });
|
|
240
227
|
}
|
|
241
228
|
}
|
|
242
229
|
}
|
|
243
230
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
244
|
-
for (
|
|
245
|
-
var _f = items_2[_e], offset = _f.offset, payload = _f.payload;
|
|
231
|
+
for (let { offset, payload } of items) {
|
|
246
232
|
gl.bufferSubData(gl.ARRAY_BUFFER, offset, payload);
|
|
247
233
|
}
|
|
248
234
|
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
249
|
-
}
|
|
235
|
+
}
|
|
250
236
|
//TODO: test
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
for (
|
|
255
|
-
var _b = data_4[_i], centerID = _b.centerID, _c = _b.hide, hide = _c === void 0 ? null : _c;
|
|
237
|
+
updateCentersHide(data) {
|
|
238
|
+
const { gl, buffer } = this;
|
|
239
|
+
const items = [];
|
|
240
|
+
for (const { centerID, hide = null } of data) {
|
|
256
241
|
if (hide === null)
|
|
257
242
|
continue;
|
|
258
|
-
|
|
259
|
-
|
|
243
|
+
const block = new Float32Array([hide]);
|
|
244
|
+
const center = this._centerMaps.get(centerID);
|
|
260
245
|
if (!center)
|
|
261
246
|
continue;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
for (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
var paddingAngle = paddingAngles_3[_e];
|
|
268
|
-
var offsetKey = offsetMapKey(centerID, ringID, paddingAngle);
|
|
247
|
+
const paddingAngles = center.get("paddingAngles");
|
|
248
|
+
const rings = center.get("rings");
|
|
249
|
+
for (const { ringID } of rings) {
|
|
250
|
+
for (const paddingAngle of paddingAngles) {
|
|
251
|
+
const offsetKey = offsetMapKey(centerID, ringID, paddingAngle);
|
|
269
252
|
items.push({ key: offsetKey, payload: block });
|
|
270
253
|
}
|
|
271
254
|
}
|
|
272
255
|
}
|
|
273
256
|
this._updatePartial(items, 8, gl, buffer);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
for (
|
|
279
|
-
|
|
280
|
-
var center = this._centerMaps.get(centerID);
|
|
257
|
+
}
|
|
258
|
+
updateCentersColor(data) {
|
|
259
|
+
const { gl, buffer } = this;
|
|
260
|
+
const items = [];
|
|
261
|
+
for (const { centerID, rgba } of data) {
|
|
262
|
+
const center = this._centerMaps.get(centerID);
|
|
281
263
|
if (!center)
|
|
282
264
|
continue;
|
|
283
265
|
center.set("rgba", rgba);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
for (
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
var offsetKey = offsetMapKey(centerID, ringID, paddingAngle);
|
|
292
|
-
items.push({ key: offsetKey, payload: payload });
|
|
266
|
+
const paddingAngles = center.get("paddingAngles");
|
|
267
|
+
const rings = center.get("rings");
|
|
268
|
+
const payload = new Float32Array(rgba);
|
|
269
|
+
for (const { ringID } of rings) {
|
|
270
|
+
for (const paddingAngle of paddingAngles) {
|
|
271
|
+
const offsetKey = offsetMapKey(centerID, ringID, paddingAngle);
|
|
272
|
+
items.push({ key: offsetKey, payload });
|
|
293
273
|
}
|
|
294
274
|
}
|
|
295
275
|
}
|
|
296
276
|
this._updatePartial(items, 4, gl, buffer);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
for (
|
|
301
|
-
var _a = data_6[_i], paddingAngles = _a.paddingAngles, rings = _a.rings;
|
|
277
|
+
}
|
|
278
|
+
__requiredSpaceForBulk(data) {
|
|
279
|
+
let space = 0;
|
|
280
|
+
for (const { paddingAngles, rings } of data) {
|
|
302
281
|
space += paddingAngles.length * rings.length;
|
|
303
282
|
}
|
|
304
283
|
return space;
|
|
305
|
-
}
|
|
284
|
+
}
|
|
306
285
|
// TODO: TEST IT WITH INSERT
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
for (
|
|
310
|
-
|
|
311
|
-
var center = this._centerMaps.get(centerID);
|
|
286
|
+
removeCenters(centerIDs) {
|
|
287
|
+
const keys = [];
|
|
288
|
+
for (const centerID of centerIDs) {
|
|
289
|
+
const center = this._centerMaps.get(centerID);
|
|
312
290
|
if (!center)
|
|
313
291
|
continue;
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
for (
|
|
317
|
-
|
|
318
|
-
for (var _b = 0, paddingAngles_5 = paddingAngles; _b < paddingAngles_5.length; _b++) {
|
|
319
|
-
var paddingAngle = paddingAngles_5[_b];
|
|
292
|
+
const rings = center.get("rings");
|
|
293
|
+
const paddingAngles = center.get("paddingAngles");
|
|
294
|
+
for (const { ringID } of rings) {
|
|
295
|
+
for (const paddingAngle of paddingAngles) {
|
|
320
296
|
keys.push(offsetMapKey(centerID, ringID, paddingAngle));
|
|
321
297
|
}
|
|
322
298
|
}
|
|
323
299
|
this._centerMaps.delete(centerID);
|
|
324
300
|
}
|
|
325
301
|
this._removeFromBuffer(keys);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
exports.BufferManager = BufferManager;
|
|
330
|
-
var offsetMapKey = function (centerID, ringID, paddingAngle) { return "".concat(centerID, "_").concat(ringID, "_").concat(paddingAngle); };
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
const offsetMapKey = (centerID, ringID, paddingAngle) => `${centerID}_${ringID}_${paddingAngle}`;
|
|
331
305
|
/**
|
|
332
306
|
* {center has x,y, color, paddingAngles, rings} key: centerID
|
|
333
307
|
* {ring has ranges, paddings} key: ringKey
|