@genome-spy/app 0.87.0 → 0.88.0
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/dist/{agentApi-BZ1JCo1N.js → agentApi-BYFBKiRQ.js} +5365 -5080
- package/dist/agentApi.es.js +3160 -2909
- package/dist/agentShared.es.js +3 -3
- package/dist/{canvas2d-Cafq5v-N.js → canvas2d-BVQ7-2eJ.js} +68 -68
- package/dist/{canvas2d-B_PnIof-.js → canvas2d-D7SZK3xv.js} +39 -39
- package/dist/{clipOptions-H68pJyEZ.js → clipOptions-BWHr3aTa.js} +822 -768
- package/dist/{clipOptions-D6eh9T-_.js → clipOptions-DTMcB_9z.js} +547 -493
- package/dist/{debug-BGzgZmyk.js → debug-CVpoEOWx.js} +2 -2
- package/dist/{debug-UYKZLNh4.js → debug-DYAMZZKl.js} +2 -2
- package/dist/index.es.js +3390 -3410
- package/dist/index.js +397 -374
- package/dist/{indexer-Di57GyxX.js → indexer-CXjZDo2Q.js} +1 -1
- package/dist/{indexer-o6Hpg4nN.js → indexer-DAH_ruVn.js} +1 -1
- package/dist/{nativeText-DAjvkrzc.js → order-C5CzA37O.js} +271 -287
- package/dist/{nativeText-D9SoxpaD.js → order-DvY7KNcu.js} +271 -287
- package/dist/{rasterExport-DzldLv6E.js → rasterExport-BgZ98e6U.js} +1 -1
- package/dist/{rasterExport-IAbJwi8F.js → rasterExport-DEr8fOLm.js} +1 -1
- package/dist/{renderCanvas2D-yJ1IrDcX.js → renderCanvas2D-DtcJjqpB.js} +57 -50
- package/dist/{renderCanvas2D-BJ93Ptqj.js → renderCanvas2D-DxturTEW.js} +62 -55
- package/dist/schema.json +756 -96
- package/dist/{svg-DJuqHIyc.js → svg-CyrLfa9e.js} +364 -357
- package/dist/{svg-BRpl2Xub.js → svg-SDJMzL--.js} +338 -331
- package/dist/{svgRasterizer-PAoqLn1j.js → svgRasterizer-f7DJ3UO0.js} +1 -1
- package/dist/{svgRasterizer-CGZQ5njV.js → svgRasterizer-mWK7HTkx.js} +1 -1
- package/dist/{vega-scale-BGC53c22.js → vega-scale-CypF85iS.js} +801 -801
- package/dist/{vega-scale-DdW2NzQ3.js → vega-scale-DLKCwWRs.js} +65 -65
- package/dist/{viewIdentityRegistry-Dc2hXYsO.js → viewIdentityRegistry-DIDo44XQ.js} +1 -1
- package/dist/{viewIdentityRegistry-D4p067HU.js → viewIdentityRegistry-Dl-vMN9I.js} +1 -1
- package/dist/{viewSelectors-DNXnGwEW.js → viewSelectors-CymbZyE6.js} +375 -340
- package/dist/{viewSelectors-DYYlOt91.js → viewSelectors-DNiDip5e.js} +370 -335
- package/dist/{viewUtils-EdhZTPrJ.js → viewUtils-BrJLIj2o.js} +1750 -1716
- package/dist/{webgl-CdgNFlJk.js → webgl-CqTDifWM.js} +1196 -1164
- package/dist/{webgl-C53DwzVT.js → webgl-jaC2m0Zr.js} +1015 -983
- package/package.json +5 -5
- package/src/embedTypes.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { T as ce, b as
|
|
3
|
-
import { i as pe, n as me, p as he, r as ge, t as _e } from "./indexer-
|
|
1
|
+
import { A as e, E as t, Gt as n, H as r, Kt as i, L as a, Tt as o, Wt as s, Yt as c, _t as l, b as u, cn as d, ct as f, d as p, dt as m, et as h, fn as g, gn as _, gt as v, ht as y, it as b, n as x, o as ee, ot as S, pt as te, qt as C, s as ne, un as re, ut as ie, vt as ae, yt as oe, z as se } from "./clipOptions-BWHr3aTa.js";
|
|
2
|
+
import { T as ce, b as w, g as le, it as ue, v as T, x as de, y as fe } from "./vega-scale-CypF85iS.js";
|
|
3
|
+
import { i as pe, n as me, p as he, r as ge, t as _e } from "./indexer-DAH_ruVn.js";
|
|
4
4
|
import { n as ve, t as ye } from "./viewError-BiR9VCgL.js";
|
|
5
5
|
import { t as be } from "./rectangle-DKnrAmKs.js";
|
|
6
6
|
import { n as xe, r as Se } from "./performanceProfiler-CPLEjApa.js";
|
|
@@ -61,13 +61,13 @@ function et(e, t) {
|
|
|
61
61
|
function tt(e, t) {
|
|
62
62
|
return typeof WebGLSampler < "u" && t instanceof WebGLSampler;
|
|
63
63
|
}
|
|
64
|
-
var nt = 35044,
|
|
64
|
+
var nt = 35044, E = 34962, rt = 34963, it = 34660, at = 5120, ot = 5121, st = 5122, ct = 5123, lt = 5124, ut = 5125, dt = 5126, ft = { attribPrefix: "" };
|
|
65
65
|
function pt(e, t, n, r, i) {
|
|
66
66
|
e.bindBuffer(t, n), e.bufferData(t, r, i || nt);
|
|
67
67
|
}
|
|
68
68
|
function mt(e, t, n, r) {
|
|
69
69
|
if (Qe(e, t)) return t;
|
|
70
|
-
n ||=
|
|
70
|
+
n ||= E;
|
|
71
71
|
let i = e.createBuffer();
|
|
72
72
|
return pt(e, n, i, t, r), i;
|
|
73
73
|
}
|
|
@@ -112,7 +112,7 @@ function wt(e, t) {
|
|
|
112
112
|
if (i.buffer && i.buffer instanceof WebGLBuffer) t = i.buffer, c = i.numComponents || i.size, o = i.type, s = i.normalize;
|
|
113
113
|
else if (typeof i == "number" || typeof i.data == "number") {
|
|
114
114
|
let n = i.data || i, a = i.type || Float32Array, l = n * a.BYTES_PER_ELEMENT;
|
|
115
|
-
o = qe(a), s = i.normalize === void 0 ? _t(a) : i.normalize, c = i.numComponents || i.size || xt(r, n), t = e.createBuffer(), e.bindBuffer(
|
|
115
|
+
o = qe(a), s = i.normalize === void 0 ? _t(a) : i.normalize, c = i.numComponents || i.size || xt(r, n), t = e.createBuffer(), e.bindBuffer(E, t), e.bufferData(E, l, i.drawType || nt);
|
|
116
116
|
} else {
|
|
117
117
|
let n = Ct(i, r);
|
|
118
118
|
t = mt(e, n, void 0, i.drawType), o = Ke(n), s = i.normalize === void 0 ? gt(n) : i.normalize, c = St(i, r);
|
|
@@ -129,10 +129,10 @@ function wt(e, t) {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
}), e.bindBuffer(
|
|
132
|
+
}), e.bindBuffer(E, null), n;
|
|
133
133
|
}
|
|
134
134
|
function Tt(e, t, n, r) {
|
|
135
|
-
n = Ct(n), r === void 0 ? pt(e,
|
|
135
|
+
n = Ct(n), r === void 0 ? pt(e, E, t.buffer, n, t.drawType) : (e.bindBuffer(E, t.buffer), e.bufferSubData(E, r, n));
|
|
136
136
|
}
|
|
137
137
|
function Et(e, t) {
|
|
138
138
|
return t === at || t === ot ? 1 : t === st || t === ct ? 2 : t === lt || t === ut || t === dt ? 4 : 0;
|
|
@@ -148,9 +148,9 @@ function Ot(e, t) {
|
|
|
148
148
|
r === Dt.length && (n = Object.keys(t)[0]);
|
|
149
149
|
let i = t[n];
|
|
150
150
|
if (!i.buffer) return 1;
|
|
151
|
-
e.bindBuffer(
|
|
152
|
-
let a = e.getBufferParameter(
|
|
153
|
-
e.bindBuffer(
|
|
151
|
+
e.bindBuffer(E, i.buffer);
|
|
152
|
+
let a = e.getBufferParameter(E, it);
|
|
153
|
+
e.bindBuffer(E, null);
|
|
154
154
|
let o = a / Et(e, i.type), s = i.numComponents || i.size, c = o / s;
|
|
155
155
|
if (c % 1 != 0) throw Error(`numComponents ${s} not correct for length ${length}`);
|
|
156
156
|
return c;
|
|
@@ -165,10 +165,10 @@ function kt(e, t, n) {
|
|
|
165
165
|
} else i.numElements ||= Ot(e, i.attribs);
|
|
166
166
|
return i;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function At(e) {
|
|
169
169
|
return !!e.texStorage2D;
|
|
170
170
|
}
|
|
171
|
-
var
|
|
171
|
+
var jt = function() {
|
|
172
172
|
let e = {}, t = {};
|
|
173
173
|
function n(n) {
|
|
174
174
|
let r = n.constructor.name;
|
|
@@ -192,22 +192,22 @@ var At = function() {
|
|
|
192
192
|
]),
|
|
193
193
|
textureOptions: {},
|
|
194
194
|
crossOrigin: void 0
|
|
195
|
-
},
|
|
195
|
+
}, Mt = Ye, Nt = function() {
|
|
196
196
|
let e;
|
|
197
197
|
return function() {
|
|
198
198
|
return e ||= typeof document < "u" && document.createElement ? document.createElement("canvas").getContext("2d") : null, e;
|
|
199
199
|
};
|
|
200
|
-
}(),
|
|
200
|
+
}(), Pt = 6406, O = 6407, k = 6408, Ft = 6409, It = 6410, Lt = 6402, Rt = 34041, zt = 33071, Bt = 9728, Vt = 9729, A = 3553, j = 34067, M = 32879, N = 35866, Ht = 34069, Ut = 34070, Wt = 34071, Gt = 34072, Kt = 34073, qt = 34074, Jt = 10241, Yt = 10240, Xt = 10242, Zt = 10243, Qt = 32882, $t = 33082, en = 33083, tn = 33084, nn = 33085, rn = 3317, an = 3314, on = 32878, sn = 3316, cn = 3315, ln = 32877, un = 37443, dn = 37441, fn = 37440, pn = 33321, mn = 36756, hn = 33325, gn = 33326, _n = 33330, vn = 33329, yn = 33338, bn = 33337, xn = 33340, Sn = 33339, Cn = 33323, wn = 36757, Tn = 33327, En = 33328, Dn = 33336, On = 33335, kn = 33332, An = 33331, jn = 33334, Mn = 33333, Nn = 32849, Pn = 35905, Fn = 36194, In = 36758, Ln = 35898, Rn = 35901, zn = 34843, Bn = 34837, Vn = 36221, Hn = 36239, Un = 36215, Wn = 36233, Gn = 36209, Kn = 36227, qn = 32856, Jn = 35907, Yn = 36759, Xn = 32855, Zn = 32854, Qn = 32857, $n = 34842, er = 34836, tr = 36220, nr = 36238, rr = 36975, ir = 36214, ar = 36232, or = 36226, sr = 36208, cr = 33189, lr = 33190, ur = 36012, dr = 36013, fr = 35056, P = 5120, F = 5121, pr = 5122, mr = 5123, hr = 5124, I = 5125, L = 5126, gr = 32819, _r = 32820, vr = 33635, R = 5131, yr = 36193, br = 33640, xr = 35899, Sr = 35902, Cr = 36269, wr = 34042, Tr = 33319, z = 33320, Er = 6403, B = 36244, V = 36248, H = 36249, Dr = {};
|
|
201
201
|
{
|
|
202
|
-
let e =
|
|
203
|
-
e[
|
|
202
|
+
let e = Dr;
|
|
203
|
+
e[Pt] = { numColorComponents: 1 }, e[Ft] = { numColorComponents: 1 }, e[It] = { numColorComponents: 2 }, e[O] = { numColorComponents: 3 }, e[k] = { numColorComponents: 4 }, e[Er] = { numColorComponents: 1 }, e[B] = { numColorComponents: 1 }, e[Tr] = { numColorComponents: 2 }, e[z] = { numColorComponents: 2 }, e[O] = { numColorComponents: 3 }, e[V] = { numColorComponents: 3 }, e[k] = { numColorComponents: 4 }, e[H] = { numColorComponents: 4 }, e[Lt] = { numColorComponents: 1 }, e[Rt] = { numColorComponents: 2 };
|
|
204
204
|
}
|
|
205
|
-
var
|
|
206
|
-
function
|
|
207
|
-
if (!
|
|
205
|
+
var Or;
|
|
206
|
+
function kr(e) {
|
|
207
|
+
if (!Or) {
|
|
208
208
|
let e = {};
|
|
209
|
-
e[
|
|
210
|
-
textureFormat:
|
|
209
|
+
e[Pt] = {
|
|
210
|
+
textureFormat: Pt,
|
|
211
211
|
colorRenderable: !0,
|
|
212
212
|
textureFilterable: !0,
|
|
213
213
|
bytesPerElement: [
|
|
@@ -219,11 +219,11 @@ function Or(e) {
|
|
|
219
219
|
type: [
|
|
220
220
|
F,
|
|
221
221
|
R,
|
|
222
|
-
|
|
222
|
+
yr,
|
|
223
223
|
L
|
|
224
224
|
]
|
|
225
|
-
}, e[
|
|
226
|
-
textureFormat:
|
|
225
|
+
}, e[Ft] = {
|
|
226
|
+
textureFormat: Ft,
|
|
227
227
|
colorRenderable: !0,
|
|
228
228
|
textureFilterable: !0,
|
|
229
229
|
bytesPerElement: [
|
|
@@ -235,11 +235,11 @@ function Or(e) {
|
|
|
235
235
|
type: [
|
|
236
236
|
F,
|
|
237
237
|
R,
|
|
238
|
-
|
|
238
|
+
yr,
|
|
239
239
|
L
|
|
240
240
|
]
|
|
241
|
-
}, e[
|
|
242
|
-
textureFormat:
|
|
241
|
+
}, e[It] = {
|
|
242
|
+
textureFormat: It,
|
|
243
243
|
colorRenderable: !0,
|
|
244
244
|
textureFilterable: !0,
|
|
245
245
|
bytesPerElement: [
|
|
@@ -251,7 +251,7 @@ function Or(e) {
|
|
|
251
251
|
type: [
|
|
252
252
|
F,
|
|
253
253
|
R,
|
|
254
|
-
|
|
254
|
+
yr,
|
|
255
255
|
L
|
|
256
256
|
]
|
|
257
257
|
}, e[O] = {
|
|
@@ -268,9 +268,9 @@ function Or(e) {
|
|
|
268
268
|
type: [
|
|
269
269
|
F,
|
|
270
270
|
R,
|
|
271
|
-
|
|
271
|
+
yr,
|
|
272
272
|
L,
|
|
273
|
-
|
|
273
|
+
vr
|
|
274
274
|
]
|
|
275
275
|
}, e[k] = {
|
|
276
276
|
textureFormat: k,
|
|
@@ -287,162 +287,162 @@ function Or(e) {
|
|
|
287
287
|
type: [
|
|
288
288
|
F,
|
|
289
289
|
R,
|
|
290
|
-
|
|
290
|
+
yr,
|
|
291
291
|
L,
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
gr,
|
|
293
|
+
_r
|
|
294
294
|
]
|
|
295
|
-
}, e[
|
|
296
|
-
textureFormat:
|
|
295
|
+
}, e[Lt] = {
|
|
296
|
+
textureFormat: Lt,
|
|
297
297
|
colorRenderable: !0,
|
|
298
298
|
textureFilterable: !1,
|
|
299
299
|
bytesPerElement: [2, 4],
|
|
300
|
-
type: [I,
|
|
301
|
-
}, e[
|
|
302
|
-
textureFormat:
|
|
300
|
+
type: [I, mr]
|
|
301
|
+
}, e[pn] = {
|
|
302
|
+
textureFormat: Er,
|
|
303
303
|
colorRenderable: !0,
|
|
304
304
|
textureFilterable: !0,
|
|
305
305
|
bytesPerElement: [1],
|
|
306
306
|
type: [F]
|
|
307
|
-
}, e[
|
|
308
|
-
textureFormat:
|
|
307
|
+
}, e[mn] = {
|
|
308
|
+
textureFormat: Er,
|
|
309
309
|
colorRenderable: !1,
|
|
310
310
|
textureFilterable: !0,
|
|
311
311
|
bytesPerElement: [1],
|
|
312
312
|
type: [P]
|
|
313
|
-
}, e[
|
|
314
|
-
textureFormat:
|
|
313
|
+
}, e[hn] = {
|
|
314
|
+
textureFormat: Er,
|
|
315
315
|
colorRenderable: !1,
|
|
316
316
|
textureFilterable: !0,
|
|
317
317
|
bytesPerElement: [4, 2],
|
|
318
318
|
type: [L, R]
|
|
319
|
-
}, e[
|
|
320
|
-
textureFormat:
|
|
319
|
+
}, e[gn] = {
|
|
320
|
+
textureFormat: Er,
|
|
321
321
|
colorRenderable: !1,
|
|
322
322
|
textureFilterable: !1,
|
|
323
323
|
bytesPerElement: [4],
|
|
324
324
|
type: [L]
|
|
325
|
-
}, e[
|
|
325
|
+
}, e[_n] = {
|
|
326
326
|
textureFormat: B,
|
|
327
327
|
colorRenderable: !0,
|
|
328
328
|
textureFilterable: !1,
|
|
329
329
|
bytesPerElement: [1],
|
|
330
330
|
type: [F]
|
|
331
|
-
}, e[
|
|
331
|
+
}, e[vn] = {
|
|
332
332
|
textureFormat: B,
|
|
333
333
|
colorRenderable: !0,
|
|
334
334
|
textureFilterable: !1,
|
|
335
335
|
bytesPerElement: [1],
|
|
336
336
|
type: [P]
|
|
337
|
-
}, e[
|
|
337
|
+
}, e[kn] = {
|
|
338
338
|
textureFormat: B,
|
|
339
339
|
colorRenderable: !0,
|
|
340
340
|
textureFilterable: !1,
|
|
341
341
|
bytesPerElement: [2],
|
|
342
|
-
type: [
|
|
343
|
-
}, e[
|
|
342
|
+
type: [mr]
|
|
343
|
+
}, e[An] = {
|
|
344
344
|
textureFormat: B,
|
|
345
345
|
colorRenderable: !0,
|
|
346
346
|
textureFilterable: !1,
|
|
347
347
|
bytesPerElement: [2],
|
|
348
|
-
type: [
|
|
349
|
-
}, e[
|
|
348
|
+
type: [pr]
|
|
349
|
+
}, e[jn] = {
|
|
350
350
|
textureFormat: B,
|
|
351
351
|
colorRenderable: !0,
|
|
352
352
|
textureFilterable: !1,
|
|
353
353
|
bytesPerElement: [4],
|
|
354
354
|
type: [I]
|
|
355
|
-
}, e[
|
|
355
|
+
}, e[Mn] = {
|
|
356
356
|
textureFormat: B,
|
|
357
357
|
colorRenderable: !0,
|
|
358
358
|
textureFilterable: !1,
|
|
359
359
|
bytesPerElement: [4],
|
|
360
|
-
type: [
|
|
361
|
-
}, e[
|
|
362
|
-
textureFormat:
|
|
360
|
+
type: [hr]
|
|
361
|
+
}, e[Cn] = {
|
|
362
|
+
textureFormat: Tr,
|
|
363
363
|
colorRenderable: !0,
|
|
364
364
|
textureFilterable: !0,
|
|
365
365
|
bytesPerElement: [2],
|
|
366
366
|
type: [F]
|
|
367
|
-
}, e[
|
|
368
|
-
textureFormat:
|
|
367
|
+
}, e[wn] = {
|
|
368
|
+
textureFormat: Tr,
|
|
369
369
|
colorRenderable: !1,
|
|
370
370
|
textureFilterable: !0,
|
|
371
371
|
bytesPerElement: [2],
|
|
372
372
|
type: [P]
|
|
373
|
-
}, e[
|
|
374
|
-
textureFormat:
|
|
373
|
+
}, e[Tn] = {
|
|
374
|
+
textureFormat: Tr,
|
|
375
375
|
colorRenderable: !1,
|
|
376
376
|
textureFilterable: !0,
|
|
377
377
|
bytesPerElement: [8, 4],
|
|
378
378
|
type: [L, R]
|
|
379
|
-
}, e[
|
|
380
|
-
textureFormat:
|
|
379
|
+
}, e[En] = {
|
|
380
|
+
textureFormat: Tr,
|
|
381
381
|
colorRenderable: !1,
|
|
382
382
|
textureFilterable: !1,
|
|
383
383
|
bytesPerElement: [8],
|
|
384
384
|
type: [L]
|
|
385
|
-
}, e[
|
|
385
|
+
}, e[Dn] = {
|
|
386
386
|
textureFormat: z,
|
|
387
387
|
colorRenderable: !0,
|
|
388
388
|
textureFilterable: !1,
|
|
389
389
|
bytesPerElement: [2],
|
|
390
390
|
type: [F]
|
|
391
|
-
}, e[
|
|
391
|
+
}, e[On] = {
|
|
392
392
|
textureFormat: z,
|
|
393
393
|
colorRenderable: !0,
|
|
394
394
|
textureFilterable: !1,
|
|
395
395
|
bytesPerElement: [2],
|
|
396
396
|
type: [P]
|
|
397
|
-
}, e[
|
|
397
|
+
}, e[yn] = {
|
|
398
398
|
textureFormat: z,
|
|
399
399
|
colorRenderable: !0,
|
|
400
400
|
textureFilterable: !1,
|
|
401
401
|
bytesPerElement: [4],
|
|
402
|
-
type: [
|
|
403
|
-
}, e[
|
|
402
|
+
type: [mr]
|
|
403
|
+
}, e[bn] = {
|
|
404
404
|
textureFormat: z,
|
|
405
405
|
colorRenderable: !0,
|
|
406
406
|
textureFilterable: !1,
|
|
407
407
|
bytesPerElement: [4],
|
|
408
|
-
type: [
|
|
409
|
-
}, e[
|
|
408
|
+
type: [pr]
|
|
409
|
+
}, e[xn] = {
|
|
410
410
|
textureFormat: z,
|
|
411
411
|
colorRenderable: !0,
|
|
412
412
|
textureFilterable: !1,
|
|
413
413
|
bytesPerElement: [8],
|
|
414
414
|
type: [I]
|
|
415
|
-
}, e[
|
|
415
|
+
}, e[Sn] = {
|
|
416
416
|
textureFormat: z,
|
|
417
417
|
colorRenderable: !0,
|
|
418
418
|
textureFilterable: !1,
|
|
419
419
|
bytesPerElement: [8],
|
|
420
|
-
type: [
|
|
421
|
-
}, e[
|
|
420
|
+
type: [hr]
|
|
421
|
+
}, e[Nn] = {
|
|
422
422
|
textureFormat: O,
|
|
423
423
|
colorRenderable: !0,
|
|
424
424
|
textureFilterable: !0,
|
|
425
425
|
bytesPerElement: [3],
|
|
426
426
|
type: [F]
|
|
427
|
-
}, e[
|
|
427
|
+
}, e[Pn] = {
|
|
428
428
|
textureFormat: O,
|
|
429
429
|
colorRenderable: !1,
|
|
430
430
|
textureFilterable: !0,
|
|
431
431
|
bytesPerElement: [3],
|
|
432
432
|
type: [F]
|
|
433
|
-
}, e[
|
|
433
|
+
}, e[Fn] = {
|
|
434
434
|
textureFormat: O,
|
|
435
435
|
colorRenderable: !0,
|
|
436
436
|
textureFilterable: !0,
|
|
437
437
|
bytesPerElement: [3, 2],
|
|
438
|
-
type: [F,
|
|
439
|
-
}, e[
|
|
438
|
+
type: [F, vr]
|
|
439
|
+
}, e[In] = {
|
|
440
440
|
textureFormat: O,
|
|
441
441
|
colorRenderable: !1,
|
|
442
442
|
textureFilterable: !0,
|
|
443
443
|
bytesPerElement: [3],
|
|
444
444
|
type: [P]
|
|
445
|
-
}, e[
|
|
445
|
+
}, e[Ln] = {
|
|
446
446
|
textureFormat: O,
|
|
447
447
|
colorRenderable: !1,
|
|
448
448
|
textureFilterable: !0,
|
|
@@ -454,9 +454,9 @@ function Or(e) {
|
|
|
454
454
|
type: [
|
|
455
455
|
L,
|
|
456
456
|
R,
|
|
457
|
-
|
|
457
|
+
xr
|
|
458
458
|
]
|
|
459
|
-
}, e[
|
|
459
|
+
}, e[Rn] = {
|
|
460
460
|
textureFormat: O,
|
|
461
461
|
colorRenderable: !1,
|
|
462
462
|
textureFilterable: !0,
|
|
@@ -468,75 +468,75 @@ function Or(e) {
|
|
|
468
468
|
type: [
|
|
469
469
|
L,
|
|
470
470
|
R,
|
|
471
|
-
|
|
471
|
+
Sr
|
|
472
472
|
]
|
|
473
|
-
}, e[
|
|
473
|
+
}, e[zn] = {
|
|
474
474
|
textureFormat: O,
|
|
475
475
|
colorRenderable: !1,
|
|
476
476
|
textureFilterable: !0,
|
|
477
477
|
bytesPerElement: [12, 6],
|
|
478
478
|
type: [L, R]
|
|
479
|
-
}, e[
|
|
479
|
+
}, e[Bn] = {
|
|
480
480
|
textureFormat: O,
|
|
481
481
|
colorRenderable: !1,
|
|
482
482
|
textureFilterable: !1,
|
|
483
483
|
bytesPerElement: [12],
|
|
484
484
|
type: [L]
|
|
485
|
-
}, e[
|
|
485
|
+
}, e[Vn] = {
|
|
486
486
|
textureFormat: V,
|
|
487
487
|
colorRenderable: !1,
|
|
488
488
|
textureFilterable: !1,
|
|
489
489
|
bytesPerElement: [3],
|
|
490
490
|
type: [F]
|
|
491
|
-
}, e[
|
|
491
|
+
}, e[Hn] = {
|
|
492
492
|
textureFormat: V,
|
|
493
493
|
colorRenderable: !1,
|
|
494
494
|
textureFilterable: !1,
|
|
495
495
|
bytesPerElement: [3],
|
|
496
496
|
type: [P]
|
|
497
|
-
}, e[
|
|
497
|
+
}, e[Un] = {
|
|
498
498
|
textureFormat: V,
|
|
499
499
|
colorRenderable: !1,
|
|
500
500
|
textureFilterable: !1,
|
|
501
501
|
bytesPerElement: [6],
|
|
502
|
-
type: [
|
|
503
|
-
}, e[
|
|
502
|
+
type: [mr]
|
|
503
|
+
}, e[Wn] = {
|
|
504
504
|
textureFormat: V,
|
|
505
505
|
colorRenderable: !1,
|
|
506
506
|
textureFilterable: !1,
|
|
507
507
|
bytesPerElement: [6],
|
|
508
|
-
type: [
|
|
509
|
-
}, e[
|
|
508
|
+
type: [pr]
|
|
509
|
+
}, e[Gn] = {
|
|
510
510
|
textureFormat: V,
|
|
511
511
|
colorRenderable: !1,
|
|
512
512
|
textureFilterable: !1,
|
|
513
513
|
bytesPerElement: [12],
|
|
514
514
|
type: [I]
|
|
515
|
-
}, e[
|
|
515
|
+
}, e[Kn] = {
|
|
516
516
|
textureFormat: V,
|
|
517
517
|
colorRenderable: !1,
|
|
518
518
|
textureFilterable: !1,
|
|
519
519
|
bytesPerElement: [12],
|
|
520
|
-
type: [
|
|
521
|
-
}, e[
|
|
520
|
+
type: [hr]
|
|
521
|
+
}, e[qn] = {
|
|
522
522
|
textureFormat: k,
|
|
523
523
|
colorRenderable: !0,
|
|
524
524
|
textureFilterable: !0,
|
|
525
525
|
bytesPerElement: [4],
|
|
526
526
|
type: [F]
|
|
527
|
-
}, e[
|
|
527
|
+
}, e[Jn] = {
|
|
528
528
|
textureFormat: k,
|
|
529
529
|
colorRenderable: !0,
|
|
530
530
|
textureFilterable: !0,
|
|
531
531
|
bytesPerElement: [4],
|
|
532
532
|
type: [F]
|
|
533
|
-
}, e[
|
|
533
|
+
}, e[Yn] = {
|
|
534
534
|
textureFormat: k,
|
|
535
535
|
colorRenderable: !1,
|
|
536
536
|
textureFilterable: !0,
|
|
537
537
|
bytesPerElement: [4],
|
|
538
538
|
type: [P]
|
|
539
|
-
}, e[
|
|
539
|
+
}, e[Xn] = {
|
|
540
540
|
textureFormat: k,
|
|
541
541
|
colorRenderable: !0,
|
|
542
542
|
textureFilterable: !0,
|
|
@@ -547,148 +547,148 @@ function Or(e) {
|
|
|
547
547
|
],
|
|
548
548
|
type: [
|
|
549
549
|
F,
|
|
550
|
-
|
|
551
|
-
|
|
550
|
+
_r,
|
|
551
|
+
br
|
|
552
552
|
]
|
|
553
|
-
}, e[
|
|
553
|
+
}, e[Zn] = {
|
|
554
554
|
textureFormat: k,
|
|
555
555
|
colorRenderable: !0,
|
|
556
556
|
textureFilterable: !0,
|
|
557
557
|
bytesPerElement: [4, 2],
|
|
558
|
-
type: [F,
|
|
559
|
-
}, e[
|
|
558
|
+
type: [F, gr]
|
|
559
|
+
}, e[Qn] = {
|
|
560
560
|
textureFormat: k,
|
|
561
561
|
colorRenderable: !0,
|
|
562
562
|
textureFilterable: !0,
|
|
563
563
|
bytesPerElement: [4],
|
|
564
|
-
type: [
|
|
565
|
-
}, e[
|
|
564
|
+
type: [br]
|
|
565
|
+
}, e[$n] = {
|
|
566
566
|
textureFormat: k,
|
|
567
567
|
colorRenderable: !1,
|
|
568
568
|
textureFilterable: !0,
|
|
569
569
|
bytesPerElement: [16, 8],
|
|
570
570
|
type: [L, R]
|
|
571
|
-
}, e[
|
|
571
|
+
}, e[er] = {
|
|
572
572
|
textureFormat: k,
|
|
573
573
|
colorRenderable: !1,
|
|
574
574
|
textureFilterable: !1,
|
|
575
575
|
bytesPerElement: [16],
|
|
576
576
|
type: [L]
|
|
577
|
-
}, e[
|
|
577
|
+
}, e[tr] = {
|
|
578
578
|
textureFormat: H,
|
|
579
579
|
colorRenderable: !0,
|
|
580
580
|
textureFilterable: !1,
|
|
581
581
|
bytesPerElement: [4],
|
|
582
582
|
type: [F]
|
|
583
|
-
}, e[
|
|
583
|
+
}, e[nr] = {
|
|
584
584
|
textureFormat: H,
|
|
585
585
|
colorRenderable: !0,
|
|
586
586
|
textureFilterable: !1,
|
|
587
587
|
bytesPerElement: [4],
|
|
588
588
|
type: [P]
|
|
589
|
-
}, e[
|
|
589
|
+
}, e[rr] = {
|
|
590
590
|
textureFormat: H,
|
|
591
591
|
colorRenderable: !0,
|
|
592
592
|
textureFilterable: !1,
|
|
593
593
|
bytesPerElement: [4],
|
|
594
|
-
type: [
|
|
595
|
-
}, e[
|
|
594
|
+
type: [br]
|
|
595
|
+
}, e[ir] = {
|
|
596
596
|
textureFormat: H,
|
|
597
597
|
colorRenderable: !0,
|
|
598
598
|
textureFilterable: !1,
|
|
599
599
|
bytesPerElement: [8],
|
|
600
|
-
type: [
|
|
601
|
-
}, e[
|
|
600
|
+
type: [mr]
|
|
601
|
+
}, e[ar] = {
|
|
602
602
|
textureFormat: H,
|
|
603
603
|
colorRenderable: !0,
|
|
604
604
|
textureFilterable: !1,
|
|
605
605
|
bytesPerElement: [8],
|
|
606
|
-
type: [
|
|
607
|
-
}, e[
|
|
606
|
+
type: [pr]
|
|
607
|
+
}, e[or] = {
|
|
608
608
|
textureFormat: H,
|
|
609
609
|
colorRenderable: !0,
|
|
610
610
|
textureFilterable: !1,
|
|
611
611
|
bytesPerElement: [16],
|
|
612
|
-
type: [
|
|
613
|
-
}, e[
|
|
612
|
+
type: [hr]
|
|
613
|
+
}, e[sr] = {
|
|
614
614
|
textureFormat: H,
|
|
615
615
|
colorRenderable: !0,
|
|
616
616
|
textureFilterable: !1,
|
|
617
617
|
bytesPerElement: [16],
|
|
618
618
|
type: [I]
|
|
619
|
-
}, e[
|
|
620
|
-
textureFormat:
|
|
619
|
+
}, e[cr] = {
|
|
620
|
+
textureFormat: Lt,
|
|
621
621
|
colorRenderable: !0,
|
|
622
622
|
textureFilterable: !1,
|
|
623
623
|
bytesPerElement: [2, 4],
|
|
624
|
-
type: [
|
|
625
|
-
}, e[
|
|
626
|
-
textureFormat:
|
|
624
|
+
type: [mr, I]
|
|
625
|
+
}, e[lr] = {
|
|
626
|
+
textureFormat: Lt,
|
|
627
627
|
colorRenderable: !0,
|
|
628
628
|
textureFilterable: !1,
|
|
629
629
|
bytesPerElement: [4],
|
|
630
630
|
type: [I]
|
|
631
|
-
}, e[
|
|
632
|
-
textureFormat:
|
|
631
|
+
}, e[ur] = {
|
|
632
|
+
textureFormat: Lt,
|
|
633
633
|
colorRenderable: !0,
|
|
634
634
|
textureFilterable: !1,
|
|
635
635
|
bytesPerElement: [4],
|
|
636
636
|
type: [L]
|
|
637
|
-
}, e[
|
|
638
|
-
textureFormat:
|
|
637
|
+
}, e[fr] = {
|
|
638
|
+
textureFormat: Rt,
|
|
639
639
|
colorRenderable: !0,
|
|
640
640
|
textureFilterable: !1,
|
|
641
641
|
bytesPerElement: [4],
|
|
642
|
-
type: [
|
|
643
|
-
}, e[
|
|
644
|
-
textureFormat:
|
|
642
|
+
type: [wr]
|
|
643
|
+
}, e[dr] = {
|
|
644
|
+
textureFormat: Rt,
|
|
645
645
|
colorRenderable: !0,
|
|
646
646
|
textureFilterable: !1,
|
|
647
647
|
bytesPerElement: [4],
|
|
648
|
-
type: [
|
|
648
|
+
type: [Cr]
|
|
649
649
|
}, Object.keys(e).forEach(function(t) {
|
|
650
650
|
let n = e[t];
|
|
651
651
|
n.bytesPerElementMap = {}, n.bytesPerElement.forEach(function(e, t) {
|
|
652
652
|
let r = n.type[t];
|
|
653
653
|
n.bytesPerElementMap[r] = e;
|
|
654
654
|
});
|
|
655
|
-
}),
|
|
655
|
+
}), Or = e;
|
|
656
656
|
}
|
|
657
|
-
return
|
|
657
|
+
return Or[e];
|
|
658
658
|
}
|
|
659
|
-
function
|
|
660
|
-
let n =
|
|
659
|
+
function Ar(e, t) {
|
|
660
|
+
let n = kr(e);
|
|
661
661
|
if (!n) throw "unknown internal format";
|
|
662
662
|
let r = n.bytesPerElementMap[t];
|
|
663
663
|
if (r === void 0) throw "unknown internal format";
|
|
664
664
|
return r;
|
|
665
665
|
}
|
|
666
|
-
function
|
|
667
|
-
let t =
|
|
666
|
+
function jr(e) {
|
|
667
|
+
let t = kr(e);
|
|
668
668
|
if (!t) throw "unknown internal format";
|
|
669
669
|
return {
|
|
670
670
|
format: t.textureFormat,
|
|
671
671
|
type: t.type[0]
|
|
672
672
|
};
|
|
673
673
|
}
|
|
674
|
-
function
|
|
674
|
+
function Mr(e) {
|
|
675
675
|
return (e & e - 1) == 0;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
678
|
-
if (!
|
|
679
|
-
let i =
|
|
677
|
+
function Nr(e, t, n, r) {
|
|
678
|
+
if (!At(e)) return Mr(t) && Mr(n);
|
|
679
|
+
let i = kr(r);
|
|
680
680
|
if (!i) throw "unknown internal format";
|
|
681
681
|
return i.colorRenderable && i.textureFilterable;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
684
|
-
let t =
|
|
683
|
+
function Pr(e) {
|
|
684
|
+
let t = kr(e);
|
|
685
685
|
if (!t) throw "unknown internal format";
|
|
686
686
|
return t.textureFilterable;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
688
|
+
function Fr(e, t, n) {
|
|
689
|
+
return Mt(t) ? Ke(t) : n || F;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function Ir(e, t, n, r, i) {
|
|
692
692
|
if (i % 1 != 0) throw "can't guess dimensions";
|
|
693
693
|
if (!n && !r) {
|
|
694
694
|
let e = Math.sqrt(i / (t === j ? 6 : 1));
|
|
@@ -701,51 +701,51 @@ function Fr(e, t, n, r, i) {
|
|
|
701
701
|
height: r
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
|
-
function
|
|
705
|
-
t.colorspaceConversion !== void 0 && e.pixelStorei(
|
|
704
|
+
function Lr(e, t) {
|
|
705
|
+
t.colorspaceConversion !== void 0 && e.pixelStorei(un, t.colorspaceConversion), t.premultiplyAlpha !== void 0 && e.pixelStorei(dn, t.premultiplyAlpha), t.flipY !== void 0 && e.pixelStorei(fn, t.flipY);
|
|
706
706
|
}
|
|
707
|
-
function
|
|
708
|
-
e.pixelStorei(
|
|
707
|
+
function Rr(e) {
|
|
708
|
+
e.pixelStorei(rn, 4), At(e) && (e.pixelStorei(an, 0), e.pixelStorei(on, 0), e.pixelStorei(sn, 0), e.pixelStorei(cn, 0), e.pixelStorei(ln, 0));
|
|
709
709
|
}
|
|
710
|
-
function
|
|
711
|
-
r.minMag && (n.call(e, t,
|
|
710
|
+
function zr(e, t, n, r) {
|
|
711
|
+
r.minMag && (n.call(e, t, Jt, r.minMag), n.call(e, t, Yt, r.minMag)), r.min && n.call(e, t, Jt, r.min), r.mag && n.call(e, t, Yt, r.mag), r.wrap && (n.call(e, t, Xt, r.wrap), n.call(e, t, Zt, r.wrap), (t === M || tt(e, t)) && n.call(e, t, Qt, r.wrap)), r.wrapR && n.call(e, t, Qt, r.wrapR), r.wrapS && n.call(e, t, Xt, r.wrapS), r.wrapT && n.call(e, t, Zt, r.wrapT), r.minLod && n.call(e, t, $t, r.minLod), r.maxLod && n.call(e, t, en, r.maxLod), r.baseLevel && n.call(e, t, tn, r.baseLevel), r.maxLevel && n.call(e, t, nn, r.maxLevel);
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function Br(e, t, n) {
|
|
714
714
|
let r = n.target || A;
|
|
715
|
-
e.bindTexture(r, t),
|
|
715
|
+
e.bindTexture(r, t), zr(e, r, e.texParameteri, n);
|
|
716
716
|
}
|
|
717
|
-
function
|
|
718
|
-
return e ||= D.textureColor,
|
|
717
|
+
function Vr(e) {
|
|
718
|
+
return e ||= D.textureColor, Mt(e) ? e : new Uint8Array([
|
|
719
719
|
e[0] * 255,
|
|
720
720
|
e[1] * 255,
|
|
721
721
|
e[2] * 255,
|
|
722
722
|
e[3] * 255
|
|
723
723
|
]);
|
|
724
724
|
}
|
|
725
|
-
function
|
|
725
|
+
function Hr(e, t, n, r, i, a) {
|
|
726
726
|
n ||= D.textureOptions, a ||= k;
|
|
727
727
|
let o = n.target || A;
|
|
728
|
-
if (r ||= n.width, i ||= n.height, e.bindTexture(o, t),
|
|
728
|
+
if (r ||= n.width, i ||= n.height, e.bindTexture(o, t), Nr(e, r, i, a)) e.generateMipmap(o);
|
|
729
729
|
else {
|
|
730
|
-
let t =
|
|
731
|
-
e.texParameteri(o,
|
|
730
|
+
let t = Pr(a) ? Vt : Bt;
|
|
731
|
+
e.texParameteri(o, Jt, t), e.texParameteri(o, Yt, t), e.texParameteri(o, Xt, zt), e.texParameteri(o, Zt, zt);
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function Ur(e) {
|
|
735
735
|
return e.auto === !0 || e.auto === void 0 && e.level === void 0;
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function Wr(e, t) {
|
|
738
738
|
return t ||= {}, t.cubeFaceOrder || [
|
|
739
|
-
Vt,
|
|
740
739
|
Ht,
|
|
741
740
|
Ut,
|
|
742
741
|
Wt,
|
|
743
742
|
Gt,
|
|
744
|
-
Kt
|
|
743
|
+
Kt,
|
|
744
|
+
qt
|
|
745
745
|
];
|
|
746
746
|
}
|
|
747
|
-
function
|
|
748
|
-
let n =
|
|
747
|
+
function Gr(e, t) {
|
|
748
|
+
let n = Wr(e, t).map(function(e, t) {
|
|
749
749
|
return {
|
|
750
750
|
face: e,
|
|
751
751
|
ndx: t
|
|
@@ -755,10 +755,10 @@ function Wr(e, t) {
|
|
|
755
755
|
return e.face - t.face;
|
|
756
756
|
}), n;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function Kr(e, t, n, r) {
|
|
759
759
|
r ||= D.textureOptions;
|
|
760
|
-
let i = r.target || A, a = r.level || 0, o = n.width, s = n.height, c = r.internalFormat || r.format || k, l =
|
|
761
|
-
if (
|
|
760
|
+
let i = r.target || A, a = r.level || 0, o = n.width, s = n.height, c = r.internalFormat || r.format || k, l = jr(c), u = r.format || l.format, d = r.type || l.type;
|
|
761
|
+
if (Lr(e, r), e.bindTexture(i, t), i === j) {
|
|
762
762
|
let l = n.width, f = n.height, p, m;
|
|
763
763
|
if (l / 6 === f) p = f, m = [
|
|
764
764
|
0,
|
|
@@ -817,34 +817,34 @@ function Gr(e, t, n, r) {
|
|
|
817
817
|
2
|
|
818
818
|
];
|
|
819
819
|
else throw "can't figure out cube map from element: " + (n.src ? n.src : n.nodeName);
|
|
820
|
-
let h =
|
|
821
|
-
h ? (h.canvas.width = p, h.canvas.height = p, o = p, s = p,
|
|
820
|
+
let h = Nt();
|
|
821
|
+
h ? (h.canvas.width = p, h.canvas.height = p, o = p, s = p, Gr(e, r).forEach(function(t) {
|
|
822
822
|
let r = m[t.ndx * 2 + 0] * p, i = m[t.ndx * 2 + 1] * p;
|
|
823
823
|
h.drawImage(n, r, i, p, p, 0, 0, p, p), e.texImage2D(t.face, a, c, u, d, h.canvas);
|
|
824
|
-
}), h.canvas.width = 1, h.canvas.height = 1) : typeof createImageBitmap < "u" && (o = p, s = p,
|
|
824
|
+
}), h.canvas.width = 1, h.canvas.height = 1) : typeof createImageBitmap < "u" && (o = p, s = p, Gr(e, r).forEach(function(l) {
|
|
825
825
|
let f = m[l.ndx * 2 + 0] * p, h = m[l.ndx * 2 + 1] * p;
|
|
826
826
|
e.texImage2D(l.face, a, c, p, p, 0, u, d, null), createImageBitmap(n, f, h, p, p, {
|
|
827
827
|
premultiplyAlpha: "none",
|
|
828
828
|
colorSpaceConversion: "none"
|
|
829
829
|
}).then(function(n) {
|
|
830
|
-
|
|
830
|
+
Lr(e, r), e.bindTexture(i, t), e.texImage2D(l.face, a, c, u, d, n), Ur(r) && Hr(e, t, r, o, s, c);
|
|
831
831
|
});
|
|
832
832
|
}));
|
|
833
833
|
} else if (i === M || i === N) {
|
|
834
834
|
let t = Math.min(n.width, n.height), r = Math.max(n.width, n.height), o = r / t;
|
|
835
835
|
if (o % 1 != 0) throw "can not compute 3D dimensions of element";
|
|
836
836
|
let s = +(n.width === r), l = +(n.height === r);
|
|
837
|
-
e.pixelStorei(
|
|
837
|
+
e.pixelStorei(rn, 1), e.pixelStorei(an, n.width), e.pixelStorei(on, 0), e.pixelStorei(ln, 0), e.texImage3D(i, a, c, t, t, t, 0, u, d, null);
|
|
838
838
|
for (let r = 0; r < o; ++r) {
|
|
839
839
|
let o = r * t * s, c = r * t * l;
|
|
840
|
-
e.pixelStorei(
|
|
840
|
+
e.pixelStorei(sn, o), e.pixelStorei(cn, c), e.texSubImage3D(i, a, 0, 0, r, t, t, 1, u, d, n);
|
|
841
841
|
}
|
|
842
|
-
|
|
842
|
+
Rr(e);
|
|
843
843
|
} else e.texImage2D(i, a, c, u, d, n);
|
|
844
|
-
|
|
844
|
+
Ur(r) && Hr(e, t, r, o, s, c), Br(e, t, r);
|
|
845
845
|
}
|
|
846
|
-
function
|
|
847
|
-
function
|
|
846
|
+
function qr() {}
|
|
847
|
+
function Jr(e) {
|
|
848
848
|
if (typeof document < "u") {
|
|
849
849
|
let t = document.createElement("a");
|
|
850
850
|
return t.href = e, t.hostname === location.hostname && t.port === location.port && t.protocol === location.protocol;
|
|
@@ -853,13 +853,13 @@ function qr(e) {
|
|
|
853
853
|
return new URL(e, location.href).origin === t;
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
|
-
function
|
|
857
|
-
return t === void 0 && !
|
|
856
|
+
function Yr(e, t) {
|
|
857
|
+
return t === void 0 && !Jr(e) ? "anonymous" : t;
|
|
858
858
|
}
|
|
859
|
-
function
|
|
860
|
-
n ||=
|
|
859
|
+
function Xr(e, t, n) {
|
|
860
|
+
n ||= qr;
|
|
861
861
|
let r;
|
|
862
|
-
if (t = t === void 0 ? D.crossOrigin : t, t =
|
|
862
|
+
if (t = t === void 0 ? D.crossOrigin : t, t = Yr(e, t), typeof Image < "u") {
|
|
863
863
|
r = new Image(), t !== void 0 && (r.crossOrigin = t);
|
|
864
864
|
let i = function() {
|
|
865
865
|
r.removeEventListener("error", a), r.removeEventListener("load", o), r = null;
|
|
@@ -890,90 +890,90 @@ function Yr(e, t, n) {
|
|
|
890
890
|
}
|
|
891
891
|
return r;
|
|
892
892
|
}
|
|
893
|
-
function
|
|
893
|
+
function Zr(e) {
|
|
894
894
|
return typeof ImageBitmap < "u" && e instanceof ImageBitmap || typeof ImageData < "u" && e instanceof ImageData || typeof HTMLElement < "u" && e instanceof HTMLElement;
|
|
895
895
|
}
|
|
896
|
-
function
|
|
897
|
-
return
|
|
896
|
+
function Qr(e, t, n) {
|
|
897
|
+
return Zr(e) ? (setTimeout(function() {
|
|
898
898
|
n(null, e);
|
|
899
|
-
}), e) :
|
|
899
|
+
}), e) : Xr(e, t, n);
|
|
900
900
|
}
|
|
901
|
-
function
|
|
901
|
+
function $r(e, t, n) {
|
|
902
902
|
n ||= D.textureOptions;
|
|
903
903
|
let r = n.target || A;
|
|
904
904
|
if (e.bindTexture(r, t), n.color === !1) return;
|
|
905
|
-
let i =
|
|
906
|
-
if (r === j) for (let t = 0; t < 6; ++t) e.texImage2D(
|
|
905
|
+
let i = Vr(n.color);
|
|
906
|
+
if (r === j) for (let t = 0; t < 6; ++t) e.texImage2D(Ht + t, 0, k, 1, 1, 0, k, F, i);
|
|
907
907
|
else r === M || r === N ? e.texImage3D(r, 0, k, 1, 1, 1, 0, k, F, i) : e.texImage2D(r, 0, k, 1, 1, 0, k, F, i);
|
|
908
908
|
}
|
|
909
|
-
function
|
|
910
|
-
return r ||=
|
|
911
|
-
i ? r(i, t, a) : (
|
|
909
|
+
function ei(e, t, n, r) {
|
|
910
|
+
return r ||= qr, n ||= D.textureOptions, $r(e, t, n), n = Object.assign({}, n), Qr(n.src, n.crossOrigin, function(i, a) {
|
|
911
|
+
i ? r(i, t, a) : (Kr(e, t, a, n), r(null, t, a));
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
|
-
function
|
|
915
|
-
r ||=
|
|
914
|
+
function ti(e, t, n, r) {
|
|
915
|
+
r ||= qr;
|
|
916
916
|
let i = n.src;
|
|
917
917
|
if (i.length !== 6) throw "there must be 6 urls for a cubemap";
|
|
918
|
-
let a = n.level || 0, o = n.internalFormat || n.format || k, s =
|
|
918
|
+
let a = n.level || 0, o = n.internalFormat || n.format || k, s = jr(o), c = n.format || s.format, l = n.type || F, u = n.target || A;
|
|
919
919
|
if (u !== j) throw "target must be TEXTURE_CUBE_MAP";
|
|
920
|
-
|
|
921
|
-
let d = 6, f = [], p =
|
|
920
|
+
$r(e, t, n), n = Object.assign({}, n);
|
|
921
|
+
let d = 6, f = [], p = Wr(e, n), m;
|
|
922
922
|
function h(i) {
|
|
923
923
|
return function(s, p) {
|
|
924
|
-
--d, s ? f.push(s) : p.width === p.height ? (
|
|
924
|
+
--d, s ? f.push(s) : p.width === p.height ? (Lr(e, n), e.bindTexture(u, t), d === 5 ? Wr().forEach(function(t) {
|
|
925
925
|
e.texImage2D(t, a, o, c, l, p);
|
|
926
|
-
}) : e.texImage2D(i, a, o, c, l, p),
|
|
926
|
+
}) : e.texImage2D(i, a, o, c, l, p), Ur(n) && e.generateMipmap(u)) : f.push("cubemap face img is not a square: " + p.src), d === 0 && r(f.length ? f : void 0, t, m);
|
|
927
927
|
};
|
|
928
928
|
}
|
|
929
929
|
m = i.map(function(e, t) {
|
|
930
|
-
return
|
|
930
|
+
return Qr(e, n.crossOrigin, h(p[t]));
|
|
931
931
|
});
|
|
932
932
|
}
|
|
933
|
-
function
|
|
934
|
-
r ||=
|
|
935
|
-
let i = n.src, a = n.internalFormat || n.format || k, o =
|
|
933
|
+
function ni(e, t, n, r) {
|
|
934
|
+
r ||= qr;
|
|
935
|
+
let i = n.src, a = n.internalFormat || n.format || k, o = jr(a), s = n.format || o.format, c = n.type || F, l = n.target || N;
|
|
936
936
|
if (l !== M && l !== N) throw "target must be TEXTURE_3D or TEXTURE_2D_ARRAY";
|
|
937
|
-
|
|
937
|
+
$r(e, t, n), n = Object.assign({}, n);
|
|
938
938
|
let u = i.length, d = [], f, p = n.level || 0, m = n.width, h = n.height, g = i.length, _ = !0;
|
|
939
939
|
function v(i) {
|
|
940
940
|
return function(o, v) {
|
|
941
941
|
if (--u, o) d.push(o);
|
|
942
942
|
else {
|
|
943
|
-
if (
|
|
943
|
+
if (Lr(e, n), e.bindTexture(l, t), _) {
|
|
944
944
|
_ = !1, m = n.width || v.width, h = n.height || v.height, e.texImage3D(l, p, a, m, h, g, 0, s, c, null);
|
|
945
945
|
for (let t = 0; t < g; ++t) e.texSubImage3D(l, p, 0, 0, t, m, h, 1, s, c, v);
|
|
946
946
|
} else {
|
|
947
947
|
let t = v, n;
|
|
948
|
-
(v.width !== m || v.height !== h) && (n =
|
|
948
|
+
(v.width !== m || v.height !== h) && (n = Nt(), t = n.canvas, n.canvas.width = m, n.canvas.height = h, n.drawImage(v, 0, 0, m, h)), e.texSubImage3D(l, p, 0, 0, i, m, h, 1, s, c, t), n && t === n.canvas && (n.canvas.width = 0, n.canvas.height = 0);
|
|
949
949
|
}
|
|
950
|
-
|
|
950
|
+
Ur(n) && e.generateMipmap(l);
|
|
951
951
|
}
|
|
952
952
|
u === 0 && r(d.length ? d : void 0, t, f);
|
|
953
953
|
};
|
|
954
954
|
}
|
|
955
955
|
f = i.map(function(e, t) {
|
|
956
|
-
return
|
|
956
|
+
return Qr(e, n.crossOrigin, v(t));
|
|
957
957
|
});
|
|
958
958
|
}
|
|
959
|
-
function
|
|
959
|
+
function ri(e, t, n, r) {
|
|
960
960
|
r ||= D.textureOptions;
|
|
961
961
|
let i = r.target || A;
|
|
962
962
|
e.bindTexture(i, t);
|
|
963
|
-
let a = r.width, o = r.height, s = r.depth, c = r.level || 0, l = r.internalFormat || r.format || k, u =
|
|
964
|
-
|
|
965
|
-
let p =
|
|
966
|
-
if (m % 1) throw "length wrong size for format: " +
|
|
963
|
+
let a = r.width, o = r.height, s = r.depth, c = r.level || 0, l = r.internalFormat || r.format || k, u = jr(l), d = r.format || u.format, f = r.type || Fr(e, n, u.type);
|
|
964
|
+
Mt(n) ? n instanceof Uint8ClampedArray && (n = new Uint8Array(n.buffer)) : n = new (Je(f))(n);
|
|
965
|
+
let p = Ar(l, f), m = n.byteLength / p;
|
|
966
|
+
if (m % 1) throw "length wrong size for format: " + jt(e, d);
|
|
967
967
|
let h;
|
|
968
968
|
if (i === M || i === N) if (!a && !o && !s) {
|
|
969
969
|
let e = Math.cbrt(m);
|
|
970
970
|
if (e % 1 != 0) throw "can't guess cube size of array of numElements: " + m;
|
|
971
971
|
a = e, o = e, s = e;
|
|
972
|
-
} else a && (!o || !s) ? (h =
|
|
973
|
-
else h =
|
|
974
|
-
if (
|
|
972
|
+
} else a && (!o || !s) ? (h = Ir(e, i, o, s, m / a), o = h.width, s = h.height) : o && (!a || !s) ? (h = Ir(e, i, a, s, m / o), a = h.width, s = h.height) : (h = Ir(e, i, a, o, m / s), a = h.width, o = h.height);
|
|
973
|
+
else h = Ir(e, i, a, o, m), a = h.width, o = h.height;
|
|
974
|
+
if (Rr(e), e.pixelStorei(rn, r.unpackAlignment || 1), Lr(e, r), i === j) {
|
|
975
975
|
let t = p / n.BYTES_PER_ELEMENT, i = m / 6 * t;
|
|
976
|
-
|
|
976
|
+
Gr(e, r).forEach((t) => {
|
|
977
977
|
let r = i * t.ndx, s = n.subarray(r, r + i);
|
|
978
978
|
e.texImage2D(t.face, c, l, a, o, 0, d, f, s);
|
|
979
979
|
});
|
|
@@ -985,322 +985,316 @@ function ni(e, t, n, r) {
|
|
|
985
985
|
type: f
|
|
986
986
|
};
|
|
987
987
|
}
|
|
988
|
-
function
|
|
988
|
+
function ii(e, t, n) {
|
|
989
989
|
let r = n.target || A;
|
|
990
990
|
e.bindTexture(r, t);
|
|
991
|
-
let i = n.level || 0, a = n.internalFormat || n.format || k, o =
|
|
992
|
-
if (
|
|
991
|
+
let i = n.level || 0, a = n.internalFormat || n.format || k, o = jr(a), s = n.format || o.format, c = n.type || o.type;
|
|
992
|
+
if (Lr(e, n), r === j) for (let t = 0; t < 6; ++t) e.texImage2D(Ht + t, i, a, n.width, n.height, 0, s, c, null);
|
|
993
993
|
else r === M || r === N ? e.texImage3D(r, i, a, n.width, n.height, n.depth, 0, s, c, null) : e.texImage2D(r, i, a, n.width, n.height, 0, s, c, null);
|
|
994
994
|
}
|
|
995
|
-
function
|
|
996
|
-
n ||=
|
|
995
|
+
function ai(e, t, n) {
|
|
996
|
+
n ||= qr, t ||= D.textureOptions;
|
|
997
997
|
let r = e.createTexture(), i = t.target || A, a = t.width || 1, o = t.height || 1, s = t.internalFormat || k;
|
|
998
|
-
e.bindTexture(i, r), i === j && (e.texParameteri(i,
|
|
998
|
+
e.bindTexture(i, r), i === j && (e.texParameteri(i, Xt, zt), e.texParameteri(i, Zt, zt));
|
|
999
999
|
let c = t.src;
|
|
1000
|
-
if (c) if (typeof c == "function" && (c = c(e, t)), typeof c == "string")
|
|
1001
|
-
else if (
|
|
1002
|
-
let n =
|
|
1000
|
+
if (c) if (typeof c == "function" && (c = c(e, t)), typeof c == "string") ei(e, r, t, n);
|
|
1001
|
+
else if (Mt(c) || Array.isArray(c) && (typeof c[0] == "number" || Array.isArray(c[0]) || Mt(c[0]))) {
|
|
1002
|
+
let n = ri(e, r, c, t);
|
|
1003
1003
|
a = n.width, o = n.height;
|
|
1004
|
-
} else Array.isArray(c) && (typeof c[0] == "string" ||
|
|
1005
|
-
else
|
|
1006
|
-
return
|
|
1004
|
+
} else Array.isArray(c) && (typeof c[0] == "string" || Zr(c[0])) ? i === j ? ti(e, r, t, n) : ni(e, r, t, n) : (Kr(e, r, c, t), a = c.width, o = c.height);
|
|
1005
|
+
else ii(e, r, t);
|
|
1006
|
+
return Ur(t) && Hr(e, r, t, a, o, s), Br(e, r, t), r;
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function oi(e, t, n, r, i, a) {
|
|
1009
1009
|
r ||= n.width, i ||= n.height, a ||= n.depth;
|
|
1010
1010
|
let o = n.target || A;
|
|
1011
1011
|
e.bindTexture(o, t);
|
|
1012
|
-
let s = n.level || 0, c = n.internalFormat || n.format || k, l =
|
|
1013
|
-
if (d = f && (
|
|
1012
|
+
let s = n.level || 0, c = n.internalFormat || n.format || k, l = jr(c), u = n.format || l.format, d, f = n.src;
|
|
1013
|
+
if (d = f && (Mt(f) || Array.isArray(f) && typeof f[0] == "number") ? n.type || Fr(e, f, l.type) : n.type || l.type, o === j) for (let t = 0; t < 6; ++t) e.texImage2D(Ht + t, s, c, r, i, 0, u, d, null);
|
|
1014
1014
|
else o === M || o === N ? e.texImage3D(o, s, c, r, i, a, 0, u, d, null) : e.texImage2D(o, s, c, r, i, 0, u, d, null);
|
|
1015
1015
|
}
|
|
1016
|
-
var
|
|
1017
|
-
function
|
|
1016
|
+
var si = Ze, ci = 33984, li = 35048, ui = 34962, di = 34963, fi = 35345, pi = 35718, mi = 35721, hi = 35971, gi = 35382, _i = 35396, vi = 35398, yi = 35392, bi = 35395, xi = 5126, Si = 35664, Ci = 35665, wi = 35666, Ti = 5124, Ei = 35667, Di = 35668, Oi = 35669, ki = 35670, Ai = 35671, ji = 35672, Mi = 35673, Ni = 35674, Pi = 35675, Fi = 35676, Ii = 35678, Li = 35680, Ri = 35679, zi = 35682, Bi = 35685, Vi = 35686, Hi = 35687, Ui = 35688, Wi = 35689, Gi = 35690, Ki = 36289, qi = 36292, Ji = 36293, Yi = 5125, Xi = 36294, Zi = 36295, Qi = 36296, $i = 36298, ea = 36299, ta = 36300, na = 36303, ra = 36306, ia = 36307, aa = 36308, oa = 36311, sa = 3553, ca = 34067, la = 32879, ua = 35866, U = {};
|
|
1017
|
+
function da(e, t) {
|
|
1018
1018
|
return U[t].bindPoint;
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function fa(e, t) {
|
|
1021
1021
|
return function(n) {
|
|
1022
1022
|
e.uniform1f(t, n);
|
|
1023
1023
|
};
|
|
1024
1024
|
}
|
|
1025
|
-
function
|
|
1025
|
+
function pa(e, t) {
|
|
1026
1026
|
return function(n) {
|
|
1027
1027
|
e.uniform1fv(t, n);
|
|
1028
1028
|
};
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1030
|
+
function ma(e, t) {
|
|
1031
1031
|
return function(n) {
|
|
1032
1032
|
e.uniform2fv(t, n);
|
|
1033
1033
|
};
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function ha(e, t) {
|
|
1036
1036
|
return function(n) {
|
|
1037
1037
|
e.uniform3fv(t, n);
|
|
1038
1038
|
};
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function ga(e, t) {
|
|
1041
1041
|
return function(n) {
|
|
1042
1042
|
e.uniform4fv(t, n);
|
|
1043
1043
|
};
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function _a(e, t) {
|
|
1046
1046
|
return function(n) {
|
|
1047
1047
|
e.uniform1i(t, n);
|
|
1048
1048
|
};
|
|
1049
1049
|
}
|
|
1050
|
-
function
|
|
1050
|
+
function va(e, t) {
|
|
1051
1051
|
return function(n) {
|
|
1052
1052
|
e.uniform1iv(t, n);
|
|
1053
1053
|
};
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function ya(e, t) {
|
|
1056
1056
|
return function(n) {
|
|
1057
1057
|
e.uniform2iv(t, n);
|
|
1058
1058
|
};
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function ba(e, t) {
|
|
1061
1061
|
return function(n) {
|
|
1062
1062
|
e.uniform3iv(t, n);
|
|
1063
1063
|
};
|
|
1064
1064
|
}
|
|
1065
|
-
function
|
|
1065
|
+
function xa(e, t) {
|
|
1066
1066
|
return function(n) {
|
|
1067
1067
|
e.uniform4iv(t, n);
|
|
1068
1068
|
};
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function Sa(e, t) {
|
|
1071
1071
|
return function(n) {
|
|
1072
1072
|
e.uniform1ui(t, n);
|
|
1073
1073
|
};
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function Ca(e, t) {
|
|
1076
1076
|
return function(n) {
|
|
1077
1077
|
e.uniform1uiv(t, n);
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
|
-
function
|
|
1080
|
+
function wa(e, t) {
|
|
1081
1081
|
return function(n) {
|
|
1082
1082
|
e.uniform2uiv(t, n);
|
|
1083
1083
|
};
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function Ta(e, t) {
|
|
1086
1086
|
return function(n) {
|
|
1087
1087
|
e.uniform3uiv(t, n);
|
|
1088
1088
|
};
|
|
1089
1089
|
}
|
|
1090
|
-
function
|
|
1090
|
+
function Ea(e, t) {
|
|
1091
1091
|
return function(n) {
|
|
1092
1092
|
e.uniform4uiv(t, n);
|
|
1093
1093
|
};
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function Da(e, t) {
|
|
1096
1096
|
return function(n) {
|
|
1097
1097
|
e.uniformMatrix2fv(t, !1, n);
|
|
1098
1098
|
};
|
|
1099
1099
|
}
|
|
1100
|
-
function
|
|
1100
|
+
function Oa(e, t) {
|
|
1101
1101
|
return function(n) {
|
|
1102
1102
|
e.uniformMatrix3fv(t, !1, n);
|
|
1103
1103
|
};
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function ka(e, t) {
|
|
1106
1106
|
return function(n) {
|
|
1107
1107
|
e.uniformMatrix4fv(t, !1, n);
|
|
1108
1108
|
};
|
|
1109
1109
|
}
|
|
1110
|
-
function
|
|
1110
|
+
function Aa(e, t) {
|
|
1111
1111
|
return function(n) {
|
|
1112
1112
|
e.uniformMatrix2x3fv(t, !1, n);
|
|
1113
1113
|
};
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function ja(e, t) {
|
|
1116
1116
|
return function(n) {
|
|
1117
1117
|
e.uniformMatrix3x2fv(t, !1, n);
|
|
1118
1118
|
};
|
|
1119
1119
|
}
|
|
1120
|
-
function
|
|
1120
|
+
function Ma(e, t) {
|
|
1121
1121
|
return function(n) {
|
|
1122
1122
|
e.uniformMatrix2x4fv(t, !1, n);
|
|
1123
1123
|
};
|
|
1124
1124
|
}
|
|
1125
|
-
function
|
|
1125
|
+
function Na(e, t) {
|
|
1126
1126
|
return function(n) {
|
|
1127
1127
|
e.uniformMatrix4x2fv(t, !1, n);
|
|
1128
1128
|
};
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1130
|
+
function Pa(e, t) {
|
|
1131
1131
|
return function(n) {
|
|
1132
1132
|
e.uniformMatrix3x4fv(t, !1, n);
|
|
1133
1133
|
};
|
|
1134
1134
|
}
|
|
1135
|
-
function
|
|
1135
|
+
function Fa(e, t) {
|
|
1136
1136
|
return function(n) {
|
|
1137
1137
|
e.uniformMatrix4x3fv(t, !1, n);
|
|
1138
1138
|
};
|
|
1139
1139
|
}
|
|
1140
1140
|
function W(e, t, n, r) {
|
|
1141
|
-
let i =
|
|
1142
|
-
return
|
|
1141
|
+
let i = da(e, t);
|
|
1142
|
+
return At(e) ? function(t) {
|
|
1143
1143
|
let a, o;
|
|
1144
|
-
et(e, t) ? (a = t, o = null) : (a = t.texture, o = t.sampler), e.uniform1i(r, n), e.activeTexture(
|
|
1144
|
+
et(e, t) ? (a = t, o = null) : (a = t.texture, o = t.sampler), e.uniform1i(r, n), e.activeTexture(ci + n), e.bindTexture(i, a), e.bindSampler(n, o);
|
|
1145
1145
|
} : function(t) {
|
|
1146
|
-
e.uniform1i(r, n), e.activeTexture(
|
|
1146
|
+
e.uniform1i(r, n), e.activeTexture(ci + n), e.bindTexture(i, t);
|
|
1147
1147
|
};
|
|
1148
1148
|
}
|
|
1149
1149
|
function G(e, t, n, r, i) {
|
|
1150
|
-
let a =
|
|
1150
|
+
let a = da(e, t), o = new Int32Array(i);
|
|
1151
1151
|
for (let e = 0; e < i; ++e) o[e] = n + e;
|
|
1152
|
-
return
|
|
1152
|
+
return At(e) ? function(t) {
|
|
1153
1153
|
e.uniform1iv(r, o), t.forEach(function(t, r) {
|
|
1154
|
-
e.activeTexture(
|
|
1154
|
+
e.activeTexture(ci + o[r]);
|
|
1155
1155
|
let i, s;
|
|
1156
1156
|
et(e, t) ? (i = t, s = null) : (i = t.texture, s = t.sampler), e.bindSampler(n, s), e.bindTexture(a, i);
|
|
1157
1157
|
});
|
|
1158
1158
|
} : function(t) {
|
|
1159
1159
|
e.uniform1iv(r, o), t.forEach(function(t, n) {
|
|
1160
|
-
e.activeTexture(
|
|
1160
|
+
e.activeTexture(ci + o[n]), e.bindTexture(a, t);
|
|
1161
1161
|
});
|
|
1162
1162
|
};
|
|
1163
1163
|
}
|
|
1164
|
-
U[
|
|
1164
|
+
U[xi] = {
|
|
1165
1165
|
Type: Float32Array,
|
|
1166
1166
|
size: 4,
|
|
1167
|
-
setter:
|
|
1168
|
-
arraySetter:
|
|
1169
|
-
}, U[
|
|
1167
|
+
setter: fa,
|
|
1168
|
+
arraySetter: pa
|
|
1169
|
+
}, U[Si] = {
|
|
1170
1170
|
Type: Float32Array,
|
|
1171
1171
|
size: 8,
|
|
1172
|
-
setter:
|
|
1172
|
+
setter: ma,
|
|
1173
1173
|
cols: 2
|
|
1174
|
-
}, U[
|
|
1174
|
+
}, U[Ci] = {
|
|
1175
1175
|
Type: Float32Array,
|
|
1176
1176
|
size: 12,
|
|
1177
|
-
setter:
|
|
1177
|
+
setter: ha,
|
|
1178
1178
|
cols: 3
|
|
1179
|
-
}, U[
|
|
1179
|
+
}, U[wi] = {
|
|
1180
1180
|
Type: Float32Array,
|
|
1181
1181
|
size: 16,
|
|
1182
|
-
setter:
|
|
1182
|
+
setter: ga,
|
|
1183
1183
|
cols: 4
|
|
1184
|
-
}, U[
|
|
1184
|
+
}, U[Ti] = {
|
|
1185
1185
|
Type: Int32Array,
|
|
1186
1186
|
size: 4,
|
|
1187
|
-
setter:
|
|
1188
|
-
arraySetter:
|
|
1189
|
-
}, U[
|
|
1187
|
+
setter: _a,
|
|
1188
|
+
arraySetter: va
|
|
1189
|
+
}, U[Ei] = {
|
|
1190
1190
|
Type: Int32Array,
|
|
1191
1191
|
size: 8,
|
|
1192
|
-
setter:
|
|
1192
|
+
setter: ya,
|
|
1193
1193
|
cols: 2
|
|
1194
|
-
}, U[
|
|
1194
|
+
}, U[Di] = {
|
|
1195
1195
|
Type: Int32Array,
|
|
1196
1196
|
size: 12,
|
|
1197
|
-
setter:
|
|
1197
|
+
setter: ba,
|
|
1198
1198
|
cols: 3
|
|
1199
|
-
}, U[
|
|
1199
|
+
}, U[Oi] = {
|
|
1200
1200
|
Type: Int32Array,
|
|
1201
1201
|
size: 16,
|
|
1202
|
-
setter:
|
|
1202
|
+
setter: xa,
|
|
1203
1203
|
cols: 4
|
|
1204
|
-
}, U[
|
|
1204
|
+
}, U[Yi] = {
|
|
1205
1205
|
Type: Uint32Array,
|
|
1206
1206
|
size: 4,
|
|
1207
|
-
setter:
|
|
1208
|
-
arraySetter:
|
|
1209
|
-
}, U[
|
|
1207
|
+
setter: Sa,
|
|
1208
|
+
arraySetter: Ca
|
|
1209
|
+
}, U[Xi] = {
|
|
1210
1210
|
Type: Uint32Array,
|
|
1211
1211
|
size: 8,
|
|
1212
|
-
setter:
|
|
1212
|
+
setter: wa,
|
|
1213
1213
|
cols: 2
|
|
1214
|
-
}, U[
|
|
1214
|
+
}, U[Zi] = {
|
|
1215
1215
|
Type: Uint32Array,
|
|
1216
1216
|
size: 12,
|
|
1217
|
-
setter:
|
|
1217
|
+
setter: Ta,
|
|
1218
1218
|
cols: 3
|
|
1219
|
-
}, U[
|
|
1219
|
+
}, U[Qi] = {
|
|
1220
1220
|
Type: Uint32Array,
|
|
1221
1221
|
size: 16,
|
|
1222
|
-
setter:
|
|
1222
|
+
setter: Ea,
|
|
1223
1223
|
cols: 4
|
|
1224
|
-
}, U[
|
|
1224
|
+
}, U[ki] = {
|
|
1225
1225
|
Type: Uint32Array,
|
|
1226
1226
|
size: 4,
|
|
1227
|
-
setter:
|
|
1228
|
-
arraySetter:
|
|
1229
|
-
}, U[
|
|
1227
|
+
setter: _a,
|
|
1228
|
+
arraySetter: va
|
|
1229
|
+
}, U[Ai] = {
|
|
1230
1230
|
Type: Uint32Array,
|
|
1231
1231
|
size: 8,
|
|
1232
|
-
setter:
|
|
1232
|
+
setter: ya,
|
|
1233
1233
|
cols: 2
|
|
1234
|
-
}, U[
|
|
1234
|
+
}, U[ji] = {
|
|
1235
1235
|
Type: Uint32Array,
|
|
1236
1236
|
size: 12,
|
|
1237
|
-
setter:
|
|
1237
|
+
setter: ba,
|
|
1238
1238
|
cols: 3
|
|
1239
|
-
}, U[
|
|
1239
|
+
}, U[Mi] = {
|
|
1240
1240
|
Type: Uint32Array,
|
|
1241
1241
|
size: 16,
|
|
1242
|
-
setter:
|
|
1242
|
+
setter: xa,
|
|
1243
1243
|
cols: 4
|
|
1244
|
-
}, U[
|
|
1244
|
+
}, U[Ni] = {
|
|
1245
1245
|
Type: Float32Array,
|
|
1246
1246
|
size: 32,
|
|
1247
|
-
setter:
|
|
1247
|
+
setter: Da,
|
|
1248
1248
|
rows: 2,
|
|
1249
1249
|
cols: 2
|
|
1250
|
-
}, U[
|
|
1250
|
+
}, U[Pi] = {
|
|
1251
1251
|
Type: Float32Array,
|
|
1252
1252
|
size: 48,
|
|
1253
|
-
setter:
|
|
1253
|
+
setter: Oa,
|
|
1254
1254
|
rows: 3,
|
|
1255
1255
|
cols: 3
|
|
1256
|
-
}, U[
|
|
1256
|
+
}, U[Fi] = {
|
|
1257
1257
|
Type: Float32Array,
|
|
1258
1258
|
size: 64,
|
|
1259
|
-
setter:
|
|
1259
|
+
setter: ka,
|
|
1260
1260
|
rows: 4,
|
|
1261
1261
|
cols: 4
|
|
1262
|
-
}, U[
|
|
1262
|
+
}, U[Bi] = {
|
|
1263
1263
|
Type: Float32Array,
|
|
1264
1264
|
size: 32,
|
|
1265
|
-
setter:
|
|
1265
|
+
setter: Aa,
|
|
1266
1266
|
rows: 2,
|
|
1267
1267
|
cols: 3
|
|
1268
|
-
}, U[
|
|
1268
|
+
}, U[Vi] = {
|
|
1269
1269
|
Type: Float32Array,
|
|
1270
1270
|
size: 32,
|
|
1271
|
-
setter:
|
|
1271
|
+
setter: Ma,
|
|
1272
1272
|
rows: 2,
|
|
1273
1273
|
cols: 4
|
|
1274
|
-
}, U[
|
|
1274
|
+
}, U[Hi] = {
|
|
1275
1275
|
Type: Float32Array,
|
|
1276
1276
|
size: 48,
|
|
1277
|
-
setter:
|
|
1277
|
+
setter: ja,
|
|
1278
1278
|
rows: 3,
|
|
1279
1279
|
cols: 2
|
|
1280
|
-
}, U[
|
|
1280
|
+
}, U[Ui] = {
|
|
1281
1281
|
Type: Float32Array,
|
|
1282
1282
|
size: 48,
|
|
1283
|
-
setter:
|
|
1283
|
+
setter: Pa,
|
|
1284
1284
|
rows: 3,
|
|
1285
1285
|
cols: 4
|
|
1286
|
-
}, U[
|
|
1286
|
+
}, U[Wi] = {
|
|
1287
1287
|
Type: Float32Array,
|
|
1288
1288
|
size: 64,
|
|
1289
|
-
setter:
|
|
1289
|
+
setter: Na,
|
|
1290
1290
|
rows: 4,
|
|
1291
1291
|
cols: 2
|
|
1292
|
-
}, U[
|
|
1292
|
+
}, U[Gi] = {
|
|
1293
1293
|
Type: Float32Array,
|
|
1294
1294
|
size: 64,
|
|
1295
|
-
setter:
|
|
1295
|
+
setter: Fa,
|
|
1296
1296
|
rows: 4,
|
|
1297
1297
|
cols: 3
|
|
1298
|
-
}, U[Fi] = {
|
|
1299
|
-
Type: null,
|
|
1300
|
-
size: 0,
|
|
1301
|
-
setter: W,
|
|
1302
|
-
arraySetter: G,
|
|
1303
|
-
bindPoint: oa
|
|
1304
1298
|
}, U[Ii] = {
|
|
1305
1299
|
Type: null,
|
|
1306
1300
|
size: 0,
|
|
@@ -1318,75 +1312,81 @@ U[bi] = {
|
|
|
1318
1312
|
size: 0,
|
|
1319
1313
|
setter: W,
|
|
1320
1314
|
arraySetter: G,
|
|
1321
|
-
bindPoint:
|
|
1322
|
-
}, U[
|
|
1315
|
+
bindPoint: la
|
|
1316
|
+
}, U[zi] = {
|
|
1323
1317
|
Type: null,
|
|
1324
1318
|
size: 0,
|
|
1325
1319
|
setter: W,
|
|
1326
1320
|
arraySetter: G,
|
|
1327
|
-
bindPoint:
|
|
1321
|
+
bindPoint: sa
|
|
1328
1322
|
}, U[Ki] = {
|
|
1329
1323
|
Type: null,
|
|
1330
1324
|
size: 0,
|
|
1331
1325
|
setter: W,
|
|
1332
1326
|
arraySetter: G,
|
|
1333
|
-
bindPoint:
|
|
1327
|
+
bindPoint: ua
|
|
1334
1328
|
}, U[qi] = {
|
|
1335
1329
|
Type: null,
|
|
1336
1330
|
size: 0,
|
|
1337
1331
|
setter: W,
|
|
1338
1332
|
arraySetter: G,
|
|
1339
|
-
bindPoint:
|
|
1340
|
-
}, U[
|
|
1333
|
+
bindPoint: ua
|
|
1334
|
+
}, U[Ji] = {
|
|
1341
1335
|
Type: null,
|
|
1342
1336
|
size: 0,
|
|
1343
1337
|
setter: W,
|
|
1344
1338
|
arraySetter: G,
|
|
1345
|
-
bindPoint:
|
|
1339
|
+
bindPoint: ca
|
|
1346
1340
|
}, U[$i] = {
|
|
1347
1341
|
Type: null,
|
|
1348
1342
|
size: 0,
|
|
1349
1343
|
setter: W,
|
|
1350
1344
|
arraySetter: G,
|
|
1351
|
-
bindPoint:
|
|
1345
|
+
bindPoint: sa
|
|
1352
1346
|
}, U[ea] = {
|
|
1353
1347
|
Type: null,
|
|
1354
1348
|
size: 0,
|
|
1355
1349
|
setter: W,
|
|
1356
1350
|
arraySetter: G,
|
|
1357
|
-
bindPoint:
|
|
1351
|
+
bindPoint: la
|
|
1358
1352
|
}, U[ta] = {
|
|
1359
1353
|
Type: null,
|
|
1360
1354
|
size: 0,
|
|
1361
1355
|
setter: W,
|
|
1362
1356
|
arraySetter: G,
|
|
1363
|
-
bindPoint:
|
|
1357
|
+
bindPoint: ca
|
|
1364
1358
|
}, U[na] = {
|
|
1365
1359
|
Type: null,
|
|
1366
1360
|
size: 0,
|
|
1367
1361
|
setter: W,
|
|
1368
1362
|
arraySetter: G,
|
|
1369
|
-
bindPoint:
|
|
1363
|
+
bindPoint: ua
|
|
1370
1364
|
}, U[ra] = {
|
|
1371
1365
|
Type: null,
|
|
1372
1366
|
size: 0,
|
|
1373
1367
|
setter: W,
|
|
1374
1368
|
arraySetter: G,
|
|
1375
|
-
bindPoint:
|
|
1369
|
+
bindPoint: sa
|
|
1376
1370
|
}, U[ia] = {
|
|
1377
1371
|
Type: null,
|
|
1378
1372
|
size: 0,
|
|
1379
1373
|
setter: W,
|
|
1380
1374
|
arraySetter: G,
|
|
1381
|
-
bindPoint:
|
|
1375
|
+
bindPoint: la
|
|
1382
1376
|
}, U[aa] = {
|
|
1383
1377
|
Type: null,
|
|
1384
1378
|
size: 0,
|
|
1385
1379
|
setter: W,
|
|
1386
1380
|
arraySetter: G,
|
|
1387
|
-
bindPoint:
|
|
1381
|
+
bindPoint: ca
|
|
1382
|
+
}, U[oa] = {
|
|
1383
|
+
Type: null,
|
|
1384
|
+
size: 0,
|
|
1385
|
+
setter: W,
|
|
1386
|
+
arraySetter: G,
|
|
1387
|
+
bindPoint: ua
|
|
1388
1388
|
};
|
|
1389
|
-
function
|
|
1389
|
+
function Ia(e, t) {
|
|
1390
1390
|
return function(n) {
|
|
1391
1391
|
if (n.value) switch (e.disableVertexAttribArray(t), n.value.length) {
|
|
1392
1392
|
case 4:
|
|
@@ -1403,104 +1403,104 @@ function Fa(e, t) {
|
|
|
1403
1403
|
break;
|
|
1404
1404
|
default: throw Error("the length of a float constant value must be between 1 and 4!");
|
|
1405
1405
|
}
|
|
1406
|
-
else e.bindBuffer(
|
|
1406
|
+
else e.bindBuffer(ui, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribPointer(t, n.numComponents || n.size, n.type || xi, n.normalize || !1, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
|
|
1407
1407
|
};
|
|
1408
1408
|
}
|
|
1409
1409
|
function K(e, t) {
|
|
1410
1410
|
return function(n) {
|
|
1411
1411
|
if (n.value) if (e.disableVertexAttribArray(t), n.value.length === 4) e.vertexAttrib4iv(t, n.value);
|
|
1412
1412
|
else throw Error("The length of an integer constant value must be 4!");
|
|
1413
|
-
else e.bindBuffer(
|
|
1413
|
+
else e.bindBuffer(ui, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribIPointer(t, n.numComponents || n.size, n.type || Ti, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
|
|
1414
1414
|
};
|
|
1415
1415
|
}
|
|
1416
|
-
function
|
|
1416
|
+
function La(e, t) {
|
|
1417
1417
|
return function(n) {
|
|
1418
1418
|
if (n.value) if (e.disableVertexAttribArray(t), n.value.length === 4) e.vertexAttrib4uiv(t, n.value);
|
|
1419
1419
|
else throw Error("The length of an unsigned integer constant value must be 4!");
|
|
1420
|
-
else e.bindBuffer(
|
|
1420
|
+
else e.bindBuffer(ui, n.buffer), e.enableVertexAttribArray(t), e.vertexAttribIPointer(t, n.numComponents || n.size, n.type || Yi, n.stride || 0, n.offset || 0), n.divisor !== void 0 && e.vertexAttribDivisor(t, n.divisor);
|
|
1421
1421
|
};
|
|
1422
1422
|
}
|
|
1423
|
-
function
|
|
1423
|
+
function Ra(e, t, n) {
|
|
1424
1424
|
let r = n.size, i = n.count;
|
|
1425
1425
|
return function(n) {
|
|
1426
|
-
e.bindBuffer(
|
|
1427
|
-
let a = n.size || n.numComponents || r, o = a / i, s = n.type ||
|
|
1426
|
+
e.bindBuffer(ui, n.buffer);
|
|
1427
|
+
let a = n.size || n.numComponents || r, o = a / i, s = n.type || xi, c = U[s].size * a, l = n.normalize || !1, u = n.offset || 0, d = c / i;
|
|
1428
1428
|
for (let r = 0; r < i; ++r) e.enableVertexAttribArray(t + r), e.vertexAttribPointer(t + r, o, s, l, c, u + d * r), n.divisor !== void 0 && e.vertexAttribDivisor(t + r, n.divisor);
|
|
1429
1429
|
};
|
|
1430
1430
|
}
|
|
1431
1431
|
var q = {};
|
|
1432
|
-
q[
|
|
1432
|
+
q[xi] = {
|
|
1433
1433
|
size: 4,
|
|
1434
|
-
setter:
|
|
1435
|
-
}, q[xi] = {
|
|
1436
|
-
size: 8,
|
|
1437
|
-
setter: Fa
|
|
1434
|
+
setter: Ia
|
|
1438
1435
|
}, q[Si] = {
|
|
1439
|
-
size:
|
|
1440
|
-
setter:
|
|
1436
|
+
size: 8,
|
|
1437
|
+
setter: Ia
|
|
1441
1438
|
}, q[Ci] = {
|
|
1442
|
-
size:
|
|
1443
|
-
setter:
|
|
1439
|
+
size: 12,
|
|
1440
|
+
setter: Ia
|
|
1444
1441
|
}, q[wi] = {
|
|
1442
|
+
size: 16,
|
|
1443
|
+
setter: Ia
|
|
1444
|
+
}, q[Ti] = {
|
|
1445
1445
|
size: 4,
|
|
1446
1446
|
setter: K
|
|
1447
|
-
}, q[
|
|
1447
|
+
}, q[Ei] = {
|
|
1448
1448
|
size: 8,
|
|
1449
1449
|
setter: K
|
|
1450
|
-
}, q[
|
|
1450
|
+
}, q[Di] = {
|
|
1451
1451
|
size: 12,
|
|
1452
1452
|
setter: K
|
|
1453
|
-
}, q[
|
|
1453
|
+
}, q[Oi] = {
|
|
1454
1454
|
size: 16,
|
|
1455
1455
|
setter: K
|
|
1456
|
-
}, q[Ji] = {
|
|
1457
|
-
size: 4,
|
|
1458
|
-
setter: Ia
|
|
1459
1456
|
}, q[Yi] = {
|
|
1460
|
-
size:
|
|
1461
|
-
setter:
|
|
1457
|
+
size: 4,
|
|
1458
|
+
setter: La
|
|
1462
1459
|
}, q[Xi] = {
|
|
1463
|
-
size:
|
|
1464
|
-
setter:
|
|
1460
|
+
size: 8,
|
|
1461
|
+
setter: La
|
|
1465
1462
|
}, q[Zi] = {
|
|
1463
|
+
size: 12,
|
|
1464
|
+
setter: La
|
|
1465
|
+
}, q[Qi] = {
|
|
1466
1466
|
size: 16,
|
|
1467
|
-
setter:
|
|
1468
|
-
}, q[
|
|
1467
|
+
setter: La
|
|
1468
|
+
}, q[ki] = {
|
|
1469
1469
|
size: 4,
|
|
1470
1470
|
setter: K
|
|
1471
|
-
}, q[
|
|
1471
|
+
}, q[Ai] = {
|
|
1472
1472
|
size: 8,
|
|
1473
1473
|
setter: K
|
|
1474
|
-
}, q[
|
|
1474
|
+
}, q[ji] = {
|
|
1475
1475
|
size: 12,
|
|
1476
1476
|
setter: K
|
|
1477
|
-
}, q[
|
|
1477
|
+
}, q[Mi] = {
|
|
1478
1478
|
size: 16,
|
|
1479
1479
|
setter: K
|
|
1480
|
-
}, q[
|
|
1480
|
+
}, q[Ni] = {
|
|
1481
1481
|
size: 4,
|
|
1482
|
-
setter:
|
|
1482
|
+
setter: Ra,
|
|
1483
1483
|
count: 2
|
|
1484
|
-
}, q[
|
|
1484
|
+
}, q[Pi] = {
|
|
1485
1485
|
size: 9,
|
|
1486
|
-
setter:
|
|
1486
|
+
setter: Ra,
|
|
1487
1487
|
count: 3
|
|
1488
|
-
}, q[
|
|
1488
|
+
}, q[Fi] = {
|
|
1489
1489
|
size: 16,
|
|
1490
|
-
setter:
|
|
1490
|
+
setter: Ra,
|
|
1491
1491
|
count: 4
|
|
1492
1492
|
};
|
|
1493
|
-
function
|
|
1493
|
+
function za(e) {
|
|
1494
1494
|
let t = e.name;
|
|
1495
1495
|
return t.startsWith("gl_") || t.startsWith("webgl_");
|
|
1496
1496
|
}
|
|
1497
|
-
var
|
|
1498
|
-
function
|
|
1499
|
-
let i = e.split(
|
|
1497
|
+
var Ba = /(\.|\[|]|\w+)/g, Va = (e) => e >= "0" && e <= "9";
|
|
1498
|
+
function Ha(e, t, n, r) {
|
|
1499
|
+
let i = e.split(Ba).filter((e) => e !== ""), a = 0, o = "";
|
|
1500
1500
|
for (;;) {
|
|
1501
1501
|
let e = i[a++];
|
|
1502
1502
|
o += e;
|
|
1503
|
-
let s =
|
|
1503
|
+
let s = Va(e[0]), c = s ? parseInt(e) : e;
|
|
1504
1504
|
if (s && (o += i[a++]), a === i.length) {
|
|
1505
1505
|
n[c] = t;
|
|
1506
1506
|
break;
|
|
@@ -1508,13 +1508,13 @@ function Va(e, t, n, r) {
|
|
|
1508
1508
|
let e = i[a++], t = e === "[", s = n[c] || (t ? [] : {});
|
|
1509
1509
|
n[c] = s, n = s, r[o] = r[o] || function(e) {
|
|
1510
1510
|
return function(t) {
|
|
1511
|
-
|
|
1511
|
+
eo(e, t);
|
|
1512
1512
|
};
|
|
1513
1513
|
}(s), o += e;
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1517
|
+
function Ua(e, t) {
|
|
1518
1518
|
let n = 0;
|
|
1519
1519
|
function r(t, r, i) {
|
|
1520
1520
|
let a = r.name.endsWith("[0]"), o = r.type, s = U[o];
|
|
@@ -1526,22 +1526,22 @@ function Ha(e, t) {
|
|
|
1526
1526
|
} else c = s.arraySetter && a ? s.arraySetter(e, i) : s.setter(e, i);
|
|
1527
1527
|
return c.location = i, c;
|
|
1528
1528
|
}
|
|
1529
|
-
let i = {}, a = {}, o = e.getProgramParameter(t,
|
|
1529
|
+
let i = {}, a = {}, o = e.getProgramParameter(t, pi);
|
|
1530
1530
|
for (let n = 0; n < o; ++n) {
|
|
1531
1531
|
let o = e.getActiveUniform(t, n);
|
|
1532
|
-
if (
|
|
1532
|
+
if (za(o)) continue;
|
|
1533
1533
|
let s = o.name;
|
|
1534
1534
|
s.endsWith("[0]") && (s = s.substr(0, s.length - 3));
|
|
1535
1535
|
let c = e.getUniformLocation(t, o.name);
|
|
1536
1536
|
if (c) {
|
|
1537
1537
|
let e = r(t, o, c);
|
|
1538
|
-
i[s] = e,
|
|
1538
|
+
i[s] = e, Ha(s, e, a, i);
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
1541
|
return i;
|
|
1542
1542
|
}
|
|
1543
|
-
function
|
|
1544
|
-
let n = {}, r = e.getProgramParameter(t,
|
|
1543
|
+
function Wa(e, t) {
|
|
1544
|
+
let n = {}, r = e.getProgramParameter(t, hi);
|
|
1545
1545
|
for (let i = 0; i < r; ++i) {
|
|
1546
1546
|
let r = e.getTransformFeedbackVarying(t, i);
|
|
1547
1547
|
n[r.name] = {
|
|
@@ -1552,8 +1552,8 @@ function Ua(e, t) {
|
|
|
1552
1552
|
}
|
|
1553
1553
|
return n;
|
|
1554
1554
|
}
|
|
1555
|
-
function
|
|
1556
|
-
let n = e.getProgramParameter(t,
|
|
1555
|
+
function Ga(e, t) {
|
|
1556
|
+
let n = e.getProgramParameter(t, pi), r = [], i = [];
|
|
1557
1557
|
for (let a = 0; a < n; ++a) {
|
|
1558
1558
|
i.push(a), r.push({});
|
|
1559
1559
|
let n = e.getActiveUniform(t, a);
|
|
@@ -1570,14 +1570,14 @@ function Wa(e, t) {
|
|
|
1570
1570
|
r[t][o] = e;
|
|
1571
1571
|
});
|
|
1572
1572
|
});
|
|
1573
|
-
let a = {}, o = e.getProgramParameter(t,
|
|
1573
|
+
let a = {}, o = e.getProgramParameter(t, gi);
|
|
1574
1574
|
for (let n = 0; n < o; ++n) {
|
|
1575
1575
|
let r = e.getActiveUniformBlockName(t, n), i = {
|
|
1576
1576
|
index: e.getUniformBlockIndex(t, r),
|
|
1577
|
-
usedByVertexShader: e.getActiveUniformBlockParameter(t, n,
|
|
1578
|
-
usedByFragmentShader: e.getActiveUniformBlockParameter(t, n,
|
|
1579
|
-
size: e.getActiveUniformBlockParameter(t, n,
|
|
1580
|
-
uniformIndices: e.getActiveUniformBlockParameter(t, n,
|
|
1577
|
+
usedByVertexShader: e.getActiveUniformBlockParameter(t, n, _i),
|
|
1578
|
+
usedByFragmentShader: e.getActiveUniformBlockParameter(t, n, vi),
|
|
1579
|
+
size: e.getActiveUniformBlockParameter(t, n, yi),
|
|
1580
|
+
uniformIndices: e.getActiveUniformBlockParameter(t, n, bi)
|
|
1581
1581
|
};
|
|
1582
1582
|
i.used = i.usedByVertexShader || i.usedByFragmentShader, a[r] = i;
|
|
1583
1583
|
}
|
|
@@ -1586,8 +1586,8 @@ function Wa(e, t) {
|
|
|
1586
1586
|
uniformData: r
|
|
1587
1587
|
};
|
|
1588
1588
|
}
|
|
1589
|
-
var
|
|
1590
|
-
function
|
|
1589
|
+
var Ka = /\[\d+\]\.$/, qa = (e, t) => ((e + (t - 1)) / t | 0) * t;
|
|
1590
|
+
function Ja(e, t, n, r) {
|
|
1591
1591
|
if (t || n) {
|
|
1592
1592
|
r ||= 1;
|
|
1593
1593
|
let t = e.length / 4;
|
|
@@ -1602,26 +1602,26 @@ function qa(e, t, n, r) {
|
|
|
1602
1602
|
t.length ? e.set(t) : e[0] = t;
|
|
1603
1603
|
};
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1605
|
+
function Ya(e, t, n, r) {
|
|
1606
1606
|
let i = n.blockSpecs, a = n.uniformData, o = i[r];
|
|
1607
|
-
if (!o) return
|
|
1607
|
+
if (!o) return si("no uniform block object named:", r), {
|
|
1608
1608
|
name: r,
|
|
1609
1609
|
uniforms: {}
|
|
1610
1610
|
};
|
|
1611
1611
|
let s = new ArrayBuffer(o.size), c = e.createBuffer(), l = o.index;
|
|
1612
|
-
e.bindBuffer(
|
|
1612
|
+
e.bindBuffer(fi, c), e.uniformBlockBinding(t, o.index, l);
|
|
1613
1613
|
let u = r + ".";
|
|
1614
|
-
|
|
1614
|
+
Ka.test(u) && (u = u.replace(Ka, "."));
|
|
1615
1615
|
let d = {}, f = {}, p = {};
|
|
1616
1616
|
return o.uniformIndices.forEach(function(e) {
|
|
1617
1617
|
let t = a[e], n = t.name;
|
|
1618
1618
|
n.startsWith(u) && (n = n.substr(u.length));
|
|
1619
1619
|
let r = n.endsWith("[0]");
|
|
1620
1620
|
r && (n = n.substr(0, n.length - 3));
|
|
1621
|
-
let i = U[t.type], o = i.Type, c = r ?
|
|
1621
|
+
let i = U[t.type], o = i.Type, c = r ? qa(i.size, 16) * t.size : i.size * t.size, l = new o(s, t.offset, c / o.BYTES_PER_ELEMENT);
|
|
1622
1622
|
d[n] = l;
|
|
1623
|
-
let m =
|
|
1624
|
-
f[n] = m,
|
|
1623
|
+
let m = Ja(l, r, i.rows, i.cols);
|
|
1624
|
+
f[n] = m, Ha(n, m, p, f);
|
|
1625
1625
|
}), {
|
|
1626
1626
|
name: r,
|
|
1627
1627
|
array: s,
|
|
@@ -1631,21 +1631,21 @@ function Ja(e, t, n, r) {
|
|
|
1631
1631
|
setters: f
|
|
1632
1632
|
};
|
|
1633
1633
|
}
|
|
1634
|
-
function Ya(e, t, n) {
|
|
1635
|
-
return Ja(e, t.program, t.uniformBlockSpec, n);
|
|
1636
|
-
}
|
|
1637
1634
|
function Xa(e, t, n) {
|
|
1635
|
+
return Ya(e, t.program, t.uniformBlockSpec, n);
|
|
1636
|
+
}
|
|
1637
|
+
function Za(e, t, n) {
|
|
1638
1638
|
let r = (t.uniformBlockSpec || t).blockSpecs[n.name];
|
|
1639
1639
|
if (r) {
|
|
1640
1640
|
let t = r.index;
|
|
1641
|
-
return e.bindBufferRange(
|
|
1641
|
+
return e.bindBufferRange(fi, t, n.buffer, n.offset || 0, n.array.byteLength), !0;
|
|
1642
1642
|
}
|
|
1643
1643
|
return !1;
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1646
|
-
|
|
1645
|
+
function Qa(e, t, n) {
|
|
1646
|
+
Za(e, t, n) && e.bufferData(fi, n.array, li);
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function $a(e, t) {
|
|
1649
1649
|
let n = e.setters;
|
|
1650
1650
|
for (let e in t) {
|
|
1651
1651
|
let r = n[e];
|
|
@@ -1655,10 +1655,10 @@ function Qa(e, t) {
|
|
|
1655
1655
|
}
|
|
1656
1656
|
}
|
|
1657
1657
|
}
|
|
1658
|
-
function
|
|
1658
|
+
function eo(e, t) {
|
|
1659
1659
|
for (let n in t) {
|
|
1660
1660
|
let r = e[n];
|
|
1661
|
-
typeof r == "function" ? r(t[n]) :
|
|
1661
|
+
typeof r == "function" ? r(t[n]) : eo(e[n], t[n]);
|
|
1662
1662
|
}
|
|
1663
1663
|
}
|
|
1664
1664
|
function J(e, ...t) {
|
|
@@ -1674,60 +1674,60 @@ function J(e, ...t) {
|
|
|
1674
1674
|
}
|
|
1675
1675
|
}
|
|
1676
1676
|
}
|
|
1677
|
-
function
|
|
1678
|
-
let n = {}, r = e.getProgramParameter(t,
|
|
1677
|
+
function to(e, t) {
|
|
1678
|
+
let n = {}, r = e.getProgramParameter(t, mi);
|
|
1679
1679
|
for (let i = 0; i < r; ++i) {
|
|
1680
1680
|
let r = e.getActiveAttrib(t, i);
|
|
1681
|
-
if (
|
|
1681
|
+
if (za(r)) continue;
|
|
1682
1682
|
let a = e.getAttribLocation(t, r.name), o = q[r.type], s = o.setter(e, a, o);
|
|
1683
1683
|
s.location = a, n[r.name] = s;
|
|
1684
1684
|
}
|
|
1685
1685
|
return n;
|
|
1686
1686
|
}
|
|
1687
|
-
function
|
|
1687
|
+
function no(e, t) {
|
|
1688
1688
|
for (let n in t) {
|
|
1689
1689
|
let r = e[n];
|
|
1690
1690
|
r && r(t[n]);
|
|
1691
1691
|
}
|
|
1692
1692
|
}
|
|
1693
1693
|
function Y(e, t, n) {
|
|
1694
|
-
n.vertexArrayObject ? e.bindVertexArray(n.vertexArrayObject) : (
|
|
1694
|
+
n.vertexArrayObject ? e.bindVertexArray(n.vertexArrayObject) : (no(t.attribSetters || t, n.attribs), n.indices && e.bindBuffer(di, n.indices));
|
|
1695
1695
|
}
|
|
1696
|
-
function
|
|
1696
|
+
function ro(e, t) {
|
|
1697
1697
|
let n = {
|
|
1698
1698
|
program: t,
|
|
1699
|
-
uniformSetters:
|
|
1700
|
-
attribSetters:
|
|
1699
|
+
uniformSetters: Ua(e, t),
|
|
1700
|
+
attribSetters: to(e, t)
|
|
1701
1701
|
};
|
|
1702
|
-
return
|
|
1702
|
+
return At(e) && (n.uniformBlockSpec = Ga(e, t), n.transformFeedbackInfo = Wa(e, t)), n;
|
|
1703
1703
|
}
|
|
1704
|
-
var
|
|
1705
|
-
function
|
|
1706
|
-
n = n === void 0 ?
|
|
1704
|
+
var io = 4, ao = 5123;
|
|
1705
|
+
function oo(e, t, n, r, i, a) {
|
|
1706
|
+
n = n === void 0 ? io : n;
|
|
1707
1707
|
let o = t.indices, s = t.elementType, c = r === void 0 ? t.numElements : r;
|
|
1708
|
-
i = i === void 0 ? 0 : i, s || o ? a === void 0 ? e.drawElements(n, c, s === void 0 ?
|
|
1709
|
-
}
|
|
1710
|
-
var
|
|
1711
|
-
format:
|
|
1712
|
-
type:
|
|
1713
|
-
min:
|
|
1714
|
-
wrap:
|
|
1715
|
-
}, { format:
|
|
1716
|
-
Z[
|
|
1717
|
-
function
|
|
1708
|
+
i = i === void 0 ? 0 : i, s || o ? a === void 0 ? e.drawElements(n, c, s === void 0 ? ao : t.elementType, i) : e.drawElementsInstanced(n, c, s === void 0 ? ao : t.elementType, i, a) : a === void 0 ? e.drawArrays(n, i, c) : e.drawArraysInstanced(n, i, c, a);
|
|
1709
|
+
}
|
|
1710
|
+
var so = 36160, X = 36161, co = 3553, lo = 5121, uo = 6402, fo = 6408, po = 33190, mo = 36012, ho = 35056, go = 36013, _o = 32854, vo = 32855, yo = 36194, bo = 33189, xo = 6401, So = 36168, Co = 34041, wo = 36064, To = 36096, Eo = 36128, Do = 33306, Oo = 33071, ko = 9729, Ao = [{
|
|
1711
|
+
format: fo,
|
|
1712
|
+
type: lo,
|
|
1713
|
+
min: ko,
|
|
1714
|
+
wrap: Oo
|
|
1715
|
+
}, { format: Co }], Z = {};
|
|
1716
|
+
Z[Co] = Do, Z[xo] = Eo, Z[So] = Eo, Z[uo] = To, Z[bo] = To, Z[po] = To, Z[mo] = To, Z[ho] = Do, Z[go] = Do;
|
|
1717
|
+
function jo(e, t) {
|
|
1718
1718
|
return Z[e] || Z[t];
|
|
1719
1719
|
}
|
|
1720
1720
|
var Q = {};
|
|
1721
|
-
Q[
|
|
1722
|
-
function
|
|
1721
|
+
Q[_o] = !0, Q[vo] = !0, Q[yo] = !0, Q[Co] = !0, Q[bo] = !0, Q[xo] = !0, Q[So] = !0;
|
|
1722
|
+
function Mo(e) {
|
|
1723
1723
|
return Q[e];
|
|
1724
1724
|
}
|
|
1725
|
-
function
|
|
1726
|
-
return e >=
|
|
1725
|
+
function No(e) {
|
|
1726
|
+
return e >= wo && e < 36096;
|
|
1727
1727
|
}
|
|
1728
|
-
function
|
|
1729
|
-
let i =
|
|
1730
|
-
e.bindFramebuffer(i, a), n ||= e.drawingBufferWidth, r ||= e.drawingBufferHeight, t ||=
|
|
1728
|
+
function Po(e, t, n, r) {
|
|
1729
|
+
let i = so, a = e.createFramebuffer();
|
|
1730
|
+
e.bindFramebuffer(i, a), n ||= e.drawingBufferWidth, r ||= e.drawingBufferHeight, t ||= Ao;
|
|
1731
1731
|
let o = [], s = {
|
|
1732
1732
|
framebuffer: a,
|
|
1733
1733
|
attachments: [],
|
|
@@ -1735,27 +1735,27 @@ function No(e, t, n, r) {
|
|
|
1735
1735
|
height: r
|
|
1736
1736
|
};
|
|
1737
1737
|
return t.forEach(function(t, a) {
|
|
1738
|
-
let c = t.attachment, l = t.samples, u = t.format, d = t.attachmentPoint ||
|
|
1739
|
-
if (d ||=
|
|
1738
|
+
let c = t.attachment, l = t.samples, u = t.format, d = t.attachmentPoint || jo(u, t.internalFormat);
|
|
1739
|
+
if (d ||= wo + a, No(d) && o.push(d), !c) if (l !== void 0 || Mo(u)) c = e.createRenderbuffer(), e.bindRenderbuffer(X, c), l > 1 ? e.renderbufferStorageMultisample(X, l, u, n, r) : e.renderbufferStorage(X, u, n, r);
|
|
1740
1740
|
else {
|
|
1741
1741
|
let i = Object.assign({}, t);
|
|
1742
|
-
i.width = n, i.height = r, i.auto === void 0 && (i.auto = !1, i.min = i.min || i.minMag ||
|
|
1742
|
+
i.width = n, i.height = r, i.auto === void 0 && (i.auto = !1, i.min = i.min || i.minMag || ko, i.mag = i.mag || i.minMag || ko, i.wrapS = i.wrapS || i.wrap || Oo, i.wrapT = i.wrapT || i.wrap || Oo), c = ai(e, i);
|
|
1743
1743
|
}
|
|
1744
1744
|
if ($e(e, c)) e.framebufferRenderbuffer(i, d, X, c);
|
|
1745
|
-
else if (et(e, c)) t.layer === void 0 ? e.framebufferTexture2D(i, d, t.target ||
|
|
1745
|
+
else if (et(e, c)) t.layer === void 0 ? e.framebufferTexture2D(i, d, t.target || co, c, t.level || 0) : e.framebufferTextureLayer(i, d, c, t.level || 0, t.layer);
|
|
1746
1746
|
else throw Error("unknown attachment type");
|
|
1747
1747
|
s.attachments.push(c);
|
|
1748
1748
|
}), e.drawBuffers && e.drawBuffers(o), s;
|
|
1749
1749
|
}
|
|
1750
|
-
function
|
|
1751
|
-
r ||= e.drawingBufferWidth, i ||= e.drawingBufferHeight, t.width = r, t.height = i, n ||=
|
|
1750
|
+
function Fo(e, t, n, r, i) {
|
|
1751
|
+
r ||= e.drawingBufferWidth, i ||= e.drawingBufferHeight, t.width = r, t.height = i, n ||= Ao, n.forEach(function(n, a) {
|
|
1752
1752
|
let o = t.attachments[a], s = n.format, c = n.samples;
|
|
1753
1753
|
if (c !== void 0 || $e(e, o)) e.bindRenderbuffer(X, o), c > 1 ? e.renderbufferStorageMultisample(X, c, s, r, i) : e.renderbufferStorage(X, s, r, i);
|
|
1754
|
-
else if (et(e, o))
|
|
1754
|
+
else if (et(e, o)) oi(e, o, n, r, i);
|
|
1755
1755
|
else throw Error("unknown attachment type");
|
|
1756
1756
|
});
|
|
1757
1757
|
}
|
|
1758
|
-
function
|
|
1758
|
+
function Io(e, t, n) {
|
|
1759
1759
|
let r = e.createVertexArray();
|
|
1760
1760
|
return e.bindVertexArray(r), t.length || (t = [t]), t.forEach(function(t) {
|
|
1761
1761
|
Y(e, t, n);
|
|
@@ -1765,12 +1765,12 @@ function Fo(e, t, n) {
|
|
|
1765
1765
|
vertexArrayObject: r
|
|
1766
1766
|
};
|
|
1767
1767
|
}
|
|
1768
|
-
var
|
|
1769
|
-
function
|
|
1770
|
-
|
|
1768
|
+
var Lo = { addExtensionsToContext: !0 }, Ro = /^(.*?)_/;
|
|
1769
|
+
function zo(e, t) {
|
|
1770
|
+
jt(e, 0);
|
|
1771
1771
|
let n = e.getExtension(t);
|
|
1772
1772
|
if (n) {
|
|
1773
|
-
let r = {}, i =
|
|
1773
|
+
let r = {}, i = Ro.exec(t)[1], a = "_" + i;
|
|
1774
1774
|
for (let t in n) {
|
|
1775
1775
|
let o = n[t], s = typeof o == "function", c = s ? i : a, l = t;
|
|
1776
1776
|
t.endsWith(c) && (l = t.substring(0, t.length - c.length)), e[l] === void 0 ? s ? e[l] = function(e) {
|
|
@@ -1779,11 +1779,11 @@ function Ro(e, t) {
|
|
|
1779
1779
|
};
|
|
1780
1780
|
}(o) : (e[l] = o, r[l] = o) : !s && e[l] !== o && Ze(l, e[l], o, t);
|
|
1781
1781
|
}
|
|
1782
|
-
r.constructor = { name: n.constructor.name },
|
|
1782
|
+
r.constructor = { name: n.constructor.name }, jt(r, 0);
|
|
1783
1783
|
}
|
|
1784
1784
|
return n;
|
|
1785
1785
|
}
|
|
1786
|
-
var
|
|
1786
|
+
var Bo = [
|
|
1787
1787
|
"ANGLE_instanced_arrays",
|
|
1788
1788
|
"EXT_blend_minmax",
|
|
1789
1789
|
"EXT_color_buffer_float",
|
|
@@ -1810,89 +1810,89 @@ var zo = [
|
|
|
1810
1810
|
"WEBGL_depth_texture",
|
|
1811
1811
|
"WEBGL_draw_buffers"
|
|
1812
1812
|
];
|
|
1813
|
-
function
|
|
1814
|
-
for (let t = 0; t <
|
|
1813
|
+
function Vo(e) {
|
|
1814
|
+
for (let t = 0; t < Bo.length; ++t) zo(e, Bo[t]);
|
|
1815
1815
|
}
|
|
1816
|
-
function
|
|
1816
|
+
function Ho(e, t) {
|
|
1817
1817
|
let n = [
|
|
1818
1818
|
"webgl2",
|
|
1819
1819
|
"webgl",
|
|
1820
1820
|
"experimental-webgl"
|
|
1821
1821
|
], r = null;
|
|
1822
1822
|
for (let i = 0; i < n.length; ++i) if (r = e.getContext(n[i], t), r) {
|
|
1823
|
-
|
|
1823
|
+
Lo.addExtensionsToContext && Vo(r);
|
|
1824
1824
|
break;
|
|
1825
1825
|
}
|
|
1826
1826
|
return r;
|
|
1827
1827
|
}
|
|
1828
|
-
function
|
|
1829
|
-
return
|
|
1828
|
+
function Uo(e, t) {
|
|
1829
|
+
return Ho(e, t);
|
|
1830
1830
|
}
|
|
1831
1831
|
//#endregion
|
|
1832
1832
|
//#region ../core/src/rendering/webgl/gl/colorUtils.js
|
|
1833
|
-
function
|
|
1834
|
-
let
|
|
1835
|
-
if (n === void 0 && !
|
|
1836
|
-
let e = ce(
|
|
1837
|
-
if (
|
|
1838
|
-
let
|
|
1839
|
-
extent:
|
|
1833
|
+
function Wo(e, t, n, r, a = !1) {
|
|
1834
|
+
let o = c(e) ? e : e.name, l = !c(e) && e.extent || [0, 1];
|
|
1835
|
+
if (n === void 0 && !c(e) && (n = e.count), o) {
|
|
1836
|
+
let e = ce(o);
|
|
1837
|
+
if (i(e)) {
|
|
1838
|
+
let i = Jo(e, {
|
|
1839
|
+
extent: l,
|
|
1840
1840
|
count: n,
|
|
1841
|
-
reverse:
|
|
1841
|
+
reverse: a
|
|
1842
1842
|
});
|
|
1843
|
-
return
|
|
1843
|
+
return Ws(t, {
|
|
1844
1844
|
minMag: t.LINEAR,
|
|
1845
1845
|
format: t.RGB,
|
|
1846
1846
|
height: 1,
|
|
1847
1847
|
wrap: t.CLAMP_TO_EDGE
|
|
1848
|
-
},
|
|
1849
|
-
} else if (
|
|
1850
|
-
else throw Error("Unknown scheme: " +
|
|
1848
|
+
}, i, r);
|
|
1849
|
+
} else if (s(e)) return qo(a ? Array.from(e).reverse() : e, t, n, r);
|
|
1850
|
+
else throw Error("Unknown scheme: " + o);
|
|
1851
1851
|
}
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1854
|
-
let i =
|
|
1855
|
-
return
|
|
1853
|
+
function Go(e, t = "rgb", n, r) {
|
|
1854
|
+
let i = Jo(le(e, c(t) ? t : t.type, c(t) ? void 0 : t.gamma));
|
|
1855
|
+
return Ws(n, {
|
|
1856
1856
|
minMag: n.LINEAR,
|
|
1857
1857
|
format: n.RGB,
|
|
1858
1858
|
height: 1,
|
|
1859
1859
|
wrap: n.CLAMP_TO_EDGE
|
|
1860
1860
|
}, i, r);
|
|
1861
1861
|
}
|
|
1862
|
-
function
|
|
1862
|
+
function Ko(e, t, n, r) {
|
|
1863
1863
|
let i = Math.max(e.length, n || 0), a = new Float32Array(i);
|
|
1864
1864
|
for (let t = 0; t < i; t++) a[t] = e[t % e.length];
|
|
1865
|
-
return
|
|
1865
|
+
return Ws(t, {
|
|
1866
1866
|
minMag: t.NEAREST,
|
|
1867
1867
|
format: t.RED,
|
|
1868
1868
|
internalFormat: t.R32F,
|
|
1869
1869
|
height: 1
|
|
1870
1870
|
}, a, r);
|
|
1871
1871
|
}
|
|
1872
|
-
function
|
|
1873
|
-
let i =
|
|
1874
|
-
return
|
|
1872
|
+
function qo(e, t, n, r) {
|
|
1873
|
+
let i = Yo(e, n);
|
|
1874
|
+
return Ws(t, {
|
|
1875
1875
|
minMag: t.NEAREST,
|
|
1876
1876
|
format: t.RGB,
|
|
1877
1877
|
height: 1
|
|
1878
1878
|
}, i, r);
|
|
1879
1879
|
}
|
|
1880
|
-
function
|
|
1881
|
-
let i = t[0], a =
|
|
1882
|
-
return n && o.reverse(),
|
|
1880
|
+
function Jo(e, { extent: t = [0, 1], reverse: n = !1, count: r = 256 } = {}) {
|
|
1881
|
+
let i = t[0], a = re(t) - i, o = _(r).map((e) => e / (r - 1)).map((e) => i + e / a).map(e);
|
|
1882
|
+
return n && o.reverse(), Yo(o);
|
|
1883
1883
|
}
|
|
1884
|
-
function
|
|
1884
|
+
function Yo(e, t) {
|
|
1885
1885
|
let n = Math.max(e.length, t || 0), r = new Uint8Array(n * 3);
|
|
1886
1886
|
for (let t = 0; t < n; t++) {
|
|
1887
|
-
let n = e[t % e.length], i =
|
|
1887
|
+
let n = e[t % e.length], i = p(n);
|
|
1888
1888
|
if (!i) throw Error(`Invalid color "${n}" in the scheme ${JSON.stringify(e)}!`);
|
|
1889
1889
|
let a = i.rgb();
|
|
1890
1890
|
r[t * 3 + 0] = a.r, r[t * 3 + 1] = a.g, r[t * 3 + 2] = a.b;
|
|
1891
1891
|
}
|
|
1892
1892
|
return r;
|
|
1893
1893
|
}
|
|
1894
|
-
function
|
|
1895
|
-
let t =
|
|
1894
|
+
function Xo(e) {
|
|
1895
|
+
let t = p(e).rgb();
|
|
1896
1896
|
return [
|
|
1897
1897
|
t.r,
|
|
1898
1898
|
t.g,
|
|
@@ -1901,8 +1901,8 @@ function Yo(e) {
|
|
|
1901
1901
|
}
|
|
1902
1902
|
//#endregion
|
|
1903
1903
|
//#region ../core/src/rendering/webgl/gl/glslScaleGenerator.js
|
|
1904
|
-
var
|
|
1905
|
-
function
|
|
1904
|
+
var Zo = "attr_", Qo = "uDomain_", $o = "range_", es = "accessor_", ts = "scale_", ns = "getScaled_", rs = "uRangeTexture_", $ = "uParam_", is = "checkSelection_", as = "isSelectionMember_", os = "isSelectionEmpty_";
|
|
1905
|
+
function ss(e) {
|
|
1906
1906
|
let t = e.match(/^(?:(\w+)-)?(\w+)$/);
|
|
1907
1907
|
if (!t) throw Error("Not a scale type: " + e);
|
|
1908
1908
|
return {
|
|
@@ -1910,29 +1910,29 @@ function as(e) {
|
|
|
1910
1910
|
transform: t[2]
|
|
1911
1911
|
};
|
|
1912
1912
|
}
|
|
1913
|
-
function
|
|
1913
|
+
function cs(e) {
|
|
1914
1914
|
return e.type === "quantize" ? e.thresholds() : e.domain();
|
|
1915
1915
|
}
|
|
1916
|
-
function
|
|
1916
|
+
function ls(e) {
|
|
1917
1917
|
return e.type === "quantize" ? e.range().length : e.type === "threshold" ? e.domain().length + 1 : e.domain().length;
|
|
1918
1918
|
}
|
|
1919
|
-
function
|
|
1920
|
-
return `${
|
|
1919
|
+
function us(e, t) {
|
|
1920
|
+
return `${es}${e}_${t}`;
|
|
1921
1921
|
}
|
|
1922
|
-
function
|
|
1922
|
+
function ds(e, t, r) {
|
|
1923
1923
|
let i;
|
|
1924
|
-
if (
|
|
1925
|
-
else if (
|
|
1924
|
+
if (l(e)) i = vs(S(e)(r));
|
|
1925
|
+
else if (c(r)) if (y(e)) i = xs(r);
|
|
1926
1926
|
else throw Error(`String values are not supported on the "${e}" channel: ${r}`);
|
|
1927
|
-
else if (
|
|
1928
|
-
else if (r === null) if (
|
|
1927
|
+
else if (n(r)) i = vs(+!!r);
|
|
1928
|
+
else if (r === null) if (y(e)) i = vs([
|
|
1929
1929
|
0,
|
|
1930
1930
|
0,
|
|
1931
1931
|
0
|
|
1932
1932
|
]);
|
|
1933
1933
|
else throw Error(`null value is not supported on the "${e}" chanel.`);
|
|
1934
|
-
else i =
|
|
1935
|
-
let a =
|
|
1934
|
+
else i = vs(r);
|
|
1935
|
+
let a = us(e, t);
|
|
1936
1936
|
return {
|
|
1937
1937
|
channel: e,
|
|
1938
1938
|
accessorGlsl: `
|
|
@@ -1943,10 +1943,10 @@ ${i.type} ${a}() {
|
|
|
1943
1943
|
accessorFunctionName: a
|
|
1944
1944
|
};
|
|
1945
1945
|
}
|
|
1946
|
-
function
|
|
1946
|
+
function fs(e, t) {
|
|
1947
1947
|
let n = "float", r = (e) => e;
|
|
1948
|
-
|
|
1949
|
-
let i = `u${
|
|
1948
|
+
y(e) ? (n = "vec3", r = (e) => Xo(e)) : l(e) && (r = S(e));
|
|
1949
|
+
let i = `u${js(e)}_${t}`, a = ` // Dynamic value\n uniform ${n} ${i};`, o = us(e, t);
|
|
1950
1950
|
return {
|
|
1951
1951
|
channel: e,
|
|
1952
1952
|
uniformName: i,
|
|
@@ -1960,8 +1960,8 @@ ${n} ${o}() {
|
|
|
1960
1960
|
adjuster: r
|
|
1961
1961
|
};
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1964
|
-
let { attributeType: i } =
|
|
1963
|
+
function ps(e, t, n, r = [e]) {
|
|
1964
|
+
let { attributeType: i } = ws(t, e), a = As(r), o = `in highp ${i} ${a};`, s = us(e, n);
|
|
1965
1965
|
return {
|
|
1966
1966
|
channel: e,
|
|
1967
1967
|
attributeName: a,
|
|
@@ -1973,8 +1973,8 @@ ${i} ${s}() {
|
|
|
1973
1973
|
accessorFunctionName: s
|
|
1974
1974
|
};
|
|
1975
1975
|
}
|
|
1976
|
-
function
|
|
1977
|
-
let { attributeType: r } =
|
|
1976
|
+
function ms(e, t, n) {
|
|
1977
|
+
let { attributeType: r } = ws(t, e), i = As(e), a = ` uniform highp ${r} ${i};`, o = us(e, n);
|
|
1978
1978
|
return {
|
|
1979
1979
|
channel: e,
|
|
1980
1980
|
uniformName: i,
|
|
@@ -1986,108 +1986,112 @@ ${r} ${o}() {
|
|
|
1986
1986
|
accessorFunctionName: o
|
|
1987
1987
|
};
|
|
1988
1988
|
}
|
|
1989
|
-
function
|
|
1989
|
+
function hs(e, t, n) {
|
|
1990
1990
|
t ??= me();
|
|
1991
|
-
let r =
|
|
1992
|
-
|
|
1993
|
-
let { transform:
|
|
1991
|
+
let r = ie(e), i = Qo + r, a = $o + r, { hp: o, attributeType: s } = ws(t, e), c = t.domain ? w(t.type) ? cs(t).length : t.domain().length : void 0, l, d = [];
|
|
1992
|
+
d.push(""), d.push("/".repeat(70)), d.push(`// Channel: ${e}`), d.push("");
|
|
1993
|
+
let { transform: f } = ss(t.type), p = (e, ...t) => Cs.apply(null, [
|
|
1994
1994
|
e,
|
|
1995
1995
|
"value",
|
|
1996
1996
|
...t
|
|
1997
|
-
]),
|
|
1998
|
-
switch (
|
|
1997
|
+
]), m;
|
|
1998
|
+
switch (f) {
|
|
1999
1999
|
case "linear":
|
|
2000
|
-
|
|
2000
|
+
m = p("scaleLinear", "domain", a);
|
|
2001
2001
|
break;
|
|
2002
2002
|
case "log":
|
|
2003
|
-
|
|
2003
|
+
m = p("scaleLog", "domain", a, t.base());
|
|
2004
2004
|
break;
|
|
2005
2005
|
case "symlog":
|
|
2006
|
-
|
|
2006
|
+
m = p("scaleSymlog", "domain", a, t.constant());
|
|
2007
2007
|
break;
|
|
2008
2008
|
case "pow":
|
|
2009
2009
|
case "sqrt":
|
|
2010
|
-
|
|
2010
|
+
m = p("scalePow", "domain", a, t.exponent());
|
|
2011
2011
|
break;
|
|
2012
2012
|
case "index":
|
|
2013
2013
|
case "locus":
|
|
2014
|
-
|
|
2014
|
+
m = p("scaleBandHp", "domain", a, t.paddingInner(), t.paddingOuter(), t.align(), n.band ?? .5);
|
|
2015
2015
|
break;
|
|
2016
2016
|
case "point":
|
|
2017
2017
|
case "band":
|
|
2018
|
-
|
|
2018
|
+
m = p("scaleBand", "domain", a, t.paddingInner(), t.paddingOuter(), t.align(), n.band ?? .5);
|
|
2019
2019
|
break;
|
|
2020
2020
|
case "ordinal":
|
|
2021
2021
|
case "null":
|
|
2022
2022
|
case "identity":
|
|
2023
|
-
|
|
2023
|
+
m = p("scaleIdentity");
|
|
2024
2024
|
break;
|
|
2025
2025
|
case "threshold":
|
|
2026
2026
|
case "quantize": break;
|
|
2027
2027
|
default: throw Error(`Unsupported scale type: ${t.type}! ${e}: ${JSON.stringify(n)}`);
|
|
2028
2028
|
}
|
|
2029
|
-
let
|
|
2030
|
-
if (
|
|
2029
|
+
let h = Ms(t, e), g;
|
|
2030
|
+
if (h && e == r) {
|
|
2031
2031
|
let e = t.props.range ?? [];
|
|
2032
|
-
if (
|
|
2033
|
-
if (
|
|
2034
|
-
|
|
2035
|
-
} else if (
|
|
2036
|
-
let e =
|
|
2037
|
-
|
|
2032
|
+
if (u(e) || e.some(u)) {
|
|
2033
|
+
if (h.length < 1 || h.length > 4) throw Error(`A range with ExprRefs must have 1-4 elements, not ${h.length}! Range: ${JSON.stringify(h)}`);
|
|
2034
|
+
g = ` uniform ${ys(h.length)} ${a};`;
|
|
2035
|
+
} else if (h.length && h.every(C)) {
|
|
2036
|
+
let e = Ss(h);
|
|
2037
|
+
d.push(`const ${e.type} ${a} = ${e};`);
|
|
2038
2038
|
}
|
|
2039
2039
|
}
|
|
2040
|
-
let
|
|
2041
|
-
if (
|
|
2042
|
-
let n =
|
|
2043
|
-
if (e == r &&
|
|
2044
|
-
else if (fe(t.type) ||
|
|
2040
|
+
let _ = bs(e), v;
|
|
2041
|
+
if (y(e)) {
|
|
2042
|
+
let n = rs + r;
|
|
2043
|
+
if (e == r && d.push(`uniform sampler2D ${n};`), T(t.type)) v = `getInterpolatedColor(${n}, transformed)`;
|
|
2044
|
+
else if (fe(t.type) || w(t.type)) v = `getDiscreteColor(${n}, int(transformed))`;
|
|
2045
2045
|
else throw Error("Problem with color scale!");
|
|
2046
|
-
} else if (t.type === "ordinal" ||
|
|
2047
|
-
let t =
|
|
2048
|
-
e == r &&
|
|
2049
|
-
}
|
|
2050
|
-
let b = [],
|
|
2051
|
-
if (b.push("int slot = 0;"),
|
|
2052
|
-
let e =
|
|
2053
|
-
b.push(
|
|
2054
|
-
}
|
|
2055
|
-
let
|
|
2056
|
-
if (
|
|
2057
|
-
let e =
|
|
2058
|
-
|
|
2046
|
+
} else if (t.type === "ordinal" || w(t.type)) {
|
|
2047
|
+
let t = rs + r;
|
|
2048
|
+
e == r && d.push(`uniform sampler2D ${t};`), v = `getDiscreteColor(${t}, int(transformed)).r`;
|
|
2049
|
+
}
|
|
2050
|
+
let b = [], x = T(t.type) && c > 2, ee = w(t.type) || x;
|
|
2051
|
+
if (b.push("int slot = 0;"), ee) {
|
|
2052
|
+
let e = i;
|
|
2053
|
+
b.push(x ? `while (slot < ${e}.length() - 2 && value >= ${e}[slot + 1]) { slot++; }` : `while (slot < ${e}.length() && value >= ${e}[slot]) { slot++; }`);
|
|
2054
|
+
}
|
|
2055
|
+
let S = T(t.type) || w(t.type) || ["band", "point"].includes(t.type);
|
|
2056
|
+
if (m) {
|
|
2057
|
+
let e = i;
|
|
2058
|
+
S && (o ? b.push(`vec3 domain = ${e};`) : b.push(`vec2 domain = vec2(${e}[slot], ${e}[slot + 1]);`)), b.push(`float transformed = ${m};`), x && b.push(`transformed = (float(slot) + transformed) / (float(${e}.length() - 1));`);
|
|
2059
2059
|
} else b.push("float transformed = float(slot);");
|
|
2060
|
-
"clamp" in t && t.clamp() && b.push(`transformed = clampToRange(transformed, ${
|
|
2061
|
-
${
|
|
2060
|
+
"clamp" in t && t.clamp() && b.push(`transformed = clampToRange(transformed, ${Ss(h)});`), b.push(`return ${v ?? "transformed"};`), d.push(`
|
|
2061
|
+
${_} ${ts}${e}(${s} value) {
|
|
2062
2062
|
${b.map((e) => ` ${e}\n`).join("")}
|
|
2063
2063
|
}`);
|
|
2064
|
-
let
|
|
2065
|
-
if (
|
|
2066
|
-
let e =
|
|
2067
|
-
|
|
2064
|
+
let te = d.join("\n");
|
|
2065
|
+
if (S && e == r) {
|
|
2066
|
+
let e = T(t.type) || w(t.type) ? c : 2;
|
|
2067
|
+
l = o ? ` highp vec3 ${i};` : ` mediump float ${i}[${e}];`;
|
|
2068
2068
|
}
|
|
2069
2069
|
return {
|
|
2070
|
-
glsl:
|
|
2071
|
-
domainUniformName:
|
|
2072
|
-
domainUniform:
|
|
2073
|
-
rangeUniformName:
|
|
2074
|
-
rangeUniform:
|
|
2070
|
+
glsl: te,
|
|
2071
|
+
domainUniformName: i,
|
|
2072
|
+
domainUniform: l,
|
|
2073
|
+
rangeUniformName: a,
|
|
2074
|
+
rangeUniform: g
|
|
2075
2075
|
};
|
|
2076
2076
|
}
|
|
2077
|
-
function
|
|
2078
|
-
let n =
|
|
2077
|
+
function gs(e, t) {
|
|
2078
|
+
let n = bs(e), r = [], i = [];
|
|
2079
2079
|
for (let n = 0; n < t.length; n++) {
|
|
2080
|
-
let { accessor: a, predicate: o } = t[n], s =
|
|
2081
|
-
|
|
2080
|
+
let { accessor: a, predicate: o } = t[n], s = us(e, n), { selection: c } = o;
|
|
2081
|
+
if (c && !c.singleParam) {
|
|
2082
|
+
let e = c.empty, t = c.params.map((e) => `${as}${e}()`), n = c.params.map((e) => `${os}${e}()`);
|
|
2083
|
+
r.push(`(${t.join(" || ")}${e ? ` || (${n.join(" && ")})` : ""})`);
|
|
2084
|
+
} else r.push(c ? `${is}${c.params[0]}(${c.empty})` : null);
|
|
2085
|
+
i.push(a.scaleChannel ? `return ${ts}${e}(${s}());` : `return ${s}();`);
|
|
2082
2086
|
}
|
|
2083
|
-
return `${n} ${
|
|
2084
|
-
${
|
|
2087
|
+
return `${n} ${ns}${e}() {
|
|
2088
|
+
${Ns(r, i)}
|
|
2085
2089
|
}
|
|
2086
2090
|
|
|
2087
2091
|
#define ${e}_DEFINED`;
|
|
2088
2092
|
}
|
|
2089
|
-
function
|
|
2090
|
-
if (!
|
|
2093
|
+
function _s(e) {
|
|
2094
|
+
if (!C(e)) throw Error(`Not a number: ${e}`);
|
|
2091
2095
|
if (e == Infinity) return "3.402823466e+38";
|
|
2092
2096
|
if (e == -Infinity) return "-3.402823466e+38";
|
|
2093
2097
|
{
|
|
@@ -2095,17 +2099,17 @@ function hs(e) {
|
|
|
2095
2099
|
return /^(-)?\d+$/.test(t) && (t += ".0"), t;
|
|
2096
2100
|
}
|
|
2097
2101
|
}
|
|
2098
|
-
function
|
|
2102
|
+
function vs(e) {
|
|
2099
2103
|
typeof e == "number" && (e = [e]);
|
|
2100
2104
|
let t = e.length;
|
|
2101
2105
|
if (t < 1 || t > 4) throw Error("Invalid number of components: " + t);
|
|
2102
|
-
let n =
|
|
2106
|
+
let n = ys(t), r = `${n}(${e.map(_s).join(", ")})`;
|
|
2103
2107
|
return Object.assign(r, {
|
|
2104
2108
|
type: n,
|
|
2105
2109
|
numComponents: t
|
|
2106
2110
|
});
|
|
2107
2111
|
}
|
|
2108
|
-
function
|
|
2112
|
+
function ys(e) {
|
|
2109
2113
|
switch (e) {
|
|
2110
2114
|
case 1: return "float";
|
|
2111
2115
|
case 2: return "vec2";
|
|
@@ -2114,21 +2118,21 @@ function gs(e) {
|
|
|
2114
2118
|
default: throw Error("Invalid number of components: " + e);
|
|
2115
2119
|
}
|
|
2116
2120
|
}
|
|
2117
|
-
function
|
|
2118
|
-
return
|
|
2121
|
+
function bs(e) {
|
|
2122
|
+
return y(e) ? "vec3" : e == "uniqueId" ? "uint" : "float";
|
|
2119
2123
|
}
|
|
2120
|
-
function
|
|
2121
|
-
return
|
|
2124
|
+
function xs(e) {
|
|
2125
|
+
return vs(Xo(e));
|
|
2122
2126
|
}
|
|
2123
|
-
function
|
|
2124
|
-
return
|
|
2127
|
+
function Ss(e) {
|
|
2128
|
+
return vs([e[0], re(e)]);
|
|
2125
2129
|
}
|
|
2126
|
-
function
|
|
2130
|
+
function Cs(e, ...t) {
|
|
2127
2131
|
let n = [];
|
|
2128
|
-
for (let e of t)
|
|
2132
|
+
for (let e of t) C(e) ? n.push(_s(e)) : s(e) ? n.push(vs(e)) : n.push(e);
|
|
2129
2133
|
return `${e}(${n.join(", ")})`;
|
|
2130
2134
|
}
|
|
2131
|
-
function
|
|
2135
|
+
function ws(e, t) {
|
|
2132
2136
|
let n = e && fe(e.type), r = e && ge(e.type), i = r && pe(e.domain()), a = i ? {
|
|
2133
2137
|
attributeType: "uvec2",
|
|
2134
2138
|
arrayConstructor: Uint32Array
|
|
@@ -2152,38 +2156,38 @@ function xs(e, t) {
|
|
|
2152
2156
|
largeHp: i
|
|
2153
2157
|
});
|
|
2154
2158
|
}
|
|
2155
|
-
var
|
|
2156
|
-
|
|
2157
|
-
function
|
|
2158
|
-
let n = e %
|
|
2159
|
-
return t[0] = (e - n) /
|
|
2159
|
+
var Ts = 2 ** 12;
|
|
2160
|
+
Ts - 1;
|
|
2161
|
+
function Es(e, t = []) {
|
|
2162
|
+
let n = e % Ts;
|
|
2163
|
+
return t[0] = (e - n) / Ts, t[1] = n, t;
|
|
2160
2164
|
}
|
|
2161
|
-
function
|
|
2162
|
-
let t = e %
|
|
2165
|
+
function Ds(e) {
|
|
2166
|
+
let t = e % Ts;
|
|
2163
2167
|
return [e - t, t];
|
|
2164
2168
|
}
|
|
2165
|
-
function
|
|
2166
|
-
return [...
|
|
2169
|
+
function Os(e) {
|
|
2170
|
+
return [...Ds(e[0]), e[1] - e[0]];
|
|
2167
2171
|
}
|
|
2168
|
-
function
|
|
2172
|
+
function ks(e) {
|
|
2169
2173
|
let t = new ue([], JSON.stringify);
|
|
2170
2174
|
for (let [n, r] of Object.entries(e)) {
|
|
2171
2175
|
let e = r.channelDef;
|
|
2172
|
-
if (
|
|
2173
|
-
let i = [e.field, r.scale ? (
|
|
2176
|
+
if (oe(e)) {
|
|
2177
|
+
let i = [e.field, r.scale ? (T(r.scale.type) || w(r.scale.type)) ?? !1 : !1];
|
|
2174
2178
|
t.set(i, [...t.get(i) ?? [], n]);
|
|
2175
2179
|
}
|
|
2176
2180
|
}
|
|
2177
2181
|
return t;
|
|
2178
2182
|
}
|
|
2179
|
-
function
|
|
2180
|
-
return
|
|
2183
|
+
function As(e) {
|
|
2184
|
+
return Zo + d(e).toSorted().join("_");
|
|
2181
2185
|
}
|
|
2182
|
-
function
|
|
2186
|
+
function js(e) {
|
|
2183
2187
|
return e[0].toUpperCase() + e.slice(1);
|
|
2184
2188
|
}
|
|
2185
|
-
var
|
|
2186
|
-
function
|
|
2189
|
+
var Ms = (e, t) => de(e.type) || T(e.type) && y(t) ? [0, 1] : e.range ? e.range() : void 0;
|
|
2190
|
+
function Ns(e, t) {
|
|
2187
2191
|
if (e.length != t.length) throw Error("Unequal array lengths");
|
|
2188
2192
|
let n = e.length;
|
|
2189
2193
|
if (n == 0) return "";
|
|
@@ -2199,23 +2203,23 @@ function As(e, t) {
|
|
|
2199
2203
|
}
|
|
2200
2204
|
//#endregion
|
|
2201
2205
|
//#region ../core/src/rendering/webgl/gl/hashTable.js
|
|
2202
|
-
var
|
|
2203
|
-
function
|
|
2206
|
+
var Ps = 4294967295, Fs = 4294967295;
|
|
2207
|
+
function Is(e) {
|
|
2204
2208
|
let t = e >>> 0;
|
|
2205
2209
|
return t ^= t >>> 16, t = Math.imul(t, 2146121005), t ^= t >>> 15, t = Math.imul(t, 2221713035), t ^= t >>> 16, t >>> 0;
|
|
2206
2210
|
}
|
|
2207
|
-
function
|
|
2208
|
-
let n = Array.from(e, (e) =>
|
|
2211
|
+
function Ls(e, t = {}) {
|
|
2212
|
+
let n = Array.from(e, (e) => zs(e, "key")), r = n.length, i = t.maxLoadFactor ?? .6;
|
|
2209
2213
|
if (!(i > 0 && i < 1)) throw Error("maxLoadFactor must be between 0 and 1.");
|
|
2210
|
-
let a = t.capacity ??
|
|
2214
|
+
let a = t.capacity ?? Bs(Math.ceil(r / i));
|
|
2211
2215
|
if (!Number.isSafeInteger(a) || a < 1) throw Error("capacity must be a positive power of two.");
|
|
2212
2216
|
if (a & a - 1) throw Error("capacity must be a power of two.");
|
|
2213
2217
|
let o = new Uint32Array(a);
|
|
2214
|
-
o.fill(
|
|
2218
|
+
o.fill(Ps);
|
|
2215
2219
|
let s = a - 1;
|
|
2216
2220
|
for (let e of n) {
|
|
2217
2221
|
if (e === 4294967295) throw Error("Hash table keys must not equal the empty sentinel (0xffffffff).");
|
|
2218
|
-
let t =
|
|
2222
|
+
let t = Is(e) & s, n = !1;
|
|
2219
2223
|
for (let r = 0; r < a; r += 1) {
|
|
2220
2224
|
let r = o[t];
|
|
2221
2225
|
if (r === 4294967295 || r === e) {
|
|
@@ -2232,7 +2236,7 @@ function Ps(e, t = {}) {
|
|
|
2232
2236
|
size: r
|
|
2233
2237
|
};
|
|
2234
2238
|
}
|
|
2235
|
-
function
|
|
2239
|
+
function Rs(e, t) {
|
|
2236
2240
|
if (!Number.isSafeInteger(e) || e < 1) throw Error("capacity must be a positive integer.");
|
|
2237
2241
|
if (e & e - 1) throw Error("capacity must be a power of two.");
|
|
2238
2242
|
if (!Number.isSafeInteger(t) || t < 1) throw Error("maxTextureSize must be a positive integer.");
|
|
@@ -2244,17 +2248,17 @@ function Fs(e, t) {
|
|
|
2244
2248
|
height: i
|
|
2245
2249
|
};
|
|
2246
2250
|
}
|
|
2247
|
-
function
|
|
2248
|
-
if (!Number.isSafeInteger(e) || e < 0 || e >
|
|
2251
|
+
function zs(e, t) {
|
|
2252
|
+
if (!Number.isSafeInteger(e) || e < 0 || e > Fs) throw Error(t + " must be a non-negative u32.");
|
|
2249
2253
|
return e >>> 0;
|
|
2250
2254
|
}
|
|
2251
|
-
function
|
|
2255
|
+
function Bs(e) {
|
|
2252
2256
|
let t = Math.max(1, e);
|
|
2253
2257
|
return --t, t |= t >>> 1, t |= t >>> 2, t |= t >>> 4, t |= t >>> 8, t |= t >>> 16, t + 1;
|
|
2254
2258
|
}
|
|
2255
2259
|
//#endregion
|
|
2256
2260
|
//#region ../core/src/rendering/webgl/gl/webGLHelper.js
|
|
2257
|
-
var
|
|
2261
|
+
var Vs = class {
|
|
2258
2262
|
#e = !1;
|
|
2259
2263
|
#t = () => {};
|
|
2260
2264
|
_ownedTextures = /* @__PURE__ */ new Set();
|
|
@@ -2265,22 +2269,22 @@ var Rs = class {
|
|
|
2265
2269
|
height: void 0
|
|
2266
2270
|
}));
|
|
2267
2271
|
this._canvasSizeHelper = void 0, this._appliedCanvasSize = void 0, this._onCanvasResize = r ?? (() => {}), this._shaderCache = /* @__PURE__ */ new Map(), this.rangeTextures = /* @__PURE__ */ new WeakMap(), this.placementTextures = /* @__PURE__ */ new WeakMap(), this.selectionTextures = /* @__PURE__ */ new WeakMap();
|
|
2268
|
-
let a = document.createElement("canvas"), o =
|
|
2272
|
+
let a = document.createElement("canvas"), o = Uo(a, {
|
|
2269
2273
|
antialias: !0,
|
|
2270
2274
|
depth: !1,
|
|
2271
2275
|
premultipliedAlpha: !0,
|
|
2272
2276
|
...n
|
|
2273
2277
|
});
|
|
2274
2278
|
if (!o) throw Error("Unable to initialize WebGL. Your browser or machine may not support it.");
|
|
2275
|
-
if (!
|
|
2276
|
-
|
|
2279
|
+
if (!At(o)) throw Error("Your web browser does not support WebGL 2.0. Chrome, Firefox, and Safari Tech Preview should work.");
|
|
2280
|
+
Vo(o);
|
|
2277
2281
|
let s = o.getExtension("WEBGL_provoking_vertex");
|
|
2278
2282
|
s && s.provokingVertexWEBGL(s.FIRST_VERTEX_CONVENTION_WEBGL), o.blendFunc(o.ONE, o.ONE_MINUS_SRC_ALPHA), this.canvas = a, this.gl = o, this._pickingAttachmentOptions = [{
|
|
2279
2283
|
format: o.RGBA,
|
|
2280
2284
|
type: o.UNSIGNED_BYTE,
|
|
2281
2285
|
minMag: o.LINEAR,
|
|
2282
2286
|
wrap: o.CLAMP_TO_EDGE
|
|
2283
|
-
}], this._pickingBufferInfo =
|
|
2287
|
+
}], this._pickingBufferInfo = Po(o, this._pickingAttachmentOptions), o.bindFramebuffer(o.FRAMEBUFFER, null), e.appendChild(a);
|
|
2284
2288
|
try {
|
|
2285
2289
|
this._canvasSizeHelper = new Te(e, a, i, () => {
|
|
2286
2290
|
this.adjustGl() && this._onCanvasResize();
|
|
@@ -2294,7 +2298,7 @@ var Rs = class {
|
|
|
2294
2298
|
if (n?.geometryRevision === t.geometryRevision) return n.texture;
|
|
2295
2299
|
let r = n?.data.length === t.rectangles.length / 2 ? n.data : new Float32Array(t.rectangles.length / 2);
|
|
2296
2300
|
for (let e = 0; e < t.rectangles.length / 4; e++) r[e * 2] = t.rectangles[e * 4 + 1], r[e * 2 + 1] = t.rectangles[e * 4 + 3];
|
|
2297
|
-
let i =
|
|
2301
|
+
let i = Ws(this.gl, {
|
|
2298
2302
|
internalFormat: this.gl.RG32F,
|
|
2299
2303
|
format: this.gl.RG,
|
|
2300
2304
|
height: 1
|
|
@@ -2317,7 +2321,7 @@ var Rs = class {
|
|
|
2317
2321
|
return this._canvasSizeHelper.invalidate(), this.adjustGl();
|
|
2318
2322
|
}
|
|
2319
2323
|
compileShader(e, t) {
|
|
2320
|
-
|
|
2324
|
+
s(t) && (t = t.join("\n\n"));
|
|
2321
2325
|
let n = this.gl, r = t.replaceAll(/ {2,}|^\s*\/\/.*$/gm, ""), i = this._shaderCache.get(r);
|
|
2322
2326
|
if (!i) {
|
|
2323
2327
|
let a = [
|
|
@@ -2331,7 +2335,7 @@ var Rs = class {
|
|
|
2331
2335
|
}
|
|
2332
2336
|
adjustGl() {
|
|
2333
2337
|
let e = this.getLogicalCanvasSize(), t = this.getPhysicalCanvasSize(e);
|
|
2334
|
-
return this._appliedCanvasSize && this._appliedCanvasSize.logicalWidth == e.width && this._appliedCanvasSize.logicalHeight == e.height && this._appliedCanvasSize.physicalWidth == t.width && this._appliedCanvasSize.physicalHeight == t.height ? !1 : (this.canvas.style.width = `${e.width}px`, this.canvas.style.height = `${e.height}px`, this.canvas.width = t.width, this.canvas.height = t.height,
|
|
2338
|
+
return this._appliedCanvasSize && this._appliedCanvasSize.logicalWidth == e.width && this._appliedCanvasSize.logicalHeight == e.height && this._appliedCanvasSize.physicalWidth == t.width && this._appliedCanvasSize.physicalHeight == t.height ? !1 : (this.canvas.style.width = `${e.width}px`, this.canvas.style.height = `${e.height}px`, this.canvas.width = t.width, this.canvas.height = t.height, Fo(this.gl, this._pickingBufferInfo, this._pickingAttachmentOptions), this._appliedCanvasSize = {
|
|
2335
2339
|
logicalWidth: e.width,
|
|
2336
2340
|
logicalHeight: e.height,
|
|
2337
2341
|
physicalWidth: t.width,
|
|
@@ -2367,42 +2371,42 @@ var Rs = class {
|
|
|
2367
2371
|
let n = this.rangeTextures.get(e.getScale());
|
|
2368
2372
|
if (!t && n) return;
|
|
2369
2373
|
function r(e, t) {
|
|
2370
|
-
return fe(t.type) ? t.domain().length : t.type == "threshold" || t.type == "quantize" ?
|
|
2374
|
+
return fe(t.type) ? t.domain().length : t.type == "threshold" || t.type == "quantize" ? ls(t) : t.type == "quantile" ? e ?? 4 : e;
|
|
2371
2375
|
}
|
|
2372
2376
|
let i = e.channel;
|
|
2373
|
-
if (
|
|
2377
|
+
if (y(i)) {
|
|
2374
2378
|
let t = e.getScale(), i = t.props, a = t.range(), o;
|
|
2375
|
-
if (i.scheme) if (fe(t.type) ||
|
|
2379
|
+
if (i.scheme) if (fe(t.type) || w(t.type)) o = qo(a, this.gl, ls(t), n);
|
|
2376
2380
|
else {
|
|
2377
|
-
let e =
|
|
2378
|
-
e = r(e, t), o =
|
|
2381
|
+
let e = c(i.scheme) ? void 0 : i.scheme.count;
|
|
2382
|
+
e = r(e, t), o = Wo(i.scheme, this.gl, e, n, !!i.reverse);
|
|
2379
2383
|
}
|
|
2380
|
-
else o = de(t.type) ||
|
|
2384
|
+
else o = de(t.type) || T(t.type) && a.length > 1 ? Go(a, i.interpolate, this.gl, n) : qo(a, this.gl, w(t.type) ? ls(t) : t.domain().length, n);
|
|
2381
2385
|
this.rangeTextures.set(t, o), this._ownedTextures.add(o);
|
|
2382
2386
|
} else {
|
|
2383
2387
|
let t = e.getScale();
|
|
2384
|
-
if (t.type === "ordinal" ||
|
|
2385
|
-
let e =
|
|
2388
|
+
if (t.type === "ordinal" || w(t.type)) {
|
|
2389
|
+
let e = l(i) ? S(i) : (e) => e, r = Ko(t.range().map(e), this.gl, w(t.type) ? ls(t) : t.domain().length, n);
|
|
2386
2390
|
this.rangeTextures.set(t, r), this._ownedTextures.add(r);
|
|
2387
2391
|
}
|
|
2388
2392
|
}
|
|
2389
2393
|
}
|
|
2390
2394
|
createSelectionTexture(e, t = !0) {
|
|
2391
|
-
if (!
|
|
2392
|
-
let { table: n, capacity: r } =
|
|
2395
|
+
if (!se(e)) throw Error("Not a multi-point selection, cannot create texture");
|
|
2396
|
+
let { table: n, capacity: r } = Ls(e.data.keys()), { width: i, height: a } = Rs(r, this.gl.getParameter(this.gl.MAX_TEXTURE_SIZE)), o = this.selectionTextures.get(e), s = this.gl, c = Ws(this.gl, {
|
|
2393
2397
|
auto: !1,
|
|
2394
2398
|
level: 0,
|
|
2395
|
-
min:
|
|
2396
|
-
mag:
|
|
2397
|
-
format:
|
|
2398
|
-
internalFormat:
|
|
2399
|
+
min: s.NEAREST,
|
|
2400
|
+
mag: s.NEAREST,
|
|
2401
|
+
format: s.RED_INTEGER,
|
|
2402
|
+
internalFormat: s.R32UI,
|
|
2399
2403
|
width: i,
|
|
2400
|
-
height:
|
|
2401
|
-
}, n, t ?
|
|
2402
|
-
|
|
2404
|
+
height: a
|
|
2405
|
+
}, n, t ? o : !1);
|
|
2406
|
+
s.bindTexture(s.TEXTURE_2D, c), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_BASE_LEVEL, 0), s.texParameteri(s.TEXTURE_2D, s.TEXTURE_MAX_LEVEL, 0), s.bindTexture(s.TEXTURE_2D, null), this.selectionTextures.set(e, c), this._ownedTextures.add(c);
|
|
2403
2407
|
}
|
|
2404
2408
|
};
|
|
2405
|
-
function
|
|
2409
|
+
function Hs(e, t = "", n = 0) {
|
|
2406
2410
|
let r = [...t.matchAll(/ERROR:\s*\d+:(\d+)/gi)], i = new Map(r.map((e, n) => {
|
|
2407
2411
|
let i = parseInt(e[1]), a = r[n + 1], o = a ? a.index : t.length, s = t.substring(e.index, o);
|
|
2408
2412
|
return [i - 1, s];
|
|
@@ -2412,14 +2416,14 @@ function zs(e, t = "", n = 0) {
|
|
|
2412
2416
|
return `${t + 1 + n}: ${e}${r ? `\n\n^^^ ${r}` : ""}`;
|
|
2413
2417
|
}).join("\n");
|
|
2414
2418
|
}
|
|
2415
|
-
function
|
|
2419
|
+
function Us(e, t, n) {
|
|
2416
2420
|
let r = e.createProgram();
|
|
2417
2421
|
e.attachShader(r, t), e.attachShader(r, n), e.linkProgram(r);
|
|
2418
2422
|
function i() {
|
|
2419
2423
|
let i, a;
|
|
2420
2424
|
if (!e.getProgramParameter(r, e.LINK_STATUS)) {
|
|
2421
2425
|
i = e.getProgramInfoLog(r);
|
|
2422
|
-
for (let r of [t, n]) e.getShaderParameter(r, e.COMPILE_STATUS) || (i = e.getShaderInfoLog(r), a =
|
|
2426
|
+
for (let r of [t, n]) e.getShaderParameter(r, e.COMPILE_STATUS) || (i = e.getShaderInfoLog(r), a = Hs(e.getShaderSource(r), i, 0) + `\nError compiling: ${i}`, e.deleteShader(r));
|
|
2423
2427
|
e.deleteProgram(r);
|
|
2424
2428
|
}
|
|
2425
2429
|
if (i) return {
|
|
@@ -2432,19 +2436,19 @@ function Bs(e, t, n) {
|
|
|
2432
2436
|
getProgramErrors: i
|
|
2433
2437
|
};
|
|
2434
2438
|
}
|
|
2435
|
-
function
|
|
2436
|
-
return r ?
|
|
2439
|
+
function Ws(e, t, n, r) {
|
|
2440
|
+
return r ? ri(e, r, n, t) : r = ai(e, {
|
|
2437
2441
|
...t,
|
|
2438
2442
|
src: n
|
|
2439
2443
|
}), r;
|
|
2440
2444
|
}
|
|
2441
|
-
function
|
|
2445
|
+
function Gs(e, t, n, r) {
|
|
2442
2446
|
let { height: i, framebuffer: a } = t, o = /* @__PURE__ */ new Uint8Array(4);
|
|
2443
2447
|
return e.bindFramebuffer(e.FRAMEBUFFER, a), e.readPixels(n, i - r - 1, 1, 1, e.RGBA, e.UNSIGNED_BYTE, o), e.bindFramebuffer(e.FRAMEBUFFER, null), o;
|
|
2444
2448
|
}
|
|
2445
2449
|
//#endregion
|
|
2446
2450
|
//#region ../core/src/rendering/webgl/bufferedViewRenderingContext.js
|
|
2447
|
-
var
|
|
2451
|
+
var Ks = class extends Ce {
|
|
2448
2452
|
#e = [
|
|
2449
2453
|
0,
|
|
2450
2454
|
0,
|
|
@@ -2468,7 +2472,7 @@ var Us = class extends Ce {
|
|
|
2468
2472
|
#f;
|
|
2469
2473
|
constructor(e, t) {
|
|
2470
2474
|
if (super(e), this.#i = t.webGLHelper, this.#a = t.markAdapter, this.#r = t.framebufferInfo, this.#u = t.devicePixelRatio, this.#d = t.canvasSize, this.#c = t.markPredicate ?? (() => !0), this.#f = t.pixelOffset, t.clearColor) {
|
|
2471
|
-
let e =
|
|
2475
|
+
let e = p(t.clearColor).rgb();
|
|
2472
2476
|
this.#e = [
|
|
2473
2477
|
e.r / 255,
|
|
2474
2478
|
e.g / 255,
|
|
@@ -2485,13 +2489,13 @@ var Us = class extends Ce {
|
|
|
2485
2489
|
}
|
|
2486
2490
|
renderMark(e, t) {
|
|
2487
2491
|
if (!this.#c(e) || this.globalOptions.picking && !e.isPickingParticipant()) return;
|
|
2488
|
-
let n =
|
|
2492
|
+
let n = ee(t);
|
|
2489
2493
|
this.#n.push({
|
|
2490
2494
|
mark: e,
|
|
2491
2495
|
options: t,
|
|
2492
2496
|
coords: this.#l,
|
|
2493
2497
|
placement: t.placement,
|
|
2494
|
-
clip:
|
|
2498
|
+
clip: ne(n, e.properties.clip, this.#l),
|
|
2495
2499
|
cullClip: n
|
|
2496
2500
|
});
|
|
2497
2501
|
}
|
|
@@ -2511,40 +2515,52 @@ var Us = class extends Ce {
|
|
|
2511
2515
|
}
|
|
2512
2516
|
#p() {
|
|
2513
2517
|
this.#t = [];
|
|
2514
|
-
let e = !0, t = !0, n = (t) => () => {
|
|
2518
|
+
let e = !0, t = !0, n = !1, r = (t) => () => {
|
|
2515
2519
|
e && t();
|
|
2516
|
-
},
|
|
2520
|
+
}, i = (n) => () => {
|
|
2517
2521
|
e && t && n();
|
|
2518
|
-
},
|
|
2519
|
-
for (let [
|
|
2520
|
-
let
|
|
2521
|
-
if (!
|
|
2522
|
-
let
|
|
2523
|
-
if (!this.#a.isEntryDrawable(
|
|
2524
|
-
this.#o.add(
|
|
2525
|
-
let
|
|
2522
|
+
}, a = he(this.#n.reverse(), (e) => e.mark);
|
|
2523
|
+
for (let [o, s] of [...a.entries()].reverse()) {
|
|
2524
|
+
let a = this.#a.getMarkEntry(o);
|
|
2525
|
+
if (!a) continue;
|
|
2526
|
+
let c = a.graphics;
|
|
2527
|
+
if (!this.#a.isEntryDrawable(a)) continue;
|
|
2528
|
+
this.#o.add(a);
|
|
2529
|
+
let l = o.getOrder?.(), u = s.map((e) => ({
|
|
2526
2530
|
...e,
|
|
2527
|
-
callback:
|
|
2531
|
+
callback: c.render(l ? {
|
|
2532
|
+
...e.options,
|
|
2533
|
+
orderPass: "all"
|
|
2534
|
+
} : e.options),
|
|
2535
|
+
orderCallbacks: l && !this.globalOptions.picking ? l.passes.map((t, n) => c.render({
|
|
2536
|
+
...e.options,
|
|
2537
|
+
orderPass: t,
|
|
2538
|
+
secondOrderPass: n === 1
|
|
2539
|
+
})) : void 0
|
|
2528
2540
|
})).filter((e) => e.callback);
|
|
2529
|
-
if (
|
|
2530
|
-
|
|
2531
|
-
e = this.#a.isEntryDrawable(i) && a.unitView.getEffectiveOpacity() > 0;
|
|
2532
|
-
});
|
|
2533
|
-
let l = c[0].placement, u = l ? {
|
|
2541
|
+
if (u.length == 0) continue;
|
|
2542
|
+
let d = u[0].placement, f = d ? {
|
|
2534
2543
|
...this.globalOptions,
|
|
2535
|
-
placement:
|
|
2536
|
-
} : this.globalOptions;
|
|
2537
|
-
this.#t.push(
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
+
placement: d
|
|
2545
|
+
} : this.globalOptions, p = c.prepareRender(f).map((e) => r(e));
|
|
2546
|
+
this.#t.push(() => {
|
|
2547
|
+
e = this.#a.isEntryDrawable(a) && o.unitView.getEffectiveOpacity() > 0, t = !0, n = !!l && !this.globalOptions.picking && l.isActive();
|
|
2548
|
+
}), this.#t.push(...p);
|
|
2549
|
+
let m, h, g;
|
|
2550
|
+
for (let e of u) {
|
|
2551
|
+
let a = e.coords;
|
|
2552
|
+
(!a.equals(m) || !x(e.clip, h) || !x(e.cullClip, g)) && this.#t.push(r(() => {
|
|
2553
|
+
t = c.setViewport(this.#d, this.#u, a, e.clip, e.cullClip, this.#f);
|
|
2554
|
+
}));
|
|
2555
|
+
let { callback: o, orderCallbacks: s } = e, l = s ? () => {
|
|
2556
|
+
if (n) for (let e of s) e();
|
|
2557
|
+
else o();
|
|
2558
|
+
} : o;
|
|
2559
|
+
this.#t.push(i(l)), m = e.coords, h = e.clip, g = e.cullClip;
|
|
2544
2560
|
}
|
|
2545
2561
|
}
|
|
2546
2562
|
}
|
|
2547
|
-
},
|
|
2563
|
+
}, qs = class extends Ce {
|
|
2548
2564
|
constructor(...e) {
|
|
2549
2565
|
super({}), this.contexts = e;
|
|
2550
2566
|
}
|
|
@@ -2563,7 +2579,7 @@ var Us = class extends Ce {
|
|
|
2563
2579
|
renderMark(e, t) {
|
|
2564
2580
|
for (let n of this.contexts) n.renderMark(e, t);
|
|
2565
2581
|
}
|
|
2566
|
-
},
|
|
2582
|
+
}, Js = class {
|
|
2567
2583
|
#e;
|
|
2568
2584
|
#t;
|
|
2569
2585
|
#n;
|
|
@@ -2606,14 +2622,14 @@ var Us = class extends Ce {
|
|
|
2606
2622
|
markAdapter: this.#n,
|
|
2607
2623
|
canvasSize: t,
|
|
2608
2624
|
devicePixelRatio: n
|
|
2609
|
-
}, i = new
|
|
2625
|
+
}, i = new Ks({ picking: !1 }, {
|
|
2610
2626
|
...r,
|
|
2611
2627
|
clearColor: this.#r()
|
|
2612
|
-
}), a = new
|
|
2628
|
+
}), a = new Ks({ picking: !0 }, {
|
|
2613
2629
|
...r,
|
|
2614
2630
|
framebufferInfo: this.#t._pickingBufferInfo
|
|
2615
2631
|
});
|
|
2616
|
-
Se("layoutReplay", () => e.collectRenderCommands(new
|
|
2632
|
+
Se("layoutReplay", () => e.collectRenderCommands(new qs(i, a))), i.finish(), a.finish(), this.#o = i, this.#s = a;
|
|
2617
2633
|
}
|
|
2618
2634
|
renderAll() {
|
|
2619
2635
|
let e = xe();
|
|
@@ -2627,9 +2643,9 @@ var Us = class extends Ce {
|
|
|
2627
2643
|
};
|
|
2628
2644
|
//#endregion
|
|
2629
2645
|
//#region ../core/src/rendering/webgl/gl/framebufferReadback.js
|
|
2630
|
-
function
|
|
2646
|
+
function Ys(e, t, n = {}) {
|
|
2631
2647
|
let r = n.x ?? 0, i = n.y ?? 0, a = n.width ?? t.width, o = n.height ?? t.height;
|
|
2632
|
-
|
|
2648
|
+
ec(t, r, i, a, o);
|
|
2633
2649
|
let s = new Uint8Array(a * o * 4);
|
|
2634
2650
|
e.bindFramebuffer(e.FRAMEBUFFER, t.framebuffer);
|
|
2635
2651
|
try {
|
|
@@ -2638,29 +2654,29 @@ function Ks(e, t, n = {}) {
|
|
|
2638
2654
|
e.bindFramebuffer(e.FRAMEBUFFER, null);
|
|
2639
2655
|
}
|
|
2640
2656
|
return {
|
|
2641
|
-
pixels:
|
|
2657
|
+
pixels: $s(s, a, o, n.unpremultiplyAlpha ?? !1),
|
|
2642
2658
|
width: a,
|
|
2643
2659
|
height: o
|
|
2644
2660
|
};
|
|
2645
2661
|
}
|
|
2646
|
-
function
|
|
2647
|
-
return
|
|
2662
|
+
function Xs(e, t, n = "image/png", r = {}) {
|
|
2663
|
+
return Qs(e, t, r).toDataURL(n);
|
|
2648
2664
|
}
|
|
2649
|
-
function
|
|
2650
|
-
let i =
|
|
2665
|
+
function Zs(e, t, n = "image/png", r = {}) {
|
|
2666
|
+
let i = Qs(e, t, r);
|
|
2651
2667
|
return new Promise((e, t) => {
|
|
2652
2668
|
i.toBlob((r) => {
|
|
2653
2669
|
r ? e(r) : t(/* @__PURE__ */ Error(`Could not encode framebuffer as ${n}.`));
|
|
2654
2670
|
}, n);
|
|
2655
2671
|
});
|
|
2656
2672
|
}
|
|
2657
|
-
function
|
|
2658
|
-
let { pixels: r, width: i, height: a } =
|
|
2673
|
+
function Qs(e, t, n) {
|
|
2674
|
+
let { pixels: r, width: i, height: a } = Ys(e, t, n), o = document.createElement("canvas");
|
|
2659
2675
|
o.width = i, o.height = a;
|
|
2660
2676
|
let s = o.getContext("2d"), c = s.createImageData(i, a);
|
|
2661
2677
|
return c.data.set(r), s.putImageData(c, 0, 0), o;
|
|
2662
2678
|
}
|
|
2663
|
-
function
|
|
2679
|
+
function $s(e, t, n, r) {
|
|
2664
2680
|
let i = new Uint8ClampedArray(e.length), a = t * 4;
|
|
2665
2681
|
for (let t = 0; t < n; t++) {
|
|
2666
2682
|
let r = (n - t - 1) * a, o = t * a;
|
|
@@ -2676,7 +2692,7 @@ function Xs(e, t, n, r) {
|
|
|
2676
2692
|
}
|
|
2677
2693
|
return i;
|
|
2678
2694
|
}
|
|
2679
|
-
function
|
|
2695
|
+
function ec(e, t, n, r, i) {
|
|
2680
2696
|
if (![
|
|
2681
2697
|
t,
|
|
2682
2698
|
n,
|
|
@@ -2687,8 +2703,8 @@ function Zs(e, t, n, r, i) {
|
|
|
2687
2703
|
}
|
|
2688
2704
|
//#endregion
|
|
2689
2705
|
//#region ../core/src/rendering/webgl/canvasExport.js
|
|
2690
|
-
function
|
|
2691
|
-
let { gl: s, framebufferInfo: c } =
|
|
2706
|
+
function tc({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, devicePixelRatio: a, clearColor: o = "white" }) {
|
|
2707
|
+
let { gl: s, framebufferInfo: c } = rc({
|
|
2692
2708
|
glHelper: e,
|
|
2693
2709
|
markAdapter: t,
|
|
2694
2710
|
viewRoot: n,
|
|
@@ -2698,14 +2714,14 @@ function Qs({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logical
|
|
|
2698
2714
|
clearColor: o
|
|
2699
2715
|
});
|
|
2700
2716
|
try {
|
|
2701
|
-
return
|
|
2717
|
+
return Xs(s, c, "image/png");
|
|
2702
2718
|
} finally {
|
|
2703
|
-
|
|
2719
|
+
ic(s, c);
|
|
2704
2720
|
}
|
|
2705
2721
|
}
|
|
2706
|
-
async function
|
|
2722
|
+
async function nc({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, pixelRatio: a, clearColor: o = "white", mimeType: s = "image/png" }) {
|
|
2707
2723
|
if (s != "image/png") throw Error(`Unsupported raster export MIME type: ${s}`);
|
|
2708
|
-
let { gl: c, framebufferInfo: l } =
|
|
2724
|
+
let { gl: c, framebufferInfo: l } = rc({
|
|
2709
2725
|
glHelper: e,
|
|
2710
2726
|
markAdapter: t,
|
|
2711
2727
|
viewRoot: n,
|
|
@@ -2715,25 +2731,25 @@ async function $s({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, l
|
|
|
2715
2731
|
clearColor: o
|
|
2716
2732
|
});
|
|
2717
2733
|
try {
|
|
2718
|
-
return await
|
|
2734
|
+
return await Zs(c, l, s);
|
|
2719
2735
|
} finally {
|
|
2720
|
-
|
|
2736
|
+
ic(c, l);
|
|
2721
2737
|
}
|
|
2722
2738
|
}
|
|
2723
|
-
function
|
|
2739
|
+
function rc({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logicalHeight: i, pixelRatio: a, clearColor: o }) {
|
|
2724
2740
|
r ??= e.getLogicalCanvasSize().width, i ??= e.getLogicalCanvasSize().height, a ??= window.devicePixelRatio ?? 1;
|
|
2725
|
-
let s = e.gl, c = Math.floor(r * a), l = Math.floor(i * a), u =
|
|
2741
|
+
let s = e.gl, c = Math.floor(r * a), l = Math.floor(i * a), u = Po(s, [{
|
|
2726
2742
|
format: s.RGBA,
|
|
2727
2743
|
type: s.UNSIGNED_BYTE,
|
|
2728
2744
|
minMag: s.LINEAR,
|
|
2729
2745
|
wrap: s.CLAMP_TO_EDGE
|
|
2730
2746
|
}], c, l), d;
|
|
2731
2747
|
try {
|
|
2732
|
-
d =
|
|
2748
|
+
d = Po(s, [{
|
|
2733
2749
|
format: s.RGBA8,
|
|
2734
2750
|
samples: Math.min(4, s.getParameter(s.MAX_SAMPLES))
|
|
2735
2751
|
}], c, l);
|
|
2736
|
-
let f = new
|
|
2752
|
+
let f = new Ks({ picking: !1 }, {
|
|
2737
2753
|
webGLHelper: e,
|
|
2738
2754
|
markAdapter: t,
|
|
2739
2755
|
canvasSize: {
|
|
@@ -2749,17 +2765,17 @@ function ec({ glHelper: e, markAdapter: t, viewRoot: n, logicalWidth: r, logical
|
|
|
2749
2765
|
framebufferInfo: u
|
|
2750
2766
|
};
|
|
2751
2767
|
} catch (e) {
|
|
2752
|
-
throw
|
|
2768
|
+
throw ic(s, u), e;
|
|
2753
2769
|
} finally {
|
|
2754
2770
|
d && (s.deleteRenderbuffer(d.attachments[0]), s.deleteFramebuffer(d.framebuffer));
|
|
2755
2771
|
}
|
|
2756
2772
|
}
|
|
2757
|
-
function
|
|
2773
|
+
function ic(e, t) {
|
|
2758
2774
|
e.deleteTexture(t.attachments[0]), e.deleteFramebuffer(t.framebuffer);
|
|
2759
2775
|
}
|
|
2760
2776
|
//#endregion
|
|
2761
2777
|
//#region ../core/src/rendering/webgl/marks/arrow.vertex.glsl
|
|
2762
|
-
var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out float vArrowHalfLengthInPixels;\nflat out float vHeadHalfWidth;\nflat out float vStemHalfWidth;\nflat out float vHeadStrokeWidth;\nflat out float vRHeadSlope;\nflat out float vRHeadNotchSlope;\nflat out float vRStartNotchSlope;\nflat out float vHeadRepeatFootprintLength;\nflat out float vHeadSpacing;\nflat out float vDirection;\n\nout vec2 vPosInPixels;\n\n/** Position along the arrow centerline. */\nin float pos;\n\n/** Which side of the extruded strip: -0.5 or 0.5. */\nin float side;\n\nfloat resolveStemHalfWidth(float arrowSize) {\n if (uStem) {\n return arrowSize * 0.5;\n } else {\n // The negative sign hides stem geometry; the magnitude remains\n // available for open-head thickness.\n return -arrowSize * 0.5;\n }\n}\n\nfloat resolveHeadHalfWidth(float arrowSize) {\n float headWidth = uHeadWidth * arrowSize;\n return max(headWidth, 0.0) * 0.5;\n}\n\n// Width along the arrow axis needed by one repeated head, including stroke.\nfloat headRepeatFootprintLength(\n float halfWidth,\n float rHeadSlope,\n float headStrokeWidth,\n float halfStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n float headStrokeLength = headStrokeWidth / length(vec2(rHeadSlope, 1.0));\n return headAxisLength + headStrokeLength + halfStrokeWidth * 2.0;\n}\n\n// Distance from the head tip to its centerline notch/join point.\nfloat headNotchOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (headHalfWidth <= 0.0) {\n return 0.0;\n }\n\n float headAxisLength = headHalfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, headHalfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(headHalfWidth, -headAxisLength));\n vec2 topInner = topOuter + normalOffset;\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\n// Distance from the arrow tip to where the stem outer edge meets a filled\n// triangle head's notch edge. This is the effective occupied head length for\n// deciding when a short inside arrow needs to blunt its head angle.\nfloat triangleHeadStemJoinLength(\n float stemHalfWidth,\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope\n) {\n float clampedRHeadNotchSlope = min(rHeadNotchSlope, rHeadSlope);\n return headHalfWidth * rHeadSlope\n - (headHalfWidth - stemHalfWidth) * clampedRHeadNotchSlope;\n}\n\n// Blunt non-repeated heads toward 90 degrees to preserve visible stem length.\nfloat effectiveHeadSlope(\n float halfLength,\n float headHalfWidth,\n float stemHalfWidth,\n float configuredRHeadSlope,\n float configuredRHeadNotchSlope,\n bool headRepeat\n) {\n if (\n headRepeat ||\n stemHalfWidth < 0.0\n ) {\n return configuredRHeadSlope;\n }\n\n if (uHeadPlacement == HEAD_PLACEMENT_OUTSIDE) {\n if (!uStartNotch || stemHalfWidth <= 0.0) {\n return configuredRHeadSlope;\n }\n\n // Outside heads start at the encoded endpoint. The preserved length is\n // therefore the encoded arrow length minus the start notch depth.\n float maxStartNotchLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n return min(\n configuredRHeadSlope,\n maxStartNotchLength / stemHalfWidth\n );\n }\n\n if (uHeadShape != HEAD_SHAPE_TRIANGLE) {\n return configuredRHeadSlope;\n }\n\n float maxJoinLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n float configuredJoinLength = triangleHeadStemJoinLength(\n stemHalfWidth,\n headHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope\n );\n\n if (configuredJoinLength <= maxJoinLength) {\n return configuredRHeadSlope;\n }\n\n float boundaryJoinLength = stemHalfWidth * configuredRHeadNotchSlope;\n if (maxJoinLength < boundaryJoinLength) {\n return stemHalfWidth > 0.0\n ? clamp(maxJoinLength / stemHalfWidth, 0.0, configuredRHeadSlope)\n : 0.0;\n } else {\n return clamp(\n (\n maxJoinLength +\n (headHalfWidth - stemHalfWidth) * configuredRHeadNotchSlope\n ) / headHalfWidth,\n 0.0,\n configuredRHeadSlope\n );\n }\n}\n\n// Outside placement extends the vertex quad so the head can protrude past the\n// encoded interval while its notch/join point stays on the endpoint.\nfloat getOutsideHeadOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (uHeadPlacement != HEAD_PLACEMENT_OUTSIDE) {\n return 0.0;\n }\n\n return headNotchOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n}\n\nvec2 getOutsideHeadExpansion(float outsideHeadOffset, float direction) {\n // Expansion is stored as negative/positive arrow-axis growth. In the\n // canonical reverse direction, the head is on the negative side.\n return direction == DIRECTION_REVERSE\n ? vec2(outsideHeadOffset, 0.0)\n : vec2(0.0, outsideHeadOffset);\n}\n\nvoid main(void) {\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n float direction = getScaled_direction();\n\n vec2 segmentInPixels = (b - a) * uViewportSize;\n float segmentLength = length(segmentInPixels);\n if (segmentLength <= 0.0) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * uViewOpacity;\n vHalfStrokeWidth = strokeWidth / 2.0;\n\n float arrowSize = max(getScaled_size(), uMinSize);\n float headHalfWidth = resolveHeadHalfWidth(arrowSize);\n float stemHalfWidth = resolveStemHalfWidth(arrowSize);\n float physicalStemHalfWidth = abs(stemHalfWidth);\n float headStrokeWidth = uHeadShape == HEAD_SHAPE_OPEN\n ? physicalStemHalfWidth * 2.0\n : 0.0;\n float configuredRHeadSlope = 1.0 / uHeadSlope;\n float configuredRHeadNotchSlope = 1.0 / uHeadNotchSlope;\n float rHeadSlope = effectiveHeadSlope(\n segmentLength * 0.5,\n headHalfWidth,\n stemHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope,\n uHeadSpacing >= 0.0\n );\n float rHeadNotchSlope = uHeadShape == HEAD_SHAPE_OPEN\n ? rHeadSlope\n : min(configuredRHeadNotchSlope, rHeadSlope);\n\n // Grow only the head side of the vertex quad for outside placement.\n float outsideHeadOffset = getOutsideHeadOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n vec2 outsideHeadExpansion = getOutsideHeadExpansion(\n outsideHeadOffset,\n direction\n );\n\n float aaPadding = 1.0 / uDevicePixelRatio;\n float stripHalfWidth = max(headHalfWidth, physicalStemHalfWidth)\n + vHalfStrokeWidth\n + aaPadding;\n\n float reverseExpansion = outsideHeadExpansion.x;\n float forwardExpansion = outsideHeadExpansion.y;\n float geometryStart = -segmentLength * 0.5 - reverseExpansion;\n float geometryEnd = segmentLength * 0.5 + forwardExpansion;\n float geometryCenter = (geometryStart + geometryEnd) * 0.5;\n float geometryHalfLength = (geometryEnd - geometryStart) * 0.5;\n\n // The SDF geometry still uses the encoded arrow length, but the vertex\n // strip needs room for stroke and antialiasing beyond both endpoints.\n float axisPadding = vHalfStrokeWidth + aaPadding;\n float drawStart = geometryStart - axisPadding;\n float drawEnd = geometryEnd + axisPadding;\n float localAxisPosition = mix(drawStart, drawEnd, pos);\n float localX = localAxisPosition - geometryCenter;\n float localY = side * stripHalfWidth * 2.0;\n\n vec2 tangentInPixels = segmentInPixels / segmentLength;\n vec2 normalInPixels = vec2(-tangentInPixels.y, tangentInPixels.x);\n vec2 segmentCenter = (a + b) * 0.5;\n vec2 p = segmentCenter\n + (tangentInPixels * localAxisPosition + normalInPixels * localY)\n / uViewportSize;\n\n vPosInPixels = vec2(localX, localY);\n vArrowHalfLengthInPixels = geometryHalfLength;\n\n // These flat varyings are per-arrow geometry constants used by the fragment\n // SDF. Keeping them here avoids repeating this math per fragment.\n vHeadHalfWidth = headHalfWidth;\n vStemHalfWidth = stemHalfWidth;\n vHeadStrokeWidth = headStrokeWidth;\n vRHeadSlope = rHeadSlope;\n vRHeadNotchSlope = rHeadNotchSlope;\n vRStartNotchSlope = uStartNotch ? vRHeadSlope : 0.0;\n vDirection = direction;\n vHeadRepeatFootprintLength = headRepeatFootprintLength(\n vHeadHalfWidth,\n vRHeadSlope,\n vHeadStrokeWidth,\n vHalfStrokeWidth\n );\n vHeadSpacing = uHeadSpacing >= 0.0 ? uHeadSpacing * arrowSize : -1.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n\n gl_Position = unitToNdc(p);\n\n float fillOpacity = getScaled_fillOpacity() * uViewOpacity;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", rc = "in vec2 vPosInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in float vArrowHalfLengthInPixels;\nflat in float vHeadHalfWidth;\nflat in float vStemHalfWidth;\nflat in float vHeadStrokeWidth;\nflat in float vRHeadSlope;\nflat in float vRHeadNotchSlope;\nflat in float vRStartNotchSlope;\nflat in float vHeadRepeatFootprintLength;\nflat in float vHeadSpacing;\nflat in float vDirection;\n\nout lowp vec4 fragColor;\n\nconst int N = 6;\nconst float FAR_OUTSIDE = 1e20;\n\n// Adapted from: https://iquilezles.org/articles/distfunctions2d/\nfloat sdPolygon(vec2[N] v, vec2 p) {\n float d = dot(p-v[0],p-v[0]);\n float s = 1.0;\n for( int i=0, j=N-1; i<N; j=i, i++ ) {\n vec2 e = v[j] - v[i];\n vec2 w = p - v[i];\n vec2 b = w - e*clamp( dot(w,e)/dot(e,e), 0.0, 1.0 );\n d = min( d, dot(b,b) );\n bvec3 c = bvec3(p.y>=v[i].y,p.y<v[j].y,e.x*w.y>e.y*w.x);\n if( all(c) || all(not(c)) ) s*=-1.0; \n }\n return s*sqrt(d);\n}\n\nfloat sdStem(\n vec2 p,\n float halfLength,\n float halfWidth,\n float rHeadSlope,\n float rStartNotchSlope\n) {\n if (halfWidth < 0.0) {\n return FAR_OUTSIDE;\n }\n\n float headSideLength = halfWidth * rHeadSlope;\n float startNotchLength = halfWidth * rStartNotchSlope;\n vec2 vertices[6] = vec2[6](\n vec2(-halfLength, 0.0),\n vec2(-halfLength + headSideLength, halfWidth),\n vec2(halfLength, halfWidth),\n vec2(halfLength - startNotchLength, 0.0),\n vec2(halfLength, -halfWidth),\n vec2(-halfLength + headSideLength, -halfWidth)\n );\n\n return sdPolygon(vertices, p);\n}\n\n// Inner corner of an open head, offset perpendicular to the outer edge.\nvec2 headInnerCorner(float halfWidth, float rHeadSlope, float headStrokeWidth) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(halfWidth, -headAxisLength));\n return topOuter + normalOffset;\n}\n\n// X coordinate where the arrowhead notch edge crosses the centerline.\nfloat headNotchX(\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\nfloat sdArrowHead(\n vec2 p,\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 bottomOuter = vec2(headAxisLength, -halfWidth);\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n vec2 normalOffset = topInner - topOuter;\n vec2 bottomInner = bottomOuter + vec2(normalOffset.x, -normalOffset.y);\n float notchX = headNotchX(\n halfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n\n vec2 vertices[6] = vec2[6](\n vec2(0.0, 0.0),\n topOuter,\n topInner,\n vec2(notchX, 0.0),\n bottomInner,\n bottomOuter\n );\n\n return sdPolygon(vertices, p);\n}\n\nfloat repeat(float x, float spacing) {\n return x >= spacing ? x - floor(x / spacing) * spacing : x;\n}\n\nfloat sdArrow(vec2 arrowPos, float arrowHalfLength) {\n float stemDistance = sdStem(\n arrowPos,\n arrowHalfLength,\n vStemHalfWidth,\n vRHeadSlope,\n vRStartNotchSlope\n );\n\n bool headRepeat = vHeadSpacing >= 0.0;\n float spacing = headRepeat\n ? max(vHeadSpacing, vHeadRepeatFootprintLength)\n : 1.0 / 0.0;\n float distanceFromStart = arrowPos.x + arrowHalfLength;\n\n // Keep the stroked tip inside the repeated head's local window.\n float arrowHeadX = repeat(\n distanceFromStart + vHalfStrokeWidth,\n spacing\n ) - vHalfStrokeWidth;\n\n float headDistance = sdArrowHead(\n vec2(arrowHeadX, arrowPos.y),\n vHeadHalfWidth,\n vRHeadSlope,\n vRHeadNotchSlope,\n vHeadStrokeWidth\n );\n\n if (headRepeat) {\n // Cull heads that would be partially clipped.\n float headTipDistance = distanceFromStart - arrowHeadX;\n float headEndDistance = headTipDistance\n + vHeadRepeatFootprintLength\n - vHalfStrokeWidth;\n\n if (headTipDistance > 0.0 && headEndDistance > arrowHalfLength * 2.0) {\n headDistance = FAR_OUTSIDE;\n }\n }\n\n return min(stemDistance, headDistance);\n}\n\nvoid main(void) {\n vec2 arrowPos = vPosInPixels;\n if (vDirection == DIRECTION_FORWARD) {\n arrowPos.x = -arrowPos.x;\n }\n float d = sdArrow(arrowPos, vArrowHalfLengthInPixels);\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n vec4(0.0),\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n}\n", ic = "layout(std140) uniform Mark {\n uniform int uHeadShape;\n\n uniform float uHeadSlope;\n uniform float uHeadNotchSlope;\n\n uniform float uMinSize;\n uniform float uHeadWidth;\n uniform bool uStartNotch;\n uniform float uMinStemLength;\n uniform float uHeadSpacing;\n uniform bool uStem;\n\n uniform int uHeadPlacement;\n\n#pragma markUniforms\n};\n\nconst float DIRECTION_FORWARD = 0.0;\nconst float DIRECTION_REVERSE = 1.0;\n\nconst int HEAD_SHAPE_TRIANGLE = 0;\nconst int HEAD_SHAPE_OPEN = 1;\n\nconst int HEAD_PLACEMENT_INSIDE = 0;\nconst int HEAD_PLACEMENT_OUTSIDE = 1;\n\n// Arrow space uses x for arrow length and y for width perpendicular to it.\n// Negative x points toward the arrowhead in the canonical \"reverse\" direction.\n", ac = 1e4, oc = class {
|
|
2778
|
+
var ac = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out float vArrowHalfLengthInPixels;\nflat out float vHeadHalfWidth;\nflat out float vStemHalfWidth;\nflat out float vHeadStrokeWidth;\nflat out float vRHeadSlope;\nflat out float vRHeadNotchSlope;\nflat out float vRStartNotchSlope;\nflat out float vHeadRepeatFootprintLength;\nflat out float vHeadSpacing;\nflat out float vDirection;\n\nout vec2 vPosInPixels;\n\n/** Position along the arrow centerline. */\nin float pos;\n\n/** Which side of the extruded strip: -0.5 or 0.5. */\nin float side;\n\nfloat resolveStemHalfWidth(float arrowSize) {\n if (uStem) {\n return arrowSize * 0.5;\n } else {\n // The negative sign hides stem geometry; the magnitude remains\n // available for open-head thickness.\n return -arrowSize * 0.5;\n }\n}\n\nfloat resolveHeadHalfWidth(float arrowSize) {\n float headWidth = uHeadWidth * arrowSize;\n return max(headWidth, 0.0) * 0.5;\n}\n\n// Width along the arrow axis needed by one repeated head, including stroke.\nfloat headRepeatFootprintLength(\n float halfWidth,\n float rHeadSlope,\n float headStrokeWidth,\n float halfStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n float headStrokeLength = headStrokeWidth / length(vec2(rHeadSlope, 1.0));\n return headAxisLength + headStrokeLength + halfStrokeWidth * 2.0;\n}\n\n// Distance from the head tip to its centerline notch/join point.\nfloat headNotchOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (headHalfWidth <= 0.0) {\n return 0.0;\n }\n\n float headAxisLength = headHalfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, headHalfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(headHalfWidth, -headAxisLength));\n vec2 topInner = topOuter + normalOffset;\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\n// Distance from the arrow tip to where the stem outer edge meets a filled\n// triangle head's notch edge. This is the effective occupied head length for\n// deciding when a short inside arrow needs to blunt its head angle.\nfloat triangleHeadStemJoinLength(\n float stemHalfWidth,\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope\n) {\n float clampedRHeadNotchSlope = min(rHeadNotchSlope, rHeadSlope);\n return headHalfWidth * rHeadSlope\n - (headHalfWidth - stemHalfWidth) * clampedRHeadNotchSlope;\n}\n\n// Blunt non-repeated heads toward 90 degrees to preserve visible stem length.\nfloat effectiveHeadSlope(\n float halfLength,\n float headHalfWidth,\n float stemHalfWidth,\n float configuredRHeadSlope,\n float configuredRHeadNotchSlope,\n bool headRepeat\n) {\n if (\n headRepeat ||\n stemHalfWidth < 0.0\n ) {\n return configuredRHeadSlope;\n }\n\n if (uHeadPlacement == HEAD_PLACEMENT_OUTSIDE) {\n if (!uStartNotch || stemHalfWidth <= 0.0) {\n return configuredRHeadSlope;\n }\n\n // Outside heads start at the encoded endpoint. The preserved length is\n // therefore the encoded arrow length minus the start notch depth.\n float maxStartNotchLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n return min(\n configuredRHeadSlope,\n maxStartNotchLength / stemHalfWidth\n );\n }\n\n if (uHeadShape != HEAD_SHAPE_TRIANGLE) {\n return configuredRHeadSlope;\n }\n\n float maxJoinLength = max(\n halfLength * 2.0 - uMinStemLength,\n 0.0\n );\n float configuredJoinLength = triangleHeadStemJoinLength(\n stemHalfWidth,\n headHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope\n );\n\n if (configuredJoinLength <= maxJoinLength) {\n return configuredRHeadSlope;\n }\n\n float boundaryJoinLength = stemHalfWidth * configuredRHeadNotchSlope;\n if (maxJoinLength < boundaryJoinLength) {\n return stemHalfWidth > 0.0\n ? clamp(maxJoinLength / stemHalfWidth, 0.0, configuredRHeadSlope)\n : 0.0;\n } else {\n return clamp(\n (\n maxJoinLength +\n (headHalfWidth - stemHalfWidth) * configuredRHeadNotchSlope\n ) / headHalfWidth,\n 0.0,\n configuredRHeadSlope\n );\n }\n}\n\n// Outside placement extends the vertex quad so the head can protrude past the\n// encoded interval while its notch/join point stays on the endpoint.\nfloat getOutsideHeadOffset(\n float headHalfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n if (uHeadPlacement != HEAD_PLACEMENT_OUTSIDE) {\n return 0.0;\n }\n\n return headNotchOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n}\n\nvec2 getOutsideHeadExpansion(float outsideHeadOffset, float direction) {\n // Expansion is stored as negative/positive arrow-axis growth. In the\n // canonical reverse direction, the head is on the negative side.\n return direction == DIRECTION_REVERSE\n ? vec2(outsideHeadOffset, 0.0)\n : vec2(0.0, outsideHeadOffset);\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n float direction = getScaled_direction();\n\n vec2 segmentInPixels = (b - a) * uViewportSize;\n float segmentLength = length(segmentInPixels);\n if (segmentLength <= 0.0) {\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * uViewOpacity;\n vHalfStrokeWidth = strokeWidth / 2.0;\n\n float arrowSize = max(getScaled_size(), uMinSize);\n float headHalfWidth = resolveHeadHalfWidth(arrowSize);\n float stemHalfWidth = resolveStemHalfWidth(arrowSize);\n float physicalStemHalfWidth = abs(stemHalfWidth);\n float headStrokeWidth = uHeadShape == HEAD_SHAPE_OPEN\n ? physicalStemHalfWidth * 2.0\n : 0.0;\n float configuredRHeadSlope = 1.0 / uHeadSlope;\n float configuredRHeadNotchSlope = 1.0 / uHeadNotchSlope;\n float rHeadSlope = effectiveHeadSlope(\n segmentLength * 0.5,\n headHalfWidth,\n stemHalfWidth,\n configuredRHeadSlope,\n configuredRHeadNotchSlope,\n uHeadSpacing >= 0.0\n );\n float rHeadNotchSlope = uHeadShape == HEAD_SHAPE_OPEN\n ? rHeadSlope\n : min(configuredRHeadNotchSlope, rHeadSlope);\n\n // Grow only the head side of the vertex quad for outside placement.\n float outsideHeadOffset = getOutsideHeadOffset(\n headHalfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n vec2 outsideHeadExpansion = getOutsideHeadExpansion(\n outsideHeadOffset,\n direction\n );\n\n float aaPadding = 1.0 / uDevicePixelRatio;\n float stripHalfWidth = max(headHalfWidth, physicalStemHalfWidth)\n + vHalfStrokeWidth\n + aaPadding;\n\n float reverseExpansion = outsideHeadExpansion.x;\n float forwardExpansion = outsideHeadExpansion.y;\n float geometryStart = -segmentLength * 0.5 - reverseExpansion;\n float geometryEnd = segmentLength * 0.5 + forwardExpansion;\n float geometryCenter = (geometryStart + geometryEnd) * 0.5;\n float geometryHalfLength = (geometryEnd - geometryStart) * 0.5;\n\n // The SDF geometry still uses the encoded arrow length, but the vertex\n // strip needs room for stroke and antialiasing beyond both endpoints.\n float axisPadding = vHalfStrokeWidth + aaPadding;\n float drawStart = geometryStart - axisPadding;\n float drawEnd = geometryEnd + axisPadding;\n float localAxisPosition = mix(drawStart, drawEnd, pos);\n float localX = localAxisPosition - geometryCenter;\n float localY = side * stripHalfWidth * 2.0;\n\n vec2 tangentInPixels = segmentInPixels / segmentLength;\n vec2 normalInPixels = vec2(-tangentInPixels.y, tangentInPixels.x);\n vec2 segmentCenter = (a + b) * 0.5;\n vec2 p = segmentCenter\n + (tangentInPixels * localAxisPosition + normalInPixels * localY)\n / uViewportSize;\n\n vPosInPixels = vec2(localX, localY);\n vArrowHalfLengthInPixels = geometryHalfLength;\n\n // These flat varyings are per-arrow geometry constants used by the fragment\n // SDF. Keeping them here avoids repeating this math per fragment.\n vHeadHalfWidth = headHalfWidth;\n vStemHalfWidth = stemHalfWidth;\n vHeadStrokeWidth = headStrokeWidth;\n vRHeadSlope = rHeadSlope;\n vRHeadNotchSlope = rHeadNotchSlope;\n vRStartNotchSlope = uStartNotch ? vRHeadSlope : 0.0;\n vDirection = direction;\n vHeadRepeatFootprintLength = headRepeatFootprintLength(\n vHeadHalfWidth,\n vRHeadSlope,\n vHeadStrokeWidth,\n vHalfStrokeWidth\n );\n vHeadSpacing = uHeadSpacing >= 0.0 ? uHeadSpacing * arrowSize : -1.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n\n gl_Position = unitToNdc(p);\n\n float fillOpacity = getScaled_fillOpacity() * uViewOpacity;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", oc = "in vec2 vPosInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in float vArrowHalfLengthInPixels;\nflat in float vHeadHalfWidth;\nflat in float vStemHalfWidth;\nflat in float vHeadStrokeWidth;\nflat in float vRHeadSlope;\nflat in float vRHeadNotchSlope;\nflat in float vRStartNotchSlope;\nflat in float vHeadRepeatFootprintLength;\nflat in float vHeadSpacing;\nflat in float vDirection;\n\nout lowp vec4 fragColor;\n\nconst int N = 6;\nconst float FAR_OUTSIDE = 1e20;\n\n// Adapted from: https://iquilezles.org/articles/distfunctions2d/\nfloat sdPolygon(vec2[N] v, vec2 p) {\n float d = dot(p-v[0],p-v[0]);\n float s = 1.0;\n for( int i=0, j=N-1; i<N; j=i, i++ ) {\n vec2 e = v[j] - v[i];\n vec2 w = p - v[i];\n vec2 b = w - e*clamp( dot(w,e)/dot(e,e), 0.0, 1.0 );\n d = min( d, dot(b,b) );\n bvec3 c = bvec3(p.y>=v[i].y,p.y<v[j].y,e.x*w.y>e.y*w.x);\n if( all(c) || all(not(c)) ) s*=-1.0; \n }\n return s*sqrt(d);\n}\n\nfloat sdStem(\n vec2 p,\n float halfLength,\n float halfWidth,\n float rHeadSlope,\n float rStartNotchSlope\n) {\n if (halfWidth < 0.0) {\n return FAR_OUTSIDE;\n }\n\n float headSideLength = halfWidth * rHeadSlope;\n float startNotchLength = halfWidth * rStartNotchSlope;\n vec2 vertices[6] = vec2[6](\n vec2(-halfLength, 0.0),\n vec2(-halfLength + headSideLength, halfWidth),\n vec2(halfLength, halfWidth),\n vec2(halfLength - startNotchLength, 0.0),\n vec2(halfLength, -halfWidth),\n vec2(-halfLength + headSideLength, -halfWidth)\n );\n\n return sdPolygon(vertices, p);\n}\n\n// Inner corner of an open head, offset perpendicular to the outer edge.\nvec2 headInnerCorner(float halfWidth, float rHeadSlope, float headStrokeWidth) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 normalOffset = headStrokeWidth\n * normalize(vec2(halfWidth, -headAxisLength));\n return topOuter + normalOffset;\n}\n\n// X coordinate where the arrowhead notch edge crosses the centerline.\nfloat headNotchX(\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n return topInner.x - topInner.y * rHeadNotchSlope;\n}\n\nfloat sdArrowHead(\n vec2 p,\n float halfWidth,\n float rHeadSlope,\n float rHeadNotchSlope,\n float headStrokeWidth\n) {\n float headAxisLength = halfWidth * rHeadSlope;\n vec2 topOuter = vec2(headAxisLength, halfWidth);\n vec2 bottomOuter = vec2(headAxisLength, -halfWidth);\n vec2 topInner = headInnerCorner(halfWidth, rHeadSlope, headStrokeWidth);\n vec2 normalOffset = topInner - topOuter;\n vec2 bottomInner = bottomOuter + vec2(normalOffset.x, -normalOffset.y);\n float notchX = headNotchX(\n halfWidth,\n rHeadSlope,\n rHeadNotchSlope,\n headStrokeWidth\n );\n\n vec2 vertices[6] = vec2[6](\n vec2(0.0, 0.0),\n topOuter,\n topInner,\n vec2(notchX, 0.0),\n bottomInner,\n bottomOuter\n );\n\n return sdPolygon(vertices, p);\n}\n\nfloat repeat(float x, float spacing) {\n return x >= spacing ? x - floor(x / spacing) * spacing : x;\n}\n\nfloat sdArrow(vec2 arrowPos, float arrowHalfLength) {\n float stemDistance = sdStem(\n arrowPos,\n arrowHalfLength,\n vStemHalfWidth,\n vRHeadSlope,\n vRStartNotchSlope\n );\n\n bool headRepeat = vHeadSpacing >= 0.0;\n float spacing = headRepeat\n ? max(vHeadSpacing, vHeadRepeatFootprintLength)\n : 1.0 / 0.0;\n float distanceFromStart = arrowPos.x + arrowHalfLength;\n\n // Keep the stroked tip inside the repeated head's local window.\n float arrowHeadX = repeat(\n distanceFromStart + vHalfStrokeWidth,\n spacing\n ) - vHalfStrokeWidth;\n\n float headDistance = sdArrowHead(\n vec2(arrowHeadX, arrowPos.y),\n vHeadHalfWidth,\n vRHeadSlope,\n vRHeadNotchSlope,\n vHeadStrokeWidth\n );\n\n if (headRepeat) {\n // Cull heads that would be partially clipped.\n float headTipDistance = distanceFromStart - arrowHeadX;\n float headEndDistance = headTipDistance\n + vHeadRepeatFootprintLength\n - vHalfStrokeWidth;\n\n if (headTipDistance > 0.0 && headEndDistance > arrowHalfLength * 2.0) {\n headDistance = FAR_OUTSIDE;\n }\n }\n\n return min(stemDistance, headDistance);\n}\n\nvoid main(void) {\n vec2 arrowPos = vPosInPixels;\n if (vDirection == DIRECTION_FORWARD) {\n arrowPos.x = -arrowPos.x;\n }\n float d = sdArrow(arrowPos, vArrowHalfLengthInPixels);\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n vec4(0.0),\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n}\n", sc = "layout(std140) uniform Mark {\n uniform int uHeadShape;\n\n uniform float uHeadSlope;\n uniform float uHeadNotchSlope;\n\n uniform float uMinSize;\n uniform float uHeadWidth;\n uniform bool uStartNotch;\n uniform float uMinStemLength;\n uniform float uHeadSpacing;\n uniform bool uStem;\n\n uniform int uHeadPlacement;\n\n#pragma markUniforms\n};\n\nconst float DIRECTION_FORWARD = 0.0;\nconst float DIRECTION_REVERSE = 1.0;\n\nconst int HEAD_SHAPE_TRIANGLE = 0;\nconst int HEAD_SHAPE_OPEN = 1;\n\nconst int HEAD_PLACEMENT_INSIDE = 0;\nconst int HEAD_PLACEMENT_OUTSIDE = 1;\n\n// Arrow space uses x for arrow length and y for width perpendicular to it.\n// Negative x points toward the arrowhead in the canonical \"reverse\" direction.\n", cc = 1e4, lc = class {
|
|
2763
2779
|
#e = !1;
|
|
2764
2780
|
constructor(e) {
|
|
2765
2781
|
this.size = e, this.arrays = {}, this.pushers = [], this.dataUpdaters = [], this.vertexCount = 0;
|
|
@@ -2773,16 +2789,16 @@ var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat
|
|
|
2773
2789
|
this.dataUpdaters.push((t.arrayReference, (e) => n(r(e))));
|
|
2774
2790
|
}
|
|
2775
2791
|
createUpdater(e, t, n = Float32Array, r = void 0) {
|
|
2776
|
-
if (!
|
|
2777
|
-
let a, o
|
|
2792
|
+
if (!C(this.size)) throw Error("The number of vertices must be defined!");
|
|
2793
|
+
let i, a, o = 0, s = new n(this.size * t);
|
|
2778
2794
|
if (this.arrays[e] = {
|
|
2779
|
-
data:
|
|
2795
|
+
data: s,
|
|
2780
2796
|
numComponents: t
|
|
2781
2797
|
}, t == 1) {
|
|
2782
2798
|
let e = 0;
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
},
|
|
2799
|
+
i = () => {
|
|
2800
|
+
s[o++] = e;
|
|
2801
|
+
}, a = (t) => {
|
|
2786
2802
|
e = +t;
|
|
2787
2803
|
};
|
|
2788
2804
|
} else {
|
|
@@ -2792,24 +2808,24 @@ var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat
|
|
|
2792
2808
|
switch (t) {
|
|
2793
2809
|
case 1: break;
|
|
2794
2810
|
case 2:
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
},
|
|
2811
|
+
i = () => {
|
|
2812
|
+
s[o++] = e[0], s[o++] = e[1];
|
|
2813
|
+
}, a = n;
|
|
2798
2814
|
break;
|
|
2799
2815
|
case 3:
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
},
|
|
2816
|
+
i = () => {
|
|
2817
|
+
s[o++] = e[0], s[o++] = e[1], s[o++] = e[2];
|
|
2818
|
+
}, a = n;
|
|
2803
2819
|
break;
|
|
2804
2820
|
case 4:
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
},
|
|
2821
|
+
i = () => {
|
|
2822
|
+
s[o++] = e[0], s[o++] = e[1], s[o++] = e[2], s[o++] = e[3];
|
|
2823
|
+
}, a = n;
|
|
2808
2824
|
break;
|
|
2809
2825
|
default: throw Error("Invalid numComponents: " + t);
|
|
2810
2826
|
}
|
|
2811
2827
|
}
|
|
2812
|
-
return this.pushers.push(
|
|
2828
|
+
return this.pushers.push(i), a;
|
|
2813
2829
|
}
|
|
2814
2830
|
pushAll() {
|
|
2815
2831
|
throw Error("Call configure() first!");
|
|
@@ -2818,7 +2834,7 @@ var nc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat
|
|
|
2818
2834
|
throw Error("Call configure() first!");
|
|
2819
2835
|
}
|
|
2820
2836
|
#t() {
|
|
2821
|
-
if (this.size >
|
|
2837
|
+
if (this.size > cc) {
|
|
2822
2838
|
let e = this.pushers.map((e, t) => `const p${t} = that.pushers[${t}];`).join("\n"), t = this.pushers.map((e, t) => ` p${t}();`).join("\n");
|
|
2823
2839
|
this.pushAll = Function("that", `${e}
|
|
2824
2840
|
return function unrolledPushAll() {
|
|
@@ -2831,7 +2847,7 @@ ${t}
|
|
|
2831
2847
|
};
|
|
2832
2848
|
}
|
|
2833
2849
|
#n() {
|
|
2834
|
-
if (this.size >
|
|
2850
|
+
if (this.size > cc) {
|
|
2835
2851
|
let e = this.dataUpdaters.map((e, t) => `const u${t} = that.dataUpdaters[${t}];`).join("\n"), t = this.dataUpdaters.map((e, t) => ` u${t}(datum);`).join("\n");
|
|
2836
2852
|
this.updateFromDatum = Function("that", "datum", `${e}
|
|
2837
2853
|
return function unrolledUpdateFromDatum(datum) {
|
|
@@ -2844,70 +2860,70 @@ ${t}
|
|
|
2844
2860
|
pushFromDatum(e) {
|
|
2845
2861
|
this.updateFromDatum(e), this.pushAll();
|
|
2846
2862
|
}
|
|
2847
|
-
},
|
|
2848
|
-
function
|
|
2863
|
+
}, uc = 2 ** 31 - 1, dc = -(2 ** 31);
|
|
2864
|
+
function fc(e, t, n, r = n, i = 0, a = i) {
|
|
2849
2865
|
if (a <= i || t[1] <= t[0]) return;
|
|
2850
2866
|
let o = n === r, s = Array(e);
|
|
2851
|
-
s.fill(
|
|
2852
|
-
let
|
|
2853
|
-
|
|
2854
|
-
let
|
|
2855
|
-
let r = (t -
|
|
2856
|
-
return
|
|
2857
|
-
},
|
|
2858
|
-
let r =
|
|
2867
|
+
s.fill(uc);
|
|
2868
|
+
let c = Array(e);
|
|
2869
|
+
c.fill(0);
|
|
2870
|
+
let l = t[0], u = (t[1] - t[0]) / e, d = (t, n) => {
|
|
2871
|
+
let r = (t - l) / u, i = Math.floor(r);
|
|
2872
|
+
return h(n && i == r ? i - 1 : i, 0, e - 1);
|
|
2873
|
+
}, f = dc, p = -Infinity, m = !1, g = (e, t, n = [0, 0]) => {
|
|
2874
|
+
let r = d(e, !1), i = d(t, !0), a = s[r], o = Math.max(c[i], a);
|
|
2859
2875
|
return n[0] = a, n[1] = o, n;
|
|
2860
2876
|
};
|
|
2861
2877
|
for (let e = i; e < a;) {
|
|
2862
|
-
let t = e, i = n(e),
|
|
2863
|
-
for (e += 1; e < a && n(e) === i && r(e) ===
|
|
2864
|
-
if (t >
|
|
2878
|
+
let t = e, i = n(e), l = r(e);
|
|
2879
|
+
for (e += 1; e < a && n(e) === i && r(e) === l;) e += 1;
|
|
2880
|
+
if (t > f) f = t;
|
|
2865
2881
|
else {
|
|
2866
|
-
|
|
2882
|
+
m = !0;
|
|
2867
2883
|
break;
|
|
2868
2884
|
}
|
|
2869
|
-
if (i <
|
|
2870
|
-
|
|
2885
|
+
if (i < p || !o && l < i) {
|
|
2886
|
+
m = !0;
|
|
2871
2887
|
break;
|
|
2872
2888
|
}
|
|
2873
|
-
|
|
2874
|
-
let u =
|
|
2875
|
-
for (let n = u; n <=
|
|
2889
|
+
p = i;
|
|
2890
|
+
let u = d(i, !1), h = o ? u : d(l, !0);
|
|
2891
|
+
for (let n = u; n <= h; n++) s[n] > t && (s[n] = t), c[n] < e && (c[n] = e);
|
|
2876
2892
|
}
|
|
2877
|
-
if (
|
|
2878
|
-
for (let e = 1; e <
|
|
2893
|
+
if (m) return;
|
|
2894
|
+
for (let e = 1; e < c.length; e++) c[e] < c[e - 1] && (c[e] = c[e - 1]);
|
|
2879
2895
|
let _ = !0;
|
|
2880
|
-
for (let e = s.length - 1; e > 0; e--) _ && s[e] ==
|
|
2896
|
+
for (let e = s.length - 1; e > 0; e--) _ && s[e] == uc ? (s[e] = c[e], _ = !1) : s[e - 1] > s[e] && (s[e - 1] = s[e]);
|
|
2881
2897
|
return g;
|
|
2882
2898
|
}
|
|
2883
2899
|
//#endregion
|
|
2884
2900
|
//#region ../core/src/rendering/webgl/gl/dataToVertices.js
|
|
2885
|
-
var
|
|
2901
|
+
var pc = class {
|
|
2886
2902
|
constructor({ encoders: e, numVertices: t = void 0, attributes: n = [] }) {
|
|
2887
2903
|
this.encoders = e, this.variableEncoders = Object.fromEntries(Object.entries(e).filter(([e, t]) => n.includes(e) && t && !t.constant));
|
|
2888
|
-
let r = [...
|
|
2889
|
-
this.allocatedVertices = t, this.variableBuilder = new
|
|
2904
|
+
let r = [...ks(e).entries()].filter(([e, t]) => e[1] && t.length > 1).map(([e, t]) => t);
|
|
2905
|
+
this.allocatedVertices = t, this.variableBuilder = new lc(t), this.attributeNames = {};
|
|
2890
2906
|
for (let [e, t] of Object.entries(this.variableEncoders)) {
|
|
2891
|
-
let n =
|
|
2907
|
+
let n = f(t);
|
|
2892
2908
|
if (!n) continue;
|
|
2893
|
-
let i = r.find((t) => t.find((t) => t == e)), a = n.asNumberAccessor(), o = t.scale, { largeHp: s, arrayConstructor: c, discrete: l, numComponents: u } =
|
|
2894
|
-
if (o && l) if ("props" in o && o.props.domainIndexer)
|
|
2895
|
-
else if ("domain" in o)
|
|
2909
|
+
let i = r.find((t) => t.find((t) => t == e)), a = n.asNumberAccessor(), o = t.scale, { largeHp: s, arrayConstructor: c, discrete: l, numComponents: u } = ws(o, e), d = [0, 0], p;
|
|
2910
|
+
if (o && l) if ("props" in o && o.props.domainIndexer) p = o.props.domainIndexer;
|
|
2911
|
+
else if ("domain" in o) p = _e(), p.addAll(o.domain());
|
|
2896
2912
|
else throw Error("Missing domain indexer for discrete scale.");
|
|
2897
|
-
let
|
|
2898
|
-
for (let t of i ?? [e]) this.attributeNames[t] =
|
|
2899
|
-
i && e != i[0] || this.variableBuilder.addConverter(
|
|
2900
|
-
f:
|
|
2913
|
+
let m = p ? (e) => p(n(e)) : s ? (e) => Es(a(e), d) : a, h = As(i ?? e);
|
|
2914
|
+
for (let t of i ?? [e]) this.attributeNames[t] = h;
|
|
2915
|
+
i && e != i[0] || this.variableBuilder.addConverter(h, {
|
|
2916
|
+
f: m,
|
|
2901
2917
|
numComponents: u,
|
|
2902
2918
|
arrayReference: s ? d : void 0,
|
|
2903
2919
|
targetArrayType: c
|
|
2904
2920
|
});
|
|
2905
2921
|
}
|
|
2906
2922
|
let i = this.variableEncoders.x, a = this.variableEncoders.x2, o = this.encoders.x?.channelDef, s = i?.scale;
|
|
2907
|
-
if (o?.buildIndex && i && s &&
|
|
2923
|
+
if (o?.buildIndex && i && s && T(s.type)) {
|
|
2908
2924
|
let e = this.attributeNames.x;
|
|
2909
2925
|
if (!e) throw Error("Missing x attribute for x indexing.");
|
|
2910
|
-
let t = a?.scale &&
|
|
2926
|
+
let t = a?.scale && T(a.scale.type) ? this.attributeNames.x2 ?? e : e;
|
|
2911
2927
|
this.xIndexConfig = {
|
|
2912
2928
|
domain: [s.domain()[0], s.domain()[1]],
|
|
2913
2929
|
xAttributeName: e,
|
|
@@ -2941,10 +2957,10 @@ var uc = class {
|
|
|
2941
2957
|
let { data: t, numComponents: n } = this.variableBuilder.arrays[e];
|
|
2942
2958
|
return n == 2 ? (e) => {
|
|
2943
2959
|
let r = e * n;
|
|
2944
|
-
return t[r] *
|
|
2960
|
+
return t[r] * Ts + t[r + 1];
|
|
2945
2961
|
} : (e) => t[e * n];
|
|
2946
2962
|
}, i = r(n.xAttributeName), a = n.x2AttributeName == n.xAttributeName ? i : r(n.x2AttributeName);
|
|
2947
|
-
return
|
|
2963
|
+
return fc(50, n.domain, i, a, e, t);
|
|
2948
2964
|
}
|
|
2949
2965
|
toArrays() {
|
|
2950
2966
|
return {
|
|
@@ -2954,7 +2970,7 @@ var uc = class {
|
|
|
2954
2970
|
rangeMap: this.rangeMap
|
|
2955
2971
|
};
|
|
2956
2972
|
}
|
|
2957
|
-
},
|
|
2973
|
+
}, mc = class extends pc {
|
|
2958
2974
|
constructor({ encoders: e, attributes: t, numItems: n }) {
|
|
2959
2975
|
super({
|
|
2960
2976
|
encoders: e,
|
|
@@ -2975,7 +2991,7 @@ var uc = class {
|
|
|
2975
2991
|
this.registerBatch(e);
|
|
2976
2992
|
}
|
|
2977
2993
|
}
|
|
2978
|
-
},
|
|
2994
|
+
}, hc = class extends pc {
|
|
2979
2995
|
constructor({ encoders: e, attributes: t, tessellationThreshold: n = Infinity, visibleRange: r = [-Infinity, Infinity], numItems: i }) {
|
|
2980
2996
|
super({
|
|
2981
2997
|
encoders: e,
|
|
@@ -2992,7 +3008,7 @@ var uc = class {
|
|
|
2992
3008
|
}
|
|
2993
3009
|
this.registerBatch(e);
|
|
2994
3010
|
}
|
|
2995
|
-
},
|
|
3011
|
+
}, gc = class extends pc {
|
|
2996
3012
|
constructor({ encoders: e, attributes: t, numItems: n = void 0 }) {
|
|
2997
3013
|
super({
|
|
2998
3014
|
encoders: e,
|
|
@@ -3007,7 +3023,7 @@ var uc = class {
|
|
|
3007
3023
|
}
|
|
3008
3024
|
this.registerBatch(e);
|
|
3009
3025
|
}
|
|
3010
|
-
},
|
|
3026
|
+
}, _c = class extends pc {
|
|
3011
3027
|
constructor({ encoders: e, attributes: t, numItems: n = void 0 }) {
|
|
3012
3028
|
super({
|
|
3013
3029
|
encoders: e,
|
|
@@ -3027,7 +3043,7 @@ var uc = class {
|
|
|
3027
3043
|
for (let t of Object.values(e)) t.divisor = 1;
|
|
3028
3044
|
return super.toArrays();
|
|
3029
3045
|
}
|
|
3030
|
-
},
|
|
3046
|
+
}, vc = class extends pc {
|
|
3031
3047
|
constructor({ encoders: e, attributes: t, fontMetrics: n, properties: r, numCharacters: i = void 0 }) {
|
|
3032
3048
|
super({
|
|
3033
3049
|
encoders: e,
|
|
@@ -3035,10 +3051,10 @@ var uc = class {
|
|
|
3035
3051
|
numVertices: i * 6
|
|
3036
3052
|
}), this.metadata = n, this.metrics = n, this.properties = r;
|
|
3037
3053
|
let a = e.text.channelDef;
|
|
3038
|
-
this.numberFormat = !
|
|
3054
|
+
this.numberFormat = !o(a) && "format" in a && a.format ? g(a.format) : (e) => e, this.updateVertexCoord = this.variableBuilder.createUpdater("vertexCoord", 2), this.updateTextureCoord = this.variableBuilder.createUpdater("textureCoord", 2), this.updateWidth = this.variableBuilder.createUpdater("width", 1), this.variableBuilder.configure();
|
|
3039
3055
|
}
|
|
3040
3056
|
addBatch(e, t, n = 0, r = t.length) {
|
|
3041
|
-
let i = this.properties.align || "left", a = this.properties.logoLetters ?? !1, o = this.metadata.common.base,
|
|
3057
|
+
let i = this.properties.align || "left", a = this.properties.logoLetters ?? !1, o = this.metadata.common.base, s = this.metadata.common.scaleH, l = -5;
|
|
3042
3058
|
switch (this.properties.baseline) {
|
|
3043
3059
|
case "top":
|
|
3044
3060
|
l += this.metrics.capHeight;
|
|
@@ -3056,7 +3072,7 @@ var uc = class {
|
|
|
3056
3072
|
let f = [0, 0];
|
|
3057
3073
|
this.updateTextureCoord(f);
|
|
3058
3074
|
for (let e = n; e < r; e++) {
|
|
3059
|
-
let n = t[e], r = this.numberFormat(u(n)), p =
|
|
3075
|
+
let n = t[e], r = this.numberFormat(u(n)), p = c(r) ? r : r === null ? "" : "" + r;
|
|
3060
3076
|
if (p.length == 0) continue;
|
|
3061
3077
|
this.variableBuilder.updateFromDatum(n);
|
|
3062
3078
|
let m = a ? p.length : this.metrics.measureWidth(p);
|
|
@@ -3075,16 +3091,20 @@ var uc = class {
|
|
|
3075
3091
|
}
|
|
3076
3092
|
a ? (v = (t.width + 10) / t.width, h = -v / 2, _ = (t.height + 10) / t.height, g = -.5 - 5 / t.height) : (_ = t.height / o, g = -(t.height + t.yoffset + l) / o, v = t.width / o);
|
|
3077
3093
|
let r = t.x, i = t.y;
|
|
3078
|
-
d[0] = h, d[1] = g + _, f[0] = r /
|
|
3094
|
+
d[0] = h, d[1] = g + _, f[0] = r / s, f[1] = i / s, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g + _, f[0] = (r + t.width) / s, f[1] = i / s, this.variableBuilder.pushAll(), d[0] = h, d[1] = g, f[0] = r / s, f[1] = (i + t.height) / s, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g + _, f[0] = (r + t.width) / s, f[1] = i / s, this.variableBuilder.pushAll(), d[0] = h, d[1] = g, f[0] = r / s, f[1] = (i + t.height) / s, this.variableBuilder.pushAll(), d[0] = h + v, d[1] = g, f[0] = (r + t.width) / s, f[1] = (i + t.height) / s, this.variableBuilder.pushAll(), h += n;
|
|
3079
3095
|
}
|
|
3080
3096
|
}
|
|
3081
3097
|
this.registerBatch(e);
|
|
3082
3098
|
}
|
|
3083
|
-
}, gc = "#define PI 3.141593\n\nuniform View {\n /** Offset in \"unit\" units */\n mediump vec2 uViewOffset;\n mediump vec2 uViewScale;\n /** Size of the logical viewport in pixels, i.e., the view */\n mediump vec2 uViewportSize;\n mediump vec4 uLogicalVisibleRect;\n lowp vec2 uCullByVisibleRange;\n lowp float uDevicePixelRatio;\n // TODO: Views with opacity less than 1.0 should be rendered into a texture\n // that is rendered with the specified opacity.\n lowp float uViewOpacity;\n bool uPickingEnabled;\n};\n\n\n/**\n * Maps a coordinate on the unit scale to a normalized device coordinate.\n * (0, 0) is at the bottom left corner.\n */\nvec4 unitToNdc(vec2 coord) {\n return vec4((coord * uViewScale + uViewOffset) * 2.0 - 1.0, 0.0, 1.0);\n}\n\nvec4 unitToNdc(float x, float y) {\n return unitToNdc(vec2(x, y));\n}\n\nvec4 pixelsToNdc(vec2 coord) {\n return unitToNdc(coord / uViewportSize);\n}\n\nvec4 pixelsToNdc(float x, float y) {\n return pixelsToNdc(vec2(x, y));\n}\n\n/** Applies logical pixel offsets to a position in unit coordinates. */\nvec2 applyOffset(vec2 pos, vec2 offset) {\n return pos + vec2(offset.x, -offset.y) / uViewportSize;\n}\n\nbool isOutsideVisibleRange(vec2 pos) {\n return (uCullByVisibleRange.x > 0.5 &&\n (pos.x < uLogicalVisibleRect.x ||\n pos.x > uLogicalVisibleRect.z)) ||\n (uCullByVisibleRange.y > 0.5 &&\n (pos.y < uLogicalVisibleRect.y ||\n pos.y > uLogicalVisibleRect.w));\n}\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nconst highp uint HASH_EMPTY_KEY = 0xffffffffu;\n\nhighp uint hash32(highp uint key) {\n highp uint v = key;\n v ^= v >> 16u;\n v *= 0x7feb352du;\n v ^= v >> 15u;\n v *= 0x846ca68bu;\n v ^= v >> 16u;\n return v;\n}\n\nbool isEmptyHashTexture(highp usampler2D s) {\n // Empty selections are encoded as a single empty hash slot.\n ivec2 texSize = textureSize(s, 0);\n return texSize.x == 1 && texSize.y == 1 && texelFetch(s, ivec2(0, 0), 0).r == HASH_EMPTY_KEY;\n}\n\nbool hashContainsTexture(highp usampler2D s, highp uint value) {\n ivec2 texSize = textureSize(s, 0);\n highp uint width = uint(texSize.x);\n highp uint size = width * uint(texSize.y);\n highp uint mask = size - 1u;\n highp uint index = hash32(value) & mask;\n\n for (highp uint probe = 0u; probe < size; probe += 1u) {\n ivec2 coord = ivec2(int(index % width), int(index / width));\n highp uint entry = texelFetch(s, coord, 0).r;\n if (entry == value) {\n return true;\n }\n if (entry == HASH_EMPTY_KEY) {\n return false;\n }\n index = (index + 1u) & mask;\n }\n\n return false;\n}\n\n/**\n * Calculates a gamma for antialiasing opacity based on the color.\n */\nfloat getGammaForColor(vec3 rgb) {\n return mix(\n 1.25,\n 0.75,\n // RGB should be linearized but this is good enough for now\n smoothstep(0.0, 1.0, dot(rgb, vec3(0.299, 0.587, 0.114))));\n}\n\n// Fragment shader stuff ////////////////////////////////////////////////////////\n\n// TODO: include the following only in fragment shaders\n\n/**\n * Specialized linearstep for doing antialiasing\n */\nfloat distanceToRatio(float d) {\n return clamp(d * uDevicePixelRatio + 0.5, 0.0, 1.0);\n}\n\nvec4 distanceToColor(float d, vec4 fill, vec4 stroke, vec4 background, float halfStrokeWidth) {\n if (halfStrokeWidth > 0.0) {\n // Distance to stroke's edge. Negative inside the stroke.\n float sd = abs(d) - halfStrokeWidth;\n return mix(\n stroke,\n d <= 0.0 ? fill : background,\n distanceToRatio(sd));\n } else {\n return mix(background, fill, distanceToRatio(-d));\n }\n}\n", _c = "uniform highp float uZero;\n\n// Utils ------------\n\nvec3 getDiscreteColor(sampler2D s, int index) {\n return texelFetch(s, ivec2(index % textureSize(s, 0).x, 0), 0).rgb;\n}\n\nvec3 getInterpolatedColor(sampler2D s, float unitValue) {\n return texture(s, vec2(unitValue, 0.0)).rgb;\n}\n\nfloat clampToRange(float value, vec2 range) {\n return clamp(value, min(range[0], range[1]), max(range[0], range[1]));\n}\n\n// Scales ------------\n// Based on d3 scales: https://github.com/d3/d3-scale\n\nfloat scaleIdentity(float value) {\n return value;\n}\n\nfloat scaleIdentity(uint value) {\n return float(value);\n}\n\nfloat scaleLinear(float value, vec2 domain, vec2 range) {\n float domainSpan = domain[1] - domain[0];\n float rangeSpan = range[1] - range[0];\n return (value - domain[0]) / domainSpan * rangeSpan + range[0];\n}\n\nfloat scaleLog(float value, vec2 domain, vec2 range, float base) {\n // y = m log(x) + b \n // TODO: Perf optimization: precalculate log domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(log(value) / log(base), log(domain) / log(base), range);\n}\n\nfloat symlog(float value, float constant) {\n // WARNING: emulating log1p with log(x + 1). Small numbers are likely to\n // have significant precision problems.\n return sign(value) * log(abs(value / constant) + 1.0);\n}\n\nfloat scaleSymlog(float value, vec2 domain, vec2 range, float constant) {\n return scaleLinear(\n symlog(value, constant),\n vec2(symlog(domain[0], constant), symlog(domain[1], constant)),\n range\n );\n}\n\nfloat scalePow(float value, vec2 domain, vec2 range, float exponent) {\n // y = mx^k + b\n // TODO: Perf optimization: precalculate pow domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(\n pow(abs(value), exponent) * sign(value),\n pow(abs(domain), vec2(exponent)) * sign(domain),\n range\n );\n}\n\n// TODO: scaleThreshold\n// TODO: scaleQuantile (special case of threshold scale)\n\n// TODO: domainExtent should be uint\nfloat scaleBand(uint value, vec2 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n float n = domainExtent[1] - domainExtent[0];\n\n // This fix departs from Vega and d3: https://github.com/vega/vega/issues/3357#issuecomment-1063253596\n paddingInner = int(n) > 1 ? paddingInner : 0.0;\n\n // Adapted from: https://github.com/d3/d3-scale/blob/master/src/band.js\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n return start + (float(value) - domainExtent[0]) * step + bandwidth * band;\n}\n\nconst int lowBits = 12;\nconst float lowDivisor = pow(2.0, float(lowBits));\nconst uint lowMask = uint(lowDivisor - 1.0);\n\nvec2 splitUint(uint value) {\n uint valueLo = value & lowMask;\n uint valueHi = value - valueLo;\n return vec2(float(valueHi), float(valueLo));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales\n */\nfloat scaleBandHp(uint value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = splitUint(value);\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales for large\n * domains where 32bit uints are not sufficient to represent the domain.\n */\nfloat scaleBandHp(uvec2 value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = vec2(float(value[0]) * lowDivisor, float(value[1]));\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n", vc = "\n/** Describes where a sample facet should be shown. */\nstruct SampleFacetPosition {\n float pos;\n float height;\n};\n\n// ----------------------------------------------------------------------------\n\n#if !defined(SAMPLE_FACET_UNIFORM) && !defined(SAMPLE_FACET_TEXTURE)\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(0.0, 1.0);\n}\n\n#elif defined(SAMPLE_FACET_UNIFORM)\n\n/**\n * Location and height of the band on the Y axis on a normalized [0, 1] scale.\n * Elements: position, height\n */\nuniform vec2 uSampleFacet;\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(\n 1.0 - uSampleFacet.x - uSampleFacet.y,\n uSampleFacet.y\n );\n}\n\n#elif defined(SAMPLE_FACET_TEXTURE)\n\nuniform sampler2D uSampleFacetTexture;\n\nSampleFacetPosition getSampleFacetPos() {\n vec2 texel = texelFetch(\n uSampleFacetTexture,\n ivec2(int(attr_facetIndex), 0),\n 0\n ).rg;\n return SampleFacetPosition(\n 1.0 - texel.x - texel.y,\n texel.y\n );\n}\n\n#endif\n\nvec2 applySampleFacet(vec2 pos) {\n SampleFacetPosition facetPos = getSampleFacetPos();\n return vec2(pos.x, facetPos.pos + pos.y * facetPos.height);\n}\n", yc = "/*\n * Based on concepts presented at:\n * https://webglfundamentals.org/webgl/lessons/webgl-picking.html\n * https://deck.gl/docs/developer-guide/custom-layers/picking\n */\n\nout highp vec4 vPickingColor;\n\n/**\n * Passes the unique id to the fragment shader as a color if picking is enabled.\n * Returns true if picking is enabled.\n */\nbool setupPicking() {\n if (uPickingEnabled) {\n#ifdef uniqueId_DEFINED\n uint id = attr_uniqueId;\n vPickingColor = vec4(\n ivec4(id >> 0, id >> 8, id >> 16, id >> 24) & 0xFF\n ) / float(0xFF);\n#else\n vPickingColor = vec4(1.0);\n#endif\n return true;\n }\n return false;\n}\n", bc = "in highp vec4 vPickingColor;\n", xc = .5, Sc = "SAMPLE_FACET_UNIFORM", Cc = "SAMPLE_FACET_TEXTURE", wc = "uSelectionTexture_", Tc = class {
|
|
3099
|
+
}, yc = "#define PI 3.141593\n\nuniform View {\n /** Offset in \"unit\" units */\n mediump vec2 uViewOffset;\n mediump vec2 uViewScale;\n /** Size of the logical viewport in pixels, i.e., the view */\n mediump vec2 uViewportSize;\n mediump vec4 uLogicalVisibleRect;\n lowp vec2 uCullByVisibleRange;\n lowp float uDevicePixelRatio;\n // TODO: Views with opacity less than 1.0 should be rendered into a texture\n // that is rendered with the specified opacity.\n lowp float uViewOpacity;\n bool uPickingEnabled;\n};\n\n\n/**\n * Maps a coordinate on the unit scale to a normalized device coordinate.\n * (0, 0) is at the bottom left corner.\n */\nvec4 unitToNdc(vec2 coord) {\n return vec4((coord * uViewScale + uViewOffset) * 2.0 - 1.0, 0.0, 1.0);\n}\n\nvec4 unitToNdc(float x, float y) {\n return unitToNdc(vec2(x, y));\n}\n\nvec4 pixelsToNdc(vec2 coord) {\n return unitToNdc(coord / uViewportSize);\n}\n\nvec4 pixelsToNdc(float x, float y) {\n return pixelsToNdc(vec2(x, y));\n}\n\n/** Applies logical pixel offsets to a position in unit coordinates. */\nvec2 applyOffset(vec2 pos, vec2 offset) {\n return pos + vec2(offset.x, -offset.y) / uViewportSize;\n}\n\nbool isOutsideVisibleRange(vec2 pos) {\n return (uCullByVisibleRange.x > 0.5 &&\n (pos.x < uLogicalVisibleRect.x ||\n pos.x > uLogicalVisibleRect.z)) ||\n (uCullByVisibleRange.y > 0.5 &&\n (pos.y < uLogicalVisibleRect.y ||\n pos.y > uLogicalVisibleRect.w));\n}\n\nfloat linearstep(float edge0, float edge1, float x) {\n return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n}\n\nconst highp uint HASH_EMPTY_KEY = 0xffffffffu;\n\nhighp uint hash32(highp uint key) {\n highp uint v = key;\n v ^= v >> 16u;\n v *= 0x7feb352du;\n v ^= v >> 15u;\n v *= 0x846ca68bu;\n v ^= v >> 16u;\n return v;\n}\n\nbool isEmptyHashTexture(highp usampler2D s) {\n // Empty selections are encoded as a single empty hash slot.\n ivec2 texSize = textureSize(s, 0);\n return texSize.x == 1 && texSize.y == 1 && texelFetch(s, ivec2(0, 0), 0).r == HASH_EMPTY_KEY;\n}\n\nbool hashContainsTexture(highp usampler2D s, highp uint value) {\n ivec2 texSize = textureSize(s, 0);\n highp uint width = uint(texSize.x);\n highp uint size = width * uint(texSize.y);\n highp uint mask = size - 1u;\n highp uint index = hash32(value) & mask;\n\n for (highp uint probe = 0u; probe < size; probe += 1u) {\n ivec2 coord = ivec2(int(index % width), int(index / width));\n highp uint entry = texelFetch(s, coord, 0).r;\n if (entry == value) {\n return true;\n }\n if (entry == HASH_EMPTY_KEY) {\n return false;\n }\n index = (index + 1u) & mask;\n }\n\n return false;\n}\n\n/**\n * Calculates a gamma for antialiasing opacity based on the color.\n */\nfloat getGammaForColor(vec3 rgb) {\n return mix(\n 1.25,\n 0.75,\n // RGB should be linearized but this is good enough for now\n smoothstep(0.0, 1.0, dot(rgb, vec3(0.299, 0.587, 0.114))));\n}\n\n// Fragment shader stuff ////////////////////////////////////////////////////////\n\n// TODO: include the following only in fragment shaders\n\n/**\n * Specialized linearstep for doing antialiasing\n */\nfloat distanceToRatio(float d) {\n return clamp(d * uDevicePixelRatio + 0.5, 0.0, 1.0);\n}\n\nvec4 distanceToColor(float d, vec4 fill, vec4 stroke, vec4 background, float halfStrokeWidth) {\n if (halfStrokeWidth > 0.0) {\n // Distance to stroke's edge. Negative inside the stroke.\n float sd = abs(d) - halfStrokeWidth;\n return mix(\n stroke,\n d <= 0.0 ? fill : background,\n distanceToRatio(sd));\n } else {\n return mix(background, fill, distanceToRatio(-d));\n }\n}\n", bc = "uniform highp float uZero;\n\n// Utils ------------\n\nvec3 getDiscreteColor(sampler2D s, int index) {\n return texelFetch(s, ivec2(index % textureSize(s, 0).x, 0), 0).rgb;\n}\n\nvec3 getInterpolatedColor(sampler2D s, float unitValue) {\n return texture(s, vec2(unitValue, 0.0)).rgb;\n}\n\nfloat clampToRange(float value, vec2 range) {\n return clamp(value, min(range[0], range[1]), max(range[0], range[1]));\n}\n\n// Scales ------------\n// Based on d3 scales: https://github.com/d3/d3-scale\n\nfloat scaleIdentity(float value) {\n return value;\n}\n\nfloat scaleIdentity(uint value) {\n return float(value);\n}\n\nfloat scaleLinear(float value, vec2 domain, vec2 range) {\n float domainSpan = domain[1] - domain[0];\n float rangeSpan = range[1] - range[0];\n return (value - domain[0]) / domainSpan * rangeSpan + range[0];\n}\n\nfloat scaleLog(float value, vec2 domain, vec2 range, float base) {\n // y = m log(x) + b \n // TODO: Perf optimization: precalculate log domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(log(value) / log(base), log(domain) / log(base), range);\n}\n\nfloat symlog(float value, float constant) {\n // WARNING: emulating log1p with log(x + 1). Small numbers are likely to\n // have significant precision problems.\n return sign(value) * log(abs(value / constant) + 1.0);\n}\n\nfloat scaleSymlog(float value, vec2 domain, vec2 range, float constant) {\n return scaleLinear(\n symlog(value, constant),\n vec2(symlog(domain[0], constant), symlog(domain[1], constant)),\n range\n );\n}\n\nfloat scalePow(float value, vec2 domain, vec2 range, float exponent) {\n // y = mx^k + b\n // TODO: Perf optimization: precalculate pow domain in js.\n // TODO: Reversed domain, etc\n return scaleLinear(\n pow(abs(value), exponent) * sign(value),\n pow(abs(domain), vec2(exponent)) * sign(domain),\n range\n );\n}\n\n// TODO: scaleThreshold\n// TODO: scaleQuantile (special case of threshold scale)\n\n// TODO: domainExtent should be uint\nfloat scaleBand(uint value, vec2 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n float n = domainExtent[1] - domainExtent[0];\n\n // This fix departs from Vega and d3: https://github.com/vega/vega/issues/3357#issuecomment-1063253596\n paddingInner = int(n) > 1 ? paddingInner : 0.0;\n\n // Adapted from: https://github.com/d3/d3-scale/blob/master/src/band.js\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n return start + (float(value) - domainExtent[0]) * step + bandwidth * band;\n}\n\nconst int lowBits = 12;\nconst float lowDivisor = pow(2.0, float(lowBits));\nconst uint lowMask = uint(lowDivisor - 1.0);\n\nvec2 splitUint(uint value) {\n uint valueLo = value & lowMask;\n uint valueHi = value - valueLo;\n return vec2(float(valueHi), float(valueLo));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales\n */\nfloat scaleBandHp(uint value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = splitUint(value);\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n\n/**\n * High precision variant of scaleBand for index/locus scales for large\n * domains where 32bit uints are not sufficient to represent the domain.\n */\nfloat scaleBandHp(uvec2 value, vec3 domainExtent, vec2 range,\n float paddingInner, float paddingOuter,\n float align, float band) {\n\n // TODO: reverse\n float start = range[0];\n float stop = range[1];\n float rangeSpan = stop - start;\n\n vec2 domainStart = domainExtent.xy;\n float n = domainExtent[2];\n\n // The following computation is identical for every vertex. Could be done on the JS side.\n float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);\n start += (rangeSpan - step * (n - paddingInner)) * align;\n float bandwidth = step * (1.0 - paddingInner);\n\n // Split into to values with each having a reduced number of significant digits\n // to mitigate the lack of precision in float32 calculations.\n vec2 splitValue = vec2(float(value[0]) * lowDivisor, float(value[1]));\n\n // Using max to prevent the shader compiler from wrecking the precision.\n // Othwewise the compiler could optimize the sum of the four terms into\n // some equivalent form that does premature rounding.\n float inf = 1.0 / uZero;\n float hi = max(splitValue[0] - domainStart[0], -inf);\n float lo = max(splitValue[1] - domainStart[1], -inf);\n\n return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));\n}\n", xc = "\n/** Describes where a sample facet should be shown. */\nstruct SampleFacetPosition {\n float pos;\n float height;\n};\n\n// ----------------------------------------------------------------------------\n\n#if !defined(SAMPLE_FACET_UNIFORM) && !defined(SAMPLE_FACET_TEXTURE)\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(0.0, 1.0);\n}\n\n#elif defined(SAMPLE_FACET_UNIFORM)\n\n/**\n * Location and height of the band on the Y axis on a normalized [0, 1] scale.\n * Elements: position, height\n */\nuniform vec2 uSampleFacet;\n\nSampleFacetPosition getSampleFacetPos() {\n return SampleFacetPosition(\n 1.0 - uSampleFacet.x - uSampleFacet.y,\n uSampleFacet.y\n );\n}\n\n#elif defined(SAMPLE_FACET_TEXTURE)\n\nuniform sampler2D uSampleFacetTexture;\n\nSampleFacetPosition getSampleFacetPos() {\n vec2 texel = texelFetch(\n uSampleFacetTexture,\n ivec2(int(attr_facetIndex), 0),\n 0\n ).rg;\n return SampleFacetPosition(\n 1.0 - texel.x - texel.y,\n texel.y\n );\n}\n\n#endif\n\nvec2 applySampleFacet(vec2 pos) {\n SampleFacetPosition facetPos = getSampleFacetPos();\n return vec2(pos.x, facetPos.pos + pos.y * facetPos.height);\n}\n", Sc = "/*\n * Based on concepts presented at:\n * https://webglfundamentals.org/webgl/lessons/webgl-picking.html\n * https://deck.gl/docs/developer-guide/custom-layers/picking\n */\n\nout highp vec4 vPickingColor;\n\n/**\n * Passes the unique id to the fragment shader as a color if picking is enabled.\n * Returns true if picking is enabled.\n */\nbool setupPicking() {\n if (uPickingEnabled) {\n#ifdef uniqueId_DEFINED\n uint id = attr_uniqueId;\n vPickingColor = vec4(\n ivec4(id >> 0, id >> 8, id >> 16, id >> 24) & 0xFF\n ) / float(0xFF);\n#else\n vPickingColor = vec4(1.0);\n#endif\n return true;\n }\n return false;\n}\n", Cc = "in highp vec4 vPickingColor;\n", wc = .5, Tc = "SAMPLE_FACET_UNIFORM", Ec = "SAMPLE_FACET_TEXTURE", Dc = "uSelectionTexture_", Oc = {
|
|
3100
|
+
all: 0,
|
|
3101
|
+
matching: 1,
|
|
3102
|
+
nonmatching: 2
|
|
3103
|
+
}, kc = class {
|
|
3084
3104
|
#e = [];
|
|
3085
3105
|
#t = !1;
|
|
3086
3106
|
constructor(e, t, n) {
|
|
3087
|
-
this.mark = e, this._glHelper = t, this._rendererResources = n, this.bufferInfo = void 0, this.bytesPerElement = /* @__PURE__ */ new Map(), this.programInfo = void 0, this.vertexArrayInfo = void 0, this.viewUniformInfo = void 0, this.markUniformInfo = void 0, this.markUniformsAltered = !0, this.selectionTextureOps = [], this.scaleResolutionDisposers = [], this.rangeMap = new
|
|
3107
|
+
this.mark = e, this._glHelper = t, this._rendererResources = n, this.bufferInfo = void 0, this.bytesPerElement = /* @__PURE__ */ new Map(), this.programInfo = void 0, this.vertexArrayInfo = void 0, this.viewUniformInfo = void 0, this.markUniformInfo = void 0, this.markUniformsAltered = !0, this.selectionTextureOps = [], this.scaleResolutionDisposers = [], this.rangeMap = new Ac();
|
|
3088
3108
|
}
|
|
3089
3109
|
get unitView() {
|
|
3090
3110
|
return this.mark.unitView;
|
|
@@ -3117,133 +3137,140 @@ var uc = class {
|
|
|
3117
3137
|
this.#n();
|
|
3118
3138
|
}
|
|
3119
3139
|
getSampleFacetMode() {
|
|
3120
|
-
if (this.encoders.facetIndex) return
|
|
3121
|
-
if (this.unitView.usesSampleFacetRendering()) return
|
|
3122
|
-
}
|
|
3123
|
-
createAndLinkShaders(
|
|
3124
|
-
let
|
|
3125
|
-
|
|
3126
|
-
let
|
|
3127
|
-
for (let e of
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
let
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
y.push(" // Selection parameter"), y.push(` uniform highp ${o}[2] ${a};`), this.#e.push(() => {
|
|
3163
|
-
this.registerMarkUniformValue(a, { expr: t }, (e) => e.intervals[i] ?? [1, 0]);
|
|
3140
|
+
if (this.encoders.facetIndex) return Ec;
|
|
3141
|
+
if (this.unitView.usesSampleFacetRendering()) return Tc;
|
|
3142
|
+
}
|
|
3143
|
+
createAndLinkShaders(n, i, s = []) {
|
|
3144
|
+
let c = this.getAttributes(), l = this.encoders, d = this.mark.getOrder(), f = this.getSampleFacetMode(), p = !!this.properties.cullByVisibleRange;
|
|
3145
|
+
f && s.push(`#define ${f}`), p && s.push("#define VISIBLE_RANGE_CULLING");
|
|
3146
|
+
let h = "// view: " + this.unitView.getPathString(), g = [], _ = /* @__PURE__ */ new Set(), y = ks(l), x = [], ee = e(l), S = new Set(ee.keys());
|
|
3147
|
+
for (let e of d?.params ?? []) S.add(e);
|
|
3148
|
+
let C = new Set(ee.keys().filter((e) => ee.get(e)));
|
|
3149
|
+
if (d && !d.predicate.selection.singleParam) for (let e of d.params) C.add(e);
|
|
3150
|
+
d && (s.push("#define CONDITIONAL_ORDER"), x.push(" // Conditional order pass"), x.push(" uniform int uOrderMode;"));
|
|
3151
|
+
for (let e of S) {
|
|
3152
|
+
let n = this.unitView.paramRuntime, i = n.findValue(e);
|
|
3153
|
+
if (!i) throw Error(`Cannot infer selection type as the parameter "${e}" has no value. Please ensure that the parameter is properly defined!`);
|
|
3154
|
+
let o = As("uniqueId");
|
|
3155
|
+
if (r(i)) {
|
|
3156
|
+
let n = $ + t(e);
|
|
3157
|
+
x.push(" // Selection parameter"), x.push(` uniform highp uint ${n};`), this.#e.push(() => {
|
|
3158
|
+
this.registerMarkUniformValue(n, { expr: e }, (e) => e.uniqueId ?? 0);
|
|
3159
|
+
}), g.push(`bool ${is}${e}(bool empty) {\n return ${$}${e} == ${o} || (empty && ${$}${e} == 0u);\n}`), C.has(e) && (g.push(`bool ${as}${e}() {\n return ${$}${e} != 0u && ${$}${e} == ${o};\n}`), g.push(`bool ${os}${e}() {\n return ${$}${e} == 0u;\n}`));
|
|
3160
|
+
} else if (se(i)) {
|
|
3161
|
+
let r = Dc + t(e);
|
|
3162
|
+
g.push(`// Selection texture\nuniform highp usampler2D ${r};`);
|
|
3163
|
+
let a = this.glHelper, s = a.selectionTextures;
|
|
3164
|
+
this.selectionTextureOps.push(() => {
|
|
3165
|
+
let t = n.getValue(e), i = s.get(t);
|
|
3166
|
+
if (!i) throw Error(`Bug: no selection texture found for "${e}"!`);
|
|
3167
|
+
J(this.programInfo, { [r]: i });
|
|
3168
|
+
});
|
|
3169
|
+
let c = Dc + e;
|
|
3170
|
+
g.push(`bool ${is}${e}(bool empty) {\n return hashContainsTexture(${c}, ${o}) || (empty && isEmptyHashTexture(${c}));\n}`), C.has(e) && (g.push(`bool ${as}${e}() {\n return hashContainsTexture(${c}, ${o});\n}`), g.push(`bool ${os}${e}() {\n return isEmptyHashTexture(${c});\n}`)), a.createSelectionTexture(i), n.watchExpression(e, () => {
|
|
3171
|
+
let t = n.getValue(e);
|
|
3172
|
+
a.createSelectionTexture(t), this.unitView.context.animator.requestRender();
|
|
3173
|
+
});
|
|
3174
|
+
} else if (a(i)) {
|
|
3175
|
+
let n = Object.keys(i.intervals).filter((e) => ["x", "y"].includes(e));
|
|
3176
|
+
if (n.length == 0) throw new ye(`Interval selection "${e}" has no supported x or y targets.`, this.unitView);
|
|
3177
|
+
let r = [], a = [];
|
|
3178
|
+
for (let i of n) {
|
|
3179
|
+
let n = $ + t(e) + `_${i}`, { attributeType: o } = ws(this.unitView.getScaleResolution(i).getScale(), i);
|
|
3180
|
+
x.push(" // Selection parameter"), x.push(` uniform highp ${o}[2] ${n};`), this.#e.push(() => {
|
|
3181
|
+
this.registerMarkUniformValue(n, { expr: e }, (e) => e.intervals[i] ?? [1, 0]);
|
|
3164
3182
|
});
|
|
3165
3183
|
let s = (e) => {
|
|
3166
|
-
for (let [t, n] of
|
|
3167
|
-
return
|
|
3168
|
-
}, c = s(i), l =
|
|
3184
|
+
for (let [t, n] of y.entries()) if (t[1] && n.includes(e)) return As(n);
|
|
3185
|
+
return As(e);
|
|
3186
|
+
}, c = s(i), l = n + "[0]", u = n + "[1]", d = m(i);
|
|
3169
3187
|
if (this.encoding[d]) {
|
|
3170
|
-
let
|
|
3171
|
-
if (
|
|
3172
|
-
else if (
|
|
3173
|
-
else if (
|
|
3174
|
-
else throw new ye(`Unsupported hit test mode "${
|
|
3175
|
-
} else
|
|
3176
|
-
|
|
3188
|
+
let e = s(d), t = this.defaultHitTestMode;
|
|
3189
|
+
if (t == "endpoints") r.push(`((${l} <= ${c} && ${c} <= ${u}) || (${l} <= ${e} && ${e} <= ${u}))`);
|
|
3190
|
+
else if (t == "encloses") r.push(`(${l} <= ${c} && ${e} <= ${u})`);
|
|
3191
|
+
else if (t == "intersects") r.push(`(${l} <= ${e} && ${c} <= ${u})`);
|
|
3192
|
+
else throw new ye(`Unsupported hit test mode "${t}" for interval selection!`, this.unitView);
|
|
3193
|
+
} else r.push(`(${l} <= ${c} && ${c} <= ${u})`);
|
|
3194
|
+
a.push(`${l} > ${u}`);
|
|
3177
3195
|
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3196
|
+
if (g.push(`bool ${is}${e}(bool empty) {\n return ${r.join(" && ")} || (empty && (${a.join(" || ")}));\n}`), !C.has(e)) continue;
|
|
3197
|
+
let o = r.map((e, t) => `(${a[t]} || ${e})`);
|
|
3198
|
+
g.push(`bool ${as}${e}() {\n return (!(${a.join(" && ")})) && (${o.join(" && ")});\n}`), g.push(`bool ${os}${e}() {\n return ${a.join(" && ")};\n}`);
|
|
3199
|
+
} else throw new ye(`Unsupported selection type "${i.type}" for WebGL conditional encoding.`, this.unitView);
|
|
3180
3200
|
}
|
|
3181
|
-
let
|
|
3201
|
+
let ne = (e, t, n, r) => {
|
|
3182
3202
|
let i = t.channelDef;
|
|
3183
|
-
if (
|
|
3184
|
-
let { uniformName: t, uniformGlsl: r, accessorGlsl: a, adjuster: o } =
|
|
3185
|
-
|
|
3203
|
+
if (o(i)) if (u(i.value)) {
|
|
3204
|
+
let { uniformName: t, uniformGlsl: r, accessorGlsl: a, adjuster: o } = fs(e, n);
|
|
3205
|
+
g.push(a), x.push(r), this.#e.push(() => {
|
|
3186
3206
|
this.registerMarkUniformValue(t, i.value, o);
|
|
3187
3207
|
});
|
|
3188
|
-
} else
|
|
3189
|
-
else if (
|
|
3190
|
-
let { uniformName: t, uniformGlsl: a, accessorGlsl: o } =
|
|
3191
|
-
|
|
3192
|
-
let { largeHp: s, discrete: c } =
|
|
3208
|
+
} else g.push(ds(e, n, i.value).accessorGlsl);
|
|
3209
|
+
else if (v(i)) {
|
|
3210
|
+
let { uniformName: t, uniformGlsl: a, accessorGlsl: o } = ms(e, r, n);
|
|
3211
|
+
x.push(a), g.push(o);
|
|
3212
|
+
let { largeHp: s, discrete: c } = ws(r, e), l = c && "domain" in r ? (e) => r.domain().indexOf(e) : s ? Es : (e) => +e;
|
|
3193
3213
|
this.#e.push(() => {
|
|
3194
3214
|
this.registerMarkUniformValue(t, i.datum, l);
|
|
3195
3215
|
});
|
|
3196
|
-
} else if (
|
|
3197
|
-
let t =
|
|
3198
|
-
_.add(a),
|
|
3199
|
-
} else if (
|
|
3200
|
-
let { attributeGlsl: t, accessorGlsl: i } =
|
|
3201
|
-
_.add(t),
|
|
3216
|
+
} else if (oe(i)) {
|
|
3217
|
+
let t = y.get([i.field, !0]), { attributeGlsl: a, accessorGlsl: o } = ps(e, r, n, t?.includes(e) ? t : void 0);
|
|
3218
|
+
_.add(a), g.push(o);
|
|
3219
|
+
} else if (ae(i)) {
|
|
3220
|
+
let { attributeGlsl: t, accessorGlsl: i } = ps(e, r, n);
|
|
3221
|
+
_.add(t), g.push(i);
|
|
3202
3222
|
} else throw new ye(`Unsupported channel definition: ${JSON.stringify(i)}`, this.unitView);
|
|
3203
3223
|
};
|
|
3204
|
-
for (let [
|
|
3205
|
-
if (!
|
|
3206
|
-
let { branches:
|
|
3207
|
-
for (let
|
|
3208
|
-
if (
|
|
3209
|
-
let
|
|
3210
|
-
|
|
3211
|
-
let
|
|
3212
|
-
this.registerScaleResolutionListener(
|
|
3213
|
-
}),
|
|
3214
|
-
let e = this.createMarkUniformSetter(
|
|
3224
|
+
for (let [e, t] of Object.entries(l)) {
|
|
3225
|
+
if (!c.includes(e)) continue;
|
|
3226
|
+
let { branches: n, channelDef: r, scale: i } = t;
|
|
3227
|
+
for (let t = 0; t < n.length; t++) ne(e, n[t].accessor, t, i);
|
|
3228
|
+
if (i) {
|
|
3229
|
+
let t = b(r), n = t && t.resolutionChannel || e, a = te(n) ? this.unitView.getScaleResolution(n) : null, { glsl: o, domainUniform: s, domainUniformName: c, rangeUniform: l, rangeUniformName: u } = hs(e, i, r);
|
|
3230
|
+
g.push(o), x.push(s), x.push(l), l && this.#e.push(() => {
|
|
3231
|
+
let t = this.createMarkUniformSetter(u), n = () => t(Ms(i, e));
|
|
3232
|
+
this.registerScaleResolutionListener(a, "range", n), n();
|
|
3233
|
+
}), s && this.#e.push(() => {
|
|
3234
|
+
let e = this.createMarkUniformSetter(c), t = () => {
|
|
3215
3235
|
let t;
|
|
3216
|
-
t = fe(
|
|
3236
|
+
t = fe(i.type) ? [0, i.domain().length] : w(i.type) ? cs(i) : i.domain(), e(ge(i.type) ? Os(t) : t);
|
|
3217
3237
|
};
|
|
3218
|
-
this.registerScaleResolutionListener(
|
|
3238
|
+
this.registerScaleResolutionListener(a, "domain", t), t();
|
|
3219
3239
|
});
|
|
3220
3240
|
}
|
|
3221
|
-
|
|
3241
|
+
g.push(gs(e, n));
|
|
3222
3242
|
}
|
|
3223
|
-
let
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3243
|
+
let re = Array.from(ee, ([e, t]) => `${t ? as : is}${e}(${t ? "" : "false"})`);
|
|
3244
|
+
if (g.push("bool isDatumSelected() {\n" + (this.encoders.uniqueId && re.length > 0 ? ` return ${re.join(" || ")};` : " return false;") + "\n}"), d) {
|
|
3245
|
+
let e = d.params.map((e) => {
|
|
3246
|
+
let t = !d.predicate.selection.singleParam;
|
|
3247
|
+
return `${t ? as : is}${e}(${t ? "" : String(d.predicate.selection.empty)})`;
|
|
3248
|
+
});
|
|
3249
|
+
g.push(`bool isOrderMatch() {
|
|
3250
|
+
return ${e.join(" || ")};\n}`);
|
|
3251
|
+
}
|
|
3252
|
+
let ie = "precision highp float;\nprecision highp int;", ce = (e) => e.replace("#pragma markUniforms", x.join("\n"));
|
|
3253
|
+
s = s.map(ce), n = ce(n), i = ce(i), n = ((e) => e.replace("#pragma orderGuard\n\n", d ? " if (uOrderMode != 0 &&\n (((uOrderMode & 3) == 1) != isOrderMatch())) {\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }" : ""))(n);
|
|
3254
|
+
let le = [
|
|
3255
|
+
ie,
|
|
3256
|
+
h,
|
|
3257
|
+
...s,
|
|
3236
3258
|
yc,
|
|
3237
|
-
t
|
|
3238
|
-
], ce = [
|
|
3239
|
-
ae,
|
|
3240
|
-
m,
|
|
3241
|
-
...o,
|
|
3242
|
-
gc,
|
|
3243
3259
|
bc,
|
|
3260
|
+
[..._].join("\n"),
|
|
3261
|
+
...g,
|
|
3262
|
+
xc,
|
|
3263
|
+
Sc,
|
|
3264
|
+
n
|
|
3265
|
+
], ue = [
|
|
3266
|
+
ie,
|
|
3267
|
+
h,
|
|
3268
|
+
...s,
|
|
3269
|
+
yc,
|
|
3270
|
+
Cc,
|
|
3244
3271
|
i
|
|
3245
|
-
],
|
|
3246
|
-
this.programStatus =
|
|
3272
|
+
], T = this.gl;
|
|
3273
|
+
this.programStatus = Us(T, this.glHelper.compileShader(T.VERTEX_SHADER, le), this.glHelper.compileShader(T.FRAGMENT_SHADER, ue));
|
|
3247
3274
|
}
|
|
3248
3275
|
finalizeGraphicsInitialization() {
|
|
3249
3276
|
if (this.#n(), this.programInfo) return;
|
|
@@ -3254,7 +3281,7 @@ var uc = class {
|
|
|
3254
3281
|
let t = /* @__PURE__ */ Error("Cannot create shader program: " + e.message);
|
|
3255
3282
|
throw t.view = this.unitView, t;
|
|
3256
3283
|
}
|
|
3257
|
-
this.programInfo =
|
|
3284
|
+
this.programInfo = ro(this.gl, this.programStatus.program), delete this.programStatus, this.viewUniformInfo = Xa(this.gl, this.programInfo, "View"), this.markUniformInfo = Xa(this.gl, this.programInfo, "Mark"), this.gl.useProgram(this.programInfo.program), J(this.programInfo, {
|
|
3258
3285
|
uSampleFacet: [0, 1],
|
|
3259
3286
|
uZero: 0
|
|
3260
3287
|
});
|
|
@@ -3270,10 +3297,10 @@ var uc = class {
|
|
|
3270
3297
|
}
|
|
3271
3298
|
registerMarkUniformValue(e, t, n = (e) => e) {
|
|
3272
3299
|
let r = this.createMarkUniformSetter(e), i = (n) => {
|
|
3273
|
-
if (n == null) throw Error(`Trying to set null/undefined value for uniform: ${e}${
|
|
3300
|
+
if (n == null) throw Error(`Trying to set null/undefined value for uniform: ${e}${u(t) ? `Expr: ${t.expr}` : ""}`);
|
|
3274
3301
|
r(n);
|
|
3275
3302
|
};
|
|
3276
|
-
if (
|
|
3303
|
+
if (u(t)) {
|
|
3277
3304
|
let e, r = () => i(n(e(null)));
|
|
3278
3305
|
e = this.unitView.paramRuntime.watchExpression(t.expr, r), r();
|
|
3279
3306
|
} else i(n(t));
|
|
@@ -3328,24 +3355,27 @@ var uc = class {
|
|
|
3328
3355
|
};
|
|
3329
3356
|
}
|
|
3330
3357
|
bindOrSetMarkUniformBlock() {
|
|
3331
|
-
this.markUniformsAltered ? (
|
|
3358
|
+
this.markUniformsAltered ? (Qa(this.gl, this.programInfo, this.markUniformInfo), this.markUniformsAltered = !1) : Za(this.gl, this.programInfo, this.markUniformInfo);
|
|
3359
|
+
}
|
|
3360
|
+
setOrderPass(e, t = !1) {
|
|
3361
|
+
$a(this.markUniformInfo, { uOrderMode: Oc[e] | (t ? 4 : 0) }), this.markUniformsAltered = !0;
|
|
3332
3362
|
}
|
|
3333
3363
|
prepareRender(e) {
|
|
3334
3364
|
let t = this.glHelper, n = this.gl, r = [];
|
|
3335
3365
|
r.push(() => {
|
|
3336
|
-
this.vertexArrayInfo ||=
|
|
3366
|
+
this.vertexArrayInfo ||= Io(this.gl, this.programInfo, this.bufferInfo), n.useProgram(this.programInfo.program);
|
|
3337
3367
|
});
|
|
3338
3368
|
for (let [e, n] of Object.entries(this.encoders)) {
|
|
3339
3369
|
let i = t.rangeTextures.get(n.scale);
|
|
3340
|
-
i && r.push(() => J(this.programInfo, { [
|
|
3370
|
+
i && r.push(() => J(this.programInfo, { [rs + e]: i }));
|
|
3341
3371
|
}
|
|
3342
|
-
r.push(...this.selectionTextureOps), this.getSampleFacetMode() ==
|
|
3372
|
+
r.push(...this.selectionTextureOps), this.getSampleFacetMode() == Ec && r.push(() => {
|
|
3343
3373
|
let t = e.placement?.source;
|
|
3344
3374
|
if (!t) throw Error("No placement source available.");
|
|
3345
3375
|
J(this.programInfo, { uSampleFacetTexture: this.glHelper.getPlacementTexture(t) });
|
|
3346
3376
|
});
|
|
3347
3377
|
let i = (e.picking ?? !1) && this.isPickingParticipant();
|
|
3348
|
-
return r.push(() =>
|
|
3378
|
+
return r.push(() => $a(this.viewUniformInfo, {
|
|
3349
3379
|
uViewOpacity: this.unitView.getEffectiveOpacity(),
|
|
3350
3380
|
uPickingEnabled: i
|
|
3351
3381
|
})), this.opaque || e.picking ? r.push(() => n.disable(n.BLEND)) : r.push(() => n.enable(n.BLEND)), r;
|
|
@@ -3362,23 +3392,25 @@ var uc = class {
|
|
|
3362
3392
|
render(e) {}
|
|
3363
3393
|
createRenderCallback(e, t) {
|
|
3364
3394
|
if (!this.bufferInfo) return () => void 0;
|
|
3365
|
-
let n = this, r
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3395
|
+
let n = this, r = t.orderPass, i = r ? (i, a) => {
|
|
3396
|
+
n.setOrderPass(r, t.secondOrderPass), n.bindOrSetMarkUniformBlock(), e(i, a);
|
|
3397
|
+
} : e, a, o = this.unitView.getScaleResolution("x")?.getScale(), s = o && T(o.type), c = ["index", "locus"].includes(o?.type) ? -1 : 0, l = [0, 0];
|
|
3398
|
+
a = (e) => {
|
|
3399
|
+
if (s && e.xIndex) {
|
|
3400
|
+
let t = o.domain(), n = Math.abs(t[1] - t[0]), r = e.xIndex(t[0] + c - n, t[1] + n, l), a = r[0], s = r[1] - a;
|
|
3401
|
+
s > 0 && i(a, s);
|
|
3402
|
+
} else i(e.offset, e.count);
|
|
3371
3403
|
};
|
|
3372
|
-
let
|
|
3404
|
+
let u = this.rangeMap.get(void 0).count == 0 ? t.facetId : void 0, d = this.rangeMap.get(u);
|
|
3373
3405
|
return t.sampleFacetRenderingOptions ? function() {
|
|
3374
|
-
|
|
3406
|
+
d.count && n.prepareSampleFacetRendering(t) && a(d);
|
|
3375
3407
|
} : function() {
|
|
3376
|
-
|
|
3408
|
+
d.count && a(d);
|
|
3377
3409
|
};
|
|
3378
3410
|
}
|
|
3379
|
-
setViewport(e, t, n, r, i, a =
|
|
3411
|
+
setViewport(e, t, n, r, i, a = wc) {
|
|
3380
3412
|
n = n.flatten();
|
|
3381
|
-
let o = this.gl, s = this.properties, c = a, l = a, u, d =
|
|
3413
|
+
let o = this.gl, s = this.properties, c = a, l = a, u, d = jc(e, n, s.clip === "never" ? void 0 : r, !1), f = d.coords;
|
|
3382
3414
|
if (d.requiresScissor) {
|
|
3383
3415
|
if (!f.isDefined()) return !1;
|
|
3384
3416
|
let r = [
|
|
@@ -3398,15 +3430,15 @@ var uc = class {
|
|
|
3398
3430
|
uViewScale: [n.width / e.width, n.height / e.height]
|
|
3399
3431
|
};
|
|
3400
3432
|
}
|
|
3401
|
-
return
|
|
3433
|
+
return $a(this.viewUniformInfo, {
|
|
3402
3434
|
...u,
|
|
3403
3435
|
uViewportSize: [n.width, n.height],
|
|
3404
|
-
uLogicalVisibleRect:
|
|
3436
|
+
uLogicalVisibleRect: Mc(n, i),
|
|
3405
3437
|
uCullByVisibleRange: [+(s.cullByVisibleRange === !0 || s.cullByVisibleRange === "x"), +(s.cullByVisibleRange === !0 || s.cullByVisibleRange === "y")],
|
|
3406
3438
|
uDevicePixelRatio: t
|
|
3407
|
-
}),
|
|
3439
|
+
}), Qa(this.gl, this.programInfo, this.viewUniformInfo), !0;
|
|
3408
3440
|
}
|
|
3409
|
-
},
|
|
3441
|
+
}, Ac = class extends ue {
|
|
3410
3442
|
constructor() {
|
|
3411
3443
|
super([], JSON.stringify);
|
|
3412
3444
|
}
|
|
@@ -3423,7 +3455,7 @@ var uc = class {
|
|
|
3423
3455
|
for (let [t, n] of e.entries()) Object.assign(this.get(t), n);
|
|
3424
3456
|
}
|
|
3425
3457
|
};
|
|
3426
|
-
function
|
|
3458
|
+
function jc(e, t, n, r = !0) {
|
|
3427
3459
|
if (!n || !n.clipX && !n.clipY) return {
|
|
3428
3460
|
requiresScissor: !1,
|
|
3429
3461
|
coords: t
|
|
@@ -3440,7 +3472,7 @@ function Dc(e, t, n, r = !0) {
|
|
|
3440
3472
|
coords: i.flatten()
|
|
3441
3473
|
};
|
|
3442
3474
|
}
|
|
3443
|
-
function
|
|
3475
|
+
function Mc(e, t) {
|
|
3444
3476
|
let n = t?.clipX ? (t.rect.x - e.x) / e.width : 0, r = t?.clipX ? (t.rect.x2 - e.x) / e.width : 1;
|
|
3445
3477
|
return [
|
|
3446
3478
|
n,
|
|
@@ -3451,7 +3483,7 @@ function Oc(e, t) {
|
|
|
3451
3483
|
}
|
|
3452
3484
|
//#endregion
|
|
3453
3485
|
//#region ../core/src/rendering/webgl/marks/arrow.js
|
|
3454
|
-
var
|
|
3486
|
+
var Nc = Math.PI / 180, Pc = 1e-6, Fc = 1, Ic = 90, Lc = ["triangle", "open"], Rc = ["inside", "outside"], zc = class extends kc {
|
|
3455
3487
|
getAttributes() {
|
|
3456
3488
|
return [
|
|
3457
3489
|
"uniqueId",
|
|
@@ -3474,15 +3506,15 @@ var kc = Math.PI / 180, Ac = 1e-6, jc = 1, Mc = 90, Nc = ["triangle", "open"], P
|
|
|
3474
3506
|
];
|
|
3475
3507
|
}
|
|
3476
3508
|
initializeGraphics() {
|
|
3477
|
-
super.initializeGraphics(), this.createAndLinkShaders(
|
|
3509
|
+
super.initializeGraphics(), this.createAndLinkShaders(ac, oc, [sc]);
|
|
3478
3510
|
}
|
|
3479
3511
|
finalizeGraphicsInitialization() {
|
|
3480
3512
|
super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
|
|
3481
3513
|
let e = this.properties;
|
|
3482
|
-
this.registerMarkUniformValue("uHeadSlope", e.headAngle,
|
|
3514
|
+
this.registerMarkUniformValue("uHeadSlope", e.headAngle, Vc), this.registerMarkUniformValue("uHeadNotchSlope", e.headNotchAngle, Vc), this.registerMarkUniformValue("uHeadShape", e.headShape, (e) => Bc(Lc, e)), this.registerMarkUniformValue("uMinSize", e.minSize), this.registerMarkUniformValue("uHeadWidth", e.headWidth), this.registerMarkUniformValue("uStartNotch", e.startNotch), this.registerMarkUniformValue("uMinStemLength", e.minStemLength), this.registerMarkUniformValue("uHeadSpacing", e.headSpacing ?? -1, Hc), this.registerMarkUniformValue("uStem", e.stem), this.registerMarkUniformValue("uHeadPlacement", e.headPlacement, (e) => Bc(Rc, e));
|
|
3483
3515
|
}
|
|
3484
3516
|
updateGraphicsData(e) {
|
|
3485
|
-
let t = e.getItemCount(), n = new
|
|
3517
|
+
let t = e.getItemCount(), n = new hc({
|
|
3486
3518
|
encoders: this.encoders,
|
|
3487
3519
|
attributes: this.getAttributes(),
|
|
3488
3520
|
numItems: t
|
|
@@ -3498,29 +3530,29 @@ var kc = Math.PI / 180, Ac = 1e-6, jc = 1, Mc = 90, Nc = ["triangle", "open"], P
|
|
|
3498
3530
|
render(e) {
|
|
3499
3531
|
let t = this.gl;
|
|
3500
3532
|
return this.createRenderCallback((e, n) => {
|
|
3501
|
-
|
|
3533
|
+
oo(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e);
|
|
3502
3534
|
}, e);
|
|
3503
3535
|
}
|
|
3504
3536
|
};
|
|
3505
|
-
function
|
|
3537
|
+
function Bc(e, t) {
|
|
3506
3538
|
let n = e.indexOf(t);
|
|
3507
3539
|
if (n < 0) throw Error(`Unsupported arrow mark value: ${t}`);
|
|
3508
3540
|
return n;
|
|
3509
3541
|
}
|
|
3510
|
-
function
|
|
3511
|
-
return Math.max(Math.tan(Math.min(Math.max(e,
|
|
3542
|
+
function Vc(e) {
|
|
3543
|
+
return Math.max(Math.tan(Math.min(Math.max(e, Fc), Ic) * Nc), Pc);
|
|
3512
3544
|
}
|
|
3513
|
-
function
|
|
3545
|
+
function Hc(e) {
|
|
3514
3546
|
return e ?? -1;
|
|
3515
3547
|
}
|
|
3516
3548
|
//#endregion
|
|
3517
3549
|
//#region ../core/src/rendering/webgl/marks/link.vertex.glsl
|
|
3518
|
-
var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\n/** The distance from the line center to the direction of normal in pixels */\nout float vNormalLengthInPixels;\n\nflat out float vGamma;\n\n// Centerline distance from the rendered endpoint baseline; negative disables fading.\nout float vFadeDistance;\n\nconst int SHAPE_ARC = 0;\nconst int SHAPE_DOME = 1;\nconst int SHAPE_DIAGONAL = 2;\nconst int SHAPE_LINE = 3;\nconst int ORIENT_VERTICAL = 0;\nconst int ORIENT_HORIZONTAL = 1;\n\nfloat distanceFromLine(vec2 pointOnLine1, vec2 pointOnLine2, vec2 point) {\n vec2 a = point - pointOnLine1;\n vec2 b = pointOnLine2 - pointOnLine1;\n vec2 proj = dot(a, b) / dot(b, b) * b;\n return length(a - proj);\n}\n\nbool isInsideViewport(vec2 point, float marginFactor) {\n vec2 margin = uViewportSize * vec2(marginFactor);\n return point.x >= -margin.x\n && point.x <= uViewportSize.x + margin.x\n && point.y >= -margin.y\n && point.y <= uViewportSize.y + margin.y;\n}\n\nfloat inverseSmoothstep(float t) {\n t = clamp(t, 0.0, 1.0);\n // The chord-axis coordinate of ARC/DOME follows the smoothstep curve.\n return 0.5 - sin(asin(1.0 - 2.0 * t) / 3.0);\n}\n\n/**\n * Remaps the parameter t to concentrate vertices to the part that is visible in the viewport.\n * This keeps the tightly bent endpoints smooth even when zooming in very close.\n */\nfloat remapVisibleChordParameter(\n float stripT,\n float chordStart,\n float chordEnd,\n float viewportLength\n) {\n // Concentrate samples in the viewport-visible chord interval without dropping the rest.\n float chordMin = min(chordStart, chordEnd);\n float chordMax = max(chordStart, chordEnd);\n float chordSpan = chordMax - chordMin;\n\n if (chordSpan <= 0.0) {\n return 0.0;\n }\n\n float visibleChordMin = max(chordMin, 0.0);\n float visibleChordMax = min(chordMax, viewportLength);\n\n if (visibleChordMax <= visibleChordMin) {\n return stripT;\n }\n\n float visibleTMin = inverseSmoothstep((visibleChordMin - chordMin) / chordSpan);\n float visibleTMax = inverseSmoothstep((visibleChordMax - chordMin) / chordSpan);\n float visibleTSpan = visibleTMax - visibleTMin;\n float offscreenTSpan = visibleTMin + (1.0 - visibleTMax);\n\n if (offscreenTSpan <= 0.0) {\n return stripT;\n }\n\n float visibleShare = clamp(0.75 + (1.0 - visibleTSpan) * 0.2, 0.75, 0.95);\n float offscreenShare = 1.0 - visibleShare;\n float leftShare = offscreenShare * visibleTMin / offscreenTSpan;\n float rightShare = offscreenShare * (1.0 - visibleTMax) / offscreenTSpan;\n\n if (stripT <= leftShare) {\n return leftShare > 0.0 ? mix(0.0, visibleTMin, stripT / leftShare) : visibleTMin;\n }\n\n float visibleStart = leftShare;\n float visibleEnd = visibleStart + visibleShare;\n\n if (stripT <= visibleEnd) {\n return visibleShare > 0.0\n ? mix(visibleTMin, visibleTMax, (stripT - visibleStart) / visibleShare)\n : visibleTMin;\n }\n\n return rightShare > 0.0\n ? mix(visibleTMax, 1.0, (stripT - visibleEnd) / rightShare)\n : visibleTMax;\n}\n\nvoid clampChordToViewport(inout vec2 p1, inout vec2 p4, inout float chordLength) {\n if (chordLength > uMaxChordLength) {\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n\n if (isInsideViewport(p1, 2.0)) {\n chordLength = uMaxChordLength;\n p4 = p1 + unitChordVector * uMaxChordLength;\n } else if (isInsideViewport(p4, 2.0)) {\n chordLength = uMaxChordLength;\n p1 = p4 - unitChordVector * uMaxChordLength;\n }\n }\n}\n\nvoid clampDomeApex(inout vec2 p1, inout vec2 p4, int orient) {\n if (orient == ORIENT_VERTICAL) {\n if (p4.x > 0.0) {\n p1.x = max(p1.x, -p4.x);\n }\n if (p1.x < uViewportSize.x) {\n p4.x = min(p4.x, 2.0 * uViewportSize.x - p1.x);\n }\n } else {\n if (p4.y > 0.0) {\n p1.y = max(p1.y, -p4.y);\n }\n if (p1.y < uViewportSize.y) {\n p4.y = min(p4.y, 2.0 * uViewportSize.y - p1.y);\n }\n }\n}\n\nvoid main(void) {\n float pixelSize = 1.0 / uDevicePixelRatio;\n float opacity = getScaled_opacity() * uViewOpacity;\n\n // The bezier's control points\n vec2 p1, p2, p3, p4;\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n ) * uViewportSize;\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n ) * uViewportSize;\n\n if (uShape <= SHAPE_DOME) {\n if (uShape == SHAPE_DOME) {\n vec2 height = vec2(0.0);\n if (uOrient == ORIENT_VERTICAL) {\n p1 = vec2(min(a.x, b.x), b.y);\n p4 = vec2(max(a.x, b.x), b.y);\n height = vec2(0.0, a.y - b.y);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_VERTICAL);\n }\n\n } else {\n p1 = vec2(b.x, min(a.y, b.y));\n p4 = vec2(b.x, max(a.y, b.y));\n height = vec2(a.x - b.x, 0.0);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_HORIZONTAL);\n }\n }\n\n vec2 controlOffset = height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n\n } if (uShape == SHAPE_ARC) {\n p1 = a;\n p4 = b;\n\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n vec2 chordNormal = vec2(-unitChordVector.y, unitChordVector.x);\n float chordLength = length(chordVector);\n clampChordToViewport(p1, p4, chordLength);\n\n float height = max(\n chordLength / 2.0 * uArcHeightFactor,\n uMinArcHeight\n );\n\n // This is a bit poor approximation of a circular arc, but it's probably enough for most purposes.\n // TODO: Consider a more sophisticated approach: https://stackoverflow.com/a/44829356/1547896\n vec2 controlOffset = chordNormal * height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n }\n\n } else if (uShape == SHAPE_DIAGONAL) {\n if (uOrient == ORIENT_VERTICAL) {\n p1 = a;\n p2 = vec2(a.x, (a.y + b.y) / 2.0);\n p3 = vec2(b.x, (a.y + b.y) / 2.0);\n p4 = b;\n } else {\n p1 = a;\n p2 = vec2((a.x + b.x) / 2.0, a.y);\n p3 = vec2((a.x + b.x) / 2.0, b.y);\n p4 = b;\n }\n } else if (uShape == SHAPE_LINE) {\n p1 = a;\n p2 = (a + b) / 2.0;\n p3 = p2;\n p4 = b;\n }\n\n vec2 strip = vec2(\n float(gl_VertexID / 2) / float(uSegmentBreaks),\n float(gl_VertexID % 2) - 0.5\n );\n\n float t = strip.x;\n\n if (uShape == SHAPE_DOME) {\n if (uOrient == ORIENT_VERTICAL) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n } else if (uShape == SHAPE_ARC) {\n if (a.y == b.y) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else if (a.x == b.x) {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n }\n\n vec2 p;\n vec2 tangent;\n\n // de Casteljau evaluation keeps the cubic stable for long chords.\n vec2 q1 = mix(p1, p2, t);\n vec2 q2 = mix(p2, p3, t);\n vec2 q3 = mix(p3, p4, t);\n\n vec2 r1 = mix(q1, q2, t);\n vec2 r2 = mix(q2, q3, t);\n\n p = mix(r1, r2, t);\n tangent = 3.0 * (r2 - r1);\n\n tangent = normalize(tangent);\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float size = getScaled_size();\n\n // Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively\n if (size < pixelSize) {\n opacity *= size / pixelSize;\n size = pixelSize;\n }\n\n // Handle minimum picking size or add an extra pixel to the stroke width to accommodate edge antialiasing\n float paddedSize = uPickingEnabled\n ? max(size, uMinPickingSize)\n : size + pixelSize;\n\n vNormalLengthInPixels = strip.y * paddedSize;\n \n vFadeDistance = -1.0;\n if ((uShape == SHAPE_ARC || uShape == SHAPE_DOME) &&\n uArcFadingDistance[0] > 0.0 &&\n uArcFadingDistance[1] > 0.0 &&\n (!uNoFadingOnPointSelection || !isDatumSelected()))\n {\n vFadeDistance = distanceFromLine(p1, p4, p);\n // Keep fully faded triangles collapsed to avoid fragment processing.\n if (1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance) <= 0.0) {\n vNormalLengthInPixels = 0.0;\n }\n }\n\n // Extrude\n p += normal * vNormalLengthInPixels;\n\n gl_Position = pixelsToNdc(p);\n\n vec3 color = getScaled_color();\n\n vColor = vec4(color * opacity, opacity);\n\n vGamma = getGammaForColor(color);\n\n vSize = paddedSize;\n\n setupPicking();\n}\n", Bc = "flat in vec4 vColor;\nflat in float vSize;\nin float vNormalLengthInPixels;\nflat in float vGamma;\nin float vFadeDistance;\n\nout lowp vec4 fragColor;\n\nvoid main(void) {\n float dpr = uDevicePixelRatio;\n\n float distance = abs(vNormalLengthInPixels);\n float opacity = clamp(((vSize / 2.0 - distance) * dpr), 0.0, 1.0);\n\n opacity = pow(opacity, vGamma);\n\n if (vFadeDistance >= 0.0) {\n opacity *= 1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance);\n }\n if (opacity <= 0.0) {\n discard;\n }\n\n fragColor = vColor * opacity;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", Vc = "layout(std140) uniform Mark {\n uniform float uArcHeightFactor;\n\n /** Make very small arcs visible */\n uniform float uMinArcHeight;\n\n /** The minimum stroke width in pixels when rendering into the picking buffer */\n uniform float uMinPickingSize;\n\n uniform int uShape;\n uniform int uOrient;\n uniform bool uClampApex;\n\n // In pixels\n uniform float uMaxChordLength;\n // In pixels\n uniform vec2 uArcFadingDistance;\n uniform bool uNoFadingOnPointSelection;\n\n uniform int uSegmentBreaks;\n\n#pragma markUniforms\n};\n", Hc = [
|
|
3550
|
+
var Uc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\n/** The distance from the line center to the direction of normal in pixels */\nout float vNormalLengthInPixels;\n\nflat out float vGamma;\n\n// Centerline distance from the rendered endpoint baseline; negative disables fading.\nout float vFadeDistance;\n\nconst int SHAPE_ARC = 0;\nconst int SHAPE_DOME = 1;\nconst int SHAPE_DIAGONAL = 2;\nconst int SHAPE_LINE = 3;\nconst int ORIENT_VERTICAL = 0;\nconst int ORIENT_HORIZONTAL = 1;\n\nfloat distanceFromLine(vec2 pointOnLine1, vec2 pointOnLine2, vec2 point) {\n vec2 a = point - pointOnLine1;\n vec2 b = pointOnLine2 - pointOnLine1;\n vec2 proj = dot(a, b) / dot(b, b) * b;\n return length(a - proj);\n}\n\nbool isInsideViewport(vec2 point, float marginFactor) {\n vec2 margin = uViewportSize * vec2(marginFactor);\n return point.x >= -margin.x\n && point.x <= uViewportSize.x + margin.x\n && point.y >= -margin.y\n && point.y <= uViewportSize.y + margin.y;\n}\n\nfloat inverseSmoothstep(float t) {\n t = clamp(t, 0.0, 1.0);\n // The chord-axis coordinate of ARC/DOME follows the smoothstep curve.\n return 0.5 - sin(asin(1.0 - 2.0 * t) / 3.0);\n}\n\n/**\n * Remaps the parameter t to concentrate vertices to the part that is visible in the viewport.\n * This keeps the tightly bent endpoints smooth even when zooming in very close.\n */\nfloat remapVisibleChordParameter(\n float stripT,\n float chordStart,\n float chordEnd,\n float viewportLength\n) {\n // Concentrate samples in the viewport-visible chord interval without dropping the rest.\n float chordMin = min(chordStart, chordEnd);\n float chordMax = max(chordStart, chordEnd);\n float chordSpan = chordMax - chordMin;\n\n if (chordSpan <= 0.0) {\n return 0.0;\n }\n\n float visibleChordMin = max(chordMin, 0.0);\n float visibleChordMax = min(chordMax, viewportLength);\n\n if (visibleChordMax <= visibleChordMin) {\n return stripT;\n }\n\n float visibleTMin = inverseSmoothstep((visibleChordMin - chordMin) / chordSpan);\n float visibleTMax = inverseSmoothstep((visibleChordMax - chordMin) / chordSpan);\n float visibleTSpan = visibleTMax - visibleTMin;\n float offscreenTSpan = visibleTMin + (1.0 - visibleTMax);\n\n if (offscreenTSpan <= 0.0) {\n return stripT;\n }\n\n float visibleShare = clamp(0.75 + (1.0 - visibleTSpan) * 0.2, 0.75, 0.95);\n float offscreenShare = 1.0 - visibleShare;\n float leftShare = offscreenShare * visibleTMin / offscreenTSpan;\n float rightShare = offscreenShare * (1.0 - visibleTMax) / offscreenTSpan;\n\n if (stripT <= leftShare) {\n return leftShare > 0.0 ? mix(0.0, visibleTMin, stripT / leftShare) : visibleTMin;\n }\n\n float visibleStart = leftShare;\n float visibleEnd = visibleStart + visibleShare;\n\n if (stripT <= visibleEnd) {\n return visibleShare > 0.0\n ? mix(visibleTMin, visibleTMax, (stripT - visibleStart) / visibleShare)\n : visibleTMin;\n }\n\n return rightShare > 0.0\n ? mix(visibleTMax, 1.0, (stripT - visibleEnd) / rightShare)\n : visibleTMax;\n}\n\nvoid clampChordToViewport(inout vec2 p1, inout vec2 p4, inout float chordLength) {\n if (chordLength > uMaxChordLength) {\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n\n if (isInsideViewport(p1, 2.0)) {\n chordLength = uMaxChordLength;\n p4 = p1 + unitChordVector * uMaxChordLength;\n } else if (isInsideViewport(p4, 2.0)) {\n chordLength = uMaxChordLength;\n p1 = p4 - unitChordVector * uMaxChordLength;\n }\n }\n}\n\nvoid clampDomeApex(inout vec2 p1, inout vec2 p4, int orient) {\n if (orient == ORIENT_VERTICAL) {\n if (p4.x > 0.0) {\n p1.x = max(p1.x, -p4.x);\n }\n if (p1.x < uViewportSize.x) {\n p4.x = min(p4.x, 2.0 * uViewportSize.x - p1.x);\n }\n } else {\n if (p4.y > 0.0) {\n p1.y = max(p1.y, -p4.y);\n }\n if (p1.y < uViewportSize.y) {\n p4.y = min(p4.y, 2.0 * uViewportSize.y - p1.y);\n }\n }\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n float pixelSize = 1.0 / uDevicePixelRatio;\n float opacity = getScaled_opacity() * uViewOpacity;\n\n // The bezier's control points\n vec2 p1, p2, p3, p4;\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n ) * uViewportSize;\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n ) * uViewportSize;\n\n if (uShape <= SHAPE_DOME) {\n if (uShape == SHAPE_DOME) {\n vec2 height = vec2(0.0);\n if (uOrient == ORIENT_VERTICAL) {\n p1 = vec2(min(a.x, b.x), b.y);\n p4 = vec2(max(a.x, b.x), b.y);\n height = vec2(0.0, a.y - b.y);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_VERTICAL);\n }\n\n } else {\n p1 = vec2(b.x, min(a.y, b.y));\n p4 = vec2(b.x, max(a.y, b.y));\n height = vec2(a.x - b.x, 0.0);\n\n float chordLength = length(p4 - p1);\n clampChordToViewport(p1, p4, chordLength);\n if (uClampApex) {\n clampDomeApex(p1, p4, ORIENT_HORIZONTAL);\n }\n }\n\n vec2 controlOffset = height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n\n } if (uShape == SHAPE_ARC) {\n p1 = a;\n p4 = b;\n\n vec2 chordVector = p4 - p1;\n vec2 unitChordVector = normalize(chordVector);\n vec2 chordNormal = vec2(-unitChordVector.y, unitChordVector.x);\n float chordLength = length(chordVector);\n clampChordToViewport(p1, p4, chordLength);\n\n float height = max(\n chordLength / 2.0 * uArcHeightFactor,\n uMinArcHeight\n );\n\n // This is a bit poor approximation of a circular arc, but it's probably enough for most purposes.\n // TODO: Consider a more sophisticated approach: https://stackoverflow.com/a/44829356/1547896\n vec2 controlOffset = chordNormal * height / 0.75;\n p2 = p1 + controlOffset;\n p3 = p4 + controlOffset;\n }\n\n } else if (uShape == SHAPE_DIAGONAL) {\n if (uOrient == ORIENT_VERTICAL) {\n p1 = a;\n p2 = vec2(a.x, (a.y + b.y) / 2.0);\n p3 = vec2(b.x, (a.y + b.y) / 2.0);\n p4 = b;\n } else {\n p1 = a;\n p2 = vec2((a.x + b.x) / 2.0, a.y);\n p3 = vec2((a.x + b.x) / 2.0, b.y);\n p4 = b;\n }\n } else if (uShape == SHAPE_LINE) {\n p1 = a;\n p2 = (a + b) / 2.0;\n p3 = p2;\n p4 = b;\n }\n\n vec2 strip = vec2(\n float(gl_VertexID / 2) / float(uSegmentBreaks),\n float(gl_VertexID % 2) - 0.5\n );\n\n float t = strip.x;\n\n if (uShape == SHAPE_DOME) {\n if (uOrient == ORIENT_VERTICAL) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n } else if (uShape == SHAPE_ARC) {\n if (a.y == b.y) {\n t = remapVisibleChordParameter(strip.x, p1.x, p4.x, uViewportSize.x);\n } else if (a.x == b.x) {\n t = remapVisibleChordParameter(strip.x, p1.y, p4.y, uViewportSize.y);\n }\n }\n\n vec2 p;\n vec2 tangent;\n\n // de Casteljau evaluation keeps the cubic stable for long chords.\n vec2 q1 = mix(p1, p2, t);\n vec2 q2 = mix(p2, p3, t);\n vec2 q3 = mix(p3, p4, t);\n\n vec2 r1 = mix(q1, q2, t);\n vec2 r2 = mix(q2, q3, t);\n\n p = mix(r1, r2, t);\n tangent = 3.0 * (r2 - r1);\n\n tangent = normalize(tangent);\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n float size = getScaled_size();\n\n // Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively\n if (size < pixelSize) {\n opacity *= size / pixelSize;\n size = pixelSize;\n }\n\n // Handle minimum picking size or add an extra pixel to the stroke width to accommodate edge antialiasing\n float paddedSize = uPickingEnabled\n ? max(size, uMinPickingSize)\n : size + pixelSize;\n\n vNormalLengthInPixels = strip.y * paddedSize;\n \n vFadeDistance = -1.0;\n if ((uShape == SHAPE_ARC || uShape == SHAPE_DOME) &&\n uArcFadingDistance[0] > 0.0 &&\n uArcFadingDistance[1] > 0.0\n#ifdef CONDITIONAL_ORDER\n && (!uNoFadingOnSecondPass || (uOrderMode & 4) == 0)\n#endif\n )\n {\n vFadeDistance = distanceFromLine(p1, p4, p);\n // Keep fully faded triangles collapsed to avoid fragment processing.\n if (1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance) <= 0.0) {\n vNormalLengthInPixels = 0.0;\n }\n }\n\n // Extrude\n p += normal * vNormalLengthInPixels;\n\n gl_Position = pixelsToNdc(p);\n\n vec3 color = getScaled_color();\n\n vColor = vec4(color * opacity, opacity);\n\n vGamma = getGammaForColor(color);\n\n vSize = paddedSize;\n\n setupPicking();\n}\n", Wc = "flat in vec4 vColor;\nflat in float vSize;\nin float vNormalLengthInPixels;\nflat in float vGamma;\nin float vFadeDistance;\n\nout lowp vec4 fragColor;\n\nvoid main(void) {\n float dpr = uDevicePixelRatio;\n\n float distance = abs(vNormalLengthInPixels);\n float opacity = clamp(((vSize / 2.0 - distance) * dpr), 0.0, 1.0);\n\n opacity = pow(opacity, vGamma);\n\n if (vFadeDistance >= 0.0) {\n opacity *= 1.0 - smoothstep(uArcFadingDistance[0], uArcFadingDistance[1], vFadeDistance);\n }\n if (opacity <= 0.0) {\n discard;\n }\n\n fragColor = vColor * opacity;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", Gc = "layout(std140) uniform Mark {\n uniform float uArcHeightFactor;\n\n /** Make very small arcs visible */\n uniform float uMinArcHeight;\n\n /** The minimum stroke width in pixels when rendering into the picking buffer */\n uniform float uMinPickingSize;\n\n uniform int uShape;\n uniform int uOrient;\n uniform bool uClampApex;\n\n // In pixels\n uniform float uMaxChordLength;\n // In pixels\n uniform vec2 uArcFadingDistance;\n uniform bool uNoFadingOnSecondPass;\n\n uniform int uSegmentBreaks;\n\n#pragma markUniforms\n};\n", Kc = [
|
|
3519
3551
|
"arc",
|
|
3520
3552
|
"dome",
|
|
3521
3553
|
"diagonal",
|
|
3522
3554
|
"line"
|
|
3523
|
-
],
|
|
3555
|
+
], qc = ["vertical", "horizontal"], Jc = class extends kc {
|
|
3524
3556
|
constructor(e, t, n) {
|
|
3525
3557
|
super(e, t, n), this._baseInstanceExt = void 0;
|
|
3526
3558
|
}
|
|
@@ -3542,15 +3574,15 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3542
3574
|
];
|
|
3543
3575
|
}
|
|
3544
3576
|
initializeGraphics() {
|
|
3545
|
-
super.initializeGraphics(), this._baseInstanceExt = this.gl.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"), this.createAndLinkShaders(
|
|
3577
|
+
super.initializeGraphics(), this._baseInstanceExt = this.gl.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"), this.createAndLinkShaders(Uc, Wc, [Gc]);
|
|
3546
3578
|
}
|
|
3547
3579
|
finalizeGraphicsInitialization() {
|
|
3548
3580
|
super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
|
|
3549
3581
|
let e = this.properties;
|
|
3550
|
-
this.registerMarkUniformValue("uArcFadingDistance", e.arcFadingDistance, (e) => e || [0, 0]), this.registerMarkUniformValue("uArcHeightFactor", e.arcHeightFactor), this.registerMarkUniformValue("uMinArcHeight", e.minArcHeight), this.registerMarkUniformValue("uMinPickingSize", e.minPickingSize), this.registerMarkUniformValue("uShape", e.linkShape, (e) =>
|
|
3582
|
+
this.registerMarkUniformValue("uArcFadingDistance", e.arcFadingDistance, (e) => e || [0, 0]), this.registerMarkUniformValue("uArcHeightFactor", e.arcHeightFactor), this.registerMarkUniformValue("uMinArcHeight", e.minArcHeight), this.registerMarkUniformValue("uMinPickingSize", e.minPickingSize), this.registerMarkUniformValue("uShape", e.linkShape, (e) => Kc.indexOf(e)), this.registerMarkUniformValue("uOrient", e.orient, (e) => qc.indexOf(e)), this.registerMarkUniformValue("uClampApex", e.clampApex, (e) => !!e), this.registerMarkUniformValue("uMaxChordLength", e.maxChordLength), this.registerMarkUniformValue("uSegmentBreaks", e.segments, (e) => e), this.registerMarkUniformValue("uNoFadingOnSecondPass", e.noFadingOnSecondPass, (e) => !!e);
|
|
3551
3583
|
}
|
|
3552
3584
|
updateGraphicsData(e) {
|
|
3553
|
-
let t = e.getItemCount(), n = new
|
|
3585
|
+
let t = e.getItemCount(), n = new _c({
|
|
3554
3586
|
encoders: this.encoders,
|
|
3555
3587
|
attributes: this.getAttributes(),
|
|
3556
3588
|
numItems: t
|
|
@@ -3578,7 +3610,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3578
3610
|
Y(t, this.programInfo, this.bufferInfo), t.drawArraysInstanced(t.TRIANGLE_STRIP, 0, n(), r);
|
|
3579
3611
|
}, e);
|
|
3580
3612
|
}
|
|
3581
|
-
},
|
|
3613
|
+
}, Yc = "flat out float vRadius;\nflat out float vRadiusWithPadding;\nflat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out lowp float vShape;\nflat out lowp float vHalfStrokeWidth;\nflat out mat2 vRotationMatrix;\n\n// Copypaste from fragment shader\nconst float CIRCLE = 0.0;\nconst float SQUARE = 1.0;\nconst float CROSS = 2.0;\nconst float DIAMOND = 3.0;\nconst float TRIANGLE_UP = 4.0;\nconst float TRIANGLE_RIGHT = 5.0;\nconst float TRIANGLE_DOWN = 6.0;\nconst float TRIANGLE_LEFT = 7.0;\nconst float TICK_UP = 8.0;\nconst float TICK_RIGHT = 9.0;\nconst float TICK_DOWN = 10.0;\nconst float TICK_LEFT = 11.0;\nconst float X = 12.0;\nconst float PLUS = 13.0;\n\nfloat computeSemanticThresholdFactor() {\n // TODO: add smooth transition\n return getScaled_semanticScore() >= uSemanticThreshold ? 1.0 : 0.0;\n}\n\n// TODO: Move this into common.glsl or something\nvec2 getDxDy() {\n#if defined(dx_DEFINED) || defined(dy_DEFINED)\n return vec2(getScaled_dx(), getScaled_dy()) / uViewportSize;\n#else\n return vec2(0.0, 0.0);\n#endif\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n float shapeAngle = 0.0;\n\n // Selected points should always be visible\n float semanticThresholdFactor = isDatumSelected()\n ? 1.0\n : computeSemanticThresholdFactor();\n\n if (semanticThresholdFactor <= 0.0) {\n gl_PointSize = 0.0;\n // Place the vertex outside the viewport. The default (0, 0) makes this super-slow\n // on Apple Silicon. Probably related to the tile-based GPU architecture.\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n // Exit early. MAY prevent some unnecessary calculations.\n return;\n }\n\n float size = getScaled_size();\n vec2 pos = vec2(getScaled_x(), getScaled_y()) + getDxDy();\n vec2 facetedPos = applyOffset(\n applySampleFacet(pos),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n\n#ifdef VISIBLE_RANGE_CULLING\n if (isOutsideVisibleRange(facetedPos)) {\n gl_PointSize = 0.0;\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }\n#endif\n\n gl_Position = unitToNdc(facetedPos);\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity();\n vShape = getScaled_shape();\n\n // Line-only shapes use their width even when the stroke falls back to the\n // fill color. An invisible stroke must not inset other filled shapes.\n if (strokeOpacity <= 0.0 && vShape != X && vShape != PLUS) {\n strokeWidth = 0.0;\n }\n\n float diameter = sqrt(size) *\n uScaleFactor *\n semanticThresholdFactor;\n\n // Clamp minimum size and adjust opacity instead. Yields more pleasing result,\n // no flickering etc.\n float opacity = uViewOpacity;\n if (strokeWidth <= 0.0 || uInwardStroke) {\n float minDiameter = 1.0 / uDevicePixelRatio;\n if (diameter < minDiameter) {\n // We do some \"cheap\" gamma correction here. It breaks on dark background, though.\n // First we take a square of the size and then apply \"gamma\" of 1.5.\n opacity *= pow(diameter / minDiameter, 2.5);\n diameter = minDiameter;\n }\n }\n\n float fillOpa = getScaled_fillOpacity() * opacity;\n float strokeOpa = strokeOpacity * opacity;\n\n // Circle doesn't have sharp corners. Do some special optimizations to minimize the point size.\n bool circle = vShape == 0.0;\n\n if (vShape > TICK_UP && vShape <= TICK_LEFT) {\n shapeAngle = (vShape - TICK_UP) * 90.0;\n vShape = TICK_UP;\n } else if (vShape > TRIANGLE_UP && vShape <= TRIANGLE_LEFT) {\n shapeAngle = (vShape - TRIANGLE_UP) * 90.0;\n vShape = TRIANGLE_UP;\n } else if (vShape == X) {\n // The x shape reuses the perpendicular stroke geometry of plus.\n shapeAngle = -45.0;\n }\n\n float angleInDegrees = getScaled_angle();\n float angle = -(shapeAngle + angleInDegrees) * PI / 180.0;\n float sinTheta = sin(angle);\n float cosTheta = cos(angle);\n vRotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\n // Not needed if we would draw rotated quads instead of gl.POINTS\n float roomForRotation = circle ? 1.0 : sin(mod(angle, PI / 2.0) + PI / 4.0) / sin(PI / 4.0);\n\n float aaPadding = 1.0 / uDevicePixelRatio;\n float rotationPadding = (diameter * roomForRotation) - diameter;\n // sqrt(3.0) ensures that the angles of equilateral triangles have enough room\n float strokePadding = uInwardStroke ? 0.0 : strokeWidth * (circle ? 1.0 : sqrt(3.0));\n float padding = rotationPadding + strokePadding + aaPadding;\n\n gl_PointSize = max(\n (diameter + padding),\n uPickingEnabled ? uMinPickingSize : 0.0\n ) * uDevicePixelRatio;\n\n vRadius = diameter / 2.0;\n vRadiusWithPadding = vRadius + padding / 2.0;\n\n vHalfStrokeWidth = strokeWidth / 2.0;\n\n vFillColor = vec4(getScaled_fill() * fillOpa, fillOpa);\n vStrokeColor = vec4(getScaled_stroke() * strokeOpa, strokeOpa);\n\n setupPicking();\n}\n", Xc = "const lowp vec4 white = vec4(1.0);\nconst lowp vec4 black = vec4(0.0, 0.0, 0.0, 1.0);\n\nflat in float vRadius;\nflat in float vRadiusWithPadding;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in lowp float vShape;\nflat in lowp float vHalfStrokeWidth;\n\nflat in mat2 vRotationMatrix;\n\nout lowp vec4 fragColor;\n\n// Copypaste from vertex shader\nconst float CIRCLE = 0.0;\nconst float SQUARE = 1.0;\nconst float CROSS = 2.0;\nconst float DIAMOND = 3.0;\nconst float TRIANGLE_UP = 4.0;\nconst float TICK_UP = 8.0;\nconst float X = 12.0;\nconst float PLUS = 13.0;\n\n// The distance functions are inspired by:\n// http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\n// However, these are not true distance functions, because the corners need to be sharp.\n\nfloat circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat square(vec2 p, float r) {\n p = abs(p);\n return max(p.x, p.y) - r;\n}\n\nfloat tickUp(vec2 p, float r) {\n float halfR = r * 0.5;\n p.y += halfR;\n p = abs(p);\n return max(p.x - r * 0.15, p.y - halfR);\n}\n\nfloat equilateralTriangle(vec2 p, float r) {\n p.y = -p.y;\n float k = sqrt(3.0);\n float kr = k * r;\n p.y -= kr / 2.0;\n return max((abs(p.x) * k + p.y) / 2.0, -p.y - kr);\n}\n\nfloat crossShape(vec2 p, float r, float armHalfWidth) {\n p = abs(p);\n\n vec2 b = vec2(armHalfWidth, r);\n vec2 v = abs(p) - b.xy;\n vec2 h = abs(p) - b.yx;\n return min(max(v.x, v.y), max(h.x, h.y));\n}\n\nfloat diamond(vec2 p, float r) {\n p = abs(p);\n return (max(abs(p.x - p.y), abs(p.x + p.y)) - r) / sqrt(2.0);\n}\n\nvoid main() {\n float d;\n bool lineShape = false;\n\n /** Normalized point coord */\n vec2 p = vRotationMatrix * (2.0 * gl_PointCoord - 1.0) * vRadiusWithPadding;\n float r = vRadius;\n\n // We could also use textures here. Could even be faster, because we have plenty of branching here.\n if (vShape == CIRCLE) {\n d = circle(p, r);\n\n } else if (vShape == SQUARE) {\n d = square(p, r);\n\n } else if (vShape == CROSS) {\n d = crossShape(p, r, r * 0.4);\n\n } else if (vShape == DIAMOND) {\n d = diamond(p, r);\n\n } else if (vShape == TRIANGLE_UP) {\n d = equilateralTriangle(p, r);\n\n } else if (vShape == TICK_UP) {\n d = tickUp(p, r);\n\n } else if (vShape == X || vShape == PLUS) {\n float lineLength = vShape == X ? r * sqrt(2.0) : r;\n d = crossShape(p, lineLength, vHalfStrokeWidth);\n lineShape = true;\n\n } else {\n d = 0.0;\n }\n\n if (!uPickingEnabled) {\n lowp vec4 fillColor = lineShape\n ? (vStrokeColor.a > 0.0 ? vStrokeColor : vFillColor)\n : mix(vFillColor, white, -d * uGradientStrength / vRadius);\n\n fragColor = distanceToColor(\n d + (!lineShape && uInwardStroke ? vHalfStrokeWidth : 0.0),\n fillColor,\n vStrokeColor,\n vec4(0.0),\n lineShape ? 0.0 : vHalfStrokeWidth);\n\n } else if (d - (lineShape ? 0.0 : vHalfStrokeWidth) <= 0.0) {\n fragColor = vPickingColor;\n\n } else {\n discard;\n }\n}\n", Zc = "layout(std140) uniform Mark {\n /**\n * The stroke should only grow inwards, e.g, the diameter/outline is not affected by the stroke width.\n * Thus, a point that has a zero size has no visible stroke. This allows strokes to be used with\n * geometric zoom, etc.\n */\n uniform bool uInwardStroke;\n\n /** The minimum point size in pixels when rendering into the picking buffer */\n uniform float uMinPickingSize;\n\n /** Scale factor for geometric zoom */\n uniform mediump float uScaleFactor;\n\n uniform mediump float uZoomLevel;\n uniform highp float uSemanticThreshold;\n\n uniform mediump float uGradientStrength;\n\n#pragma markUniforms\n};\n", Qc = class extends kc {
|
|
3582
3614
|
getAttributes() {
|
|
3583
3615
|
return [
|
|
3584
3616
|
"uniqueId",
|
|
@@ -3601,7 +3633,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3601
3633
|
];
|
|
3602
3634
|
}
|
|
3603
3635
|
initializeGraphics() {
|
|
3604
|
-
super.initializeGraphics(), this.createAndLinkShaders(
|
|
3636
|
+
super.initializeGraphics(), this.createAndLinkShaders(Yc, Xc, [Zc]);
|
|
3605
3637
|
}
|
|
3606
3638
|
finalizeGraphicsInitialization() {
|
|
3607
3639
|
super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
|
|
@@ -3609,7 +3641,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3609
3641
|
this.registerMarkUniformValue("uInwardStroke", e.inwardStroke, (e) => !!e), this.registerMarkUniformValue("uGradientStrength", e.fillGradientStrength), this.registerMarkUniformValue("uMinPickingSize", e.minPickingSize);
|
|
3610
3642
|
}
|
|
3611
3643
|
updateGraphicsData(e) {
|
|
3612
|
-
let t = e.getItemCount(), n = new
|
|
3644
|
+
let t = e.getItemCount(), n = new gc({
|
|
3613
3645
|
encoders: this.encoders,
|
|
3614
3646
|
attributes: this.getAttributes(),
|
|
3615
3647
|
numItems: t
|
|
@@ -3625,7 +3657,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3625
3657
|
prepareRender(e) {
|
|
3626
3658
|
let t = super.prepareRender(e);
|
|
3627
3659
|
return t.push(() => {
|
|
3628
|
-
|
|
3660
|
+
$a(this.markUniformInfo, {
|
|
3629
3661
|
uScaleFactor: this.#e(),
|
|
3630
3662
|
uSemanticThreshold: this.mark.getSemanticThreshold()
|
|
3631
3663
|
}), this.markUniformsAltered = !0;
|
|
@@ -3634,10 +3666,10 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3634
3666
|
render(e) {
|
|
3635
3667
|
let t = this.gl;
|
|
3636
3668
|
return this.createRenderCallback((e, n) => {
|
|
3637
|
-
n &&
|
|
3669
|
+
n && oo(t, this.vertexArrayInfo, t.POINTS, n, e);
|
|
3638
3670
|
}, e);
|
|
3639
3671
|
}
|
|
3640
|
-
}, Yc = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out vec4 vCornerRadii;\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n/** Position for SDF-strokes */\nout vec2 vPosInPixels;\n#endif\n\n/** Size of the rect in pixels */\nflat out vec2 vHalfSizeInPixels;\n\n/**\n * Adjusts the vertex position to ensure that the rectangle is at least `minSpan`\n * wide or high. Returns a value that reflects the amount of clamping and can be\n * used to adjust the opacity of the rectangle.\n *\n * pos: vertex position\n * frac: vertex position within the rectangle, [0, 1]\n * size: width or height of the rectangle\n * minSize: minimum width or height of the rectangle\n */\nfloat clampMinSize(inout float pos, float frac, float size, float minSize) {\n if (minSize > 0.0 && size < minSize) {\n pos += (frac - 0.5) * (minSize - size);\n return size / minSize;\n }\n\n return 1.0;\n}\n\nvoid sort(inout float a, inout float b) {\n if (a > b) {\n float tmp = b;\n b = a;\n a = tmp;\n }\n}\n\n/**\n * The vertex position wrt the rectangle specified by (x, x2, y, y2).\n * [0, 0] = [x, y], [1, 1] = [x2, y2]. \n * The x or y component may contain fractional values if the rectangle \n * have been tessellated.\n */\nvec2 getVertexPos() {\n int index = gl_VertexID % 6;\n return vec2(\n index == 0 || index == 1 || index == 3 ? 0.0 : 1.0,\n index == 0 || index == 1 || index == 2 ? 0.0 : 1.0\n );\n \n}\n\nvoid main(void) {\n vec2 frac = getVertexPos();\n\n vec2 normalizedMinSize = vec2(uMinWidth, uMinHeight) / uViewportSize;\n vec4 cornerRadii = vec4(\n uCornerRadiusTopRight,\n uCornerRadiusBottomRight,\n uCornerRadiusTopLeft,\n uCornerRadiusBottomLeft\n );\n\n SampleFacetPosition sampleFacetPos = getSampleFacetPos();\n if (sampleFacetPos.height == 0.0) {\n // Filtered samples have no facet height. Cull them before minimum-size\n // clamping can expand their rectangles at the viewport boundary.\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }\n\n vec2 pos1 = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 pos2 = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n\n sort(pos1.x, pos2.x);\n sort(pos1.y, pos2.y);\n\n // Clamp x to prevent precision artifacts when the scale is zoomed very close.\n // TODO: clamp y as well\n float clampMargin = 1.0;\n pos1.x = clamp(pos1.x, 0.0 - clampMargin, 1.0 + clampMargin);\n pos2.x = clamp(pos2.x, 0.0 - clampMargin, 1.0 + clampMargin);\n\n vec2 size = pos2 - pos1;\n\n if (size.x < 0.0 || size.y < 0.0) {\n // Keep zero-sized rects alive so min-size clamping can stabilize them.\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n vec2 pos = pos1 + frac * size;\n\n // Clamp to minimum size, optionally compensate with opacity\n float opaFactor = uViewOpacity * max(uMinOpacity,\n clampMinSize(pos.x, frac.x, size.x, normalizedMinSize.x) *\n clampMinSize(pos.y, frac.y, size.y, normalizedMinSize.y));\n\n size = max(size, normalizedMinSize);\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n // Add an extra pixel to the stroke width to accommodate edge antialiasing\n float aaPadding = 1.0 / uDevicePixelRatio;\n\n // TODO: Only expand to the offset direction. Now high offsets result in\n // a large expansion in all directions.\n float shadowPadding = uShadowBlur + max(abs(uShadowOffsetX), abs(uShadowOffsetY));\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * opaFactor;\n\n vec2 centeredFrac = frac - 0.5;\n vec2 expand = centeredFrac * (strokeWidth + aaPadding + shadowPadding * 2.0) / uViewportSize;\n pos += expand;\n\n vec2 sizeInPixels = size * uViewportSize;\n vPosInPixels = (centeredFrac + expand / size) * sizeInPixels;\n\n vHalfSizeInPixels = sizeInPixels / 2.0;\n\n vCornerRadii = min(cornerRadii, min(vHalfSizeInPixels.x, vHalfSizeInPixels.y));\n vHalfStrokeWidth = strokeWidth / 2.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n#endif\n\n gl_Position = unitToNdc(pos);\n\n float fillOpacity = getScaled_fillOpacity() * opaFactor;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", Xc = "#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\nin vec2 vPosInPixels;\n#endif\n\nflat in vec2 vHalfSizeInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in vec4 vCornerRadii;\n\nout lowp vec4 fragColor;\n\n// ----------------------------------------------------------------------------\n// Shadow source: https://madebyevan.com/shaders/fast-rounded-rectangle-shadows/\n// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)\n\n#ifdef SHADOW\n\n// A standard gaussian function, used for weighting samples\nfloat gaussian(float x, float sigma) {\n const float pi = 3.141592653589793;\n return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma);\n}\n\n// This approximates the error function, needed for the gaussian integral\nvec2 erf(vec2 x) {\n vec2 s = sign(x), a = abs(x);\n x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a;\n x *= x;\n return s - s / (x * x);\n}\n\n// Return the blurred mask along the x dimension\nfloat roundedBoxShadowX(float x, float y, float sigma, float corner, vec2 halfSize) {\n float delta = min(halfSize.y - corner - abs(y), 0.0);\n float curved = halfSize.x - corner + sqrt(max(0.0, corner * corner - delta * delta));\n vec2 integral = 0.5 + 0.5 * erf((x + vec2(-curved, curved)) * (sqrt(0.5) / sigma));\n return integral.y - integral.x;\n}\n\n// Return the mask for the shadow of a box from lower to upper\nfloat roundedBoxShadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) {\n // Center everything to make the math easier\n vec2 center = (lower + upper) * 0.5;\n vec2 halfSize = (upper - lower) * 0.5;\n point -= center;\n\n // The signal is only non-zero in a limited range, so don't waste samples\n float low = point.y - halfSize.y;\n float high = point.y + halfSize.y;\n float start = clamp(-3.0 * sigma, low, high);\n float end = clamp(3.0 * sigma, low, high);\n\n // Accumulate samples (we can get away with surprisingly few samples)\n float step = (end - start) / 4.0;\n float y = start + step * 0.5;\n float value = 0.0;\n for (int i = 0; i < 4; i++) {\n value += roundedBoxShadowX(point.x, point.y - y, sigma, corner, halfSize) * gaussian(y, sigma) * step;\n y += step;\n }\n\n return value;\n}\n\n// ----------------------------------------------------------------------------\n\n#endif\n\n// Source: https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\nfloat sdRoundedBox(vec2 p, vec2 b, vec4 r) {\n r.xy = p.x > 0.0 ? r.xy : r.zw;\n r.x = p.y > 0.0 ? r.x : r.y;\n vec2 q = abs(p) - b + r.x;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;\n}\n\n// Not a true SDF. Makes the corners of strokes sharp and is faster.\nfloat sdSharpBox(vec2 p, vec2 b) {\n vec2 q = abs(p) - b;\n return max(q.x, q.y);\n}\n\nfloat diagonalPattern(vec2 uv, float spacing) {\n // Using 1.5 to approximate sqrt(2.0) to reduce aliasing artifacts.\n float divisor = spacing * vHalfStrokeWidth * 2.0 * 1.5;\n return abs(mod(uv.x - uv.y, divisor) - 0.5 * divisor) / 1.5;\n}\n\nfloat verticalPattern(float x, float spacing) {\n float divisor = spacing * vHalfStrokeWidth * 2.0;\n return abs(mod(x, divisor)) / 2.0;\n}\n\nfloat circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat masonryCirclePattern(vec2 uv, float spacing, float radius) {\n float halfSpacing = 0.5 * spacing;\n\n float row = floor(uv.y / spacing);\n float shift = mod(row, 2.0) * halfSpacing;\n\n vec2 shifted = vec2(uv.x + shift, uv.y + halfSpacing);\n vec2 cell = mod(shifted + 0.5 * spacing, spacing) - halfSpacing;\n\n return abs(circle(cell, radius));\n}\n\n/**\n * Patterns:\n * 0 none\n * 1 diagonal (/)\n * 2 antiDiagonal (\\)\n * 3 cross (X)\n * 4 vertical (|)\n * 5 horizontal (-)\n * 6 grid (+)\n * 7 dots (.)\n * 8 rings (o)\n * 9 ringsLarge (O)\n */\nfloat pattern() {\n#ifdef STROKED\n int patternType = uHatchPattern;\n vec2 uv = vPosInPixels;\n float spacing = 4.0;\n\n switch (patternType) {\n case 1:\n return diagonalPattern(vec2(uv.x, -uv.y), spacing);\n case 2:\n return diagonalPattern(uv, spacing);\n case 3:\n return min(\n diagonalPattern(uv, spacing),\n diagonalPattern(vec2(uv.x, -uv.y), spacing)\n );\n case 4:\n return verticalPattern(uv.x, spacing);\n case 5:\n return verticalPattern(uv.y, spacing);\n case 6:\n return min(\n verticalPattern(uv.x, spacing),\n verticalPattern(uv.y, spacing)\n );\n case 7:\n case 8:\n case 9: {\n float spacing = vHalfStrokeWidth * 14.0;\n float radius = spacing * (\n patternType == 8 ? 0.2 :\n patternType == 9 ? 0.35 :\n 0.07\n );\n return masonryCirclePattern(uv, spacing, radius);\n }\n default:\n break;\n }\n#endif\n return 1.0 / 0.0; // Infinity\n}\n\nvoid main(void) {\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n#ifdef ROUNDED_CORNERS\n // Distance from rectangle's edge in pixels. Negative inside the rectangle.\n float d = sdRoundedBox(vPosInPixels, vHalfSizeInPixels, vCornerRadii);\n#else\n float d = sdSharpBox(vPosInPixels, vHalfSizeInPixels);\n#endif\n\n vec4 backgroundColor = vec4(0.0, 0.0, 0.0, 0.0);\n\n#ifdef SHADOW\n float maxCornerRadius = max(vCornerRadii.x, max(vCornerRadii.y, max(vCornerRadii.z, vCornerRadii.w)));\n\n float shadow = 0.0;\n // Only calculate shadow for the region outside the stroke.\n if (d >= vHalfStrokeWidth - 1.0 && uShadowOpacity > 0.0) {\n shadow = roundedBoxShadow(\n -vHalfSizeInPixels - vHalfStrokeWidth,\n vHalfSizeInPixels + vHalfStrokeWidth,\n vPosInPixels - vec2(uShadowOffsetX, -uShadowOffsetY),\n max(uShadowBlur / 2.5, 0.25),\n maxCornerRadius + vHalfStrokeWidth\n ) * uShadowOpacity * uViewOpacity;\n }\n backgroundColor = vec4(uShadowColor * shadow, shadow);\n#endif\n\n if (vHalfStrokeWidth > 0.0 && uHatchPattern > 0) {\n d = max(d, -pattern());\n }\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n backgroundColor,\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n#else\n // The trivial, non-decorated case\n fragColor = vFillColor;\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n#endif\n}\n", Zc = "layout(std140) uniform Mark {\n /** Minimum size (width, height) of the displayed rectangle in pixels */\n uniform float uMinWidth;\n uniform float uMinHeight;\n\n /** Minimum opacity for the size clamping */\n uniform float uMinOpacity;\n\n uniform float uCornerRadiusTopRight;\n uniform float uCornerRadiusBottomRight;\n uniform float uCornerRadiusTopLeft;\n uniform float uCornerRadiusBottomLeft;\n\n uniform int uHatchPattern;\n\n uniform vec3 uShadowColor;\n uniform float uShadowOpacity;\n uniform float uShadowBlur;\n uniform float uShadowOffsetX;\n uniform float uShadowOffsetY;\n\n#pragma markUniforms\n};\n", Qc = [
|
|
3672
|
+
}, $c = "flat out lowp vec4 vFillColor;\nflat out lowp vec4 vStrokeColor;\nflat out float vHalfStrokeWidth;\nflat out vec4 vCornerRadii;\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n/** Position for SDF-strokes */\nout vec2 vPosInPixels;\n#endif\n\n/** Size of the rect in pixels */\nflat out vec2 vHalfSizeInPixels;\n\n/**\n * Adjusts the vertex position to ensure that the rectangle is at least `minSpan`\n * wide or high. Returns a value that reflects the amount of clamping and can be\n * used to adjust the opacity of the rectangle.\n *\n * pos: vertex position\n * frac: vertex position within the rectangle, [0, 1]\n * size: width or height of the rectangle\n * minSize: minimum width or height of the rectangle\n */\nfloat clampMinSize(inout float pos, float frac, float size, float minSize) {\n if (minSize > 0.0 && size < minSize) {\n pos += (frac - 0.5) * (minSize - size);\n return size / minSize;\n }\n\n return 1.0;\n}\n\nvoid sort(inout float a, inout float b) {\n if (a > b) {\n float tmp = b;\n b = a;\n a = tmp;\n }\n}\n\n/**\n * The vertex position wrt the rectangle specified by (x, x2, y, y2).\n * [0, 0] = [x, y], [1, 1] = [x2, y2]. \n * The x or y component may contain fractional values if the rectangle \n * have been tessellated.\n */\nvec2 getVertexPos() {\n int index = gl_VertexID % 6;\n return vec2(\n index == 0 || index == 1 || index == 3 ? 0.0 : 1.0,\n index == 0 || index == 1 || index == 2 ? 0.0 : 1.0\n );\n \n}\n\nvoid main(void) {\n#pragma orderGuard\n\n vec2 frac = getVertexPos();\n\n vec2 normalizedMinSize = vec2(uMinWidth, uMinHeight) / uViewportSize;\n vec4 cornerRadii = vec4(\n uCornerRadiusTopRight,\n uCornerRadiusBottomRight,\n uCornerRadiusTopLeft,\n uCornerRadiusBottomLeft\n );\n\n SampleFacetPosition sampleFacetPos = getSampleFacetPos();\n if (sampleFacetPos.height == 0.0) {\n // Filtered samples have no facet height. Cull them before minimum-size\n // clamping can expand their rectangles at the viewport boundary.\n gl_Position = vec4(100.0, 0.0, 0.0, 0.0);\n return;\n }\n\n vec2 pos1 = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 pos2 = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n\n sort(pos1.x, pos2.x);\n sort(pos1.y, pos2.y);\n\n // Clamp x to prevent precision artifacts when the scale is zoomed very close.\n // TODO: clamp y as well\n float clampMargin = 1.0;\n pos1.x = clamp(pos1.x, 0.0 - clampMargin, 1.0 + clampMargin);\n pos2.x = clamp(pos2.x, 0.0 - clampMargin, 1.0 + clampMargin);\n\n vec2 size = pos2 - pos1;\n\n if (size.x < 0.0 || size.y < 0.0) {\n // Keep zero-sized rects alive so min-size clamping can stabilize them.\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n return;\n }\n\n vec2 pos = pos1 + frac * size;\n\n // Clamp to minimum size, optionally compensate with opacity\n float opaFactor = uViewOpacity * max(uMinOpacity,\n clampMinSize(pos.x, frac.x, size.x, normalizedMinSize.x) *\n clampMinSize(pos.y, frac.y, size.y, normalizedMinSize.y));\n\n size = max(size, normalizedMinSize);\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n // Add an extra pixel to the stroke width to accommodate edge antialiasing\n float aaPadding = 1.0 / uDevicePixelRatio;\n\n // TODO: Only expand to the offset direction. Now high offsets result in\n // a large expansion in all directions.\n float shadowPadding = uShadowBlur + max(abs(uShadowOffsetX), abs(uShadowOffsetY));\n\n float strokeWidth = getScaled_strokeWidth();\n float strokeOpacity = getScaled_strokeOpacity() * opaFactor;\n\n vec2 centeredFrac = frac - 0.5;\n vec2 expand = centeredFrac * (strokeWidth + aaPadding + shadowPadding * 2.0) / uViewportSize;\n pos += expand;\n\n vec2 sizeInPixels = size * uViewportSize;\n vPosInPixels = (centeredFrac + expand / size) * sizeInPixels;\n\n vHalfSizeInPixels = sizeInPixels / 2.0;\n\n vCornerRadii = min(cornerRadii, min(vHalfSizeInPixels.x, vHalfSizeInPixels.y));\n vHalfStrokeWidth = strokeWidth / 2.0;\n vStrokeColor = vec4(getScaled_stroke() * strokeOpacity, strokeOpacity);\n#endif\n\n gl_Position = unitToNdc(pos);\n\n float fillOpacity = getScaled_fillOpacity() * opaFactor;\n vFillColor = vec4(getScaled_fill() * fillOpacity, fillOpacity);\n\n setupPicking();\n}\n", el = "#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\nin vec2 vPosInPixels;\n#endif\n\nflat in vec2 vHalfSizeInPixels;\n\nflat in lowp vec4 vFillColor;\nflat in lowp vec4 vStrokeColor;\nflat in float vHalfStrokeWidth;\nflat in vec4 vCornerRadii;\n\nout lowp vec4 fragColor;\n\n// ----------------------------------------------------------------------------\n// Shadow source: https://madebyevan.com/shaders/fast-rounded-rectangle-shadows/\n// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)\n\n#ifdef SHADOW\n\n// A standard gaussian function, used for weighting samples\nfloat gaussian(float x, float sigma) {\n const float pi = 3.141592653589793;\n return exp(-(x * x) / (2.0 * sigma * sigma)) / (sqrt(2.0 * pi) * sigma);\n}\n\n// This approximates the error function, needed for the gaussian integral\nvec2 erf(vec2 x) {\n vec2 s = sign(x), a = abs(x);\n x = 1.0 + (0.278393 + (0.230389 + 0.078108 * (a * a)) * a) * a;\n x *= x;\n return s - s / (x * x);\n}\n\n// Return the blurred mask along the x dimension\nfloat roundedBoxShadowX(float x, float y, float sigma, float corner, vec2 halfSize) {\n float delta = min(halfSize.y - corner - abs(y), 0.0);\n float curved = halfSize.x - corner + sqrt(max(0.0, corner * corner - delta * delta));\n vec2 integral = 0.5 + 0.5 * erf((x + vec2(-curved, curved)) * (sqrt(0.5) / sigma));\n return integral.y - integral.x;\n}\n\n// Return the mask for the shadow of a box from lower to upper\nfloat roundedBoxShadow(vec2 lower, vec2 upper, vec2 point, float sigma, float corner) {\n // Center everything to make the math easier\n vec2 center = (lower + upper) * 0.5;\n vec2 halfSize = (upper - lower) * 0.5;\n point -= center;\n\n // The signal is only non-zero in a limited range, so don't waste samples\n float low = point.y - halfSize.y;\n float high = point.y + halfSize.y;\n float start = clamp(-3.0 * sigma, low, high);\n float end = clamp(3.0 * sigma, low, high);\n\n // Accumulate samples (we can get away with surprisingly few samples)\n float step = (end - start) / 4.0;\n float y = start + step * 0.5;\n float value = 0.0;\n for (int i = 0; i < 4; i++) {\n value += roundedBoxShadowX(point.x, point.y - y, sigma, corner, halfSize) * gaussian(y, sigma) * step;\n y += step;\n }\n\n return value;\n}\n\n// ----------------------------------------------------------------------------\n\n#endif\n\n// Source: https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm\nfloat sdRoundedBox(vec2 p, vec2 b, vec4 r) {\n r.xy = p.x > 0.0 ? r.xy : r.zw;\n r.x = p.y > 0.0 ? r.x : r.y;\n vec2 q = abs(p) - b + r.x;\n return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;\n}\n\n// Not a true SDF. Makes the corners of strokes sharp and is faster.\nfloat sdSharpBox(vec2 p, vec2 b) {\n vec2 q = abs(p) - b;\n return max(q.x, q.y);\n}\n\nfloat diagonalPattern(vec2 uv, float spacing) {\n // Using 1.5 to approximate sqrt(2.0) to reduce aliasing artifacts.\n float divisor = spacing * vHalfStrokeWidth * 2.0 * 1.5;\n return abs(mod(uv.x - uv.y, divisor) - 0.5 * divisor) / 1.5;\n}\n\nfloat verticalPattern(float x, float spacing) {\n float divisor = spacing * vHalfStrokeWidth * 2.0;\n return abs(mod(x, divisor)) / 2.0;\n}\n\nfloat circle(vec2 p, float r) {\n return length(p) - r;\n}\n\nfloat masonryCirclePattern(vec2 uv, float spacing, float radius) {\n float halfSpacing = 0.5 * spacing;\n\n float row = floor(uv.y / spacing);\n float shift = mod(row, 2.0) * halfSpacing;\n\n vec2 shifted = vec2(uv.x + shift, uv.y + halfSpacing);\n vec2 cell = mod(shifted + 0.5 * spacing, spacing) - halfSpacing;\n\n return abs(circle(cell, radius));\n}\n\n/**\n * Patterns:\n * 0 none\n * 1 diagonal (/)\n * 2 antiDiagonal (\\)\n * 3 cross (X)\n * 4 vertical (|)\n * 5 horizontal (-)\n * 6 grid (+)\n * 7 dots (.)\n * 8 rings (o)\n * 9 ringsLarge (O)\n */\nfloat pattern() {\n#ifdef STROKED\n int patternType = uHatchPattern;\n vec2 uv = vPosInPixels;\n float spacing = 4.0;\n\n switch (patternType) {\n case 1:\n return diagonalPattern(vec2(uv.x, -uv.y), spacing);\n case 2:\n return diagonalPattern(uv, spacing);\n case 3:\n return min(\n diagonalPattern(uv, spacing),\n diagonalPattern(vec2(uv.x, -uv.y), spacing)\n );\n case 4:\n return verticalPattern(uv.x, spacing);\n case 5:\n return verticalPattern(uv.y, spacing);\n case 6:\n return min(\n verticalPattern(uv.x, spacing),\n verticalPattern(uv.y, spacing)\n );\n case 7:\n case 8:\n case 9: {\n float spacing = vHalfStrokeWidth * 14.0;\n float radius = spacing * (\n patternType == 8 ? 0.2 :\n patternType == 9 ? 0.35 :\n 0.07\n );\n return masonryCirclePattern(uv, spacing, radius);\n }\n default:\n break;\n }\n#endif\n return 1.0 / 0.0; // Infinity\n}\n\nvoid main(void) {\n\n#if defined(ROUNDED_CORNERS) || defined(STROKED) || defined(SHADOW)\n#ifdef ROUNDED_CORNERS\n // Distance from rectangle's edge in pixels. Negative inside the rectangle.\n float d = sdRoundedBox(vPosInPixels, vHalfSizeInPixels, vCornerRadii);\n#else\n float d = sdSharpBox(vPosInPixels, vHalfSizeInPixels);\n#endif\n\n vec4 backgroundColor = vec4(0.0, 0.0, 0.0, 0.0);\n\n#ifdef SHADOW\n float maxCornerRadius = max(vCornerRadii.x, max(vCornerRadii.y, max(vCornerRadii.z, vCornerRadii.w)));\n\n float shadow = 0.0;\n // Only calculate shadow for the region outside the stroke.\n if (d >= vHalfStrokeWidth - 1.0 && uShadowOpacity > 0.0) {\n shadow = roundedBoxShadow(\n -vHalfSizeInPixels - vHalfStrokeWidth,\n vHalfSizeInPixels + vHalfStrokeWidth,\n vPosInPixels - vec2(uShadowOffsetX, -uShadowOffsetY),\n max(uShadowBlur / 2.5, 0.25),\n maxCornerRadius + vHalfStrokeWidth\n ) * uShadowOpacity * uViewOpacity;\n }\n backgroundColor = vec4(uShadowColor * shadow, shadow);\n#endif\n\n if (vHalfStrokeWidth > 0.0 && uHatchPattern > 0) {\n d = max(d, -pattern());\n }\n\n fragColor = distanceToColor(\n d,\n vFillColor,\n vStrokeColor,\n backgroundColor,\n vHalfStrokeWidth\n );\n\n if (uPickingEnabled) {\n if (d < vHalfStrokeWidth) {\n fragColor = vPickingColor;\n }\n } else if (fragColor.a == 0.0) {\n discard;\n }\n#else\n // The trivial, non-decorated case\n fragColor = vFillColor;\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n#endif\n}\n", tl = "layout(std140) uniform Mark {\n /** Minimum size (width, height) of the displayed rectangle in pixels */\n uniform float uMinWidth;\n uniform float uMinHeight;\n\n /** Minimum opacity for the size clamping */\n uniform float uMinOpacity;\n\n uniform float uCornerRadiusTopRight;\n uniform float uCornerRadiusBottomRight;\n uniform float uCornerRadiusTopLeft;\n uniform float uCornerRadiusBottomLeft;\n\n uniform int uHatchPattern;\n\n uniform vec3 uShadowColor;\n uniform float uShadowOpacity;\n uniform float uShadowBlur;\n uniform float uShadowOffsetX;\n uniform float uShadowOffsetY;\n\n#pragma markUniforms\n};\n", nl = [
|
|
3641
3673
|
"none",
|
|
3642
3674
|
"diagonal",
|
|
3643
3675
|
"antiDiagonal",
|
|
@@ -3648,9 +3680,9 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3648
3680
|
"dots",
|
|
3649
3681
|
"rings",
|
|
3650
3682
|
"ringsLarge"
|
|
3651
|
-
],
|
|
3683
|
+
], rl = class extends kc {
|
|
3652
3684
|
get opaque() {
|
|
3653
|
-
return ve(this, "opaque", () => !this.#e() && !this.#t() && !this.properties.shadowOpacity &&
|
|
3685
|
+
return ve(this, "opaque", () => !this.#e() && !this.#t() && !this.properties.shadowOpacity && o(this.encoding.fillOpacity) && this.encoding.fillOpacity.value == 1 && this.properties.minOpacity == 1) && this.unitView.getEffectiveOpacity() == 1;
|
|
3654
3686
|
}
|
|
3655
3687
|
getAttributes() {
|
|
3656
3688
|
return [
|
|
@@ -3677,20 +3709,20 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3677
3709
|
}
|
|
3678
3710
|
#t() {
|
|
3679
3711
|
let e = this.encoding.strokeWidth;
|
|
3680
|
-
return !(
|
|
3712
|
+
return !(o(e) && !e.value) || "condition" in e;
|
|
3681
3713
|
}
|
|
3682
3714
|
initializeGraphics() {
|
|
3683
3715
|
super.initializeGraphics();
|
|
3684
3716
|
let e = [];
|
|
3685
|
-
this.#e() && e.push("ROUNDED_CORNERS"), this.#t() && e.push("STROKED"), this.properties.shadowOpacity && e.push("SHADOW"), this.createAndLinkShaders(
|
|
3717
|
+
this.#e() && e.push("ROUNDED_CORNERS"), this.#t() && e.push("STROKED"), this.properties.shadowOpacity && e.push("SHADOW"), this.createAndLinkShaders($c, el, [tl, ...e.map((e) => "#define " + e)]);
|
|
3686
3718
|
}
|
|
3687
3719
|
finalizeGraphicsInitialization() {
|
|
3688
3720
|
super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
|
|
3689
3721
|
let e = this.properties;
|
|
3690
|
-
this.registerMarkUniformValue("uMinWidth", e.minWidth), this.registerMarkUniformValue("uMinHeight", e.minHeight), this.registerMarkUniformValue("uMinOpacity", e.minOpacity), this.registerMarkUniformValue("uCornerRadiusTopRight", e.cornerRadiusTopRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomRight", e.cornerRadiusBottomRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusTopLeft", e.cornerRadiusTopLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomLeft", e.cornerRadiusBottomLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uHatchPattern", e.hatch, (e) => Math.max(0,
|
|
3722
|
+
this.registerMarkUniformValue("uMinWidth", e.minWidth), this.registerMarkUniformValue("uMinHeight", e.minHeight), this.registerMarkUniformValue("uMinOpacity", e.minOpacity), this.registerMarkUniformValue("uCornerRadiusTopRight", e.cornerRadiusTopRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomRight", e.cornerRadiusBottomRight ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusTopLeft", e.cornerRadiusTopLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uCornerRadiusBottomLeft", e.cornerRadiusBottomLeft ?? e.cornerRadius ?? 0), this.registerMarkUniformValue("uHatchPattern", e.hatch, (e) => Math.max(0, nl.indexOf(e ?? "none"))), this.registerMarkUniformValue("uShadowBlur", e.shadowBlur ?? 0), this.registerMarkUniformValue("uShadowOpacity", e.shadowOpacity ?? 0), this.registerMarkUniformValue("uShadowOffsetX", e.shadowOffsetX ?? 0), this.registerMarkUniformValue("uShadowOffsetY", e.shadowOffsetY ?? 0), this.registerMarkUniformValue("uShadowColor", e.shadowColor ?? "black", Xo);
|
|
3691
3723
|
}
|
|
3692
3724
|
updateGraphicsData(e) {
|
|
3693
|
-
let t = e.getItemCount(), n = new
|
|
3725
|
+
let t = e.getItemCount(), n = new mc({
|
|
3694
3726
|
encoders: this.encoders,
|
|
3695
3727
|
attributes: this.getAttributes(),
|
|
3696
3728
|
numItems: t
|
|
@@ -3706,10 +3738,10 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3706
3738
|
render(e) {
|
|
3707
3739
|
let t = this.gl;
|
|
3708
3740
|
return this.createRenderCallback((e, n) => {
|
|
3709
|
-
|
|
3741
|
+
oo(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e);
|
|
3710
3742
|
}, e);
|
|
3711
3743
|
}
|
|
3712
|
-
},
|
|
3744
|
+
}, il = "// Line caps\nconst int BUTT = 0;\nconst int SQUARE = 1;\nconst int ROUND = 2;\n\n/** Position along the rule */\nin float pos;\n\n/** Which side of the stroke: -0.5 or 0.5 */\nin float side;\n\nflat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\n/** The distance from the line center to the direction of normal in pixels */\nout float vNormalLengthInPixels;\n\n/** Distances from the line endings. Used for rendering the round caps and dashes */\nout highp vec2 vPosInPixels;\n\n\nvoid main(void) {\n#pragma orderGuard\n\n float pixelSize = 1.0 / uDevicePixelRatio;\n\n // Stroke width in pixels\n float size = getScaled_size();\n float opacity = getScaled_opacity() * uViewOpacity;\n\n // Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively\n if (size < pixelSize) {\n opacity *= size / pixelSize;\n size = pixelSize;\n }\n\n vec2 a = applyOffset(\n applySampleFacet(vec2(getScaled_x(), getScaled_y())),\n vec2(getScaled_xOffset(), getScaled_yOffset())\n );\n vec2 b = applyOffset(\n applySampleFacet(vec2(getScaled_x2(), getScaled_y2())),\n vec2(getScaled_x2Offset(), getScaled_y2Offset())\n );\n\n vec2 tangent = b - a;\n\n float offset = 0.0;\n float relativeDiff = 0.0;\n if (uMinLength > 0.0 || uStrokeCap != BUTT) {\n float len = length(tangent * uViewportSize);\n\n // Elongate to reach the minimum length.\n // The length difference in pixels\n float diff = max(0.0, uMinLength - len);\n\n // Add line caps\n if (uStrokeCap != BUTT) {\n diff += size;\n }\n\n relativeDiff = diff / len;\n offset = relativeDiff * (pos - 0.5);\n }\n\n // Apply caps and minimum length by spreading the vertices along the tangent\n vec2 p = pos < 1.0\n ? a + tangent * (pos + offset)\n : b + tangent * offset;\n\n // Add an extra pixel to stroke width to accommodate edge antialiasing\n float aaPadding = pixelSize;\n\n // Extrude\n vec2 normal = normalize(vec2(-tangent.y, tangent.x) / uViewportSize);\n p += normal * side * (size + aaPadding) / uViewportSize;\n\n gl_Position = unitToNdc(p);\n\n vColor = vec4(getScaled_color() * opacity, opacity);\n vSize = size;\n vNormalLengthInPixels = side * (size + aaPadding);\n\n // TODO: Here's a precision problem that breaks round caps when zoomed in enough\n vPosInPixels = vec2(pos, (1.0 - pos)) * (1.0 + relativeDiff) * length(tangent * uViewportSize) -\n vec2(uStrokeCap != BUTT ? size / 2.0 : 0.0);\n \n setupPicking();\n}\n", al = "// Line ending\nconst int BUTT = 0;\nconst int SQUARE = 1;\nconst int ROUND = 2;\n\nuniform sampler2D uDashTexture;\n\nflat in vec4 vColor;\nflat in float vSize;\n\n/** Position on the rule along its length in pixels */\nin vec2 vPosInPixels;\nin float vNormalLengthInPixels;\n\nout lowp vec4 fragColor;\n\nvoid main(void) {\n float dpr = uDevicePixelRatio;\n\n float distanceFromEnd = -min(vPosInPixels[0], vPosInPixels[1]);\n float distance; // from the rule centerline or end\n if (distanceFromEnd > 0.0 && uStrokeCap == ROUND) {\n // round cap\n distance = length(vec2(distanceFromEnd, vNormalLengthInPixels));\n } else {\n distance = abs(vNormalLengthInPixels);\n }\n\n // Use a signed distance field to implement edge antialiasing\n float opacity = clamp(((vSize / 2.0 - distance) * dpr), -0.5, 0.5) + 0.5;\n\n if (uDashTextureSize > 0.0) {\n float pos = (vPosInPixels[0] + uStrokeDashOffset) * dpr;\n float floored = floor(pos);\n vec2 texelPositions = (floored + vec2(0.5, 1.5)) / dpr / uDashTextureSize;\n \n // Do antialiasing\n opacity *= mix(\n texture(uDashTexture, vec2(texelPositions[0], 0)).r,\n texture(uDashTexture, vec2(texelPositions[1], 0)).r,\n clamp((pos - floored), 0.0, 1.0));\n }\n\n fragColor = vColor * opacity;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", ol = "layout(std140) uniform Mark {\n /** Minimum rule length in pixels */\n uniform mediump float uMinLength;\n\n uniform mediump float uDashTextureSize;\n uniform lowp int uStrokeCap;\n uniform mediump float uStrokeDashOffset;\n\n#pragma markUniforms\n};\n", sl = class extends kc {
|
|
3713
3745
|
constructor(e, t, n) {
|
|
3714
3746
|
super(e, t, n), this.dashTexture = void 0, this.dashTextureSize = 0;
|
|
3715
3747
|
}
|
|
@@ -3732,8 +3764,8 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3732
3764
|
}
|
|
3733
3765
|
initializeGraphics() {
|
|
3734
3766
|
super.initializeGraphics();
|
|
3735
|
-
let e = this.gl, t =
|
|
3736
|
-
this.dashTexture =
|
|
3767
|
+
let e = this.gl, t = cl(this.properties.strokeDash);
|
|
3768
|
+
this.dashTexture = ai(e, {
|
|
3737
3769
|
level: 0,
|
|
3738
3770
|
mag: e.NEAREST,
|
|
3739
3771
|
min: e.NEAREST,
|
|
@@ -3741,7 +3773,7 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3741
3773
|
format: e.RED,
|
|
3742
3774
|
src: t,
|
|
3743
3775
|
height: 1
|
|
3744
|
-
}), this.dashTextureSize = t.length, this.createAndLinkShaders(
|
|
3776
|
+
}), this.dashTextureSize = t.length, this.createAndLinkShaders(il, al, [ol]);
|
|
3745
3777
|
}
|
|
3746
3778
|
finalizeGraphicsInitialization() {
|
|
3747
3779
|
super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
|
|
@@ -3750,10 +3782,10 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3750
3782
|
"butt",
|
|
3751
3783
|
"square",
|
|
3752
3784
|
"round"
|
|
3753
|
-
].indexOf(e)),
|
|
3785
|
+
].indexOf(e)), $a(this.markUniformInfo, { uDashTextureSize: +this.dashTextureSize }), this.markUniformsAltered = !0;
|
|
3754
3786
|
}
|
|
3755
3787
|
updateGraphicsData(e) {
|
|
3756
|
-
let t = e.getItemCount(), n = new
|
|
3788
|
+
let t = e.getItemCount(), n = new hc({
|
|
3757
3789
|
encoders: this.encoders,
|
|
3758
3790
|
attributes: this.getAttributes(),
|
|
3759
3791
|
numItems: t
|
|
@@ -3768,13 +3800,13 @@ var zc = "flat out vec4 vColor;\n\n/** Stroke width */\nflat out float vSize;\n\
|
|
|
3768
3800
|
}
|
|
3769
3801
|
render(e) {
|
|
3770
3802
|
let t = this.gl;
|
|
3771
|
-
return this.createRenderCallback((e, n) =>
|
|
3803
|
+
return this.createRenderCallback((e, n) => oo(t, this.vertexArrayInfo, t.TRIANGLE_STRIP, n, e), e);
|
|
3772
3804
|
}
|
|
3773
3805
|
dispose() {
|
|
3774
3806
|
this.dashTexture &&= (this.gl.deleteTexture(this.dashTexture), void 0), super.dispose();
|
|
3775
3807
|
}
|
|
3776
3808
|
};
|
|
3777
|
-
function
|
|
3809
|
+
function cl(e) {
|
|
3778
3810
|
if (!e) return /* @__PURE__ */ new Uint8Array();
|
|
3779
3811
|
if (e.length == 0 || e.length % 2 || e.findIndex((e) => Math.round(e) != e || e < 1 || e > 1e3) >= 0) throw Error("Invalid stroke dash pattern: " + JSON.stringify(e));
|
|
3780
3812
|
let t = e.reduce((e, t) => e + t), n = new Uint8Array(t), r = !0, i = 0;
|
|
@@ -3786,24 +3818,24 @@ function il(e) {
|
|
|
3786
3818
|
}
|
|
3787
3819
|
//#endregion
|
|
3788
3820
|
//#region ../core/src/rendering/webgl/marks/text.vertex.glsl
|
|
3789
|
-
var
|
|
3821
|
+
var ll = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width of the text (all letters)\nin float width;\n\nout vec2 vTexCoord;\nout float vEdgeFadeOpacity;\nflat out vec4 vColor;\nflat out float vSlope;\nflat out float vGamma;\n\nstruct RangeResult {\n float pos;\n float scale;\n};\n\nfloat minValue(vec4 v) {\n return min(min(v.x, v.y), min(v.z, v.w));\n}\n\nfloat maxValue(vec4 v) {\n return max(max(v.x, v.y), max(v.z, v.w));\n}\n\n/**\n * All measures are in [0, 1]\n */\nRangeResult positionInsideRange(float a, float b, float width, float padding,\n int align, bool flush) {\n float span = b - a;\n float paddedWidth = width + 2.0 * padding;\n\n // Is the text clearly outside the viewport\n if (a > 1.0 || b < 0.0) {\n return RangeResult(0.0, 0.0);\n }\n\n // How much extra space we have for adjusting the position so that the\n // text stays inside the range.\n float extra = max(0.0, span - paddedWidth);\n\n float pos;\n\n // Align the text and try to keep it inside the range and the viewport\n if (align == 0) {\n float centre = a + b;\n\n if (flush) {\n float leftOver = max(0.0, paddedWidth - centre);\n centre += min(leftOver, extra);\n\n float rightOver = max(0.0, paddedWidth + centre - 2.0);\n centre -= min(rightOver, extra);\n }\n\n pos = centre / 2.0;\n\n } else if (align < 0) {\n float edge = a;\n\n if (flush) {\n float over = max(0.0, -edge);\n edge += min(over, extra);\n }\n\n pos = edge + padding;\n\n } else {\n float edge = b;\n\n if (flush) {\n float over = max(0.0, edge - 1.0);\n edge -= min(over, extra);\n }\n\n // TODO: If the text spans the whole viewport, try to keep it centered if possible.\n\n pos = edge - padding;\n }\n\n // How the text should be scaled to make it fit inside the range (if it didn't fit).\n float scale = clamp((span - padding) / paddedWidth, 0.0, 1.0);\n\n // TODO: Fix padding in scale factor. Padding should stay constant\n return RangeResult(pos, scale);\n}\n\nvec2 calculateRotatedDimensions(float width, mat2 rotationMatrix) {\n vec2 a = abs(rotationMatrix * vec2(width / 2.0, 0.5));\n vec2 b = abs(rotationMatrix * vec2(width / 2.0, -0.5));\n return vec2(max(a.x, b.x), max(a.y, b.y)) * 2.0;\n}\n\n/** Needed when using ranged text */\nivec2 fixAlignForAngle(ivec2 align, float angleInDegrees) {\n float a = mod(angleInDegrees + 45.0, 360.0);\n int x = align.x;\n int y = -align.y;\n\n // TODO: Optimize by avoiding branching\n if (a < 90.0) {\n return ivec2(x, y);\n } else if (a < 180.0) {\n return ivec2(y, -x);\n } else if (a < 270.0) {\n return ivec2(-x, y);\n } else {\n return ivec2(-y, x);\n }\n}\n\nvoid main(void) {\n#pragma orderGuard\n\n float opacity = getScaled_opacity() * uViewOpacity;\n vec2 size = vec2(getScaled_size());\n float x = getScaled_x() + getScaled_xOffset() / uViewportSize.x;\n float y = getScaled_y();\n\n float scale = 1.0;\n\n float angleInDegrees = getScaled_angle();\n float angle = -angleInDegrees * PI / 180.0;\n \n float sinTheta = sin(angle);\n float cosTheta = cos(angle);\n mat2 rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\n vec2 flushSize = calculateRotatedDimensions(width, rotationMatrix);\n\n#if defined(x2_DEFINED) || defined(y2_DEFINED)\n ivec2 align = fixAlignForAngle(uAlign, angleInDegrees);\n#else\n ivec2 align = uAlign;\n#endif\n\n#ifdef x2_DEFINED\n float x2 = getScaled_x2() + getScaled_x2Offset() / uViewportSize.x;\n\n if (uLogoLetter) {\n size.x = (x2 - x) * uViewportSize.x;\n x += (x2 - x) / 2.0;\n\n } else {\n RangeResult result = positionInsideRange(\n min(x, x2), max(x, x2),\n size.x * scale * flushSize.x / uViewportSize.x, uPaddingX / uViewportSize.x,\n align.x, uFlushX);\n \n x = result.pos;\n scale *= result.scale;\n }\n#endif\n\n // Position of the text origo \n vec2 pos = applyOffset(\n applySampleFacet(vec2(x, y)),\n vec2(0.0, getScaled_yOffset())\n );\n\n#ifdef y2_DEFINED\n float y2 = getScaled_y2();\n vec2 pos2 = applyOffset(\n applySampleFacet(vec2(x, y2)),\n vec2(0.0, getScaled_y2Offset())\n );\n\n if (uLogoLetter) {\n size.y = (pos2.y - pos.y) * uViewportSize.y;\n pos.y += (pos2.y - pos.y) / 2.0;\n\n } else {\n RangeResult result = positionInsideRange(\n min(pos.y, pos2.y), max(pos.y, pos2.y),\n size.y * scale * flushSize.y / uViewportSize.y, uPaddingY / uViewportSize.y,\n align.y, uFlushY);\n \n pos.y = result.pos;\n scale *= result.scale;\n }\n#endif\n\n#ifdef VISIBLE_RANGE_CULLING\n if (isOutsideVisibleRange(pos)) {\n gl_Position = vec4(0.0);\n return;\n }\n#endif\n\n if (scale < 1.0) {\n if (uSqueeze) {\n vec2 scaleFadeExtent = vec2(3.0, 6.0) / size;\n\n if (scale < scaleFadeExtent[0]) {\n gl_Position = vec4(0.0);\n return;\n }\n\n size *= scale;\n opacity *= linearstep(scaleFadeExtent[0], scaleFadeExtent[1], scale);\n\n } else if (scale < 1.0) {\n // Eliminate the text\n gl_Position = vec4(0.0);\n return;\n }\n }\n\n // Position of the character vertex in relation to the text origo\n vec2 charPos = rotationMatrix * (vertexCoord * size + uD);\n\n // Position of the character vertex inside the unit viewport\n vec2 unitPos = pos + charPos / uViewportSize;\n\n gl_Position = unitToNdc(unitPos);\n\n // Controls antialiasing of the SDF\n vSlope = max(1.0, min(size.x, size.y) / uSdfNumerator * uDevicePixelRatio);\n\n vec3 color = getScaled_color();\n\n // Premultiply alpha\n vColor = vec4(color * opacity, opacity);\n\n // Do something like gamma correction for text when the color is close to black or white.\n vGamma = getGammaForColor(color);\n\n vTexCoord = textureCoord;\n\n // Edge fading. The implementation is simplistic and fails with primitives that\n // span the whole viewport. However, it works just fine with reasonable font sizes.\n // x: top, y: right, z: bottom, w: left\n if (maxValue(uViewportEdgeFadeDistance) > -pow(10.0, 10.0)) { // -Infinity would be nice\n vEdgeFadeOpacity = minValue(\n ((vec4(1.0, 1.0, 0.0, 0.0) + vec4(-1.0, -1.0, 1.0, 1.0) * unitPos.yxyx) *\n uViewportSize.yxyx - uViewportEdgeFadeDistance) / uViewportEdgeFadeWidth);\n } else {\n vEdgeFadeOpacity = 1.0;\n }\n\n setupPicking();\n}\n", ul = "uniform sampler2D uTexture;\n\nin vec2 vTexCoord;\nin float vEdgeFadeOpacity;\nflat in vec4 vColor;\nflat in float vSlope;\nflat in float vGamma;\n\nout lowp vec4 fragColor;\n\nfloat median(float r, float g, float b) {\n return max(min(r, g), min(max(r, g), b));\n}\n\nfloat getDist(vec2 uv) {\n vec3 c = texture(uTexture, uv).rgb;\n return 1.0 - median(c.r, c.g, c.b);\n}\n\n/**\n * Calculates the super-sampled distance to the edge.\n * This is used to avoid aliasing when rendering small text,\n * as mip-mapping cannot be used here.\n * The distance is averaged over a grid of n x n samples.\n */\nfloat getSuperDist(vec2 uv) {\n vec2 dx = dFdx(uv);\n vec2 dy = dFdy(uv);\n\n float n = 2.0;\n\n float sum = 0.0;\n for (float x = 0.5; x < n; x++){\n for (float y = 0.5; y < n; y++) {\n sum += getDist(\n uv +\n x / n * dx +\n y / n * dy\n ); \n }\n }\n\n return sum / (n * n);\n}\n\nvoid main() {\n float sigDist = getSuperDist(vTexCoord);\n\n float slope = vSlope;\n if (uLogoLetter) {\n // Using screen-space derivatives for logo letters because skewed aspect ratios\n // result in blurry edges otherwise. However, use of screen-space derivatives\n // results in crappy looking text with regular letters text.\n slope = 0.7 / length(vec2(dFdy(sigDist), dFdx(sigDist)));\n }\n\n float opa = clamp((sigDist - 0.5) * slope + 0.5, 0.0, 1.0);\n opa *= clamp(vEdgeFadeOpacity, 0.0, 1.0);\n\n opa = pow(opa, vGamma);\n\n fragColor = vColor * opa;\n\n if (uPickingEnabled) {\n fragColor = vPickingColor;\n }\n}\n", dl = "layout(std140) uniform Mark {\n uniform mediump float uSdfNumerator;\n\n uniform mediump vec2 uD; // dx & dy\n\n uniform mediump vec4 uViewportEdgeFadeWidth;\n uniform mediump vec4 uViewportEdgeFadeDistance;\n \n uniform bool uSqueeze;\n uniform bool uLogoLetter;\n\n // x: -1, 0, 1 = left, center, right\n // y: -1, 0, 1 = top, middle, bottom \n uniform lowp ivec2 uAlign;\n\n uniform mediump float uPaddingX;\n uniform bool uFlushX;\n uniform mediump float uPaddingY;\n uniform bool uFlushY;\n\n#pragma markUniforms\n};\n", fl = 1024, pl = {
|
|
3790
3822
|
left: -1,
|
|
3791
3823
|
center: 0,
|
|
3792
3824
|
right: 1
|
|
3793
|
-
},
|
|
3825
|
+
}, ml = {
|
|
3794
3826
|
top: -1,
|
|
3795
3827
|
middle: 0,
|
|
3796
3828
|
bottom: 1,
|
|
3797
3829
|
alphabetic: 1,
|
|
3798
3830
|
baseline: 1
|
|
3799
|
-
},
|
|
3800
|
-
point:
|
|
3801
|
-
rect:
|
|
3802
|
-
arrow:
|
|
3803
|
-
rule:
|
|
3804
|
-
tick:
|
|
3805
|
-
link:
|
|
3806
|
-
text: class extends
|
|
3831
|
+
}, hl = {
|
|
3832
|
+
point: Qc,
|
|
3833
|
+
rect: rl,
|
|
3834
|
+
arrow: zc,
|
|
3835
|
+
rule: sl,
|
|
3836
|
+
tick: sl,
|
|
3837
|
+
link: Jc,
|
|
3838
|
+
text: class extends kc {
|
|
3807
3839
|
getAttributes() {
|
|
3808
3840
|
return [
|
|
3809
3841
|
"uniqueId",
|
|
@@ -3823,7 +3855,7 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
|
|
|
3823
3855
|
];
|
|
3824
3856
|
}
|
|
3825
3857
|
initializeGraphics() {
|
|
3826
|
-
super.initializeGraphics(), this.createAndLinkShaders(
|
|
3858
|
+
super.initializeGraphics(), this.createAndLinkShaders(ll, ul, [dl]);
|
|
3827
3859
|
}
|
|
3828
3860
|
finalizeGraphicsInitialization() {
|
|
3829
3861
|
super.finalizeGraphicsInitialization(), this.gl.useProgram(this.programInfo.program);
|
|
@@ -3838,23 +3870,23 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
|
|
|
3838
3870
|
e.viewportEdgeFadeDistanceRight,
|
|
3839
3871
|
e.viewportEdgeFadeDistanceBottom,
|
|
3840
3872
|
e.viewportEdgeFadeDistanceLeft
|
|
3841
|
-
]),
|
|
3842
|
-
uAlign: [
|
|
3873
|
+
]), $a(this.markUniformInfo, {
|
|
3874
|
+
uAlign: [pl[e.align], ml[e.baseline]],
|
|
3843
3875
|
uD: [e.dx, -e.dy]
|
|
3844
3876
|
});
|
|
3845
3877
|
}
|
|
3846
3878
|
registerMarkUniformVector(e, t) {
|
|
3847
3879
|
let n = this.createMarkUniformSetter(e), r = [], i = () => n(r.map((e) => e()));
|
|
3848
|
-
for (let e of t) r.push(
|
|
3880
|
+
for (let e of t) r.push(u(e) ? this.unitView.paramRuntime.watchExpression(e.expr, i) : () => e);
|
|
3849
3881
|
i();
|
|
3850
3882
|
}
|
|
3851
3883
|
updateGraphicsData(e) {
|
|
3852
|
-
let t = e.getData(), n = this.encoding, r = this.properties, i =
|
|
3884
|
+
let t = e.getData(), n = this.encoding, r = this.properties, i = u(r.logoLetters) ? this.unitView.paramRuntime.evaluateAndGet(r.logoLetters.expr) : r.logoLetters, a = this.encoders.text, o = 0, s = "format" in n.text ? g(n.text.format) : (e) => e;
|
|
3853
3885
|
for (let e of t) {
|
|
3854
|
-
let t =
|
|
3886
|
+
let t = s(a(e)), n = c(t) ? t : t === null ? "" : "" + t;
|
|
3855
3887
|
o += n && n.length || 0;
|
|
3856
3888
|
}
|
|
3857
|
-
let l = new
|
|
3889
|
+
let l = new vc({
|
|
3858
3890
|
encoders: this.encoders,
|
|
3859
3891
|
attributes: this.getAttributes(),
|
|
3860
3892
|
properties: {
|
|
@@ -3863,11 +3895,11 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
|
|
|
3863
3895
|
logoLetters: i
|
|
3864
3896
|
},
|
|
3865
3897
|
fontMetrics: this.font.metrics,
|
|
3866
|
-
numCharacters: Math.max(o,
|
|
3898
|
+
numCharacters: Math.max(o, fl)
|
|
3867
3899
|
});
|
|
3868
3900
|
l.addBatches(e.facetBatches);
|
|
3869
|
-
let
|
|
3870
|
-
this.rangeMap.migrateEntries(
|
|
3901
|
+
let d = l.toArrays();
|
|
3902
|
+
this.rangeMap.migrateEntries(d.rangeMap), this.updateBufferInfo(d);
|
|
3871
3903
|
}
|
|
3872
3904
|
prepareRender(e) {
|
|
3873
3905
|
let t = super.prepareRender(e);
|
|
@@ -3877,16 +3909,16 @@ var al = "in mediump vec2 vertexCoord;\nin lowp vec2 textureCoord;\n\n// Width o
|
|
|
3877
3909
|
}
|
|
3878
3910
|
render(e) {
|
|
3879
3911
|
let t = this.gl;
|
|
3880
|
-
return this.createRenderCallback((e, n) =>
|
|
3912
|
+
return this.createRenderCallback((e, n) => oo(t, this.vertexArrayInfo, t.TRIANGLES, n, e), e);
|
|
3881
3913
|
}
|
|
3882
3914
|
}
|
|
3883
3915
|
};
|
|
3884
|
-
function
|
|
3885
|
-
let r =
|
|
3916
|
+
function gl(e, t, n) {
|
|
3917
|
+
let r = hl[e.getType()];
|
|
3886
3918
|
if (!r) throw Error("Unsupported WebGL mark type: " + e.getType());
|
|
3887
3919
|
return new r(e, t, n);
|
|
3888
3920
|
}
|
|
3889
|
-
var
|
|
3921
|
+
var _l = class {
|
|
3890
3922
|
#e = !1;
|
|
3891
3923
|
#t = /* @__PURE__ */ new Map();
|
|
3892
3924
|
#n = /* @__PURE__ */ new Map();
|
|
@@ -3896,7 +3928,7 @@ var pl = class {
|
|
|
3896
3928
|
}
|
|
3897
3929
|
#i(e) {
|
|
3898
3930
|
this.#s();
|
|
3899
|
-
let t =
|
|
3931
|
+
let t = gl(e, this.glHelper, this), n = {
|
|
3900
3932
|
mark: e,
|
|
3901
3933
|
graphics: t,
|
|
3902
3934
|
state: "compiling",
|
|
@@ -3983,7 +4015,7 @@ var pl = class {
|
|
|
3983
4015
|
let t = this.#r.get(e);
|
|
3984
4016
|
if (t) return t.ready;
|
|
3985
4017
|
let n = this.glHelper.gl, r, i = new Promise((t, i) => {
|
|
3986
|
-
r =
|
|
4018
|
+
r = ai(n, {
|
|
3987
4019
|
src: e,
|
|
3988
4020
|
min: n.LINEAR
|
|
3989
4021
|
}, (a) => {
|
|
@@ -4018,22 +4050,22 @@ var pl = class {
|
|
|
4018
4050
|
let n = t.unitView.getCollector();
|
|
4019
4051
|
e.collector = n, e.dataRevision = n?.dataRevision ?? -1, e.configurationRevision = t.getRenderingRevision("configuration") ?? -1, e.encodedDataRevision = t.getEncodedDataRevision();
|
|
4020
4052
|
}
|
|
4021
|
-
#l(
|
|
4022
|
-
for (let [
|
|
4023
|
-
if (!
|
|
4024
|
-
let
|
|
4025
|
-
if (!
|
|
4026
|
-
let
|
|
4027
|
-
if (!
|
|
4028
|
-
|
|
4029
|
-
let
|
|
4030
|
-
if (
|
|
4031
|
-
|
|
4053
|
+
#l(e) {
|
|
4054
|
+
for (let [t, n] of Object.entries(e.mark.encoders)) {
|
|
4055
|
+
if (!n.scale) continue;
|
|
4056
|
+
let r = b(n.channelDef)?.resolutionChannel ?? t;
|
|
4057
|
+
if (!te(r)) continue;
|
|
4058
|
+
let i = e.mark.unitView.getScaleResolution(r);
|
|
4059
|
+
if (!i || e.scaleResolutions.has(i)) continue;
|
|
4060
|
+
e.scaleResolutions.add(i);
|
|
4061
|
+
let a = this.#n.get(i);
|
|
4062
|
+
if (a) {
|
|
4063
|
+
a.count++;
|
|
4032
4064
|
continue;
|
|
4033
4065
|
}
|
|
4034
|
-
this.glHelper.createRangeTexture(
|
|
4066
|
+
this.glHelper.createRangeTexture(i), this.#n.set(i, {
|
|
4035
4067
|
count: 1,
|
|
4036
|
-
dispose:
|
|
4068
|
+
dispose: i.observeMapping(() => this.glHelper.createRangeTexture(i, !0))
|
|
4037
4069
|
});
|
|
4038
4070
|
}
|
|
4039
4071
|
}
|
|
@@ -4047,13 +4079,13 @@ var pl = class {
|
|
|
4047
4079
|
};
|
|
4048
4080
|
//#endregion
|
|
4049
4081
|
//#region ../core/src/rendering/webgl/svgRasterizer.js
|
|
4050
|
-
function
|
|
4082
|
+
function vl({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter: i, logicalWidth: a, logicalHeight: o, pixelRatio: s }) {
|
|
4051
4083
|
let c = r.gl, l = Math.ceil(a * s), u = Math.ceil(o * s);
|
|
4052
|
-
|
|
4084
|
+
yl(c, l, u);
|
|
4053
4085
|
let d = s == 1 && n ? n : we(t, be.create(0, 0, a, o), {
|
|
4054
4086
|
devicePixelRatio: s,
|
|
4055
4087
|
renderingOptions: { firstFacet: !0 }
|
|
4056
|
-
}), f =
|
|
4088
|
+
}), f = Po(c, [{
|
|
4057
4089
|
format: c.RGBA,
|
|
4058
4090
|
type: c.UNSIGNED_BYTE,
|
|
4059
4091
|
minMag: c.LINEAR,
|
|
@@ -4061,7 +4093,7 @@ function ml({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter
|
|
|
4061
4093
|
}], l, u);
|
|
4062
4094
|
try {
|
|
4063
4095
|
for (let t of e) {
|
|
4064
|
-
let e = new
|
|
4096
|
+
let e = new Ks({ picking: !1 }, {
|
|
4065
4097
|
webGLHelper: r,
|
|
4066
4098
|
markAdapter: i,
|
|
4067
4099
|
canvasSize: {
|
|
@@ -4075,7 +4107,7 @@ function ml({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter
|
|
|
4075
4107
|
});
|
|
4076
4108
|
d.collectRenderCommands(e), e.finish(), e.render();
|
|
4077
4109
|
let n = De(t.bounds, s, l, u);
|
|
4078
|
-
Ee(t, n, s,
|
|
4110
|
+
Ee(t, n, s, Xs(c, f, "image/png", {
|
|
4079
4111
|
...n,
|
|
4080
4112
|
unpremultiplyAlpha: !0
|
|
4081
4113
|
}));
|
|
@@ -4084,44 +4116,44 @@ function ml({ runs: e, viewRoot: t, layoutResult: n, webGLHelper: r, markAdapter
|
|
|
4084
4116
|
c.bindFramebuffer(c.FRAMEBUFFER, null), c.deleteTexture(f.attachments[0]), c.deleteFramebuffer(f.framebuffer);
|
|
4085
4117
|
}
|
|
4086
4118
|
}
|
|
4087
|
-
function
|
|
4119
|
+
function yl(e, t, n) {
|
|
4088
4120
|
let r = e.getParameter(e.MAX_RENDERBUFFER_SIZE), i = e.getParameter(e.MAX_TEXTURE_SIZE), a = Math.min(r, i);
|
|
4089
4121
|
if (t <= 0 || n <= 0 || t > a || n > a) throw RangeError(`SVG raster dimensions ${t} x ${n} exceed the WebGL limit ${a}.`);
|
|
4090
4122
|
}
|
|
4091
4123
|
//#endregion
|
|
4092
4124
|
//#region ../core/src/rendering/webgl/index.js
|
|
4093
|
-
function
|
|
4094
|
-
let t = new
|
|
4125
|
+
function bl(e) {
|
|
4126
|
+
let t = new Vs(e.container, e.sizeSource, { powerPreference: e.powerPreference }, e.onCanvasResize), n = new _l(t);
|
|
4095
4127
|
return {
|
|
4096
4128
|
surface: t,
|
|
4097
4129
|
defaultFontBitmapUrl: Oe,
|
|
4098
4130
|
prepareFontBitmap: (e) => n.prepareFontBitmap(e),
|
|
4099
4131
|
getMarkRenderingDebugState: (e) => n.getMarkRenderingDebugState(e),
|
|
4100
|
-
createRenderCoordinator: (e) => new
|
|
4132
|
+
createRenderCoordinator: (e) => new Js({
|
|
4101
4133
|
...e,
|
|
4102
4134
|
glHelper: t,
|
|
4103
4135
|
markAdapter: n
|
|
4104
4136
|
}),
|
|
4105
|
-
exportCanvas: (e) =>
|
|
4137
|
+
exportCanvas: (e) => tc({
|
|
4106
4138
|
...e,
|
|
4107
4139
|
glHelper: t,
|
|
4108
4140
|
markAdapter: n
|
|
4109
4141
|
}),
|
|
4110
|
-
exportRaster: (e) =>
|
|
4142
|
+
exportRaster: (e) => nc({
|
|
4111
4143
|
...e,
|
|
4112
4144
|
glHelper: t,
|
|
4113
4145
|
markAdapter: n
|
|
4114
4146
|
}),
|
|
4115
|
-
rasterizeSvgRuns: (e) =>
|
|
4147
|
+
rasterizeSvgRuns: (e) => vl({
|
|
4116
4148
|
...e,
|
|
4117
4149
|
webGLHelper: t,
|
|
4118
4150
|
markAdapter: n
|
|
4119
4151
|
}),
|
|
4120
4152
|
readPickingId: (e, n) => {
|
|
4121
|
-
let r = t.getDevicePixelRatio(), i =
|
|
4153
|
+
let r = t.getDevicePixelRatio(), i = Gs(t.gl, t._pickingBufferInfo, e * r, n * r);
|
|
4122
4154
|
return i[0] | i[1] << 8 | i[2] << 16 | i[3] << 24;
|
|
4123
4155
|
}
|
|
4124
4156
|
};
|
|
4125
4157
|
}
|
|
4126
4158
|
//#endregion
|
|
4127
|
-
export {
|
|
4159
|
+
export { bl as createWebGLRenderingBackend };
|