@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
package/timetracks/program.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Author: Toprak Nihat Deniz Ozturk
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const util_1 = require("../util");
|
|
7
|
+
class TrackGlowLineProgram {
|
|
8
8
|
/**
|
|
9
9
|
* @param {WebGL2RenderingContext} gl
|
|
10
10
|
* @param {number} width
|
|
@@ -19,8 +19,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
19
19
|
* @param {number} options.finalAlphaRatio 0 ~ 1
|
|
20
20
|
* @param {+int} options.blurRepetition 1 ~ inf default 2
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
if (options === void 0) { options = {}; }
|
|
22
|
+
constructor(gl, attrBuffer, width, height, options = {}) {
|
|
24
23
|
this.gl = gl;
|
|
25
24
|
this.program = null;
|
|
26
25
|
this._premultipliedAlpha = false;
|
|
@@ -39,14 +38,13 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
39
38
|
this._totalLength = 0;
|
|
40
39
|
this._initUniforms(options);
|
|
41
40
|
}
|
|
42
|
-
|
|
41
|
+
_createInnerTextures() {
|
|
43
42
|
this._middleTexture = this._createTextures();
|
|
44
43
|
this._blurTextures = [this._createTextures(), this._createTextures()];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
44
|
+
}
|
|
45
|
+
_initUniforms(options = {}) {
|
|
46
|
+
const { gl, _lineProgram, _blurProgram, _combineProgram } = this;
|
|
47
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
50
48
|
gl.useProgram(_lineProgram.program);
|
|
51
49
|
gl.uniform1f(_lineProgram.u_head_percentage, options.headPercentage || 1.0 / 30.0);
|
|
52
50
|
gl.uniform1f(_lineProgram.u_route_alpha, options.routeAlpha || 0.025);
|
|
@@ -59,150 +57,187 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
59
57
|
gl.uniform1f(_combineProgram.u_gamma, options.gamma || 1.0);
|
|
60
58
|
gl.uniform1f(_combineProgram.u_final_alpha_ratio, options.finalAlphaRatio || 1.0);
|
|
61
59
|
gl.useProgram(currentProgram);
|
|
62
|
-
}
|
|
63
|
-
|
|
60
|
+
}
|
|
61
|
+
setPremultipliedAlpha(boolean) {
|
|
64
62
|
if (typeof boolean !== 'boolean') {
|
|
65
63
|
console.warn("boolean should be a boolean value, but got", boolean);
|
|
66
64
|
return;
|
|
67
65
|
}
|
|
68
66
|
this._premultipliedAlpha = boolean;
|
|
69
|
-
}
|
|
67
|
+
}
|
|
70
68
|
/**
|
|
71
69
|
* @param {number} alpha 0 ~ 1
|
|
72
70
|
* @returns
|
|
73
71
|
*/
|
|
74
|
-
|
|
72
|
+
setAlphaThreshold(alpha) {
|
|
75
73
|
if (alpha < 0 || alpha > 1) {
|
|
76
74
|
console.warn("alpha should be between 0 and 1, but got", alpha);
|
|
77
75
|
return;
|
|
78
76
|
}
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
const { gl, _blurProgram } = this;
|
|
78
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
81
79
|
gl.useProgram(_blurProgram.program);
|
|
82
80
|
gl.uniform1f(_blurProgram.u_alpha_threshold, alpha);
|
|
83
81
|
gl.useProgram(currentProgram);
|
|
84
|
-
}
|
|
82
|
+
}
|
|
85
83
|
/**
|
|
86
84
|
* @param {number} gamma 0 ~ inf
|
|
87
85
|
*/
|
|
88
|
-
|
|
86
|
+
setGamma(gamma) {
|
|
89
87
|
if (gamma < 0) {
|
|
90
88
|
console.warn("gamma should be equal or greater than 0, but got", gamma);
|
|
91
89
|
return;
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
const { gl, _combineProgram } = this;
|
|
92
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
95
93
|
gl.useProgram(_combineProgram.program);
|
|
96
94
|
gl.uniform1f(_combineProgram.u_gamma, gamma);
|
|
97
95
|
gl.useProgram(currentProgram);
|
|
98
|
-
}
|
|
96
|
+
}
|
|
99
97
|
/**
|
|
100
98
|
*
|
|
101
99
|
* @param {number} exposure 0 ~ inf
|
|
102
100
|
* @returns
|
|
103
101
|
*/
|
|
104
|
-
|
|
102
|
+
setExposure(exposure) {
|
|
105
103
|
if (exposure < 0) {
|
|
106
104
|
console.warn("exposure should be equal or greater than 0, but got", exposure);
|
|
107
105
|
return;
|
|
108
106
|
}
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
const { gl, _combineProgram } = this;
|
|
108
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
111
109
|
gl.useProgram(_combineProgram.program);
|
|
112
110
|
gl.uniform1f(_combineProgram.u_exposure, exposure);
|
|
113
111
|
gl.useProgram(currentProgram);
|
|
114
|
-
}
|
|
112
|
+
}
|
|
115
113
|
/**
|
|
116
114
|
*
|
|
117
115
|
* @param {number} ratio 0 ~ 1
|
|
118
116
|
* @returns
|
|
119
117
|
*/
|
|
120
|
-
|
|
118
|
+
setFinalAlphaRatio(ratio) {
|
|
121
119
|
if (ratio < 0 || ratio > 1) {
|
|
122
120
|
console.warn("ratio should be between 0 and 1, but got", ratio);
|
|
123
121
|
return;
|
|
124
122
|
}
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
const { gl, _combineProgram } = this;
|
|
124
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
127
125
|
gl.useProgram(_combineProgram.program);
|
|
128
126
|
gl.uniform1f(_combineProgram.u_final_alpha_ratio, ratio);
|
|
129
127
|
gl.useProgram(currentProgram);
|
|
130
|
-
}
|
|
128
|
+
}
|
|
131
129
|
/**
|
|
132
130
|
* @param {Array.<Number>} weight [w1, w2, w3, w4, w5]
|
|
133
131
|
*/
|
|
134
|
-
|
|
132
|
+
setBlurWeights(weights) {
|
|
135
133
|
if (weights.length !== 5) {
|
|
136
134
|
console.warn("weights should be an array of 5 numbers, but got", weights);
|
|
137
135
|
return;
|
|
138
136
|
}
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
const { gl, _blurProgram } = this;
|
|
138
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
141
139
|
gl.useProgram(_blurProgram.program);
|
|
142
140
|
gl.uniform1fv(_blurProgram.u_weight, weights);
|
|
143
141
|
gl.useProgram(currentProgram);
|
|
144
|
-
}
|
|
142
|
+
}
|
|
145
143
|
/**
|
|
146
144
|
* @param {number} routeAlpha 0 ~ 1
|
|
147
145
|
*/
|
|
148
|
-
|
|
146
|
+
setRouteAlpha(routeAlpha) {
|
|
149
147
|
if (routeAlpha < 0 || routeAlpha > 1) {
|
|
150
148
|
console.warn("routeAlpha should be between 0 and 1, but got", routeAlpha);
|
|
151
149
|
return;
|
|
152
150
|
}
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
const { gl, _lineProgram } = this;
|
|
152
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
155
153
|
gl.useProgram(_lineProgram.program);
|
|
156
154
|
gl.uniform1f(_lineProgram.u_route_alpha, routeAlpha);
|
|
157
155
|
gl.useProgram(currentProgram);
|
|
158
|
-
}
|
|
159
|
-
|
|
156
|
+
}
|
|
157
|
+
setGlow(boolean) {
|
|
160
158
|
if (typeof boolean !== 'boolean') {
|
|
161
159
|
console.warn("boolean should be a boolean value, but got", boolean);
|
|
162
160
|
return;
|
|
163
161
|
}
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
const { gl, _blurProgram } = this;
|
|
163
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
166
164
|
gl.useProgram(_blurProgram.program);
|
|
167
165
|
gl.uniform1i(_blurProgram.u_glow, boolean);
|
|
168
166
|
gl.useProgram(currentProgram);
|
|
169
|
-
}
|
|
167
|
+
}
|
|
170
168
|
/**
|
|
171
169
|
* blur uses pingpong effect. This number decides how many times the blur will be applied.
|
|
172
170
|
* @param {+int} repetition
|
|
173
171
|
* @returns
|
|
174
172
|
*/
|
|
175
|
-
|
|
173
|
+
setBlurRepetition(repetition) {
|
|
176
174
|
if (repetition < 0 && repetition % 1 !== 0) {
|
|
177
175
|
console.warn("repetition should be an integer greater than 0, but got", repetition);
|
|
178
176
|
return;
|
|
179
177
|
}
|
|
180
178
|
this._blurRepetition = repetition;
|
|
181
|
-
}
|
|
179
|
+
}
|
|
182
180
|
/**
|
|
183
181
|
* Head Is colored as white. This number decides proportion of the head according to the total length of the line.
|
|
184
182
|
* @param {Number} percentage 0 ~ 1
|
|
185
183
|
*/
|
|
186
|
-
|
|
184
|
+
setHeadPercentage(percentage) {
|
|
187
185
|
if (percentage < 0 || 1 < percentage) {
|
|
188
186
|
console.warn("percentage should be between 0 and 1, but got", percentage);
|
|
189
187
|
return;
|
|
190
188
|
}
|
|
191
189
|
;
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
const { gl, _lineProgram } = this;
|
|
191
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
194
192
|
gl.useProgram(_lineProgram.program);
|
|
195
193
|
gl.uniform1f(_lineProgram.u_head_percentage, percentage);
|
|
196
194
|
gl.useProgram(currentProgram);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
195
|
+
}
|
|
196
|
+
_createCombineProgram() {
|
|
197
|
+
const gl = this.gl;
|
|
198
|
+
const vertexShader = `#version 300 es
|
|
199
|
+
precision lowp float;
|
|
200
|
+
|
|
201
|
+
in vec2 a_position;
|
|
202
|
+
|
|
203
|
+
out vec2 v_texcoord;
|
|
204
|
+
|
|
205
|
+
void main() {
|
|
206
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
207
|
+
v_texcoord = a_position.xy * 0.5 + 0.5;
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
210
|
+
const fragmentShader = `#version 300 es
|
|
211
|
+
precision lowp float;
|
|
212
|
+
|
|
213
|
+
in vec2 v_texcoord;
|
|
214
|
+
|
|
215
|
+
uniform sampler2D u_main_texture;
|
|
216
|
+
uniform sampler2D u_bloom_texture;
|
|
217
|
+
|
|
218
|
+
uniform float u_exposure;
|
|
219
|
+
uniform float u_gamma;
|
|
220
|
+
uniform float u_final_alpha_ratio;
|
|
221
|
+
|
|
222
|
+
out vec4 outColor;
|
|
223
|
+
|
|
224
|
+
void main() {
|
|
225
|
+
vec4 hdrColor = texture(u_main_texture, v_texcoord);
|
|
226
|
+
vec4 bloomColor = texture(u_bloom_texture, v_texcoord);
|
|
227
|
+
vec4 result;
|
|
228
|
+
if (bloomColor.a > 0.09){
|
|
229
|
+
result = bloomColor * u_exposure;
|
|
230
|
+
} else {
|
|
231
|
+
result = hdrColor + bloomColor * u_exposure;
|
|
232
|
+
}
|
|
233
|
+
result = pow(result, vec4(1.0 / u_gamma));
|
|
234
|
+
outColor = vec4(result.rgb, result.a * u_final_alpha_ratio);
|
|
235
|
+
}
|
|
236
|
+
`;
|
|
237
|
+
const program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
|
|
238
|
+
const buffer = gl.createBuffer();
|
|
239
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
240
|
+
const vao = gl.createVertexArray();
|
|
206
241
|
gl.bindVertexArray(vao);
|
|
207
242
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
208
243
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
@@ -225,14 +260,137 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
225
260
|
u_gamma: gl.getUniformLocation(program, "u_gamma"),
|
|
226
261
|
u_final_alpha_ratio: gl.getUniformLocation(program, "u_final_alpha_ratio"),
|
|
227
262
|
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
263
|
+
}
|
|
264
|
+
_createBlurProgram() {
|
|
265
|
+
const gl = this.gl;
|
|
266
|
+
const vertexShader = `#version 300 es
|
|
267
|
+
precision highp float;
|
|
268
|
+
|
|
269
|
+
in vec2 a_position;
|
|
270
|
+
out vec2 v_texcoord;
|
|
271
|
+
|
|
272
|
+
void main() {
|
|
273
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
274
|
+
v_texcoord = a_position.xy * 0.5 + 0.5;
|
|
275
|
+
}
|
|
276
|
+
`;
|
|
277
|
+
const fragmentShader = `#version 300 es
|
|
278
|
+
precision highp float;
|
|
279
|
+
|
|
280
|
+
in vec2 v_texcoord;
|
|
281
|
+
|
|
282
|
+
uniform sampler2D u_texture;
|
|
283
|
+
uniform bool u_horizontal;
|
|
284
|
+
uniform float u_weight[5];
|
|
285
|
+
uniform float u_alpha_threshold;
|
|
286
|
+
uniform bool u_glow;
|
|
287
|
+
out vec4 outColor;
|
|
288
|
+
|
|
289
|
+
void main()
|
|
290
|
+
{
|
|
291
|
+
vec2 tex_offset = vec2(
|
|
292
|
+
1.0 / float(textureSize(u_texture, 0).x),
|
|
293
|
+
1.0 / float(textureSize(u_texture, 0).y) ); // gets size of single texel
|
|
294
|
+
vec3 color = vec3(0.0);
|
|
295
|
+
float total_alpha = texture(u_texture, v_texcoord).a * u_weight[0];
|
|
296
|
+
if (total_alpha > 0.0){
|
|
297
|
+
color = texture(u_texture, v_texcoord).rgb;
|
|
298
|
+
}
|
|
299
|
+
vec2 offset = vec2(0.0);
|
|
300
|
+
float alpha;
|
|
301
|
+
float color_count = 0.0;
|
|
302
|
+
if (!u_glow){
|
|
303
|
+
if(u_horizontal){
|
|
304
|
+
for(int i = 1; i < 5; ++i)
|
|
305
|
+
{
|
|
306
|
+
offset = vec2(tex_offset.x * float(i), 0.0);
|
|
307
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
308
|
+
|
|
309
|
+
if (alpha > u_alpha_threshold){
|
|
310
|
+
// color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
311
|
+
color += texture(u_texture, v_texcoord + offset).rgb;
|
|
312
|
+
total_alpha += alpha;
|
|
313
|
+
color_count += 1.0;
|
|
314
|
+
}
|
|
315
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
316
|
+
if (alpha > u_alpha_threshold){
|
|
317
|
+
// color = max( color, texture(u_texture, v_texcoord - offset).rgb);
|
|
318
|
+
color += texture(u_texture, v_texcoord - offset).rgb ;
|
|
319
|
+
total_alpha += alpha;
|
|
320
|
+
color_count += 1.0;
|
|
321
|
+
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
for(int i = 1; i < 5; ++i)
|
|
326
|
+
{
|
|
327
|
+
offset = vec2(0.0, tex_offset.y * float(i));
|
|
328
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
329
|
+
if (alpha > u_alpha_threshold){
|
|
330
|
+
// color = max( color , texture(u_texture, v_texcoord + offset).rgb);
|
|
331
|
+
color += texture(u_texture, v_texcoord + offset).rgb;
|
|
332
|
+
total_alpha += alpha;
|
|
333
|
+
color_count += 1.0;
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
337
|
+
if (alpha > u_alpha_threshold){
|
|
338
|
+
// color = max( color, texture(u_texture, v_texcoord - offset).rgb );
|
|
339
|
+
color += texture(u_texture, v_texcoord - offset).rgb ;
|
|
340
|
+
total_alpha += alpha;
|
|
341
|
+
color_count += 1.0;
|
|
342
|
+
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
}
|
|
347
|
+
if (color_count > 0.0){
|
|
348
|
+
color /= color_count;
|
|
349
|
+
}
|
|
350
|
+
} else {
|
|
351
|
+
if(u_horizontal)
|
|
352
|
+
{
|
|
353
|
+
for(int i = 1; i < 5; ++i)
|
|
354
|
+
{
|
|
355
|
+
offset = vec2(tex_offset.x * float(i), 0.0);
|
|
356
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
357
|
+
|
|
358
|
+
if (alpha > u_alpha_threshold){
|
|
359
|
+
color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
360
|
+
total_alpha += alpha;
|
|
361
|
+
}
|
|
362
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
363
|
+
if (alpha > u_alpha_threshold){
|
|
364
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb);
|
|
365
|
+
|
|
366
|
+
total_alpha += alpha;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
else
|
|
371
|
+
{
|
|
372
|
+
for(int i = 1; i < 5; ++i)
|
|
373
|
+
{
|
|
374
|
+
offset = vec2(0.0, tex_offset.y * float(i));
|
|
375
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
376
|
+
if (alpha > u_alpha_threshold){
|
|
377
|
+
color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
378
|
+
total_alpha += alpha;
|
|
379
|
+
}
|
|
380
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
381
|
+
if (alpha > u_alpha_threshold){
|
|
382
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb );
|
|
383
|
+
total_alpha += alpha;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
outColor = vec4(color, total_alpha);
|
|
389
|
+
}
|
|
390
|
+
`;
|
|
391
|
+
const program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
|
|
392
|
+
const buffer = gl.createBuffer();
|
|
393
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
236
394
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
237
395
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
238
396
|
-1, -1,
|
|
@@ -242,7 +400,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
242
400
|
1, 1,
|
|
243
401
|
-1, 1,
|
|
244
402
|
]), gl.STATIC_DRAW);
|
|
245
|
-
|
|
403
|
+
const vao = gl.createVertexArray();
|
|
246
404
|
gl.bindVertexArray(vao);
|
|
247
405
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
248
406
|
gl.enableVertexAttribArray(a_position);
|
|
@@ -257,14 +415,84 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
257
415
|
u_alpha_threshold: gl.getUniformLocation(program, "u_alpha_threshold"),
|
|
258
416
|
u_glow: gl.getUniformLocation(program, "u_glow"),
|
|
259
417
|
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
418
|
+
}
|
|
419
|
+
_createBlurProgramHOLD() {
|
|
420
|
+
const gl = this.gl;
|
|
421
|
+
const vertexShader = `#version 300 es
|
|
422
|
+
precision highp float;
|
|
423
|
+
|
|
424
|
+
in vec2 a_position;
|
|
425
|
+
out vec2 v_texcoord;
|
|
426
|
+
|
|
427
|
+
void main() {
|
|
428
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
429
|
+
v_texcoord = a_position.xy * 0.5 + 0.5;
|
|
430
|
+
}
|
|
431
|
+
`;
|
|
432
|
+
const fragmentShader = `#version 300 es
|
|
433
|
+
precision highp float;
|
|
434
|
+
|
|
435
|
+
in vec2 v_texcoord;
|
|
436
|
+
|
|
437
|
+
uniform sampler2D u_texture;
|
|
438
|
+
uniform bool u_horizontal;
|
|
439
|
+
uniform float u_weight[5];
|
|
440
|
+
uniform float u_alpha_threshold;
|
|
441
|
+
|
|
442
|
+
out vec4 outColor;
|
|
443
|
+
|
|
444
|
+
void main()
|
|
445
|
+
{
|
|
446
|
+
vec2 tex_offset = vec2(1) / vec2(textureSize(u_texture, 0)); // gets size of single texel
|
|
447
|
+
vec3 color = vec3(0.0);
|
|
448
|
+
float total_alpha = texture(u_texture, v_texcoord).a * u_weight[0];
|
|
449
|
+
if (total_alpha > 0.0){
|
|
450
|
+
color = texture(u_texture, v_texcoord).rgb;
|
|
451
|
+
}
|
|
452
|
+
vec2 offset = vec2(0.0);
|
|
453
|
+
float alpha;
|
|
454
|
+
|
|
455
|
+
if(u_horizontal)
|
|
456
|
+
{
|
|
457
|
+
for(int i = 1; i < 5; ++i)
|
|
458
|
+
{
|
|
459
|
+
offset = vec2(tex_offset.x * float(i), 0.0);
|
|
460
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
461
|
+
|
|
462
|
+
if (alpha > u_alpha_threshold){
|
|
463
|
+
color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
464
|
+
total_alpha += alpha;
|
|
465
|
+
}
|
|
466
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
467
|
+
if (alpha > u_alpha_threshold){
|
|
468
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb);
|
|
469
|
+
total_alpha += alpha;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
else
|
|
474
|
+
{
|
|
475
|
+
for(int i = 1; i < 5; ++i)
|
|
476
|
+
{
|
|
477
|
+
offset = vec2(0.0, tex_offset.y * float(i));
|
|
478
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
479
|
+
if (alpha > u_alpha_threshold){
|
|
480
|
+
color = max( color , texture(u_texture, v_texcoord + offset).rgb);
|
|
481
|
+
total_alpha += alpha;
|
|
482
|
+
}
|
|
483
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
484
|
+
if (alpha > u_alpha_threshold){
|
|
485
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb );
|
|
486
|
+
total_alpha += alpha;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
outColor = vec4(color, total_alpha);
|
|
491
|
+
}
|
|
492
|
+
`;
|
|
493
|
+
const program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
|
|
494
|
+
const buffer = gl.createBuffer();
|
|
495
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
268
496
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
269
497
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
270
498
|
-1, -1,
|
|
@@ -274,7 +502,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
274
502
|
1, 1,
|
|
275
503
|
-1, 1,
|
|
276
504
|
]), gl.STATIC_DRAW);
|
|
277
|
-
|
|
505
|
+
const vao = gl.createVertexArray();
|
|
278
506
|
gl.bindVertexArray(vao);
|
|
279
507
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
280
508
|
gl.enableVertexAttribArray(a_position);
|
|
@@ -288,28 +516,108 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
288
516
|
u_weight: gl.getUniformLocation(program, "u_weight"),
|
|
289
517
|
u_alpha_threshold: gl.getUniformLocation(program, "u_alpha_threshold"),
|
|
290
518
|
};
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
|
|
519
|
+
}
|
|
520
|
+
resize(width, height) {
|
|
521
|
+
const { gl, _lineProgram } = this;
|
|
294
522
|
this._width = width;
|
|
295
523
|
this._height = height;
|
|
296
|
-
|
|
524
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
297
525
|
this._createInnerTextures();
|
|
298
526
|
gl.useProgram(_lineProgram.program);
|
|
299
527
|
gl.uniform2fv(_lineProgram.u_scrWH, [width, height]);
|
|
300
528
|
gl.useProgram(currentProgram);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
529
|
+
}
|
|
530
|
+
_createLineProgram() {
|
|
531
|
+
const gl = this.gl;
|
|
532
|
+
const vertexShader = `#version 300 es
|
|
533
|
+
precision highp float;
|
|
534
|
+
|
|
535
|
+
in vec3 a_position;
|
|
536
|
+
in float a_time;
|
|
537
|
+
in vec3 a_color;
|
|
538
|
+
in float a_track_start_time;
|
|
539
|
+
in float a_track_end_time;
|
|
540
|
+
|
|
541
|
+
uniform mat4 uModelViewMatrix;
|
|
542
|
+
uniform mat4 uProjectionMatrix;
|
|
543
|
+
uniform vec3 uTranslate;
|
|
544
|
+
|
|
545
|
+
uniform bool u_is_3d;
|
|
546
|
+
uniform vec2 u_mapWH;
|
|
547
|
+
uniform vec2 u_scrWH;
|
|
548
|
+
|
|
549
|
+
out float v_time;
|
|
550
|
+
out vec3 v_color;
|
|
551
|
+
out float v_track_start_time;
|
|
552
|
+
out float v_track_end_time;
|
|
553
|
+
|
|
554
|
+
${util_1.shaderfunctions.pixelXYToCartesian3DPoint}
|
|
555
|
+
${util_1.shaderfunctions.pixelXYToCartesian2DPoint}
|
|
556
|
+
|
|
557
|
+
void main() {
|
|
558
|
+
v_time = a_time;
|
|
559
|
+
v_color = a_color;
|
|
560
|
+
v_track_start_time = a_track_start_time;
|
|
561
|
+
v_track_end_time = a_track_end_time;
|
|
562
|
+
if (u_is_3d){
|
|
563
|
+
vec3 pos = pixelXYToCartesian3DPoint(a_position);
|
|
564
|
+
gl_Position = uProjectionMatrix * uModelViewMatrix * vec4(pos - uTranslate, 1.0);
|
|
565
|
+
} else {
|
|
566
|
+
vec2 xy = pixelXYToCartesian2DPoint(a_position.xy, uTranslate.xy, u_mapWH, u_scrWH);
|
|
567
|
+
gl_Position = uProjectionMatrix * vec4(xy.x, xy.y, 0.0, 1.0);
|
|
568
|
+
|
|
569
|
+
}
|
|
570
|
+
gl_PointSize = 1.0;
|
|
571
|
+
}
|
|
572
|
+
`;
|
|
573
|
+
const fragmentShader = `#version 300 es
|
|
574
|
+
precision lowp float;
|
|
575
|
+
|
|
576
|
+
in float v_time;
|
|
577
|
+
in vec3 v_color;
|
|
578
|
+
in float v_track_start_time;
|
|
579
|
+
in float v_track_end_time;
|
|
580
|
+
|
|
581
|
+
uniform float u_head_time;
|
|
582
|
+
uniform float u_tail_time;
|
|
583
|
+
|
|
584
|
+
uniform float u_head_percentage;
|
|
585
|
+
uniform float u_route_alpha;
|
|
586
|
+
|
|
587
|
+
layout(location = 0) out vec4 outColor0;
|
|
588
|
+
layout(location = 1) out vec4 outColor1;
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
void main() {
|
|
592
|
+
if ( u_tail_time > v_track_end_time || u_head_time < v_track_start_time) discard;
|
|
593
|
+
// if ( v_time < u_tail_time || v_time > u_head_time) discard;
|
|
594
|
+
|
|
595
|
+
float gap = u_head_time - u_tail_time;
|
|
596
|
+
float head = gap * u_head_percentage;
|
|
597
|
+
float dist = u_head_time - v_time;
|
|
598
|
+
if ((v_time > u_head_time ) || (v_time < u_tail_time) ){
|
|
599
|
+
|
|
600
|
+
outColor0 = vec4(v_color , u_route_alpha);
|
|
601
|
+
} else if (dist < head) {
|
|
602
|
+
// white head
|
|
603
|
+
outColor0 = vec4(1.0, 1.0, 1.0, 0.77 + ( u_route_alpha * 0.23));
|
|
604
|
+
outColor1 = vec4(1.0, 1.0, 1.0, 0.77 + ( u_route_alpha * 0.23));
|
|
605
|
+
//
|
|
606
|
+
} else {
|
|
607
|
+
// colored body of lines
|
|
608
|
+
float alpha = ((gap - dist) / gap) / 2.0 + 0.5;
|
|
609
|
+
outColor0 = vec4(v_color , alpha );
|
|
610
|
+
outColor1 = vec4(v_color , alpha );
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
`;
|
|
614
|
+
const program = (0, util_1.createProgram)(this.gl, vertexShader, fragmentShader);
|
|
615
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
616
|
+
const a_time = gl.getAttribLocation(program, "a_time");
|
|
617
|
+
const a_track_start_time = gl.getAttribLocation(program, "a_track_start_time");
|
|
618
|
+
const a_track_end_time = gl.getAttribLocation(program, "a_track_end_time");
|
|
619
|
+
const a_color = gl.getAttribLocation(program, "a_color");
|
|
620
|
+
const vao = gl.createVertexArray();
|
|
313
621
|
gl.bindVertexArray(vao);
|
|
314
622
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._inBuffer);
|
|
315
623
|
gl.enableVertexAttribArray(a_position);
|
|
@@ -337,7 +645,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
337
645
|
u_head_percentage: gl.getUniformLocation(program, "u_head_percentage"),
|
|
338
646
|
u_route_alpha: gl.getUniformLocation(program, "u_route_alpha"),
|
|
339
647
|
};
|
|
340
|
-
}
|
|
648
|
+
}
|
|
341
649
|
/**
|
|
342
650
|
* @param { Float32Array} data // [x, y, z, time, x, y, z, time, ...]
|
|
343
651
|
*/
|
|
@@ -346,19 +654,19 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
346
654
|
// gl.bindBuffer(gl.ARRAY_BUFFER, this._inBuffer);
|
|
347
655
|
// gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
348
656
|
// }
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
657
|
+
setIs3D(is3d) {
|
|
658
|
+
const { gl, _lineProgram } = this;
|
|
659
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
352
660
|
gl.useProgram(_lineProgram.program);
|
|
353
661
|
gl.uniform1i(_lineProgram.u_is_3d, is3d);
|
|
354
662
|
gl.useProgram(currentProgram);
|
|
355
|
-
}
|
|
356
|
-
|
|
663
|
+
}
|
|
664
|
+
setTotalLength(totalLength) {
|
|
357
665
|
this._totalLength = totalLength;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
666
|
+
}
|
|
667
|
+
_createTextures() {
|
|
668
|
+
const { gl, _width, _height } = this;
|
|
669
|
+
const texture = gl.createTexture();
|
|
362
670
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
363
671
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, _width, _height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); // UNSIGNED_BYTE
|
|
364
672
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
@@ -367,9 +675,9 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
367
675
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
368
676
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
369
677
|
return texture;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
678
|
+
}
|
|
679
|
+
_resetTexture() {
|
|
680
|
+
const { gl, _width, _height } = this;
|
|
373
681
|
gl.bindTexture(gl.TEXTURE_2D, this._middleTexture); // UNSIGNED_BYTE
|
|
374
682
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, _width, _height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
375
683
|
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[0]);
|
|
@@ -377,10 +685,9 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
377
685
|
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[1]);
|
|
378
686
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, _width, _height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
379
687
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
var _a = this, gl = _a.gl, _lineProgram = _a._lineProgram, _blurProgram = _a._blurProgram, _blurRepetition = _a._blurRepetition, _premultipliedAlpha = _a._premultipliedAlpha;
|
|
688
|
+
}
|
|
689
|
+
draw(u_head_time, u_tail_time, uProjectionMatrix, uModelViewMatrix, uTranslate, u_mapWH = null) {
|
|
690
|
+
const { gl, _lineProgram, _blurProgram, _blurRepetition, _premultipliedAlpha } = this;
|
|
384
691
|
this._resetTexture();
|
|
385
692
|
// if (_premultipliedAlpha) {
|
|
386
693
|
gl.enable(gl.BLEND);
|
|
@@ -415,7 +722,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
415
722
|
{ // blur ping pong
|
|
416
723
|
gl.useProgram(_blurProgram.program);
|
|
417
724
|
gl.bindVertexArray(_blurProgram.vao);
|
|
418
|
-
for (
|
|
725
|
+
for (let i = 0; i < _blurRepetition * 2; i++) {
|
|
419
726
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._blurFrameBuffers[i % 2]);
|
|
420
727
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._blurTextures[(i + 1) % 2], 0);
|
|
421
728
|
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[i % 2]);
|
|
@@ -443,9 +750,9 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
443
750
|
if (_premultipliedAlpha) {
|
|
444
751
|
(0, util_1.defaultblendfunction)(gl);
|
|
445
752
|
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
753
|
+
}
|
|
754
|
+
free() {
|
|
755
|
+
const { gl, _lineProgram, _blurProgram, _combineProgram } = this;
|
|
449
756
|
gl.deleteBuffer(this._inBuffer);
|
|
450
757
|
gl.deleteFramebuffer(this._frameBuffer);
|
|
451
758
|
gl.deleteFramebuffer(this._blurFrameBuffers[0]);
|
|
@@ -460,7 +767,6 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
460
767
|
gl.deleteProgram(_lineProgram.program);
|
|
461
768
|
gl.deleteProgram(_blurProgram.program);
|
|
462
769
|
gl.deleteProgram(_combineProgram.program);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
}());
|
|
770
|
+
}
|
|
771
|
+
}
|
|
466
772
|
exports.default = TrackGlowLineProgram;
|