@pirireis/webglobeplugins 0.9.11 → 0.9.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Math/angle-calculation.js +9 -11
- package/Math/arc.js +38 -41
- package/Math/bounds/line-bbox.js +79 -83
- package/Math/constants.js +4 -9
- package/Math/frustum/types.js +1 -2
- package/Math/juction/arc-plane.js +33 -36
- package/Math/juction/line-sphere.js +15 -18
- package/Math/juction/plane-plane.js +20 -23
- package/Math/line.js +42 -47
- package/Math/methods.js +69 -92
- package/Math/plane.js +33 -38
- package/Math/quaternion.js +48 -55
- package/Math/types.js +1 -2
- package/Math/utils.js +2 -4
- package/Math/vec3.js +46 -52
- package/algorithms/search-binary.js +5 -8
- package/altitude-locator/draw-subset-obj.js +8 -11
- package/altitude-locator/plugin.js +114 -133
- package/altitude-locator/types.js +1 -3
- package/arrowfield/adaptor.js +3 -7
- package/arrowfield/index.js +3 -10
- package/arrowfield/plugin.js +63 -69
- package/bearing-line/index.js +2 -8
- package/bearing-line/plugin.js +218 -248
- package/circle-line-chain/chain-list-map.js +82 -92
- package/circle-line-chain/plugin.js +147 -182
- package/circle-line-chain/util.js +1 -5
- package/compass-rose/compass-rose-padding-flat.js +111 -140
- package/compass-rose/compass-text-writer.js +63 -75
- package/compass-rose/index.js +3 -7
- package/compassrose/compassrose.js +50 -57
- package/compassrose/index.js +2 -8
- package/heatwave/index.js +3 -10
- package/heatwave/isobar/objectarraylabels.js +50 -56
- package/heatwave/isobar/plugin.js +111 -170
- package/heatwave/isobar/quadtreecontours.js +78 -96
- package/heatwave/plugins/heatwaveglobeshell.js +73 -94
- package/index.js +12 -58
- package/package.json +1 -1
- package/partialrings/buffer-manager.js +32 -70
- package/partialrings/index.js +2 -41
- package/partialrings/plugin.js +55 -98
- package/partialrings/program.js +141 -59
- package/pin/pin-object-array.js +89 -97
- package/pin/pin-point-totem.js +21 -22
- package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +11 -14
- package/point-heat-map/plugin-webworker.js +45 -53
- package/point-heat-map/point-to-heat-map-flow.js +46 -51
- package/point-tracks/key-methods.js +2 -5
- package/point-tracks/plugin.js +141 -170
- package/programs/arrowfield/index.js +2 -7
- package/programs/arrowfield/logic.js +172 -67
- package/programs/arrowfield/object.js +35 -43
- package/programs/data2legend/density-to-legend.js +47 -26
- package/programs/data2legend/point-to-density-texture.js +56 -34
- package/programs/float2legendwithratio/index.js +2 -8
- package/programs/float2legendwithratio/logic.js +88 -45
- package/programs/float2legendwithratio/object.js +45 -54
- package/programs/globe-util/is-globe-moved.js +10 -13
- package/programs/globeshell/index.js +2 -8
- package/programs/globeshell/wiggle/index.js +2 -8
- package/programs/globeshell/wiggle/logic.js +191 -101
- package/programs/globeshell/wiggle/object.js +35 -43
- package/programs/helpers/blender/program.js +36 -22
- package/programs/helpers/fadeaway/index.js +2 -7
- package/programs/helpers/fadeaway/logic.js +36 -17
- package/programs/helpers/fadeaway/object.js +11 -18
- package/programs/helpers/index.js +2 -8
- package/programs/index.js +9 -58
- package/programs/line-on-globe/angled-line.js +95 -39
- package/programs/line-on-globe/circle-accurate-3d.js +86 -39
- package/programs/line-on-globe/circle-accurate-flat.js +116 -64
- package/programs/line-on-globe/circle-accurate.js +113 -46
- package/programs/line-on-globe/circle.js +106 -44
- package/programs/line-on-globe/degree-padding-around-circle-3d.js +89 -42
- package/programs/line-on-globe/lines-color-instanced-flat.js +84 -43
- package/programs/line-on-globe/linestrip.js +126 -63
- package/programs/line-on-globe/naive-accurate-flexible.js +126 -59
- package/programs/line-on-globe/to-the-surface.js +62 -35
- package/programs/line-on-globe/util.js +2 -5
- package/programs/picking/pickable-renderer.js +127 -46
- package/programs/point-on-globe/element-globe-surface-glow.js +83 -46
- package/programs/point-on-globe/element-point-glow.js +112 -47
- package/programs/point-on-globe/square-pixel-point.js +80 -34
- package/programs/programcache.js +14 -19
- package/programs/rings/distancering/circleflatprogram.js +76 -70
- package/programs/rings/distancering/circlepaddingfreeangleprogram.js +168 -194
- package/programs/rings/distancering/circlepaddysharedbuffer.js +121 -200
- package/programs/rings/distancering/index.js +5 -14
- package/programs/rings/distancering/paddyflatprogram.js +87 -70
- package/programs/rings/distancering/paddyflatprogram2d.js +89 -72
- package/programs/rings/distancering/paddyflatprogram3d.js +87 -70
- package/programs/rings/index.js +1 -17
- package/programs/rings/partial-ring/piece-of-pie.js +144 -44
- package/programs/totems/camerauniformblock.js +65 -56
- package/programs/totems/canvas-webglobe-info.js +49 -45
- package/programs/totems/gpu-selection-uniform-block.js +45 -45
- package/programs/totems/index.js +2 -40
- package/programs/two-d/pixel-padding-for-compass.js +94 -36
- package/programs/util.js +7 -10
- package/programs/vectorfields/index.js +3 -23
- package/programs/vectorfields/logics/drawrectangleparticles.js +73 -35
- package/programs/vectorfields/logics/index.js +4 -12
- package/programs/vectorfields/logics/pixelbased.js +94 -41
- package/programs/vectorfields/logics/ubo.js +32 -32
- package/programs/vectorfields/pingpongbuffermanager.js +30 -37
- package/rangerings/enum.js +2 -5
- package/rangerings/index.js +5 -15
- package/rangerings/plugin.js +223 -286
- package/rangerings/rangeringangletext.js +122 -137
- package/rangerings/ring-account.js +53 -75
- package/shaders/fragment-toy/firework.js +55 -4
- package/shaders/fragment-toy/singularity.js +56 -5
- package/timetracks/adaptors-line-strip.js +27 -44
- package/timetracks/adaptors.js +48 -67
- package/timetracks/index.js +5 -19
- package/timetracks/plugin-line-strip.js +65 -79
- package/timetracks/plugin.js +71 -85
- package/timetracks/program-line-strip.js +297 -107
- package/timetracks/program.js +421 -118
- package/timetracks/programpoint-line-strip.js +98 -48
- package/timetracks/programpoint.js +91 -48
- package/util/account/bufferoffsetmanager.js +72 -98
- package/util/account/index.js +3 -23
- package/util/account/single-attribute-buffer-management/buffer-manager.js +44 -48
- package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +68 -98
- package/util/account/single-attribute-buffer-management/index.js +4 -9
- package/util/account/single-attribute-buffer-management/object-store.js +29 -34
- package/util/account/single-attribute-buffer-management/types.js +1 -2
- package/util/account/util.js +2 -8
- package/util/algorithms/search-binary.js +5 -8
- package/util/check/get.js +5 -9
- package/util/check/typecheck.js +13 -24
- package/util/geometry/index.js +10 -18
- package/util/gl-util/buffer/attribute-loader.js +10 -26
- package/util/gl-util/buffer/index.js +2 -5
- package/util/gl-util/draw-options/methods.js +10 -15
- package/util/gl-util/uniform-block/manager.js +69 -72
- package/util/heatwavedatamanager/datamanager.js +56 -119
- package/util/heatwavedatamanager/index.js +3 -10
- package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +38 -47
- package/util/heatwavedatamanager/pointcoordsmeta.js +9 -13
- package/util/index.js +13 -57
- package/util/interpolation/timetrack/index.js +2 -5
- package/util/interpolation/timetrack/timetrack-interpolator.js +30 -36
- package/util/interpolation/timetrack/web-worker-str.js +180 -5
- package/util/interpolation/timetrack/web-worker.js +4 -6
- package/util/jshelpers/data-filler.js +8 -11
- package/util/jshelpers/equality.js +1 -3
- package/util/jshelpers/index.js +2 -37
- package/util/jshelpers/timefilters.js +8 -10
- package/util/picking/fence.js +8 -11
- package/util/picking/picker-displayer.js +49 -58
- package/util/programs/draw-texture-on-canvas.js +41 -26
- package/util/programs/index.js +1 -17
- package/util/programs/shapesonglobe.js +104 -68
- package/util/programs/supersampletotextures.js +45 -43
- package/util/programs/texturetoglobe.js +99 -52
- package/util/shaderfunctions/geometrytransformations.js +323 -35
- package/util/shaderfunctions/index.js +2 -18
- package/util/shaderfunctions/nodata.js +8 -5
- package/util/shaderfunctions/noisefunctions.js +40 -12
- package/util/surface-line-data/arcs-to-cuts.js +20 -23
- package/util/webglobe/gldefaultstates.js +1 -4
- package/util/webglobe/index.js +2 -18
- package/util/webglobe/rasteroverlay.js +36 -41
- package/util/webglobjectbuilders.js +70 -93
- package/util/webglobjectbuilders1.js +63 -82
- package/waveparticles/adaptor.js +7 -10
- package/waveparticles/index.js +3 -10
- package/waveparticles/plugin.js +82 -90
- package/wind/imagetovectorfieldandmagnitude.js +16 -19
- package/wind/index.js +5 -14
- package/wind/plugin.js +454 -291
- package/wind/vectorfieldimage.js +6 -8
- package/write-text/attached-text-writer.js +48 -54
- package/write-text/context-text.js +52 -63
- package/write-text/context-text3.js +71 -80
- package/write-text/index.js +1 -5
package/timetracks/program.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Author: Toprak Nihat Deniz Ozturk
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var TrackGlowLineProgram = /** @class */ (function () {
|
|
4
|
+
import { createProgram, defaultblendfunction, shaderfunctions } from "../util";
|
|
5
|
+
export default class TrackGlowLineProgram {
|
|
8
6
|
/**
|
|
9
7
|
* @param {WebGL2RenderingContext} gl
|
|
10
8
|
* @param {number} width
|
|
@@ -19,8 +17,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
19
17
|
* @param {number} options.finalAlphaRatio 0 ~ 1
|
|
20
18
|
* @param {+int} options.blurRepetition 1 ~ inf default 2
|
|
21
19
|
*/
|
|
22
|
-
|
|
23
|
-
if (options === void 0) { options = {}; }
|
|
20
|
+
constructor(gl, attrBuffer, width, height, options = {}) {
|
|
24
21
|
this.gl = gl;
|
|
25
22
|
this.program = null;
|
|
26
23
|
this._premultipliedAlpha = false;
|
|
@@ -39,14 +36,13 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
39
36
|
this._totalLength = 0;
|
|
40
37
|
this._initUniforms(options);
|
|
41
38
|
}
|
|
42
|
-
|
|
39
|
+
_createInnerTextures() {
|
|
43
40
|
this._middleTexture = this._createTextures();
|
|
44
41
|
this._blurTextures = [this._createTextures(), this._createTextures()];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
42
|
+
}
|
|
43
|
+
_initUniforms(options = {}) {
|
|
44
|
+
const { gl, _lineProgram, _blurProgram, _combineProgram } = this;
|
|
45
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
50
46
|
gl.useProgram(_lineProgram.program);
|
|
51
47
|
gl.uniform1f(_lineProgram.u_head_percentage, options.headPercentage || 1.0 / 30.0);
|
|
52
48
|
gl.uniform1f(_lineProgram.u_route_alpha, options.routeAlpha || 0.025);
|
|
@@ -59,150 +55,187 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
59
55
|
gl.uniform1f(_combineProgram.u_gamma, options.gamma || 1.0);
|
|
60
56
|
gl.uniform1f(_combineProgram.u_final_alpha_ratio, options.finalAlphaRatio || 1.0);
|
|
61
57
|
gl.useProgram(currentProgram);
|
|
62
|
-
}
|
|
63
|
-
|
|
58
|
+
}
|
|
59
|
+
setPremultipliedAlpha(boolean) {
|
|
64
60
|
if (typeof boolean !== 'boolean') {
|
|
65
61
|
console.warn("boolean should be a boolean value, but got", boolean);
|
|
66
62
|
return;
|
|
67
63
|
}
|
|
68
64
|
this._premultipliedAlpha = boolean;
|
|
69
|
-
}
|
|
65
|
+
}
|
|
70
66
|
/**
|
|
71
67
|
* @param {number} alpha 0 ~ 1
|
|
72
68
|
* @returns
|
|
73
69
|
*/
|
|
74
|
-
|
|
70
|
+
setAlphaThreshold(alpha) {
|
|
75
71
|
if (alpha < 0 || alpha > 1) {
|
|
76
72
|
console.warn("alpha should be between 0 and 1, but got", alpha);
|
|
77
73
|
return;
|
|
78
74
|
}
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
const { gl, _blurProgram } = this;
|
|
76
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
81
77
|
gl.useProgram(_blurProgram.program);
|
|
82
78
|
gl.uniform1f(_blurProgram.u_alpha_threshold, alpha);
|
|
83
79
|
gl.useProgram(currentProgram);
|
|
84
|
-
}
|
|
80
|
+
}
|
|
85
81
|
/**
|
|
86
82
|
* @param {number} gamma 0 ~ inf
|
|
87
83
|
*/
|
|
88
|
-
|
|
84
|
+
setGamma(gamma) {
|
|
89
85
|
if (gamma < 0) {
|
|
90
86
|
console.warn("gamma should be equal or greater than 0, but got", gamma);
|
|
91
87
|
return;
|
|
92
88
|
}
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
const { gl, _combineProgram } = this;
|
|
90
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
95
91
|
gl.useProgram(_combineProgram.program);
|
|
96
92
|
gl.uniform1f(_combineProgram.u_gamma, gamma);
|
|
97
93
|
gl.useProgram(currentProgram);
|
|
98
|
-
}
|
|
94
|
+
}
|
|
99
95
|
/**
|
|
100
96
|
*
|
|
101
97
|
* @param {number} exposure 0 ~ inf
|
|
102
98
|
* @returns
|
|
103
99
|
*/
|
|
104
|
-
|
|
100
|
+
setExposure(exposure) {
|
|
105
101
|
if (exposure < 0) {
|
|
106
102
|
console.warn("exposure should be equal or greater than 0, but got", exposure);
|
|
107
103
|
return;
|
|
108
104
|
}
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
const { gl, _combineProgram } = this;
|
|
106
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
111
107
|
gl.useProgram(_combineProgram.program);
|
|
112
108
|
gl.uniform1f(_combineProgram.u_exposure, exposure);
|
|
113
109
|
gl.useProgram(currentProgram);
|
|
114
|
-
}
|
|
110
|
+
}
|
|
115
111
|
/**
|
|
116
112
|
*
|
|
117
113
|
* @param {number} ratio 0 ~ 1
|
|
118
114
|
* @returns
|
|
119
115
|
*/
|
|
120
|
-
|
|
116
|
+
setFinalAlphaRatio(ratio) {
|
|
121
117
|
if (ratio < 0 || ratio > 1) {
|
|
122
118
|
console.warn("ratio should be between 0 and 1, but got", ratio);
|
|
123
119
|
return;
|
|
124
120
|
}
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
const { gl, _combineProgram } = this;
|
|
122
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
127
123
|
gl.useProgram(_combineProgram.program);
|
|
128
124
|
gl.uniform1f(_combineProgram.u_final_alpha_ratio, ratio);
|
|
129
125
|
gl.useProgram(currentProgram);
|
|
130
|
-
}
|
|
126
|
+
}
|
|
131
127
|
/**
|
|
132
128
|
* @param {Array.<Number>} weight [w1, w2, w3, w4, w5]
|
|
133
129
|
*/
|
|
134
|
-
|
|
130
|
+
setBlurWeights(weights) {
|
|
135
131
|
if (weights.length !== 5) {
|
|
136
132
|
console.warn("weights should be an array of 5 numbers, but got", weights);
|
|
137
133
|
return;
|
|
138
134
|
}
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
const { gl, _blurProgram } = this;
|
|
136
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
141
137
|
gl.useProgram(_blurProgram.program);
|
|
142
138
|
gl.uniform1fv(_blurProgram.u_weight, weights);
|
|
143
139
|
gl.useProgram(currentProgram);
|
|
144
|
-
}
|
|
140
|
+
}
|
|
145
141
|
/**
|
|
146
142
|
* @param {number} routeAlpha 0 ~ 1
|
|
147
143
|
*/
|
|
148
|
-
|
|
144
|
+
setRouteAlpha(routeAlpha) {
|
|
149
145
|
if (routeAlpha < 0 || routeAlpha > 1) {
|
|
150
146
|
console.warn("routeAlpha should be between 0 and 1, but got", routeAlpha);
|
|
151
147
|
return;
|
|
152
148
|
}
|
|
153
|
-
|
|
154
|
-
|
|
149
|
+
const { gl, _lineProgram } = this;
|
|
150
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
155
151
|
gl.useProgram(_lineProgram.program);
|
|
156
152
|
gl.uniform1f(_lineProgram.u_route_alpha, routeAlpha);
|
|
157
153
|
gl.useProgram(currentProgram);
|
|
158
|
-
}
|
|
159
|
-
|
|
154
|
+
}
|
|
155
|
+
setGlow(boolean) {
|
|
160
156
|
if (typeof boolean !== 'boolean') {
|
|
161
157
|
console.warn("boolean should be a boolean value, but got", boolean);
|
|
162
158
|
return;
|
|
163
159
|
}
|
|
164
|
-
|
|
165
|
-
|
|
160
|
+
const { gl, _blurProgram } = this;
|
|
161
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
166
162
|
gl.useProgram(_blurProgram.program);
|
|
167
163
|
gl.uniform1i(_blurProgram.u_glow, boolean);
|
|
168
164
|
gl.useProgram(currentProgram);
|
|
169
|
-
}
|
|
165
|
+
}
|
|
170
166
|
/**
|
|
171
167
|
* blur uses pingpong effect. This number decides how many times the blur will be applied.
|
|
172
168
|
* @param {+int} repetition
|
|
173
169
|
* @returns
|
|
174
170
|
*/
|
|
175
|
-
|
|
171
|
+
setBlurRepetition(repetition) {
|
|
176
172
|
if (repetition < 0 && repetition % 1 !== 0) {
|
|
177
173
|
console.warn("repetition should be an integer greater than 0, but got", repetition);
|
|
178
174
|
return;
|
|
179
175
|
}
|
|
180
176
|
this._blurRepetition = repetition;
|
|
181
|
-
}
|
|
177
|
+
}
|
|
182
178
|
/**
|
|
183
179
|
* Head Is colored as white. This number decides proportion of the head according to the total length of the line.
|
|
184
180
|
* @param {Number} percentage 0 ~ 1
|
|
185
181
|
*/
|
|
186
|
-
|
|
182
|
+
setHeadPercentage(percentage) {
|
|
187
183
|
if (percentage < 0 || 1 < percentage) {
|
|
188
184
|
console.warn("percentage should be between 0 and 1, but got", percentage);
|
|
189
185
|
return;
|
|
190
186
|
}
|
|
191
187
|
;
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
const { gl, _lineProgram } = this;
|
|
189
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
194
190
|
gl.useProgram(_lineProgram.program);
|
|
195
191
|
gl.uniform1f(_lineProgram.u_head_percentage, percentage);
|
|
196
192
|
gl.useProgram(currentProgram);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
193
|
+
}
|
|
194
|
+
_createCombineProgram() {
|
|
195
|
+
const gl = this.gl;
|
|
196
|
+
const vertexShader = `#version 300 es
|
|
197
|
+
precision lowp float;
|
|
198
|
+
|
|
199
|
+
in vec2 a_position;
|
|
200
|
+
|
|
201
|
+
out vec2 v_texcoord;
|
|
202
|
+
|
|
203
|
+
void main() {
|
|
204
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
205
|
+
v_texcoord = a_position.xy * 0.5 + 0.5;
|
|
206
|
+
}
|
|
207
|
+
`;
|
|
208
|
+
const fragmentShader = `#version 300 es
|
|
209
|
+
precision lowp float;
|
|
210
|
+
|
|
211
|
+
in vec2 v_texcoord;
|
|
212
|
+
|
|
213
|
+
uniform sampler2D u_main_texture;
|
|
214
|
+
uniform sampler2D u_bloom_texture;
|
|
215
|
+
|
|
216
|
+
uniform float u_exposure;
|
|
217
|
+
uniform float u_gamma;
|
|
218
|
+
uniform float u_final_alpha_ratio;
|
|
219
|
+
|
|
220
|
+
out vec4 outColor;
|
|
221
|
+
|
|
222
|
+
void main() {
|
|
223
|
+
vec4 hdrColor = texture(u_main_texture, v_texcoord);
|
|
224
|
+
vec4 bloomColor = texture(u_bloom_texture, v_texcoord);
|
|
225
|
+
vec4 result;
|
|
226
|
+
if (bloomColor.a > 0.09){
|
|
227
|
+
result = bloomColor * u_exposure;
|
|
228
|
+
} else {
|
|
229
|
+
result = hdrColor + bloomColor * u_exposure;
|
|
230
|
+
}
|
|
231
|
+
result = pow(result, vec4(1.0 / u_gamma));
|
|
232
|
+
outColor = vec4(result.rgb, result.a * u_final_alpha_ratio);
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
const program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
236
|
+
const buffer = gl.createBuffer();
|
|
237
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
238
|
+
const vao = gl.createVertexArray();
|
|
206
239
|
gl.bindVertexArray(vao);
|
|
207
240
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
208
241
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
@@ -225,14 +258,137 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
225
258
|
u_gamma: gl.getUniformLocation(program, "u_gamma"),
|
|
226
259
|
u_final_alpha_ratio: gl.getUniformLocation(program, "u_final_alpha_ratio"),
|
|
227
260
|
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
261
|
+
}
|
|
262
|
+
_createBlurProgram() {
|
|
263
|
+
const gl = this.gl;
|
|
264
|
+
const vertexShader = `#version 300 es
|
|
265
|
+
precision highp float;
|
|
266
|
+
|
|
267
|
+
in vec2 a_position;
|
|
268
|
+
out vec2 v_texcoord;
|
|
269
|
+
|
|
270
|
+
void main() {
|
|
271
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
272
|
+
v_texcoord = a_position.xy * 0.5 + 0.5;
|
|
273
|
+
}
|
|
274
|
+
`;
|
|
275
|
+
const fragmentShader = `#version 300 es
|
|
276
|
+
precision highp float;
|
|
277
|
+
|
|
278
|
+
in vec2 v_texcoord;
|
|
279
|
+
|
|
280
|
+
uniform sampler2D u_texture;
|
|
281
|
+
uniform bool u_horizontal;
|
|
282
|
+
uniform float u_weight[5];
|
|
283
|
+
uniform float u_alpha_threshold;
|
|
284
|
+
uniform bool u_glow;
|
|
285
|
+
out vec4 outColor;
|
|
286
|
+
|
|
287
|
+
void main()
|
|
288
|
+
{
|
|
289
|
+
vec2 tex_offset = vec2(
|
|
290
|
+
1.0 / float(textureSize(u_texture, 0).x),
|
|
291
|
+
1.0 / float(textureSize(u_texture, 0).y) ); // gets size of single texel
|
|
292
|
+
vec3 color = vec3(0.0);
|
|
293
|
+
float total_alpha = texture(u_texture, v_texcoord).a * u_weight[0];
|
|
294
|
+
if (total_alpha > 0.0){
|
|
295
|
+
color = texture(u_texture, v_texcoord).rgb;
|
|
296
|
+
}
|
|
297
|
+
vec2 offset = vec2(0.0);
|
|
298
|
+
float alpha;
|
|
299
|
+
float color_count = 0.0;
|
|
300
|
+
if (!u_glow){
|
|
301
|
+
if(u_horizontal){
|
|
302
|
+
for(int i = 1; i < 5; ++i)
|
|
303
|
+
{
|
|
304
|
+
offset = vec2(tex_offset.x * float(i), 0.0);
|
|
305
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
306
|
+
|
|
307
|
+
if (alpha > u_alpha_threshold){
|
|
308
|
+
// color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
309
|
+
color += texture(u_texture, v_texcoord + offset).rgb;
|
|
310
|
+
total_alpha += alpha;
|
|
311
|
+
color_count += 1.0;
|
|
312
|
+
}
|
|
313
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
314
|
+
if (alpha > u_alpha_threshold){
|
|
315
|
+
// color = max( color, texture(u_texture, v_texcoord - offset).rgb);
|
|
316
|
+
color += texture(u_texture, v_texcoord - offset).rgb ;
|
|
317
|
+
total_alpha += alpha;
|
|
318
|
+
color_count += 1.0;
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
} else {
|
|
323
|
+
for(int i = 1; i < 5; ++i)
|
|
324
|
+
{
|
|
325
|
+
offset = vec2(0.0, tex_offset.y * float(i));
|
|
326
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
327
|
+
if (alpha > u_alpha_threshold){
|
|
328
|
+
// color = max( color , texture(u_texture, v_texcoord + offset).rgb);
|
|
329
|
+
color += texture(u_texture, v_texcoord + offset).rgb;
|
|
330
|
+
total_alpha += alpha;
|
|
331
|
+
color_count += 1.0;
|
|
332
|
+
|
|
333
|
+
}
|
|
334
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
335
|
+
if (alpha > u_alpha_threshold){
|
|
336
|
+
// color = max( color, texture(u_texture, v_texcoord - offset).rgb );
|
|
337
|
+
color += texture(u_texture, v_texcoord - offset).rgb ;
|
|
338
|
+
total_alpha += alpha;
|
|
339
|
+
color_count += 1.0;
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
if (color_count > 0.0){
|
|
346
|
+
color /= color_count;
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
if(u_horizontal)
|
|
350
|
+
{
|
|
351
|
+
for(int i = 1; i < 5; ++i)
|
|
352
|
+
{
|
|
353
|
+
offset = vec2(tex_offset.x * float(i), 0.0);
|
|
354
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
355
|
+
|
|
356
|
+
if (alpha > u_alpha_threshold){
|
|
357
|
+
color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
358
|
+
total_alpha += alpha;
|
|
359
|
+
}
|
|
360
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
361
|
+
if (alpha > u_alpha_threshold){
|
|
362
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb);
|
|
363
|
+
|
|
364
|
+
total_alpha += alpha;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else
|
|
369
|
+
{
|
|
370
|
+
for(int i = 1; i < 5; ++i)
|
|
371
|
+
{
|
|
372
|
+
offset = vec2(0.0, tex_offset.y * float(i));
|
|
373
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
374
|
+
if (alpha > u_alpha_threshold){
|
|
375
|
+
color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
376
|
+
total_alpha += alpha;
|
|
377
|
+
}
|
|
378
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
379
|
+
if (alpha > u_alpha_threshold){
|
|
380
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb );
|
|
381
|
+
total_alpha += alpha;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
outColor = vec4(color, total_alpha);
|
|
387
|
+
}
|
|
388
|
+
`;
|
|
389
|
+
const program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
390
|
+
const buffer = gl.createBuffer();
|
|
391
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
236
392
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
237
393
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
238
394
|
-1, -1,
|
|
@@ -242,7 +398,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
242
398
|
1, 1,
|
|
243
399
|
-1, 1,
|
|
244
400
|
]), gl.STATIC_DRAW);
|
|
245
|
-
|
|
401
|
+
const vao = gl.createVertexArray();
|
|
246
402
|
gl.bindVertexArray(vao);
|
|
247
403
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
248
404
|
gl.enableVertexAttribArray(a_position);
|
|
@@ -257,14 +413,84 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
257
413
|
u_alpha_threshold: gl.getUniformLocation(program, "u_alpha_threshold"),
|
|
258
414
|
u_glow: gl.getUniformLocation(program, "u_glow"),
|
|
259
415
|
};
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
416
|
+
}
|
|
417
|
+
_createBlurProgramHOLD() {
|
|
418
|
+
const gl = this.gl;
|
|
419
|
+
const vertexShader = `#version 300 es
|
|
420
|
+
precision highp float;
|
|
421
|
+
|
|
422
|
+
in vec2 a_position;
|
|
423
|
+
out vec2 v_texcoord;
|
|
424
|
+
|
|
425
|
+
void main() {
|
|
426
|
+
gl_Position = vec4(a_position, 0.0, 1.0);
|
|
427
|
+
v_texcoord = a_position.xy * 0.5 + 0.5;
|
|
428
|
+
}
|
|
429
|
+
`;
|
|
430
|
+
const fragmentShader = `#version 300 es
|
|
431
|
+
precision highp float;
|
|
432
|
+
|
|
433
|
+
in vec2 v_texcoord;
|
|
434
|
+
|
|
435
|
+
uniform sampler2D u_texture;
|
|
436
|
+
uniform bool u_horizontal;
|
|
437
|
+
uniform float u_weight[5];
|
|
438
|
+
uniform float u_alpha_threshold;
|
|
439
|
+
|
|
440
|
+
out vec4 outColor;
|
|
441
|
+
|
|
442
|
+
void main()
|
|
443
|
+
{
|
|
444
|
+
vec2 tex_offset = vec2(1) / vec2(textureSize(u_texture, 0)); // gets size of single texel
|
|
445
|
+
vec3 color = vec3(0.0);
|
|
446
|
+
float total_alpha = texture(u_texture, v_texcoord).a * u_weight[0];
|
|
447
|
+
if (total_alpha > 0.0){
|
|
448
|
+
color = texture(u_texture, v_texcoord).rgb;
|
|
449
|
+
}
|
|
450
|
+
vec2 offset = vec2(0.0);
|
|
451
|
+
float alpha;
|
|
452
|
+
|
|
453
|
+
if(u_horizontal)
|
|
454
|
+
{
|
|
455
|
+
for(int i = 1; i < 5; ++i)
|
|
456
|
+
{
|
|
457
|
+
offset = vec2(tex_offset.x * float(i), 0.0);
|
|
458
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
459
|
+
|
|
460
|
+
if (alpha > u_alpha_threshold){
|
|
461
|
+
color = max( color, texture(u_texture, v_texcoord + offset).rgb);
|
|
462
|
+
total_alpha += alpha;
|
|
463
|
+
}
|
|
464
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
465
|
+
if (alpha > u_alpha_threshold){
|
|
466
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb);
|
|
467
|
+
total_alpha += alpha;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else
|
|
472
|
+
{
|
|
473
|
+
for(int i = 1; i < 5; ++i)
|
|
474
|
+
{
|
|
475
|
+
offset = vec2(0.0, tex_offset.y * float(i));
|
|
476
|
+
alpha = texture(u_texture, v_texcoord + offset).a * u_weight[i];
|
|
477
|
+
if (alpha > u_alpha_threshold){
|
|
478
|
+
color = max( color , texture(u_texture, v_texcoord + offset).rgb);
|
|
479
|
+
total_alpha += alpha;
|
|
480
|
+
}
|
|
481
|
+
alpha = texture(u_texture, v_texcoord - offset).a * u_weight[i];
|
|
482
|
+
if (alpha > u_alpha_threshold){
|
|
483
|
+
color = max( color, texture(u_texture, v_texcoord - offset).rgb );
|
|
484
|
+
total_alpha += alpha;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
outColor = vec4(color, total_alpha);
|
|
489
|
+
}
|
|
490
|
+
`;
|
|
491
|
+
const program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
492
|
+
const buffer = gl.createBuffer();
|
|
493
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
268
494
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
269
495
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
|
270
496
|
-1, -1,
|
|
@@ -274,7 +500,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
274
500
|
1, 1,
|
|
275
501
|
-1, 1,
|
|
276
502
|
]), gl.STATIC_DRAW);
|
|
277
|
-
|
|
503
|
+
const vao = gl.createVertexArray();
|
|
278
504
|
gl.bindVertexArray(vao);
|
|
279
505
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
280
506
|
gl.enableVertexAttribArray(a_position);
|
|
@@ -288,28 +514,108 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
288
514
|
u_weight: gl.getUniformLocation(program, "u_weight"),
|
|
289
515
|
u_alpha_threshold: gl.getUniformLocation(program, "u_alpha_threshold"),
|
|
290
516
|
};
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
|
|
517
|
+
}
|
|
518
|
+
resize(width, height) {
|
|
519
|
+
const { gl, _lineProgram } = this;
|
|
294
520
|
this._width = width;
|
|
295
521
|
this._height = height;
|
|
296
|
-
|
|
522
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
297
523
|
this._createInnerTextures();
|
|
298
524
|
gl.useProgram(_lineProgram.program);
|
|
299
525
|
gl.uniform2fv(_lineProgram.u_scrWH, [width, height]);
|
|
300
526
|
gl.useProgram(currentProgram);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
527
|
+
}
|
|
528
|
+
_createLineProgram() {
|
|
529
|
+
const gl = this.gl;
|
|
530
|
+
const vertexShader = `#version 300 es
|
|
531
|
+
precision highp float;
|
|
532
|
+
|
|
533
|
+
in vec3 a_position;
|
|
534
|
+
in float a_time;
|
|
535
|
+
in vec3 a_color;
|
|
536
|
+
in float a_track_start_time;
|
|
537
|
+
in float a_track_end_time;
|
|
538
|
+
|
|
539
|
+
uniform mat4 uModelViewMatrix;
|
|
540
|
+
uniform mat4 uProjectionMatrix;
|
|
541
|
+
uniform vec3 uTranslate;
|
|
542
|
+
|
|
543
|
+
uniform bool u_is_3d;
|
|
544
|
+
uniform vec2 u_mapWH;
|
|
545
|
+
uniform vec2 u_scrWH;
|
|
546
|
+
|
|
547
|
+
out float v_time;
|
|
548
|
+
out vec3 v_color;
|
|
549
|
+
out float v_track_start_time;
|
|
550
|
+
out float v_track_end_time;
|
|
551
|
+
|
|
552
|
+
${shaderfunctions.pixelXYToCartesian3DPoint}
|
|
553
|
+
${shaderfunctions.pixelXYToCartesian2DPoint}
|
|
554
|
+
|
|
555
|
+
void main() {
|
|
556
|
+
v_time = a_time;
|
|
557
|
+
v_color = a_color;
|
|
558
|
+
v_track_start_time = a_track_start_time;
|
|
559
|
+
v_track_end_time = a_track_end_time;
|
|
560
|
+
if (u_is_3d){
|
|
561
|
+
vec3 pos = pixelXYToCartesian3DPoint(a_position);
|
|
562
|
+
gl_Position = uProjectionMatrix * uModelViewMatrix * vec4(pos - uTranslate, 1.0);
|
|
563
|
+
} else {
|
|
564
|
+
vec2 xy = pixelXYToCartesian2DPoint(a_position.xy, uTranslate.xy, u_mapWH, u_scrWH);
|
|
565
|
+
gl_Position = uProjectionMatrix * vec4(xy.x, xy.y, 0.0, 1.0);
|
|
566
|
+
|
|
567
|
+
}
|
|
568
|
+
gl_PointSize = 1.0;
|
|
569
|
+
}
|
|
570
|
+
`;
|
|
571
|
+
const fragmentShader = `#version 300 es
|
|
572
|
+
precision lowp float;
|
|
573
|
+
|
|
574
|
+
in float v_time;
|
|
575
|
+
in vec3 v_color;
|
|
576
|
+
in float v_track_start_time;
|
|
577
|
+
in float v_track_end_time;
|
|
578
|
+
|
|
579
|
+
uniform float u_head_time;
|
|
580
|
+
uniform float u_tail_time;
|
|
581
|
+
|
|
582
|
+
uniform float u_head_percentage;
|
|
583
|
+
uniform float u_route_alpha;
|
|
584
|
+
|
|
585
|
+
layout(location = 0) out vec4 outColor0;
|
|
586
|
+
layout(location = 1) out vec4 outColor1;
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
void main() {
|
|
590
|
+
if ( u_tail_time > v_track_end_time || u_head_time < v_track_start_time) discard;
|
|
591
|
+
// if ( v_time < u_tail_time || v_time > u_head_time) discard;
|
|
592
|
+
|
|
593
|
+
float gap = u_head_time - u_tail_time;
|
|
594
|
+
float head = gap * u_head_percentage;
|
|
595
|
+
float dist = u_head_time - v_time;
|
|
596
|
+
if ((v_time > u_head_time ) || (v_time < u_tail_time) ){
|
|
597
|
+
|
|
598
|
+
outColor0 = vec4(v_color , u_route_alpha);
|
|
599
|
+
} else if (dist < head) {
|
|
600
|
+
// white head
|
|
601
|
+
outColor0 = vec4(1.0, 1.0, 1.0, 0.77 + ( u_route_alpha * 0.23));
|
|
602
|
+
outColor1 = vec4(1.0, 1.0, 1.0, 0.77 + ( u_route_alpha * 0.23));
|
|
603
|
+
//
|
|
604
|
+
} else {
|
|
605
|
+
// colored body of lines
|
|
606
|
+
float alpha = ((gap - dist) / gap) / 2.0 + 0.5;
|
|
607
|
+
outColor0 = vec4(v_color , alpha );
|
|
608
|
+
outColor1 = vec4(v_color , alpha );
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
`;
|
|
612
|
+
const program = createProgram(this.gl, vertexShader, fragmentShader);
|
|
613
|
+
const a_position = gl.getAttribLocation(program, "a_position");
|
|
614
|
+
const a_time = gl.getAttribLocation(program, "a_time");
|
|
615
|
+
const a_track_start_time = gl.getAttribLocation(program, "a_track_start_time");
|
|
616
|
+
const a_track_end_time = gl.getAttribLocation(program, "a_track_end_time");
|
|
617
|
+
const a_color = gl.getAttribLocation(program, "a_color");
|
|
618
|
+
const vao = gl.createVertexArray();
|
|
313
619
|
gl.bindVertexArray(vao);
|
|
314
620
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._inBuffer);
|
|
315
621
|
gl.enableVertexAttribArray(a_position);
|
|
@@ -337,7 +643,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
337
643
|
u_head_percentage: gl.getUniformLocation(program, "u_head_percentage"),
|
|
338
644
|
u_route_alpha: gl.getUniformLocation(program, "u_route_alpha"),
|
|
339
645
|
};
|
|
340
|
-
}
|
|
646
|
+
}
|
|
341
647
|
/**
|
|
342
648
|
* @param { Float32Array} data // [x, y, z, time, x, y, z, time, ...]
|
|
343
649
|
*/
|
|
@@ -346,19 +652,19 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
346
652
|
// gl.bindBuffer(gl.ARRAY_BUFFER, this._inBuffer);
|
|
347
653
|
// gl.bufferData(gl.ARRAY_BUFFER, data, gl.STATIC_DRAW);
|
|
348
654
|
// }
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
655
|
+
setIs3D(is3d) {
|
|
656
|
+
const { gl, _lineProgram } = this;
|
|
657
|
+
const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM);
|
|
352
658
|
gl.useProgram(_lineProgram.program);
|
|
353
659
|
gl.uniform1i(_lineProgram.u_is_3d, is3d);
|
|
354
660
|
gl.useProgram(currentProgram);
|
|
355
|
-
}
|
|
356
|
-
|
|
661
|
+
}
|
|
662
|
+
setTotalLength(totalLength) {
|
|
357
663
|
this._totalLength = totalLength;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
664
|
+
}
|
|
665
|
+
_createTextures() {
|
|
666
|
+
const { gl, _width, _height } = this;
|
|
667
|
+
const texture = gl.createTexture();
|
|
362
668
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
363
669
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, _width, _height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); // UNSIGNED_BYTE
|
|
364
670
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
@@ -367,9 +673,9 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
367
673
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
368
674
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
369
675
|
return texture;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
|
|
676
|
+
}
|
|
677
|
+
_resetTexture() {
|
|
678
|
+
const { gl, _width, _height } = this;
|
|
373
679
|
gl.bindTexture(gl.TEXTURE_2D, this._middleTexture); // UNSIGNED_BYTE
|
|
374
680
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, _width, _height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
375
681
|
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[0]);
|
|
@@ -377,10 +683,9 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
377
683
|
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[1]);
|
|
378
684
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, _width, _height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
379
685
|
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;
|
|
686
|
+
}
|
|
687
|
+
draw(u_head_time, u_tail_time, uProjectionMatrix, uModelViewMatrix, uTranslate, u_mapWH = null) {
|
|
688
|
+
const { gl, _lineProgram, _blurProgram, _blurRepetition, _premultipliedAlpha } = this;
|
|
384
689
|
this._resetTexture();
|
|
385
690
|
// if (_premultipliedAlpha) {
|
|
386
691
|
gl.enable(gl.BLEND);
|
|
@@ -415,7 +720,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
415
720
|
{ // blur ping pong
|
|
416
721
|
gl.useProgram(_blurProgram.program);
|
|
417
722
|
gl.bindVertexArray(_blurProgram.vao);
|
|
418
|
-
for (
|
|
723
|
+
for (let i = 0; i < _blurRepetition * 2; i++) {
|
|
419
724
|
gl.bindFramebuffer(gl.FRAMEBUFFER, this._blurFrameBuffers[i % 2]);
|
|
420
725
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this._blurTextures[(i + 1) % 2], 0);
|
|
421
726
|
gl.bindTexture(gl.TEXTURE_2D, this._blurTextures[i % 2]);
|
|
@@ -425,7 +730,7 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
425
730
|
}
|
|
426
731
|
}
|
|
427
732
|
if (!_premultipliedAlpha) {
|
|
428
|
-
|
|
733
|
+
defaultblendfunction(gl);
|
|
429
734
|
}
|
|
430
735
|
{ // combine
|
|
431
736
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
@@ -441,11 +746,11 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
441
746
|
}
|
|
442
747
|
gl.bindVertexArray(null);
|
|
443
748
|
if (_premultipliedAlpha) {
|
|
444
|
-
|
|
749
|
+
defaultblendfunction(gl);
|
|
445
750
|
}
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
|
|
751
|
+
}
|
|
752
|
+
free() {
|
|
753
|
+
const { gl, _lineProgram, _blurProgram, _combineProgram } = this;
|
|
449
754
|
gl.deleteBuffer(this._inBuffer);
|
|
450
755
|
gl.deleteFramebuffer(this._frameBuffer);
|
|
451
756
|
gl.deleteFramebuffer(this._blurFrameBuffers[0]);
|
|
@@ -460,7 +765,5 @@ var TrackGlowLineProgram = /** @class */ (function () {
|
|
|
460
765
|
gl.deleteProgram(_lineProgram.program);
|
|
461
766
|
gl.deleteProgram(_blurProgram.program);
|
|
462
767
|
gl.deleteProgram(_combineProgram.program);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
}());
|
|
466
|
-
exports.default = TrackGlowLineProgram;
|
|
768
|
+
}
|
|
769
|
+
}
|