@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.
- package/index.js +58 -15
- package/package.json +1 -1
- package/dist/Math/angle-calculation.js +0 -15
- package/dist/Math/arc.js +0 -65
- package/dist/Math/bounds/line-bbox.js +0 -188
- package/dist/Math/constants.js +0 -9
- package/dist/Math/frustum/camera.js +0 -24
- package/dist/Math/frustum/from-globeinfo.js +0 -48
- package/dist/Math/frustum/types.js +0 -2
- package/dist/Math/globe-util/horizon-plane.js +0 -112
- package/dist/Math/index.js +0 -1
- package/dist/Math/juction/arc-plane.js +0 -83
- package/dist/Math/juction/line-sphere.js +0 -25
- package/dist/Math/juction/plane-plane.js +0 -58
- package/dist/Math/line.js +0 -56
- package/dist/Math/matrix4.js +0 -1
- package/dist/Math/methods.js +0 -201
- package/dist/Math/plane.js +0 -60
- package/dist/Math/quaternion.js +0 -104
- package/dist/Math/types.js +0 -2
- package/dist/Math/utils.js +0 -4
- package/dist/Math/vec3.js +0 -126
- package/dist/algorithms/search-binary.js +0 -19
- package/dist/altitude-locator/adaptors.js +0 -1
- package/dist/altitude-locator/draw-subset-obj.js +0 -18
- package/dist/altitude-locator/keymethod.js +0 -1
- package/dist/altitude-locator/plugin.js +0 -341
- package/dist/altitude-locator/types.js +0 -23
- package/dist/arrowfield/adaptor.js +0 -14
- package/dist/arrowfield/index.js +0 -10
- package/dist/arrowfield/plugin.js +0 -86
- package/dist/bearing-line/index.js +0 -8
- package/dist/bearing-line/plugin.js +0 -449
- package/dist/circle-line-chain/chain-list-map.js +0 -205
- package/dist/circle-line-chain/init.js +0 -1
- package/dist/circle-line-chain/plugin.js +0 -424
- package/dist/circle-line-chain/util.js +0 -5
- package/dist/compass-rose/compass-rose-padding-flat.js +0 -225
- package/dist/compass-rose/compass-text-writer.js +0 -153
- package/dist/compass-rose/index.js +0 -7
- package/dist/compassrose/compassrose.js +0 -296
- package/dist/compassrose/index.js +0 -8
- package/dist/globe-types.js +0 -1
- package/dist/heatwave/index.js +0 -10
- package/dist/heatwave/isobar/objectarraylabels.js +0 -202
- package/dist/heatwave/isobar/plugin.js +0 -343
- package/dist/heatwave/isobar/quadtreecontours.js +0 -300
- package/dist/heatwave/plugins/heatwaveglobeshell.js +0 -206
- package/dist/index.js +0 -58
- package/dist/jest.config.js +0 -7
- package/dist/partialrings/buffer-manager.js +0 -81
- package/dist/partialrings/index.js +0 -41
- package/dist/partialrings/plugin.js +0 -135
- package/dist/partialrings/program.js +0 -286
- package/dist/pin/pin-object-array.js +0 -305
- package/dist/pin/pin-point-totem.js +0 -60
- package/dist/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -66
- package/dist/point-heat-map/index.js +0 -1
- package/dist/point-heat-map/plugin-webworker.js +0 -126
- package/dist/point-heat-map/point-to-heat-map-flow.js +0 -127
- package/dist/point-tracks/key-methods.js +0 -5
- package/dist/point-tracks/plugin.js +0 -338
- package/dist/programs/arrowfield/index.js +0 -7
- package/dist/programs/arrowfield/logic.js +0 -257
- package/dist/programs/arrowfield/object.js +0 -66
- package/dist/programs/data2legend/density-to-legend.js +0 -101
- package/dist/programs/data2legend/point-to-density-texture.js +0 -100
- package/dist/programs/float2legendwithratio/index.js +0 -8
- package/dist/programs/float2legendwithratio/logic.js +0 -171
- package/dist/programs/float2legendwithratio/object.js +0 -110
- package/dist/programs/globe-util/is-globe-moved.js +0 -21
- package/dist/programs/globeshell/index.js +0 -8
- package/dist/programs/globeshell/noise/noises.js +0 -1
- package/dist/programs/globeshell/wiggle/index.js +0 -8
- package/dist/programs/globeshell/wiggle/logic.js +0 -345
- package/dist/programs/globeshell/wiggle/object.js +0 -72
- package/dist/programs/helpers/blender/index.js +0 -1
- package/dist/programs/helpers/blender/program.js +0 -79
- package/dist/programs/helpers/fadeaway/index.js +0 -7
- package/dist/programs/helpers/fadeaway/logic.js +0 -72
- package/dist/programs/helpers/fadeaway/object.js +0 -20
- package/dist/programs/helpers/index.js +0 -8
- package/dist/programs/index.js +0 -58
- package/dist/programs/interface.js +0 -1
- package/dist/programs/line-on-globe/angled-line.js +0 -176
- package/dist/programs/line-on-globe/circle-accurate-3d.js +0 -141
- package/dist/programs/line-on-globe/circle-accurate-flat.js +0 -216
- package/dist/programs/line-on-globe/circle-accurate.js +0 -178
- package/dist/programs/line-on-globe/circle.js +0 -167
- package/dist/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -159
- package/dist/programs/line-on-globe/index.js +0 -1
- package/dist/programs/line-on-globe/lines-color-instanced-flat.js +0 -136
- package/dist/programs/line-on-globe/linestrip.js +0 -171
- package/dist/programs/line-on-globe/naive-accurate-flexible.js +0 -195
- package/dist/programs/line-on-globe/to-the-surface.js +0 -111
- package/dist/programs/line-on-globe/util.js +0 -8
- package/dist/programs/picking/pickable-renderer.js +0 -188
- package/dist/programs/point-on-globe/element-globe-surface-glow.js +0 -142
- package/dist/programs/point-on-globe/element-point-glow.js +0 -153
- package/dist/programs/point-on-globe/square-pixel-point.js +0 -174
- package/dist/programs/programcache.js +0 -131
- package/dist/programs/rings/distancering/circleflatprogram.js +0 -156
- package/dist/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -369
- package/dist/programs/rings/distancering/circlepaddysharedbuffer.js +0 -357
- package/dist/programs/rings/distancering/index.js +0 -14
- package/dist/programs/rings/distancering/paddyflatprogram.js +0 -172
- package/dist/programs/rings/distancering/paddyflatprogram2d.js +0 -174
- package/dist/programs/rings/distancering/paddyflatprogram3d.js +0 -172
- package/dist/programs/rings/distancering/shader.js +0 -1
- package/dist/programs/rings/index.js +0 -17
- package/dist/programs/rings/partial-ring/piece-of-pie.js +0 -275
- package/dist/programs/totems/camerauniformblock.js +0 -160
- package/dist/programs/totems/canvas-webglobe-info.js +0 -110
- package/dist/programs/totems/gpu-selection-uniform-block.js +0 -108
- package/dist/programs/totems/index.js +0 -40
- package/dist/programs/two-d/pixel-circle.js +0 -1
- package/dist/programs/two-d/pixel-padding-for-compass.js +0 -162
- package/dist/programs/util.js +0 -17
- package/dist/programs/vectorfields/index.js +0 -23
- package/dist/programs/vectorfields/logics/drawrectangleparticles.js +0 -107
- package/dist/programs/vectorfields/logics/index.js +0 -12
- package/dist/programs/vectorfields/logics/pixelbased.js +0 -142
- package/dist/programs/vectorfields/logics/ubo.js +0 -63
- package/dist/programs/vectorfields/pingpongbuffermanager.js +0 -76
- package/dist/rangerings/enum.js +0 -5
- package/dist/rangerings/index.js +0 -15
- package/dist/rangerings/plugin.js +0 -560
- package/dist/rangerings/rangeringangletext.js +0 -329
- package/dist/rangerings/ring-account.js +0 -117
- package/dist/shaders/fragment-toy/firework.js +0 -58
- package/dist/shaders/fragment-toy/singularity.js +0 -59
- package/dist/shape-on-terrain/arc/naive/plugin.js +0 -252
- package/dist/timetracks/adaptors-line-strip.js +0 -71
- package/dist/timetracks/adaptors.js +0 -122
- package/dist/timetracks/index.js +0 -19
- package/dist/timetracks/plugin-line-strip.js +0 -250
- package/dist/timetracks/plugin.js +0 -258
- package/dist/timetracks/program-line-strip.js +0 -611
- package/dist/timetracks/program.js +0 -772
- package/dist/timetracks/programpoint-line-strip.js +0 -154
- package/dist/timetracks/programpoint.js +0 -147
- package/dist/types.js +0 -15
- package/dist/util/account/bufferoffsetmanager.js +0 -179
- package/dist/util/account/index.js +0 -23
- package/dist/util/account/single-attribute-buffer-management/buffer-manager.js +0 -108
- package/dist/util/account/single-attribute-buffer-management/buffer-orchestrator.js +0 -150
- package/dist/util/account/single-attribute-buffer-management/index.js +0 -9
- package/dist/util/account/single-attribute-buffer-management/object-store.js +0 -51
- package/dist/util/account/single-attribute-buffer-management/types.js +0 -2
- package/dist/util/account/util.js +0 -22
- package/dist/util/algorithms/index.js +0 -1
- package/dist/util/algorithms/search-binary.js +0 -28
- package/dist/util/check/get.js +0 -18
- package/dist/util/check/index.js +0 -1
- package/dist/util/check/typecheck.js +0 -49
- package/dist/util/geometry/index.js +0 -51
- package/dist/util/gl-util/buffer/attribute-loader.js +0 -69
- package/dist/util/gl-util/buffer/index.js +0 -6
- package/dist/util/gl-util/buffer/types.js +0 -1
- package/dist/util/gl-util/draw-options/methods.js +0 -38
- package/dist/util/gl-util/draw-options/types.js +0 -15
- package/dist/util/gl-util/uniform-block/manager.js +0 -156
- package/dist/util/gl-util/uniform-block/shader.js +0 -1
- package/dist/util/gl-util/uniform-block/types.js +0 -8
- package/dist/util/heatwavedatamanager/datamanager.js +0 -152
- package/dist/util/heatwavedatamanager/index.js +0 -10
- package/dist/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -122
- package/dist/util/heatwavedatamanager/pointcoordsmeta.js +0 -20
- package/dist/util/index.js +0 -57
- package/dist/util/interpolation/index.js +0 -1
- package/dist/util/interpolation/timetrack/index.js +0 -5
- package/dist/util/interpolation/timetrack/timetrack-interpolator.js +0 -79
- package/dist/util/interpolation/timetrack/web-worker-str.js +0 -183
- package/dist/util/interpolation/timetrack/web-worker.js +0 -48
- package/dist/util/jshelpers/data-filler.js +0 -20
- package/dist/util/jshelpers/equality.js +0 -20
- package/dist/util/jshelpers/index.js +0 -37
- package/dist/util/jshelpers/timefilters.js +0 -32
- package/dist/util/picking/fence.js +0 -46
- package/dist/util/picking/picker-displayer.js +0 -139
- package/dist/util/programs/draw-texture-on-canvas.js +0 -89
- package/dist/util/programs/index.js +0 -17
- package/dist/util/programs/shapesonglobe.js +0 -214
- package/dist/util/programs/supersampletotextures.js +0 -113
- package/dist/util/programs/texturetoglobe.js +0 -182
- package/dist/util/shaderfunctions/geometrytransformations.js +0 -340
- package/dist/util/shaderfunctions/index.js +0 -18
- package/dist/util/shaderfunctions/nodata.js +0 -11
- package/dist/util/shaderfunctions/noisefunctions.js +0 -43
- package/dist/util/surface-line-data/arc-bboxes.js +0 -25
- package/dist/util/surface-line-data/arcs-to-cuts.js +0 -50
- package/dist/util/surface-line-data/cut-arc.js +0 -1
- package/dist/util/surface-line-data/flow.js +0 -28
- package/dist/util/surface-line-data/rbush-manager.js +0 -1
- package/dist/util/surface-line-data/types.js +0 -1
- package/dist/util/surface-line-data/web-worker.js +0 -1
- package/dist/util/webglobe/gldefaultstates.js +0 -7
- package/dist/util/webglobe/index.js +0 -18
- package/dist/util/webglobe/rasteroverlay.js +0 -78
- package/dist/util/webglobjectbuilders.js +0 -388
- package/dist/util/webglobjectbuilders1.js +0 -237
- package/dist/waveparticles/adaptor.js +0 -17
- package/dist/waveparticles/index.js +0 -10
- package/dist/waveparticles/plugin.js +0 -266
- package/dist/wind/imagetovectorfieldandmagnitude.js +0 -35
- package/dist/wind/index.js +0 -14
- package/dist/wind/plugin.js +0 -926
- package/dist/wind/vectorfieldimage.js +0 -25
- package/dist/write-text/attached-text-writer.js +0 -91
- package/dist/write-text/context-text.js +0 -98
- package/dist/write-text/context-text3.js +0 -155
- package/dist/write-text/index.js +0 -5
- package/dist/write-text/writer-plugin.js +0 -8
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ring data model
|
|
4
|
-
* [centerX, centerY, range, padding, r, g, b, a, hide]
|
|
5
|
-
*
|
|
6
|
-
* Buffer is initialized with ring capacity and buffer is created with that capacity. It might be called buffer orphaning.
|
|
7
|
-
*
|
|
8
|
-
* */
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
/**
|
|
11
|
-
* TODO
|
|
12
|
-
* delete registerCenter
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
const RING_SIZE = 9;
|
|
17
|
-
class default_1 {
|
|
18
|
-
/**
|
|
19
|
-
* @param {WebGL2RenderingContext} gl
|
|
20
|
-
* @param {Object} options
|
|
21
|
-
* @param {Number} options.initialRingCapacity
|
|
22
|
-
* @param {String} options.bufferType - "static" or "dynamic"
|
|
23
|
-
* */
|
|
24
|
-
constructor(gl, globe, { initialRingCapacity = 20, bufferType = "STATIC_DRAW", implicitExtentionRate = 1.2 } = {}) {
|
|
25
|
-
this.gl = gl;
|
|
26
|
-
this.globe = globe;
|
|
27
|
-
this._capacity = initialRingCapacity;
|
|
28
|
-
this._ringCounter = 0;
|
|
29
|
-
this._length = 0;
|
|
30
|
-
this._centerMap = new Map(); // key, new MAP(x,y, rings:[])
|
|
31
|
-
this._ringOffsets = new Map();
|
|
32
|
-
this._removedRingsOffsetStack = [];
|
|
33
|
-
this._bufferType = gl[bufferType.toUpperCase()];
|
|
34
|
-
this.implicitExtentionRate = implicitExtentionRate;
|
|
35
|
-
this.buffer = gl.createBuffer();
|
|
36
|
-
{ // initilize data
|
|
37
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
38
|
-
gl.bufferData(gl.ARRAY_BUFFER, initialRingCapacity * 4 * RING_SIZE, this._bufferType);
|
|
39
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
40
|
-
}
|
|
41
|
-
{
|
|
42
|
-
this._circleVAO = gl.createVertexArray();
|
|
43
|
-
gl.bindVertexArray(this._circleVAO);
|
|
44
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
45
|
-
gl.enableVertexAttribArray(0);
|
|
46
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, RING_SIZE * 4, 0);
|
|
47
|
-
gl.enableVertexAttribArray(1);
|
|
48
|
-
gl.vertexAttribPointer(1, 1, gl.FLOAT, false, RING_SIZE * 4, 2 * 4);
|
|
49
|
-
gl.enableVertexAttribArray(2);
|
|
50
|
-
gl.vertexAttribPointer(2, 4, gl.FLOAT, false, RING_SIZE * 4, 4 * 4);
|
|
51
|
-
gl.enableVertexAttribArray(3);
|
|
52
|
-
gl.vertexAttribPointer(3, 3, gl.FLOAT, false, RING_SIZE * 4, 8 * 4);
|
|
53
|
-
// set divisors to 1
|
|
54
|
-
gl.vertexAttribDivisor(0, 1);
|
|
55
|
-
gl.vertexAttribDivisor(1, 1);
|
|
56
|
-
gl.vertexAttribDivisor(2, 1);
|
|
57
|
-
gl.vertexAttribDivisor(3, 1);
|
|
58
|
-
gl.bindVertexArray(null);
|
|
59
|
-
}
|
|
60
|
-
{
|
|
61
|
-
this._paddingVAO = gl.createVertexArray();
|
|
62
|
-
gl.bindVertexArray(this._paddingVAO);
|
|
63
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
|
|
64
|
-
gl.enableVertexAttribArray(0);
|
|
65
|
-
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, RING_SIZE * 4, 0);
|
|
66
|
-
gl.enableVertexAttribArray(1);
|
|
67
|
-
gl.vertexAttribPointer(1, 1, gl.FLOAT, false, RING_SIZE * 4, 2 * 4);
|
|
68
|
-
gl.enableVertexAttribArray(2);
|
|
69
|
-
gl.vertexAttribPointer(2, 1, gl.FLOAT, false, RING_SIZE * 4, 3 * 4);
|
|
70
|
-
gl.enableVertexAttribArray(3);
|
|
71
|
-
gl.vertexAttribPointer(3, 4, gl.FLOAT, false, RING_SIZE * 4, 4 * 4);
|
|
72
|
-
gl.enableVertexAttribArray(4);
|
|
73
|
-
gl.vertexAttribPointer(4, 3, gl.FLOAT, false, RING_SIZE * 4, 8 * 4);
|
|
74
|
-
gl.vertexAttribDivisor(0, 1);
|
|
75
|
-
gl.vertexAttribDivisor(1, 1);
|
|
76
|
-
gl.vertexAttribDivisor(2, 1);
|
|
77
|
-
gl.vertexAttribDivisor(3, 1);
|
|
78
|
-
gl.vertexAttribDivisor(4, 1);
|
|
79
|
-
gl.bindVertexArray(null);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @param {String} centerID
|
|
84
|
-
* @param {Object} options
|
|
85
|
-
* @param {Number} options.x
|
|
86
|
-
* @param {Number} options.y
|
|
87
|
-
* */
|
|
88
|
-
registerCenter(centerID, { x = 0, y = 0 } = {}) {
|
|
89
|
-
this._centerMap.set(centerID, new Map([
|
|
90
|
-
["x", x],
|
|
91
|
-
["y", y],
|
|
92
|
-
["rings", []] // ring keys
|
|
93
|
-
]));
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
*
|
|
97
|
-
* @param {null | number} newCapacity if null, vacuum defragmentation is applied -> capacity is set to the current ring count
|
|
98
|
-
*/
|
|
99
|
-
defrag(newCapacity = null) {
|
|
100
|
-
const { _removedRingsOffsetStack, _ringOffsets } = this;
|
|
101
|
-
_removedRingsOffsetStack.sort();
|
|
102
|
-
this._capacity = newCapacity || this._ringCounter;
|
|
103
|
-
const arrayToLoad = new Float32Array(this._capacity * RING_SIZE);
|
|
104
|
-
const bufferData = this._getBufferData();
|
|
105
|
-
let arrayOffset = 0;
|
|
106
|
-
const newRingOffsets = new Map();
|
|
107
|
-
for (const [key, offset] of _ringOffsets) {
|
|
108
|
-
const ringOffset = offset / 4;
|
|
109
|
-
const ringData = bufferData.slice(ringOffset, ringOffset + RING_SIZE);
|
|
110
|
-
arrayToLoad.set(ringData, arrayOffset);
|
|
111
|
-
newRingOffsets.set(key, arrayOffset * 4);
|
|
112
|
-
arrayOffset += RING_SIZE;
|
|
113
|
-
}
|
|
114
|
-
const { gl, buffer } = this;
|
|
115
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
116
|
-
gl.bufferData(gl.ARRAY_BUFFER, arrayToLoad, this._bufferType);
|
|
117
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
118
|
-
this._ringOffsets = newRingOffsets;
|
|
119
|
-
this._removedRingsOffsetStack = [];
|
|
120
|
-
this._length = this._ringCounter;
|
|
121
|
-
}
|
|
122
|
-
extendBuffer(newCapacity) {
|
|
123
|
-
if (this._capacity >= newCapacity) {
|
|
124
|
-
console.warn("New capacity is smaller than the current capacity");
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
this._capacity = newCapacity;
|
|
128
|
-
const { gl, buffer } = this;
|
|
129
|
-
const bufferData = this._getBufferData();
|
|
130
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
131
|
-
gl.bufferData(gl.ARRAY_BUFFER, newCapacity * RING_SIZE * 4, this._bufferType);
|
|
132
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
133
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
134
|
-
}
|
|
135
|
-
checkCapacity(sizeLeft = 1) {
|
|
136
|
-
return sizeLeft <= this._capacity - this._ringCounter;
|
|
137
|
-
}
|
|
138
|
-
capacityLeft() {
|
|
139
|
-
return this._capacity - this._ringCounter;
|
|
140
|
-
}
|
|
141
|
-
get capacity() {
|
|
142
|
-
return this._capacity;
|
|
143
|
-
}
|
|
144
|
-
get length() {
|
|
145
|
-
return this._length;
|
|
146
|
-
}
|
|
147
|
-
get ringCount() {
|
|
148
|
-
return this._ringCounter;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* @param {Array<string>} centerIDs
|
|
152
|
-
* */
|
|
153
|
-
removeCenters(centerIDs) {
|
|
154
|
-
const { gl, buffer } = this;
|
|
155
|
-
const zero = new Float32Array([0]);
|
|
156
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
157
|
-
for (let centerID of centerIDs) {
|
|
158
|
-
if (!this._centerMap.has(centerID)) {
|
|
159
|
-
// console.warn("Center is not registered yet");
|
|
160
|
-
// return;
|
|
161
|
-
continue;
|
|
162
|
-
}
|
|
163
|
-
const center = this._centerMap.get(centerID);
|
|
164
|
-
const rings = center.get("rings");
|
|
165
|
-
for (let i = 0; i < rings.length; i++) {
|
|
166
|
-
// set range to 0, 3rd index of float32array
|
|
167
|
-
const offset = this._ringOffsets.get(rings[i]);
|
|
168
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, offset + 8, zero);
|
|
169
|
-
this._removedRingsOffsetStack.push(offset);
|
|
170
|
-
this._ringOffsets.delete(rings[i]);
|
|
171
|
-
}
|
|
172
|
-
this._ringCounter -= rings.length;
|
|
173
|
-
this._centerMap.delete(centerID);
|
|
174
|
-
}
|
|
175
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
176
|
-
this.globe.DrawRender();
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
*
|
|
180
|
-
* @property {String} centerID
|
|
181
|
-
* @property {Number} x radians x
|
|
182
|
-
* @property {Number} y radians y
|
|
183
|
-
* @param {*} centerIDxyList
|
|
184
|
-
*/
|
|
185
|
-
updateCentersXY(centerIDxyList) {
|
|
186
|
-
const { gl, buffer } = this;
|
|
187
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
188
|
-
for (let { centerID, x, y } of centerIDxyList) {
|
|
189
|
-
const center = this._centerMap.get(centerID);
|
|
190
|
-
center.set("x", x);
|
|
191
|
-
center.set("y", y);
|
|
192
|
-
const xyBlock = new Float32Array([x, y]);
|
|
193
|
-
const rings = center.get("rings");
|
|
194
|
-
for (let i = 0; i < rings.length; i++) {
|
|
195
|
-
const offset = this._ringOffsets.get(rings[i]);
|
|
196
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, offset, xyBlock);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
200
|
-
this.globe.DrawRender();
|
|
201
|
-
}
|
|
202
|
-
updateCentersHide(data) {
|
|
203
|
-
const { gl, buffer } = this;
|
|
204
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
205
|
-
for (let { centerID, hide = null } of data) {
|
|
206
|
-
if (hide === null)
|
|
207
|
-
continue;
|
|
208
|
-
const rings = this._centerMap.get(centerID).get("rings");
|
|
209
|
-
for (let i = 0; i < rings.length; i++) {
|
|
210
|
-
const offset = this._ringOffsets.get(rings[i]);
|
|
211
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, offset + 32, new Float32Array([hide]));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
215
|
-
this.globe.DrawRender();
|
|
216
|
-
}
|
|
217
|
-
insertBulk(rangeRingDatas) {
|
|
218
|
-
const { gl, buffer } = this;
|
|
219
|
-
{ // remove existring centers
|
|
220
|
-
const existingCenterIDs = [];
|
|
221
|
-
for (let { centerID } of rangeRingDatas) {
|
|
222
|
-
if (this._centerMap.has(centerID)) {
|
|
223
|
-
existingCenterIDs.push(centerID);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
this.removeCenters(existingCenterIDs);
|
|
227
|
-
}
|
|
228
|
-
{ // capacity check
|
|
229
|
-
let incomingRingSize = 0;
|
|
230
|
-
for (let { rings } of rangeRingDatas) {
|
|
231
|
-
incomingRingSize += rings.length;
|
|
232
|
-
// It should check if ring is already registered but for now it is not implemented.
|
|
233
|
-
// Reasons: increase in complexity and performance
|
|
234
|
-
}
|
|
235
|
-
this._implicitExtendBufferInNeed(incomingRingSize);
|
|
236
|
-
}
|
|
237
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
238
|
-
for (const { centerID, x, y, rings, hide = 0 } of rangeRingDatas) {
|
|
239
|
-
this.registerCenter(centerID, { x, y });
|
|
240
|
-
for (const { ringID, radius, padding, rgba } of rings) {
|
|
241
|
-
const key = this._ringKey(centerID, ringID);
|
|
242
|
-
const bufferData = new Float32Array([x, y, radius, padding, ...rgba, hide]);
|
|
243
|
-
const offset = this._nextBufferOffset();
|
|
244
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, offset, bufferData);
|
|
245
|
-
this._ringOffsets.set(key, offset);
|
|
246
|
-
this._centerMap.get(centerID).get("rings").push(key);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
250
|
-
this.globe.DrawRender();
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
*
|
|
254
|
-
* @param {Array<{centerID, rgba}} centersColors
|
|
255
|
-
*/
|
|
256
|
-
updateCentersColor(centersColors) {
|
|
257
|
-
const { gl, buffer } = this;
|
|
258
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
259
|
-
for (let { centerID, rgba } of centersColors) {
|
|
260
|
-
if (!this._centerMap.has(centerID)) {
|
|
261
|
-
console.warn("Center is not registered yet");
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
const rings = this._centerMap.get(centerID).get("rings");
|
|
265
|
-
const block = new Float32Array(rgba);
|
|
266
|
-
for (let i = 0; i < rings.length; i++) {
|
|
267
|
-
const offset = this._ringOffsets.get(rings[i]);
|
|
268
|
-
gl.bufferSubData(gl.ARRAY_BUFFER, offset + 16, block);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
272
|
-
this.globe.DrawRender();
|
|
273
|
-
}
|
|
274
|
-
// ----------------- INTERNAL METHODS ----------------- //
|
|
275
|
-
bindCircleVAO() {
|
|
276
|
-
this.gl.bindVertexArray(this._circleVAO);
|
|
277
|
-
}
|
|
278
|
-
bindPaddingVAO() {
|
|
279
|
-
this.gl.bindVertexArray(this._paddingVAO);
|
|
280
|
-
}
|
|
281
|
-
free() {
|
|
282
|
-
this.gl.deleteBuffer(this.buffer);
|
|
283
|
-
this.gl.deleteVertexArray(this._circleVAO);
|
|
284
|
-
this.gl.deleteVertexArray(this._paddingVAO);
|
|
285
|
-
}
|
|
286
|
-
// ----------------- PRIVATE METHODS ----------------- //
|
|
287
|
-
_getBufferData() {
|
|
288
|
-
const { gl, buffer } = this;
|
|
289
|
-
const size = new Float32Array(this._length * RING_SIZE);
|
|
290
|
-
const bufferData = new Float32Array(size);
|
|
291
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
292
|
-
gl.getBufferSubData(gl.ARRAY_BUFFER, 0, bufferData);
|
|
293
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
|
294
|
-
return bufferData;
|
|
295
|
-
}
|
|
296
|
-
_ringKey(centerID, ringID) {
|
|
297
|
-
return `C=${centerID},R=${ringID}`;
|
|
298
|
-
}
|
|
299
|
-
_nextBufferOffset() {
|
|
300
|
-
if (!this.checkCapacity()) {
|
|
301
|
-
throw new Error("Buffer is full");
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
let offset;
|
|
305
|
-
if (this._removedRingsOffsetStack.length > 0) {
|
|
306
|
-
offset = this._removedRingsOffsetStack.pop();
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
offset = this._ringCounter * RING_SIZE * 4;
|
|
310
|
-
this._length++;
|
|
311
|
-
}
|
|
312
|
-
this._ringCounter++;
|
|
313
|
-
return offset;
|
|
314
|
-
}
|
|
315
|
-
_implicitExtendBufferInNeed(incomingRingSize) {
|
|
316
|
-
const overCapacity = incomingRingSize - this.capacityLeft();
|
|
317
|
-
if (overCapacity <= 0)
|
|
318
|
-
return;
|
|
319
|
-
const newCapacity = Math.ceil((this._capacity + overCapacity) * this.implicitExtentionRate);
|
|
320
|
-
this.extendBuffer(newCapacity);
|
|
321
|
-
}
|
|
322
|
-
async readRing(centerID, ringID) {
|
|
323
|
-
const key = this._ringKey(centerID, ringID);
|
|
324
|
-
if (!this._ringOffsets.has(key)) {
|
|
325
|
-
console.warn("Ring is not registered yet");
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
const offset = this._ringOffsets.get(key);
|
|
329
|
-
const { gl, buffer } = this;
|
|
330
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
331
|
-
const bufferData = new Float32Array(9);
|
|
332
|
-
gl.getBufferSubData(gl.ARRAY_BUFFER, offset, bufferData);
|
|
333
|
-
return {
|
|
334
|
-
centerX: bufferData[0],
|
|
335
|
-
centerY: bufferData[1],
|
|
336
|
-
range: bufferData[2],
|
|
337
|
-
padding: bufferData[3],
|
|
338
|
-
rgba: [bufferData[4], bufferData[5], bufferData[6], bufferData[7]],
|
|
339
|
-
hide: bufferData[8]
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
exports.default = default_1;
|
|
344
|
-
/**
|
|
345
|
-
* Documentation
|
|
346
|
-
*
|
|
347
|
-
* Methods:
|
|
348
|
-
* - insertRings(centerIdringIdRadiusPaddingRgbaHide)
|
|
349
|
-
* - removeRings(centerIDringIDs)
|
|
350
|
-
* - removeCenters(centerIDs)
|
|
351
|
-
* - updateCentersXY(centerIDxyList)
|
|
352
|
-
* - updateCenters(centerDatas)
|
|
353
|
-
* - insertBulk(rangeRingDatas)
|
|
354
|
-
* - updateRing(centerID, ringID, { radius, padding, rgba, hide })
|
|
355
|
-
* - readRing(centerID, ringID)
|
|
356
|
-
*
|
|
357
|
-
*/
|
|
@@ -1,14 +0,0 @@
|
|
|
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.PaddingFreeAngleCache = exports.CirclePaddySharedBuffer = exports.PaddingProgramCache = exports.circleProgramCache = void 0;
|
|
7
|
-
const circleflatprogram_1 = require("./circleflatprogram");
|
|
8
|
-
Object.defineProperty(exports, "circleProgramCache", { enumerable: true, get: function () { return circleflatprogram_1.programCache; } });
|
|
9
|
-
const paddyflatprogram_1 = require("./paddyflatprogram");
|
|
10
|
-
Object.defineProperty(exports, "PaddingProgramCache", { enumerable: true, get: function () { return paddyflatprogram_1.PaddingProgramCache; } });
|
|
11
|
-
const circlepaddysharedbuffer_1 = __importDefault(require("./circlepaddysharedbuffer"));
|
|
12
|
-
exports.CirclePaddySharedBuffer = circlepaddysharedbuffer_1.default;
|
|
13
|
-
const circlepaddingfreeangleprogram_1 = require("./circlepaddingfreeangleprogram");
|
|
14
|
-
Object.defineProperty(exports, "PaddingFreeAngleCache", { enumerable: true, get: function () { return circlepaddingfreeangleprogram_1.PaddingFreeAngleCache; } });
|
|
@@ -1,172 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.PaddingProgramCache = void 0;
|
|
37
|
-
const util_1 = require("../../../util");
|
|
38
|
-
const camerauniformblock_1 = __importStar(require("../../totems/camerauniformblock"));
|
|
39
|
-
const programcache_1 = require("../../programcache");
|
|
40
|
-
const vertexShader = `#version 300 es ` +
|
|
41
|
-
util_1.shaderfunctions.PI +
|
|
42
|
-
util_1.shaderfunctions.R +
|
|
43
|
-
util_1.shaderfunctions.POLE +
|
|
44
|
-
camerauniformblock_1.CameraUniformBlockString +
|
|
45
|
-
util_1.shaderfunctions.mercatorXYToGLPosition +
|
|
46
|
-
util_1.shaderfunctions.longLatRadToMercator +
|
|
47
|
-
util_1.shaderfunctions.longLatRadToCartesian3D +
|
|
48
|
-
util_1.shaderfunctions.circleLimpFromLongLatRadCenterCartesian3D +
|
|
49
|
-
util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorCompass +
|
|
50
|
-
util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistancePadding +
|
|
51
|
-
util_1.shaderfunctions.circleLimpFromLongLatRadCenterMercatorRealDistance + `
|
|
52
|
-
|
|
53
|
-
in vec2 center;
|
|
54
|
-
in float radius;
|
|
55
|
-
in float pad_range;
|
|
56
|
-
in vec4 color;
|
|
57
|
-
in float flag;
|
|
58
|
-
|
|
59
|
-
uniform int compass;
|
|
60
|
-
uniform float pad_count;
|
|
61
|
-
|
|
62
|
-
uniform float opacity;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
out vec2 v_limp;
|
|
66
|
-
out vec4 v_color;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
void main() {
|
|
70
|
-
|
|
71
|
-
float alpha_padding = z_level * z_level / (pad_range/ 100.0 );
|
|
72
|
-
if( flag == 2.0 || flag == 1.0 || radius == 0.0 || alpha_padding < 0.1 || z_level < 3.0 ) return; // 1.0 is hide
|
|
73
|
-
v_color = vec4(color.rgb, color.a * alpha_padding * opacity);
|
|
74
|
-
|
|
75
|
-
gl_PointSize = 2.0;
|
|
76
|
-
|
|
77
|
-
float odd = mod(float(gl_VertexID), 2.0);
|
|
78
|
-
float index = (float(gl_VertexID)- odd ) / 2.0;
|
|
79
|
-
float angle = 3.1415926535897932384626433832795 * 2.0 * (index / pad_count );
|
|
80
|
-
float radius_ = radius - (pad_range * odd);
|
|
81
|
-
|
|
82
|
-
if ( is3D){
|
|
83
|
-
gl_Position = projection * view * vec4(
|
|
84
|
-
circleLimpFromLongLatRadCenterCartesian3D( center, radius_, angle) - translate, 1.0);
|
|
85
|
-
v_limp = vec2(0.0, 0.0);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
vec2 limp;
|
|
89
|
-
if ( compass == 1 ){
|
|
90
|
-
limp = circleLimpFromLongLatRadCenterMercatorCompass(center , radius_, angle);
|
|
91
|
-
} else {
|
|
92
|
-
// limp = circleLimpFromLongLatRadCenterMercatorRealDistancePadding(center, radius_, angle);
|
|
93
|
-
limp = circleLimpFromLongLatRadCenterMercatorRealDistance(center, radius_, angle);
|
|
94
|
-
}
|
|
95
|
-
v_limp = limp;
|
|
96
|
-
gl_Position = mercatorXYToGLPosition(limp);
|
|
97
|
-
}`;
|
|
98
|
-
const fragmentShader = `#version 300 es
|
|
99
|
-
precision highp float; ` +
|
|
100
|
-
util_1.shaderfunctions.POLE + `
|
|
101
|
-
in vec4 v_color;
|
|
102
|
-
in vec2 v_limp;
|
|
103
|
-
out vec4 outColor;
|
|
104
|
-
void main() {
|
|
105
|
-
if ( v_limp.x < -POLE || v_limp.x > POLE || v_limp.y < -POLE || v_limp.y > POLE ){ discard; }
|
|
106
|
-
outColor = v_color;
|
|
107
|
-
}`;
|
|
108
|
-
class Logic {
|
|
109
|
-
constructor(globe) {
|
|
110
|
-
this.globe = globe;
|
|
111
|
-
this.gl = globe.gl;
|
|
112
|
-
this.program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
|
|
113
|
-
{ // bind positions so bufferManager can use them
|
|
114
|
-
this.gl.bindAttribLocation(this.program, 0, "center");
|
|
115
|
-
this.gl.bindAttribLocation(this.program, 1, "radius");
|
|
116
|
-
this.gl.bindAttribLocation(this.program, 2, "pad_range");
|
|
117
|
-
this.gl.bindAttribLocation(this.program, 3, "color");
|
|
118
|
-
this.gl.bindAttribLocation(this.program, 4, "flag");
|
|
119
|
-
}
|
|
120
|
-
this.cameraBlockBindingPoint = 0;
|
|
121
|
-
const cameraBlockIndex = this.gl.getUniformBlockIndex(this.program, "CameraUniformBlock");
|
|
122
|
-
this.gl.uniformBlockBinding(this.program, cameraBlockIndex, this.cameraBlockBindingPoint);
|
|
123
|
-
this.cameraBlockTotem = programcache_1.globeProgramCache.getProgram(globe, camerauniformblock_1.default);
|
|
124
|
-
this._padCountLocation = this.gl.getUniformLocation(this.program, "pad_count");
|
|
125
|
-
this._opacityLocation = this.gl.getUniformLocation(this.program, "opacity");
|
|
126
|
-
this._compassLocation = this.gl.getUniformLocation(this.program, "compass");
|
|
127
|
-
this._compassMode = 1;
|
|
128
|
-
this._opacity = 1.0;
|
|
129
|
-
this._padCount = 360;
|
|
130
|
-
{
|
|
131
|
-
const currentProgram = this.gl.getParameter(this.gl.CURRENT_PROGRAM);
|
|
132
|
-
this.gl.useProgram(this.program);
|
|
133
|
-
this.gl.uniform1i(this._compassLocation, 1);
|
|
134
|
-
this.gl.uniform1f(this._opacityLocation, 1.0);
|
|
135
|
-
this.gl.uniform1f(this._padCountLocation, 360);
|
|
136
|
-
this.gl.useProgram(currentProgram);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
draw(attrBufferManager, padCount, compass, opacity) {
|
|
140
|
-
const { gl, program, _padCountLocation, cameraBlockBindingPoint, cameraBlockTotem, _compassLocation } = this;
|
|
141
|
-
gl.useProgram(program);
|
|
142
|
-
attrBufferManager.bindPaddingVAO();
|
|
143
|
-
cameraBlockTotem.bind(cameraBlockBindingPoint);
|
|
144
|
-
// draw instanced
|
|
145
|
-
if (padCount !== this._padCount) {
|
|
146
|
-
this._padCount = padCount;
|
|
147
|
-
// console.log("padCount", padCount);
|
|
148
|
-
gl.uniform1f(_padCountLocation, padCount);
|
|
149
|
-
}
|
|
150
|
-
if (compass !== this._compassMode) {
|
|
151
|
-
// console.log("compass", compass);
|
|
152
|
-
gl.uniform1i(_compassLocation, compass);
|
|
153
|
-
this._compassMode = compass;
|
|
154
|
-
}
|
|
155
|
-
if (opacity !== this._opacity) {
|
|
156
|
-
// console.log("opacity", opacity);
|
|
157
|
-
this._opacity = opacity;
|
|
158
|
-
gl.uniform1f(this._opacityLocation, opacity);
|
|
159
|
-
}
|
|
160
|
-
gl.drawArraysInstanced(gl.LINES, 0, padCount * 2, attrBufferManager.length);
|
|
161
|
-
gl.bindVertexArray(null);
|
|
162
|
-
cameraBlockTotem.unbind(cameraBlockBindingPoint);
|
|
163
|
-
}
|
|
164
|
-
free() {
|
|
165
|
-
this.gl.deleteProgram(this.program);
|
|
166
|
-
programcache_1.globeProgramCache.releaseProgram(this.globe, camerauniformblock_1.default);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
exports.PaddingProgramCache = Object.freeze({
|
|
170
|
-
getProgram: (globe) => { return programcache_1.noRegisterGlobeProgramCache.getProgram(globe, Logic); },
|
|
171
|
-
releaseProgram: (globe) => { programcache_1.noRegisterGlobeProgramCache.releaseProgram(globe, Logic); }
|
|
172
|
-
});
|