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