@cosmos.gl/graph 2.7.0-beta.1 → 2.7.0-beta.3
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/{index-B1_1MjaX.js → index-u8g06ZrC.js} +14137 -14174
- package/dist/index-u8g06ZrC.js.map +1 -0
- package/dist/index.js +11 -10
- package/dist/index.min.js +59 -74
- package/dist/index.min.js.map +1 -1
- package/dist/{config.d.ts → src/config.d.ts} +0 -16
- package/dist/{helper.d.ts → src/helper.d.ts} +10 -0
- package/dist/{index.d.ts → src/index.d.ts} +33 -1
- package/dist/{modules → src/modules}/Clusters/index.d.ts +6 -4
- package/dist/{modules → src/modules}/ForceCenter/index.d.ts +5 -4
- package/dist/{modules → src/modules}/ForceGravity/index.d.ts +5 -2
- package/dist/{modules → src/modules}/ForceLink/index.d.ts +5 -2
- package/dist/{modules → src/modules}/ForceManyBody/index.d.ts +5 -4
- package/dist/{modules → src/modules}/ForceMouse/index.d.ts +5 -2
- package/dist/{modules → src/modules}/Lines/index.d.ts +5 -0
- package/dist/{modules → src/modules}/Points/index.d.ts +4 -4
- package/dist/src/modules/Shared/buffer.d.ts +1 -0
- package/dist/src/modules/Shared/texture-utils.d.ts +8 -0
- package/dist/src/modules/Shared/uniform-utils.d.ts +11 -0
- package/dist/{modules → src/modules}/Store/index.d.ts +7 -1
- package/dist/{variables.d.ts → src/variables.d.ts} +0 -2
- package/dist/vite.config.d.ts +2 -0
- package/dist/{webgl-device-DzkMihDq.js → webgl-device-BeV8-7_B.js} +204 -194
- package/dist/webgl-device-BeV8-7_B.js.map +1 -0
- package/package.json +7 -7
- package/dist/index-B1_1MjaX.js.map +0 -1
- package/dist/modules/ForceManyBody/quadtree-frag-shader.d.ts +0 -1
- package/dist/modules/ForceManyBodyQuadtree/index.d.ts +0 -15
- package/dist/modules/ForceManyBodyQuadtree/quadtree-frag-shader.d.ts +0 -1
- package/dist/modules/Shared/buffer.d.ts +0 -8
- package/dist/webgl-device-DzkMihDq.js.map +0 -1
- /package/dist/{graph → src/graph}/utils/error-message.d.ts +0 -0
- /package/dist/{modules → src/modules}/Drag/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/FPSMonitor/css.d.ts +0 -0
- /package/dist/{modules → src/modules}/FPSMonitor/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/ForceLink/force-spring.d.ts +0 -0
- /package/dist/{modules → src/modules}/GraphData/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/Lines/geometry.d.ts +0 -0
- /package/dist/{modules → src/modules}/Points/atlas-utils.d.ts +0 -0
- /package/dist/{modules → src/modules}/Zoom/index.d.ts +0 -0
- /package/dist/{modules → src/modules}/core-module.d.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var je = Object.defineProperty;
|
|
2
2
|
var Qe = (r, t, e) => t in r ? je(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
3
|
var o = (r, t, e) => Qe(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { i as Me, a as Ye, n as Ke, u as Ze, R as S, l as b, T as
|
|
4
|
+
import { i as Me, a as Ye, n as Ke, u as Ze, R as S, l as b, T as B, g as Je, t as We, D as et, b as tt, B as C, S as rt, c as it, d as nt, e as st, f as at, h as ot, j as ct, k as lt, m as pe, o as ut, p as ht } from "./index-u8g06ZrC.js";
|
|
5
5
|
function ft(r) {
|
|
6
6
|
return Me() ? Ye() ? "Electron" : (Ke.userAgent || "").indexOf("Edge") > -1 ? "Edge" : globalThis.chrome ? "Chrome" : globalThis.safari ? "Safari" : globalThis.mozInnerScreenX ? "Firefox" : "Unknown" : "Node";
|
|
7
7
|
}
|
|
@@ -11,7 +11,7 @@ function dt() {
|
|
|
11
11
|
r = i, t = n;
|
|
12
12
|
}), resolve: r, reject: t };
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const L = class L {
|
|
15
15
|
constructor(t) {
|
|
16
16
|
o(this, "id");
|
|
17
17
|
o(this, "props");
|
|
@@ -46,7 +46,7 @@ const E = class E {
|
|
|
46
46
|
o(this, "_position");
|
|
47
47
|
o(this, "destroyed", !1);
|
|
48
48
|
var e, i;
|
|
49
|
-
if (this.props = { ...
|
|
49
|
+
if (this.props = { ...L.defaultProps, ...t }, t = this.props, this.initialized = this._initializedResolvers.promise, Me() ? t.canvas ? typeof t.canvas == "string" ? this.canvas = bt(t.canvas) : this.canvas = t.canvas : this.canvas = mt(t) : this.canvas = { width: t.width || 1, height: t.height || 1 }, L.isHTMLCanvas(this.canvas) ? (this.id = t.id || this.canvas.id, this.type = "html-canvas", this.htmlCanvas = this.canvas) : L.isOffscreenCanvas(this.canvas) ? (this.id = t.id || "offscreen-canvas", this.type = "offscreen-canvas", this.offscreenCanvas = this.canvas) : (this.id = t.id || "node-canvas-context", this.type = "node"), this.cssWidth = ((e = this.htmlCanvas) == null ? void 0 : e.clientWidth) || this.canvas.width, this.cssHeight = ((i = this.htmlCanvas) == null ? void 0 : i.clientHeight) || this.canvas.height, this.devicePixelWidth = this.canvas.width, this.devicePixelHeight = this.canvas.height, this.drawingBufferWidth = this.canvas.width, this.drawingBufferHeight = this.canvas.height, this.devicePixelRatio = globalThis.devicePixelRatio || 1, this._position = [0, 0], L.isHTMLCanvas(this.canvas)) {
|
|
50
50
|
this._intersectionObserver = new IntersectionObserver((n) => this._handleIntersection(n)), this._intersectionObserver.observe(this.canvas), this._resizeObserver = new ResizeObserver((n) => this._handleResize(n));
|
|
51
51
|
try {
|
|
52
52
|
this._resizeObserver.observe(this.canvas, { box: "device-pixel-content-box" });
|
|
@@ -211,7 +211,7 @@ const E = class E {
|
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
|
-
o(
|
|
214
|
+
o(L, "defaultProps", {
|
|
215
215
|
id: void 0,
|
|
216
216
|
canvas: null,
|
|
217
217
|
width: 800,
|
|
@@ -224,7 +224,7 @@ o(E, "defaultProps", {
|
|
|
224
224
|
colorSpace: "srgb",
|
|
225
225
|
trackPosition: !1
|
|
226
226
|
});
|
|
227
|
-
let
|
|
227
|
+
let H = L;
|
|
228
228
|
function gt(r) {
|
|
229
229
|
if (typeof r == "string") {
|
|
230
230
|
const t = document.getElementById(r);
|
|
@@ -236,7 +236,7 @@ function gt(r) {
|
|
|
236
236
|
}
|
|
237
237
|
function bt(r) {
|
|
238
238
|
const t = document.getElementById(r);
|
|
239
|
-
if (!
|
|
239
|
+
if (!H.isHTMLCanvas(t))
|
|
240
240
|
throw new Error("Object is not a canvas element");
|
|
241
241
|
return t;
|
|
242
242
|
}
|
|
@@ -266,9 +266,9 @@ function xe(r, t, e) {
|
|
|
266
266
|
function ye(r, t, e, i) {
|
|
267
267
|
return i ? Math.max(0, e - 1 - Math.round(r * t)) : Math.min(Math.round(r * t), e - 1);
|
|
268
268
|
}
|
|
269
|
-
const
|
|
269
|
+
const j = class j extends S {
|
|
270
270
|
constructor(e, i = {}) {
|
|
271
|
-
super(e, i,
|
|
271
|
+
super(e, i, j.defaultProps);
|
|
272
272
|
/** Width of all attachments in this framebuffer */
|
|
273
273
|
o(this, "width");
|
|
274
274
|
/** Height of all attachments in this framebuffer */
|
|
@@ -303,20 +303,20 @@ const q = class q extends S {
|
|
|
303
303
|
const s = this.createColorTexture(i, n);
|
|
304
304
|
return this.attachResource(s), s.view;
|
|
305
305
|
}
|
|
306
|
-
return i instanceof
|
|
306
|
+
return i instanceof B ? i.view : i;
|
|
307
307
|
});
|
|
308
308
|
const e = this.props.depthStencilAttachment;
|
|
309
309
|
if (e)
|
|
310
310
|
if (typeof e == "string") {
|
|
311
311
|
const i = this.createDepthStencilTexture(e);
|
|
312
312
|
this.attachResource(i), this.depthStencilAttachment = i.view;
|
|
313
|
-
} else e instanceof
|
|
313
|
+
} else e instanceof B ? this.depthStencilAttachment = e.view : this.depthStencilAttachment = e;
|
|
314
314
|
}
|
|
315
315
|
/** Create a color texture */
|
|
316
316
|
createColorTexture(e, i) {
|
|
317
317
|
return this.device.createTexture({
|
|
318
318
|
id: `${this.id}-color-attachment-${i}`,
|
|
319
|
-
usage:
|
|
319
|
+
usage: B.RENDER_ATTACHMENT,
|
|
320
320
|
format: e,
|
|
321
321
|
width: this.width,
|
|
322
322
|
height: this.height,
|
|
@@ -331,7 +331,7 @@ const q = class q extends S {
|
|
|
331
331
|
createDepthStencilTexture(e) {
|
|
332
332
|
return this.device.createTexture({
|
|
333
333
|
id: `${this.id}-depth-stencil-attachment`,
|
|
334
|
-
usage:
|
|
334
|
+
usage: B.RENDER_ATTACHMENT,
|
|
335
335
|
format: e,
|
|
336
336
|
width: this.width,
|
|
337
337
|
height: this.height
|
|
@@ -361,7 +361,7 @@ const q = class q extends S {
|
|
|
361
361
|
this.updateAttachments();
|
|
362
362
|
}
|
|
363
363
|
};
|
|
364
|
-
o(
|
|
364
|
+
o(j, "defaultProps", {
|
|
365
365
|
...S.defaultProps,
|
|
366
366
|
width: 1,
|
|
367
367
|
height: 1,
|
|
@@ -370,30 +370,30 @@ o(q, "defaultProps", {
|
|
|
370
370
|
depthStencilAttachment: null
|
|
371
371
|
// 'depth24plus-stencil8'
|
|
372
372
|
});
|
|
373
|
-
let
|
|
374
|
-
const
|
|
373
|
+
let q = j;
|
|
374
|
+
const P = class P extends S {
|
|
375
375
|
get [Symbol.toStringTag]() {
|
|
376
376
|
return "RenderPass";
|
|
377
377
|
}
|
|
378
378
|
constructor(t, e) {
|
|
379
|
-
e =
|
|
379
|
+
e = P.normalizeProps(t, e), super(t, e, P.defaultProps);
|
|
380
380
|
}
|
|
381
381
|
static normalizeProps(t, e) {
|
|
382
382
|
return e;
|
|
383
383
|
}
|
|
384
384
|
};
|
|
385
385
|
/** TODO - should be [0, 0, 0, 0], update once deck.gl tests run clean */
|
|
386
|
-
o(
|
|
387
|
-
o(
|
|
388
|
-
o(
|
|
389
|
-
o(
|
|
386
|
+
o(P, "defaultClearColor", [0, 0, 0, 1]), /** Depth 1.0 represents the far plance */
|
|
387
|
+
o(P, "defaultClearDepth", 1), /** Clears all stencil bits */
|
|
388
|
+
o(P, "defaultClearStencil", 0), /** Default properties for RenderPass */
|
|
389
|
+
o(P, "defaultProps", {
|
|
390
390
|
...S.defaultProps,
|
|
391
391
|
framebuffer: null,
|
|
392
392
|
parameters: void 0,
|
|
393
|
-
clearColor:
|
|
393
|
+
clearColor: P.defaultClearColor,
|
|
394
394
|
clearColors: void 0,
|
|
395
|
-
clearDepth:
|
|
396
|
-
clearStencil:
|
|
395
|
+
clearDepth: P.defaultClearDepth,
|
|
396
|
+
clearStencil: P.defaultClearStencil,
|
|
397
397
|
depthReadOnly: !1,
|
|
398
398
|
stencilReadOnly: !1,
|
|
399
399
|
discard: !1,
|
|
@@ -402,38 +402,38 @@ o(_, "defaultProps", {
|
|
|
402
402
|
beginTimestampIndex: void 0,
|
|
403
403
|
endTimestampIndex: void 0
|
|
404
404
|
});
|
|
405
|
-
let
|
|
406
|
-
const
|
|
405
|
+
let ne = P;
|
|
406
|
+
const Q = class Q extends S {
|
|
407
407
|
get [Symbol.toStringTag]() {
|
|
408
408
|
return "CommandEncoder";
|
|
409
409
|
}
|
|
410
410
|
constructor(t, e) {
|
|
411
|
-
super(t, e,
|
|
411
|
+
super(t, e, Q.defaultProps);
|
|
412
412
|
}
|
|
413
413
|
};
|
|
414
414
|
// TODO - luma.gl has these on the device, should we align with WebGPU API?
|
|
415
415
|
// beginRenderPass(GPURenderPassDescriptor descriptor): GPURenderPassEncoder;
|
|
416
416
|
// beginComputePass(optional GPUComputePassDescriptor descriptor = {}): GPUComputePassEncoder;
|
|
417
|
-
o(
|
|
417
|
+
o(Q, "defaultProps", {
|
|
418
418
|
...S.defaultProps,
|
|
419
419
|
measureExecutionTime: void 0
|
|
420
420
|
});
|
|
421
|
-
let
|
|
422
|
-
const
|
|
421
|
+
let se = Q;
|
|
422
|
+
const Y = class Y extends S {
|
|
423
423
|
get [Symbol.toStringTag]() {
|
|
424
424
|
return "CommandBuffer";
|
|
425
425
|
}
|
|
426
426
|
constructor(t, e) {
|
|
427
|
-
super(t, e,
|
|
427
|
+
super(t, e, Y.defaultProps);
|
|
428
428
|
}
|
|
429
429
|
};
|
|
430
|
-
o(
|
|
430
|
+
o(Y, "defaultProps", {
|
|
431
431
|
...S.defaultProps
|
|
432
432
|
});
|
|
433
|
-
let
|
|
434
|
-
const
|
|
433
|
+
let ae = Y;
|
|
434
|
+
const K = class K extends S {
|
|
435
435
|
constructor(e, i) {
|
|
436
|
-
super(e, i,
|
|
436
|
+
super(e, i, K.defaultProps);
|
|
437
437
|
/** Max number of vertex attributes */
|
|
438
438
|
o(this, "maxVertexAttributes");
|
|
439
439
|
/** Attribute infos indexed by location - TODO only needed by webgl module? */
|
|
@@ -453,41 +453,41 @@ const Y = class Y extends S {
|
|
|
453
453
|
this.device.reportError(new Error("constant attributes not supported"), this)();
|
|
454
454
|
}
|
|
455
455
|
};
|
|
456
|
-
o(
|
|
456
|
+
o(K, "defaultProps", {
|
|
457
457
|
...S.defaultProps,
|
|
458
458
|
shaderLayout: void 0,
|
|
459
459
|
bufferLayout: []
|
|
460
460
|
});
|
|
461
|
-
let
|
|
462
|
-
const
|
|
461
|
+
let oe = K;
|
|
462
|
+
const Z = class Z extends S {
|
|
463
463
|
get [Symbol.toStringTag]() {
|
|
464
464
|
return "TransformFeedback";
|
|
465
465
|
}
|
|
466
466
|
constructor(t, e) {
|
|
467
|
-
super(t, e,
|
|
467
|
+
super(t, e, Z.defaultProps);
|
|
468
468
|
}
|
|
469
469
|
};
|
|
470
|
-
o(
|
|
470
|
+
o(Z, "defaultProps", {
|
|
471
471
|
...S.defaultProps,
|
|
472
472
|
layout: void 0,
|
|
473
473
|
buffers: {}
|
|
474
474
|
});
|
|
475
|
-
let
|
|
476
|
-
const
|
|
475
|
+
let ce = Z;
|
|
476
|
+
const J = class J extends S {
|
|
477
477
|
get [Symbol.toStringTag]() {
|
|
478
478
|
return "QuerySet";
|
|
479
479
|
}
|
|
480
480
|
constructor(t, e) {
|
|
481
|
-
super(t, e,
|
|
481
|
+
super(t, e, J.defaultProps);
|
|
482
482
|
}
|
|
483
483
|
};
|
|
484
|
-
o(
|
|
484
|
+
o(J, "defaultProps", {
|
|
485
485
|
...S.defaultProps,
|
|
486
486
|
type: void 0,
|
|
487
487
|
count: void 0
|
|
488
488
|
});
|
|
489
|
-
let
|
|
490
|
-
const
|
|
489
|
+
let le = J;
|
|
490
|
+
const fe = {
|
|
491
491
|
3042: !1,
|
|
492
492
|
32773: new Float32Array([0, 0, 0, 0]),
|
|
493
493
|
32777: 32774,
|
|
@@ -569,7 +569,7 @@ const he = {
|
|
|
569
569
|
}, y = (r, t, e) => t ? r.enable(e) : r.disable(e), we = (r, t, e) => r.hint(e, t), T = (r, t, e) => r.pixelStorei(e, t), ve = (r, t, e) => {
|
|
570
570
|
const i = e === 36006 ? 36009 : 36008;
|
|
571
571
|
return r.bindFramebuffer(i, t);
|
|
572
|
-
},
|
|
572
|
+
}, I = (r, t, e) => {
|
|
573
573
|
const n = {
|
|
574
574
|
34964: 34962,
|
|
575
575
|
36662: 36662,
|
|
@@ -579,7 +579,7 @@ const he = {
|
|
|
579
579
|
}[e];
|
|
580
580
|
r.bindBuffer(n, t);
|
|
581
581
|
};
|
|
582
|
-
function
|
|
582
|
+
function ee(r) {
|
|
583
583
|
return Array.isArray(r) || ArrayBuffer.isView(r) && !(r instanceof DataView);
|
|
584
584
|
}
|
|
585
585
|
const xt = {
|
|
@@ -613,11 +613,11 @@ const xt = {
|
|
|
613
613
|
36006: ve,
|
|
614
614
|
36010: ve,
|
|
615
615
|
// Buffers
|
|
616
|
-
34964:
|
|
617
|
-
36662:
|
|
618
|
-
36663:
|
|
619
|
-
35053:
|
|
620
|
-
35055:
|
|
616
|
+
34964: I,
|
|
617
|
+
36662: I,
|
|
618
|
+
36663: I,
|
|
619
|
+
35053: I,
|
|
620
|
+
35055: I,
|
|
621
621
|
2886: (r, t) => r.frontFace(t),
|
|
622
622
|
33170: we,
|
|
623
623
|
2849: (r, t) => r.lineWidth(t),
|
|
@@ -718,17 +718,17 @@ const xt = {
|
|
|
718
718
|
scissor: (r, t) => r.scissor(...t),
|
|
719
719
|
stencilTest: (r, t) => t ? r.enable(2960) : r.disable(2960),
|
|
720
720
|
stencilMask: (r, t) => {
|
|
721
|
-
t =
|
|
721
|
+
t = ee(t) ? t : [t, t];
|
|
722
722
|
const [e, i] = t;
|
|
723
723
|
r.stencilMaskSeparate(1028, e), r.stencilMaskSeparate(1029, i);
|
|
724
724
|
},
|
|
725
725
|
stencilFunc: (r, t) => {
|
|
726
|
-
t =
|
|
726
|
+
t = ee(t) && t.length === 3 ? [...t, ...t] : t;
|
|
727
727
|
const [e, i, n, s, a, c] = t;
|
|
728
728
|
r.stencilFuncSeparate(1028, e, i, n), r.stencilFuncSeparate(1029, s, a, c);
|
|
729
729
|
},
|
|
730
730
|
stencilOp: (r, t) => {
|
|
731
|
-
t =
|
|
731
|
+
t = ee(t) && t.length === 3 ? [...t, ...t] : t;
|
|
732
732
|
const [e, i, n, s, a, c] = t;
|
|
733
733
|
r.stencilOpSeparate(1028, e, i, n), r.stencilOpSeparate(1029, s, a, c);
|
|
734
734
|
},
|
|
@@ -898,17 +898,17 @@ const yt = {
|
|
|
898
898
|
viewport: (r, t, e, i, n) => r({
|
|
899
899
|
2978: [t, e, i, n]
|
|
900
900
|
})
|
|
901
|
-
},
|
|
902
|
-
3042:
|
|
903
|
-
2884:
|
|
904
|
-
2929:
|
|
905
|
-
3024:
|
|
906
|
-
32823:
|
|
907
|
-
32926:
|
|
908
|
-
32928:
|
|
909
|
-
3089:
|
|
910
|
-
2960:
|
|
911
|
-
35977:
|
|
901
|
+
}, A = (r, t) => r.isEnabled(t), Te = {
|
|
902
|
+
3042: A,
|
|
903
|
+
2884: A,
|
|
904
|
+
2929: A,
|
|
905
|
+
3024: A,
|
|
906
|
+
32823: A,
|
|
907
|
+
32926: A,
|
|
908
|
+
32928: A,
|
|
909
|
+
3089: A,
|
|
910
|
+
2960: A,
|
|
911
|
+
35977: A
|
|
912
912
|
}, wt = /* @__PURE__ */ new Set([
|
|
913
913
|
34016,
|
|
914
914
|
36388,
|
|
@@ -941,7 +941,7 @@ const yt = {
|
|
|
941
941
|
32874,
|
|
942
942
|
34068
|
|
943
943
|
]);
|
|
944
|
-
function
|
|
944
|
+
function R(r, t) {
|
|
945
945
|
if (St(t))
|
|
946
946
|
return;
|
|
947
947
|
const e = {};
|
|
@@ -956,7 +956,7 @@ function W(r, t) {
|
|
|
956
956
|
s(r, t, i);
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
function Re(r, t =
|
|
959
|
+
function Re(r, t = fe) {
|
|
960
960
|
if (typeof t == "number") {
|
|
961
961
|
const n = t, s = Te[n];
|
|
962
962
|
return s ? s(r, n) : r.getParameter(n);
|
|
@@ -969,7 +969,7 @@ function Re(r, t = he) {
|
|
|
969
969
|
return i;
|
|
970
970
|
}
|
|
971
971
|
function vt(r) {
|
|
972
|
-
|
|
972
|
+
R(r, fe);
|
|
973
973
|
}
|
|
974
974
|
function St(r) {
|
|
975
975
|
for (const t in r)
|
|
@@ -990,7 +990,7 @@ function Tt(r, t) {
|
|
|
990
990
|
function _e(r) {
|
|
991
991
|
return Array.isArray(r) || ArrayBuffer.isView(r);
|
|
992
992
|
}
|
|
993
|
-
class
|
|
993
|
+
class F {
|
|
994
994
|
constructor(t, e) {
|
|
995
995
|
o(this, "gl");
|
|
996
996
|
o(this, "program", null);
|
|
@@ -1010,7 +1010,7 @@ class C {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
pop() {
|
|
1012
1012
|
const t = this.stateStack[this.stateStack.length - 1];
|
|
1013
|
-
|
|
1013
|
+
R(this.gl, t), this.stateStack.pop();
|
|
1014
1014
|
}
|
|
1015
1015
|
/**
|
|
1016
1016
|
* Initialize WebGL state caching on a context
|
|
@@ -1021,7 +1021,7 @@ class C {
|
|
|
1021
1021
|
* temporarily modifying, and then restoring state.
|
|
1022
1022
|
*/
|
|
1023
1023
|
trackState(t, e) {
|
|
1024
|
-
if (this.cache = e != null && e.copyState ? Re(t) : Object.assign({},
|
|
1024
|
+
if (this.cache = e != null && e.copyState ? Re(t) : Object.assign({}, fe), this.initialized)
|
|
1025
1025
|
throw new Error("WebGLStateTracker");
|
|
1026
1026
|
this.initialized = !0, this.gl.state = this, Pt(t);
|
|
1027
1027
|
for (const i in Se) {
|
|
@@ -1051,7 +1051,7 @@ function Pe(r, t) {
|
|
|
1051
1051
|
r[t] = function(n) {
|
|
1052
1052
|
if (n === void 0 || wt.has(n))
|
|
1053
1053
|
return e(n);
|
|
1054
|
-
const s =
|
|
1054
|
+
const s = F.get(r);
|
|
1055
1055
|
return n in s.cache || (s.cache[n] = e(n)), s.enable ? (
|
|
1056
1056
|
// Call the getter the params so that it can e.g. serve from a cache
|
|
1057
1057
|
s.cache[n]
|
|
@@ -1069,7 +1069,7 @@ function _t(r, t, e) {
|
|
|
1069
1069
|
return;
|
|
1070
1070
|
const i = r[t].bind(r);
|
|
1071
1071
|
r[t] = function(...s) {
|
|
1072
|
-
const a =
|
|
1072
|
+
const a = F.get(r), { valueChanged: c, oldValue: l } = e(a._updateCache, ...s);
|
|
1073
1073
|
return c && i(...s), l;
|
|
1074
1074
|
}, Object.defineProperty(r[t], "name", {
|
|
1075
1075
|
value: `${t}-to-cache`,
|
|
@@ -1079,7 +1079,7 @@ function _t(r, t, e) {
|
|
|
1079
1079
|
function Pt(r) {
|
|
1080
1080
|
const t = r.useProgram.bind(r);
|
|
1081
1081
|
r.useProgram = function(i) {
|
|
1082
|
-
const n =
|
|
1082
|
+
const n = F.get(r);
|
|
1083
1083
|
n.program !== i && (t(i), n.program = i);
|
|
1084
1084
|
};
|
|
1085
1085
|
}
|
|
@@ -1096,12 +1096,12 @@ function At(r, t, e) {
|
|
|
1096
1096
|
const { onContextLost: a, onContextRestored: c } = t;
|
|
1097
1097
|
return r.addEventListener("webglcontextlost", (l) => a(l), !1), r.addEventListener("webglcontextrestored", (l) => c(l), !1), s.luma || (s.luma = {}), s;
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1099
|
+
function W(r, t, e) {
|
|
1100
1100
|
return e[t] === void 0 && (e[t] = r.getExtension(t) || null), e[t];
|
|
1101
1101
|
}
|
|
1102
1102
|
function Et(r, t) {
|
|
1103
1103
|
const e = r.getParameter(7936), i = r.getParameter(7937);
|
|
1104
|
-
|
|
1104
|
+
W(r, "WEBGL_debug_renderer_info", t);
|
|
1105
1105
|
const n = t.WEBGL_debug_renderer_info, s = r.getParameter(n ? n.UNMASKED_VENDOR_WEBGL : 7936), a = r.getParameter(n ? n.UNMASKED_RENDERER_WEBGL : 7937), c = s || e, l = a || i, u = r.getParameter(7938), h = Ie(c, l), f = Lt(c, l), g = Bt(c, l);
|
|
1106
1106
|
return {
|
|
1107
1107
|
type: "webgl",
|
|
@@ -1167,7 +1167,7 @@ function Oe(r) {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
throw new Error(String(r));
|
|
1169
1169
|
}
|
|
1170
|
-
const
|
|
1170
|
+
const O = "WEBGL_compressed_texture_s3tc", $ = "WEBGL_compressed_texture_s3tc_srgb", D = "EXT_texture_compression_rgtc", G = "EXT_texture_compression_bptc", Ct = "WEBGL_compressed_texture_etc", Ft = "WEBGL_compressed_texture_astc", kt = "WEBGL_compressed_texture_etc1", Dt = "WEBGL_compressed_texture_pvrtc", Gt = "WEBGL_compressed_texture_atc", Ae = "EXT_texture_norm16", Ee = "EXT_render_snorm", Mt = "EXT_color_buffer_float", de = {
|
|
1171
1171
|
"float32-renderable-webgl": ["EXT_color_buffer_float"],
|
|
1172
1172
|
"float16-renderable-webgl": ["EXT_color_buffer_half_float"],
|
|
1173
1173
|
"rgb9e5ufloat-renderable-webgl": ["WEBGL_render_shared_exponent"],
|
|
@@ -1178,11 +1178,11 @@ const I = "WEBGL_compressed_texture_s3tc", O = "WEBGL_compressed_texture_s3tc_sr
|
|
|
1178
1178
|
"float16-filterable-webgl": ["OES_texture_half_float_linear"],
|
|
1179
1179
|
"texture-filterable-anisotropic-webgl": ["EXT_texture_filter_anisotropic"],
|
|
1180
1180
|
"texture-blend-float-webgl": ["EXT_float_blend"],
|
|
1181
|
-
"texture-compression-bc": [
|
|
1181
|
+
"texture-compression-bc": [O, $, D, G],
|
|
1182
1182
|
// 'texture-compression-bc3-srgb-webgl': [X_S3TC_SRGB],
|
|
1183
1183
|
// 'texture-compression-bc3-webgl': [X_S3TC],
|
|
1184
|
-
"texture-compression-bc5-webgl": [
|
|
1185
|
-
"texture-compression-bc7-webgl": [
|
|
1184
|
+
"texture-compression-bc5-webgl": [D],
|
|
1185
|
+
"texture-compression-bc7-webgl": [G],
|
|
1186
1186
|
"texture-compression-etc2": [Ct],
|
|
1187
1187
|
"texture-compression-astc": [Ft],
|
|
1188
1188
|
"texture-compression-etc1-webgl": [kt],
|
|
@@ -1190,12 +1190,12 @@ const I = "WEBGL_compressed_texture_s3tc", O = "WEBGL_compressed_texture_s3tc_sr
|
|
|
1190
1190
|
"texture-compression-atc-webgl": [Gt]
|
|
1191
1191
|
};
|
|
1192
1192
|
function Wt(r) {
|
|
1193
|
-
return r in
|
|
1193
|
+
return r in de;
|
|
1194
1194
|
}
|
|
1195
1195
|
function Rt(r, t, e) {
|
|
1196
|
-
return (
|
|
1196
|
+
return (de[t] || []).every((n) => W(r, n, e));
|
|
1197
1197
|
}
|
|
1198
|
-
const
|
|
1198
|
+
const ge = {
|
|
1199
1199
|
// 8-bit formats
|
|
1200
1200
|
r8unorm: { gl: 33321, rb: !0 },
|
|
1201
1201
|
r8snorm: { gl: 36756 },
|
|
@@ -1273,22 +1273,22 @@ const de = {
|
|
|
1273
1273
|
// "depth32float-stencil8" feature - TODO below is render buffer only?
|
|
1274
1274
|
"depth32float-stencil8": { gl: 36013, dataFormat: 34041, types: [36269], rb: !0 },
|
|
1275
1275
|
// BC compressed formats: check device.features.has("texture-compression-bc");
|
|
1276
|
-
"bc1-rgb-unorm-webgl": { gl: 33776, x:
|
|
1277
|
-
"bc1-rgb-unorm-srgb-webgl": { gl: 35916, x:
|
|
1278
|
-
"bc1-rgba-unorm": { gl: 33777, x:
|
|
1279
|
-
"bc1-rgba-unorm-srgb": { gl: 35916, x:
|
|
1280
|
-
"bc2-rgba-unorm": { gl: 33778, x:
|
|
1281
|
-
"bc2-rgba-unorm-srgb": { gl: 35918, x:
|
|
1282
|
-
"bc3-rgba-unorm": { gl: 33779, x:
|
|
1283
|
-
"bc3-rgba-unorm-srgb": { gl: 35919, x:
|
|
1284
|
-
"bc4-r-unorm": { gl: 36283, x:
|
|
1285
|
-
"bc4-r-snorm": { gl: 36284, x:
|
|
1286
|
-
"bc5-rg-unorm": { gl: 36285, x:
|
|
1287
|
-
"bc5-rg-snorm": { gl: 36286, x:
|
|
1288
|
-
"bc6h-rgb-ufloat": { gl: 36495, x:
|
|
1289
|
-
"bc6h-rgb-float": { gl: 36494, x:
|
|
1290
|
-
"bc7-rgba-unorm": { gl: 36492, x:
|
|
1291
|
-
"bc7-rgba-unorm-srgb": { gl: 36493, x:
|
|
1276
|
+
"bc1-rgb-unorm-webgl": { gl: 33776, x: O },
|
|
1277
|
+
"bc1-rgb-unorm-srgb-webgl": { gl: 35916, x: $ },
|
|
1278
|
+
"bc1-rgba-unorm": { gl: 33777, x: O },
|
|
1279
|
+
"bc1-rgba-unorm-srgb": { gl: 35916, x: $ },
|
|
1280
|
+
"bc2-rgba-unorm": { gl: 33778, x: O },
|
|
1281
|
+
"bc2-rgba-unorm-srgb": { gl: 35918, x: $ },
|
|
1282
|
+
"bc3-rgba-unorm": { gl: 33779, x: O },
|
|
1283
|
+
"bc3-rgba-unorm-srgb": { gl: 35919, x: $ },
|
|
1284
|
+
"bc4-r-unorm": { gl: 36283, x: D },
|
|
1285
|
+
"bc4-r-snorm": { gl: 36284, x: D },
|
|
1286
|
+
"bc5-rg-unorm": { gl: 36285, x: D },
|
|
1287
|
+
"bc5-rg-snorm": { gl: 36286, x: D },
|
|
1288
|
+
"bc6h-rgb-ufloat": { gl: 36495, x: G },
|
|
1289
|
+
"bc6h-rgb-float": { gl: 36494, x: G },
|
|
1290
|
+
"bc7-rgba-unorm": { gl: 36492, x: G },
|
|
1291
|
+
"bc7-rgba-unorm-srgb": { gl: 36493, x: G },
|
|
1292
1292
|
// WEBGL_compressed_texture_etc: device.features.has("texture-compression-etc2")
|
|
1293
1293
|
// Note: Supposedly guaranteed availability compressed formats in WebGL2, but through CPU decompression
|
|
1294
1294
|
"etc2-rgb8unorm": { gl: 37492 },
|
|
@@ -1344,8 +1344,8 @@ const de = {
|
|
|
1344
1344
|
};
|
|
1345
1345
|
function It(r, t, e) {
|
|
1346
1346
|
let i = t.create;
|
|
1347
|
-
const n =
|
|
1348
|
-
return (n == null ? void 0 : n.gl) === void 0 && (i = !1), n != null && n.x && (i = i && !!
|
|
1347
|
+
const n = ge[t.format];
|
|
1348
|
+
return (n == null ? void 0 : n.gl) === void 0 && (i = !1), n != null && n.x && (i = i && !!W(r, n.x, e)), {
|
|
1349
1349
|
format: t.format,
|
|
1350
1350
|
// @ts-ignore
|
|
1351
1351
|
create: i && t.create,
|
|
@@ -1361,7 +1361,7 @@ function It(r, t, e) {
|
|
|
1361
1361
|
}
|
|
1362
1362
|
function $e(r) {
|
|
1363
1363
|
var n;
|
|
1364
|
-
const t =
|
|
1364
|
+
const t = ge[r], e = zt(r), i = We.getInfo(r);
|
|
1365
1365
|
return i.compressed && (t.dataFormat = e), {
|
|
1366
1366
|
internalFormat: e,
|
|
1367
1367
|
format: (t == null ? void 0 : t.dataFormat) || $t(i.channels, i.integer, i.normalized, e),
|
|
@@ -1401,7 +1401,7 @@ function $t(r, t, e, i) {
|
|
|
1401
1401
|
}
|
|
1402
1402
|
}
|
|
1403
1403
|
function zt(r) {
|
|
1404
|
-
const t =
|
|
1404
|
+
const t = ge[r], e = t == null ? void 0 : t.gl;
|
|
1405
1405
|
if (e === void 0)
|
|
1406
1406
|
throw new Error(`Unsupported texture format ${r}`);
|
|
1407
1407
|
return e;
|
|
@@ -1430,7 +1430,7 @@ class Vt extends et {
|
|
|
1430
1430
|
o(this, "gl");
|
|
1431
1431
|
o(this, "extensions");
|
|
1432
1432
|
o(this, "testedFeatures", /* @__PURE__ */ new Set());
|
|
1433
|
-
this.gl = e, this.extensions = i,
|
|
1433
|
+
this.gl = e, this.extensions = i, W(e, "EXT_color_buffer_float", i);
|
|
1434
1434
|
}
|
|
1435
1435
|
*[Symbol.iterator]() {
|
|
1436
1436
|
const e = this.getFeatures();
|
|
@@ -1450,12 +1450,12 @@ class Vt extends et {
|
|
|
1450
1450
|
}
|
|
1451
1451
|
// IMPLEMENTATION
|
|
1452
1452
|
getFeatures() {
|
|
1453
|
-
return [...Object.keys(Le), ...Object.keys(
|
|
1453
|
+
return [...Object.keys(Le), ...Object.keys(de)];
|
|
1454
1454
|
}
|
|
1455
1455
|
/** Extract all WebGL features */
|
|
1456
1456
|
getWebGLFeature(e) {
|
|
1457
1457
|
const i = Le[e];
|
|
1458
|
-
return typeof i == "string" ? !!
|
|
1458
|
+
return typeof i == "string" ? !!W(this.gl, i, this.extensions) : !!i;
|
|
1459
1459
|
}
|
|
1460
1460
|
}
|
|
1461
1461
|
class Ut extends tt {
|
|
@@ -1562,7 +1562,7 @@ class Ut extends tt {
|
|
|
1562
1562
|
return this.limits[e] === void 0 && (this.limits[e] = this.gl.getParameter(e)), this.limits[e] || 0;
|
|
1563
1563
|
}
|
|
1564
1564
|
}
|
|
1565
|
-
class
|
|
1565
|
+
class z extends q {
|
|
1566
1566
|
constructor(e, i) {
|
|
1567
1567
|
super(e, i);
|
|
1568
1568
|
o(this, "device");
|
|
@@ -1659,7 +1659,7 @@ function Xt(r) {
|
|
|
1659
1659
|
return `${r}`;
|
|
1660
1660
|
}
|
|
1661
1661
|
}
|
|
1662
|
-
class Ht extends
|
|
1662
|
+
class Ht extends H {
|
|
1663
1663
|
constructor(e, i) {
|
|
1664
1664
|
super(i);
|
|
1665
1665
|
o(this, "device");
|
|
@@ -1671,19 +1671,19 @@ class Ht extends X {
|
|
|
1671
1671
|
return "WebGLCanvasContext";
|
|
1672
1672
|
}
|
|
1673
1673
|
getCurrentFramebuffer() {
|
|
1674
|
-
return this._framebuffer = this._framebuffer || new
|
|
1674
|
+
return this._framebuffer = this._framebuffer || new z(this.device, { handle: null }), this._framebuffer;
|
|
1675
1675
|
}
|
|
1676
1676
|
// IMPLEMENTATION OF ABSTRACT METHODS
|
|
1677
1677
|
_updateDevice() {
|
|
1678
1678
|
}
|
|
1679
1679
|
}
|
|
1680
|
-
const
|
|
1680
|
+
const te = {};
|
|
1681
1681
|
function qt(r = "id") {
|
|
1682
|
-
|
|
1683
|
-
const t =
|
|
1682
|
+
te[r] = te[r] || 1;
|
|
1683
|
+
const t = te[r]++;
|
|
1684
1684
|
return `${r}-${t}`;
|
|
1685
1685
|
}
|
|
1686
|
-
class
|
|
1686
|
+
class V extends C {
|
|
1687
1687
|
constructor(e, i = {}) {
|
|
1688
1688
|
super(e, i);
|
|
1689
1689
|
o(this, "device");
|
|
@@ -1742,10 +1742,10 @@ class z extends B {
|
|
|
1742
1742
|
}
|
|
1743
1743
|
}
|
|
1744
1744
|
function jt(r) {
|
|
1745
|
-
return r &
|
|
1745
|
+
return r & C.INDEX ? 34963 : r & C.VERTEX ? 34962 : r & C.UNIFORM ? 35345 : 34962;
|
|
1746
1746
|
}
|
|
1747
1747
|
function Qt(r) {
|
|
1748
|
-
return r &
|
|
1748
|
+
return r & C.INDEX || r & C.VERTEX ? 35044 : r & C.UNIFORM ? 35048 : 35044;
|
|
1749
1749
|
}
|
|
1750
1750
|
function Yt(r) {
|
|
1751
1751
|
const t = r.split(/\r?\n/), e = [];
|
|
@@ -1861,7 +1861,7 @@ function Zt(r, t, e, i) {
|
|
|
1861
1861
|
const n = r;
|
|
1862
1862
|
n.pushState();
|
|
1863
1863
|
try {
|
|
1864
|
-
return Jt(r, t),
|
|
1864
|
+
return Jt(r, t), R(n.gl, e), i(r);
|
|
1865
1865
|
} finally {
|
|
1866
1866
|
n.popState();
|
|
1867
1867
|
}
|
|
@@ -1880,11 +1880,11 @@ function Jt(r, t) {
|
|
|
1880
1880
|
i.enable(2884), i.cullFace(1029);
|
|
1881
1881
|
break;
|
|
1882
1882
|
}
|
|
1883
|
-
if (t.frontFace && i.frontFace(
|
|
1883
|
+
if (t.frontFace && i.frontFace(k("frontFace", t.frontFace, {
|
|
1884
1884
|
ccw: 2305,
|
|
1885
1885
|
cw: 2304
|
|
1886
1886
|
})), t.unclippedDepth && r.features.has("depth-clip-control") && i.enable(34383), t.depthBias !== void 0 && (i.enable(32823), i.polygonOffset(t.depthBias, t.depthBiasSlopeScale || 0)), t.provokingVertex && r.features.has("provoking-vertex-webgl")) {
|
|
1887
|
-
const s = e.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex, a =
|
|
1887
|
+
const s = e.getExtension("WEBGL_provoking_vertex").WEBGL_provoking_vertex, a = k("provokingVertex", t.provokingVertex, {
|
|
1888
1888
|
first: 36429,
|
|
1889
1889
|
last: 36430
|
|
1890
1890
|
});
|
|
@@ -1892,7 +1892,7 @@ function Jt(r, t) {
|
|
|
1892
1892
|
}
|
|
1893
1893
|
if ((t.polygonMode || t.polygonOffsetLine) && r.features.has("polygon-mode-webgl")) {
|
|
1894
1894
|
if (t.polygonMode) {
|
|
1895
|
-
const s = e.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode, a =
|
|
1895
|
+
const s = e.getExtension("WEBGL_polygon_mode").WEBGL_polygon_mode, a = k("polygonMode", t.polygonMode, {
|
|
1896
1896
|
fill: 6914,
|
|
1897
1897
|
line: 6913
|
|
1898
1898
|
});
|
|
@@ -1900,16 +1900,16 @@ function Jt(r, t) {
|
|
|
1900
1900
|
}
|
|
1901
1901
|
t.polygonOffsetLine && i.enable(10754);
|
|
1902
1902
|
}
|
|
1903
|
-
if (r.features.has("shader-clip-cull-distance-webgl") && (t.clipDistance0 && i.enable(12288), t.clipDistance1 && i.enable(12289), t.clipDistance2 && i.enable(12290), t.clipDistance3 && i.enable(12291), t.clipDistance4 && i.enable(12292), t.clipDistance5 && i.enable(12293), t.clipDistance6 && i.enable(12294), t.clipDistance7 && i.enable(12295)), t.depthWriteEnabled !== void 0 && i.depthMask(tr("depthWriteEnabled", t.depthWriteEnabled)), t.depthCompare && (t.depthCompare !== "always" ? i.enable(2929) : i.disable(2929), i.depthFunc(
|
|
1903
|
+
if (r.features.has("shader-clip-cull-distance-webgl") && (t.clipDistance0 && i.enable(12288), t.clipDistance1 && i.enable(12289), t.clipDistance2 && i.enable(12290), t.clipDistance3 && i.enable(12291), t.clipDistance4 && i.enable(12292), t.clipDistance5 && i.enable(12293), t.clipDistance6 && i.enable(12294), t.clipDistance7 && i.enable(12295)), t.depthWriteEnabled !== void 0 && i.depthMask(tr("depthWriteEnabled", t.depthWriteEnabled)), t.depthCompare && (t.depthCompare !== "always" ? i.enable(2929) : i.disable(2929), i.depthFunc(ue("depthCompare", t.depthCompare))), t.stencilWriteMask) {
|
|
1904
1904
|
const n = t.stencilWriteMask;
|
|
1905
1905
|
i.stencilMaskSeparate(1028, n), i.stencilMaskSeparate(1029, n);
|
|
1906
1906
|
}
|
|
1907
1907
|
if (t.stencilReadMask && b.warn("stencilReadMask not supported under WebGL"), t.stencilCompare) {
|
|
1908
|
-
const n = t.stencilReadMask || 4294967295, s =
|
|
1908
|
+
const n = t.stencilReadMask || 4294967295, s = ue("depthCompare", t.stencilCompare);
|
|
1909
1909
|
t.stencilCompare !== "always" ? i.enable(2960) : i.disable(2960), i.stencilFuncSeparate(1028, s, 0, n), i.stencilFuncSeparate(1029, s, 0, n);
|
|
1910
1910
|
}
|
|
1911
1911
|
if (t.stencilPassOperation && t.stencilFailOperation && t.stencilDepthFailOperation) {
|
|
1912
|
-
const n =
|
|
1912
|
+
const n = re("stencilPassOperation", t.stencilPassOperation), s = re("stencilFailOperation", t.stencilFailOperation), a = re("stencilDepthFailOperation", t.stencilDepthFailOperation);
|
|
1913
1913
|
i.stencilOpSeparate(1028, s, a, n), i.stencilOpSeparate(1029, s, a, n);
|
|
1914
1914
|
}
|
|
1915
1915
|
switch (t.blend) {
|
|
@@ -1923,12 +1923,12 @@ function Jt(r, t) {
|
|
|
1923
1923
|
if (t.blendColorOperation || t.blendAlphaOperation) {
|
|
1924
1924
|
const n = Ce("blendColorOperation", t.blendColorOperation || "add"), s = Ce("blendAlphaOperation", t.blendAlphaOperation || "add");
|
|
1925
1925
|
i.blendEquationSeparate(n, s);
|
|
1926
|
-
const a =
|
|
1926
|
+
const a = X("blendColorSrcFactor", t.blendColorSrcFactor || "one"), c = X("blendColorDstFactor", t.blendColorDstFactor || "zero"), l = X("blendAlphaSrcFactor", t.blendAlphaSrcFactor || "one"), u = X("blendAlphaDstFactor", t.blendAlphaDstFactor || "zero");
|
|
1927
1927
|
i.blendFuncSeparate(a, c, l, u);
|
|
1928
1928
|
}
|
|
1929
1929
|
}
|
|
1930
|
-
function
|
|
1931
|
-
return
|
|
1930
|
+
function ue(r, t) {
|
|
1931
|
+
return k(r, t, {
|
|
1932
1932
|
never: 512,
|
|
1933
1933
|
less: 513,
|
|
1934
1934
|
equal: 514,
|
|
@@ -1939,8 +1939,8 @@ function le(r, t) {
|
|
|
1939
1939
|
always: 519
|
|
1940
1940
|
});
|
|
1941
1941
|
}
|
|
1942
|
-
function
|
|
1943
|
-
return
|
|
1942
|
+
function re(r, t) {
|
|
1943
|
+
return k(r, t, {
|
|
1944
1944
|
keep: 7680,
|
|
1945
1945
|
zero: 0,
|
|
1946
1946
|
replace: 7681,
|
|
@@ -1952,7 +1952,7 @@ function te(r, t) {
|
|
|
1952
1952
|
});
|
|
1953
1953
|
}
|
|
1954
1954
|
function Ce(r, t) {
|
|
1955
|
-
return
|
|
1955
|
+
return k(r, t, {
|
|
1956
1956
|
add: 32774,
|
|
1957
1957
|
subtract: 32778,
|
|
1958
1958
|
"reverse-subtract": 32779,
|
|
@@ -1960,8 +1960,8 @@ function Ce(r, t) {
|
|
|
1960
1960
|
max: 32776
|
|
1961
1961
|
});
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1964
|
-
return
|
|
1963
|
+
function X(r, t, e = "color") {
|
|
1964
|
+
return k(r, t, {
|
|
1965
1965
|
one: 1,
|
|
1966
1966
|
zero: 0,
|
|
1967
1967
|
src: 768,
|
|
@@ -1987,7 +1987,7 @@ function N(r, t, e = "color") {
|
|
|
1987
1987
|
function er(r, t) {
|
|
1988
1988
|
return `Illegal parameter ${t} for ${r}`;
|
|
1989
1989
|
}
|
|
1990
|
-
function
|
|
1990
|
+
function k(r, t, e) {
|
|
1991
1991
|
if (!(t in e))
|
|
1992
1992
|
throw new Error(er(r, t));
|
|
1993
1993
|
return e[t];
|
|
@@ -2005,9 +2005,9 @@ function rr(r) {
|
|
|
2005
2005
|
}
|
|
2006
2006
|
function ze(r) {
|
|
2007
2007
|
const t = {};
|
|
2008
|
-
return r.addressModeU && (t[10242] =
|
|
2008
|
+
return r.addressModeU && (t[10242] = ie(r.addressModeU)), r.addressModeV && (t[10243] = ie(r.addressModeV)), r.addressModeW && (t[32882] = ie(r.addressModeW)), r.magFilter && (t[10240] = he(r.magFilter)), (r.minFilter || r.mipmapFilter) && (t[10241] = ir(r.minFilter || "linear", r.mipmapFilter)), r.lodMinClamp !== void 0 && (t[33082] = r.lodMinClamp), r.lodMaxClamp !== void 0 && (t[33083] = r.lodMaxClamp), r.type === "comparison-sampler" && (t[34892] = 34894), r.compare && (t[34893] = ue("compare", r.compare)), r.maxAnisotropy && (t[34046] = r.maxAnisotropy), t;
|
|
2009
2009
|
}
|
|
2010
|
-
function
|
|
2010
|
+
function ie(r) {
|
|
2011
2011
|
switch (r) {
|
|
2012
2012
|
case "clamp-to-edge":
|
|
2013
2013
|
return 33071;
|
|
@@ -2017,7 +2017,7 @@ function re(r) {
|
|
|
2017
2017
|
return 33648;
|
|
2018
2018
|
}
|
|
2019
2019
|
}
|
|
2020
|
-
function
|
|
2020
|
+
function he(r) {
|
|
2021
2021
|
switch (r) {
|
|
2022
2022
|
case "nearest":
|
|
2023
2023
|
return 9728;
|
|
@@ -2027,10 +2027,10 @@ function ue(r) {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
function ir(r, t = "none") {
|
|
2029
2029
|
if (!t)
|
|
2030
|
-
return
|
|
2030
|
+
return he(r);
|
|
2031
2031
|
switch (t) {
|
|
2032
2032
|
case "none":
|
|
2033
|
-
return
|
|
2033
|
+
return he(r);
|
|
2034
2034
|
case "nearest":
|
|
2035
2035
|
switch (r) {
|
|
2036
2036
|
case "nearest":
|
|
@@ -2078,11 +2078,11 @@ class nr extends it {
|
|
|
2078
2078
|
}
|
|
2079
2079
|
}
|
|
2080
2080
|
}
|
|
2081
|
-
function
|
|
2081
|
+
function N(r, t, e) {
|
|
2082
2082
|
if (sr(t))
|
|
2083
2083
|
return e(r);
|
|
2084
|
-
const { nocatch: i = !0 } = t, n =
|
|
2085
|
-
n.push(),
|
|
2084
|
+
const { nocatch: i = !0 } = t, n = F.get(r);
|
|
2085
|
+
n.push(), R(r, t);
|
|
2086
2086
|
let s;
|
|
2087
2087
|
if (i)
|
|
2088
2088
|
s = e(r), n.pop();
|
|
@@ -2099,9 +2099,9 @@ function sr(r) {
|
|
|
2099
2099
|
return !1;
|
|
2100
2100
|
return !0;
|
|
2101
2101
|
}
|
|
2102
|
-
class
|
|
2102
|
+
class M extends nt {
|
|
2103
2103
|
constructor(e, i) {
|
|
2104
|
-
super(e, { ...
|
|
2104
|
+
super(e, { ...B.defaultProps, ...i });
|
|
2105
2105
|
o(this, "device");
|
|
2106
2106
|
o(this, "gl");
|
|
2107
2107
|
o(this, "handle");
|
|
@@ -2110,7 +2110,7 @@ class G extends nt {
|
|
|
2110
2110
|
this.device = e, this.gl = this.device.gl, this.handle = null, this.texture = i.texture;
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
|
-
class
|
|
2113
|
+
class U extends B {
|
|
2114
2114
|
constructor(e, i) {
|
|
2115
2115
|
super(e, i);
|
|
2116
2116
|
// readonly MAX_ATTRIBUTES: number;
|
|
@@ -2157,13 +2157,13 @@ class V extends L {
|
|
|
2157
2157
|
default:
|
|
2158
2158
|
throw new Error(s);
|
|
2159
2159
|
}
|
|
2160
|
-
this.gl.bindTexture(this.glTarget, null), this._initializeData(i.data), this.setSampler(this.props.sampler), this.view = new
|
|
2160
|
+
this.gl.bindTexture(this.glTarget, null), this._initializeData(i.data), this.setSampler(this.props.sampler), this.view = new M(this.device, { ...this.props, texture: this }), Object.seal(this);
|
|
2161
2161
|
}
|
|
2162
2162
|
destroy() {
|
|
2163
2163
|
this.handle && (this.gl.deleteTexture(this.handle), this.removeStats(), this.trackDeallocatedMemory("Texture"), this.destroyed = !0);
|
|
2164
2164
|
}
|
|
2165
2165
|
createView(e) {
|
|
2166
|
-
return new
|
|
2166
|
+
return new M(this.device, { ...e, texture: this });
|
|
2167
2167
|
}
|
|
2168
2168
|
setSampler(e = {}) {
|
|
2169
2169
|
super.setSampler(e);
|
|
@@ -2171,11 +2171,21 @@ class V extends L {
|
|
|
2171
2171
|
this._setSamplerParameters(i);
|
|
2172
2172
|
}
|
|
2173
2173
|
copyImageData(e) {
|
|
2174
|
-
const i = this._normalizeCopyImageDataOptions(e), n = i.data, { width: s, height: a, depth: c } = this, { mipLevel: l = 0, byteOffset: u = 0, x: h = 0, y: f = 0, z: g = 0 } = i, { glFormat: d, glType: m, compressed: p } = this, w = Fe(this.glTarget, this.dimension,
|
|
2175
|
-
|
|
2174
|
+
const i = this._normalizeCopyImageDataOptions(e), n = i.data, { width: s, height: a, depth: c } = this, { mipLevel: l = 0, byteOffset: u = 0, x: h = 0, y: f = 0, z: g = 0 } = i, { glFormat: d, glType: m, compressed: p } = this, w = Fe(this.glTarget, this.dimension, g);
|
|
2175
|
+
let v;
|
|
2176
|
+
if (!this.compressed) {
|
|
2177
|
+
const { bytesPerPixel: E } = this.device.getTextureFormatInfo(this.format);
|
|
2178
|
+
if (E) {
|
|
2179
|
+
if (i.bytesPerRow % E !== 0)
|
|
2180
|
+
throw new Error(`bytesPerRow (${i.bytesPerRow}) must be a multiple of bytesPerPixel (${E}) for ${this.format}`);
|
|
2181
|
+
v = i.bytesPerRow / E;
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
const _ = this.compressed ? {} : {
|
|
2185
|
+
...v !== void 0 ? { 3314: v } : {},
|
|
2176
2186
|
32878: i.rowsPerImage
|
|
2177
2187
|
};
|
|
2178
|
-
this.gl.bindTexture(w, this.handle),
|
|
2188
|
+
this.gl.bindTexture(w, this.handle), N(this.gl, _, () => {
|
|
2179
2189
|
switch (this.dimension) {
|
|
2180
2190
|
case "2d":
|
|
2181
2191
|
case "cube":
|
|
@@ -2194,7 +2204,7 @@ class V extends L {
|
|
|
2194
2204
|
if (i.sourceX || i.sourceY)
|
|
2195
2205
|
throw new Error("WebGL does not support sourceX/sourceY)");
|
|
2196
2206
|
const { glFormat: n, glType: s } = this, { image: a, depth: c, mipLevel: l, x: u, y: h, z: f, width: g, height: d } = i, m = Fe(this.glTarget, this.dimension, c), p = i.flipY ? { 37440: !0 } : {};
|
|
2197
|
-
return this.gl.bindTexture(this.glTarget, this.handle),
|
|
2207
|
+
return this.gl.bindTexture(this.glTarget, this.handle), N(this.gl, p, () => {
|
|
2198
2208
|
switch (this.dimension) {
|
|
2199
2209
|
case "2d":
|
|
2200
2210
|
case "cube":
|
|
@@ -2289,7 +2299,7 @@ function Fe(r, t, e) {
|
|
|
2289
2299
|
function or(r) {
|
|
2290
2300
|
return hr[r];
|
|
2291
2301
|
}
|
|
2292
|
-
function
|
|
2302
|
+
function be(r) {
|
|
2293
2303
|
return ur[r];
|
|
2294
2304
|
}
|
|
2295
2305
|
function cr(r) {
|
|
@@ -2413,7 +2423,7 @@ function dr(r, t) {
|
|
|
2413
2423
|
/* , size*/
|
|
2414
2424
|
} = s, l = r.getAttribLocation(t, a);
|
|
2415
2425
|
if (l >= 0) {
|
|
2416
|
-
const u =
|
|
2426
|
+
const u = be(c), h = /instance/i.test(a) ? "instance" : "vertex";
|
|
2417
2427
|
e.push({
|
|
2418
2428
|
name: a,
|
|
2419
2429
|
location: l,
|
|
@@ -2431,7 +2441,7 @@ function gr(r, t) {
|
|
|
2431
2441
|
const s = r.getTransformFeedbackVarying(t, n);
|
|
2432
2442
|
if (!s)
|
|
2433
2443
|
throw new Error("activeInfo");
|
|
2434
|
-
const { name: a, type: c, size: l } = s, u =
|
|
2444
|
+
const { name: a, type: c, size: l } = s, u = be(c), { type: h, components: f } = st(u);
|
|
2435
2445
|
e.push({ location: n, name: a, type: h, size: l * f });
|
|
2436
2446
|
}
|
|
2437
2447
|
return e.sort((n, s) => n.location - s.location), e;
|
|
@@ -2482,7 +2492,7 @@ function mr(r, t) {
|
|
|
2482
2492
|
const d = r.getActiveUniform(t, c[g]);
|
|
2483
2493
|
if (!d)
|
|
2484
2494
|
throw new Error("activeInfo");
|
|
2485
|
-
const m =
|
|
2495
|
+
const m = be(l[g]);
|
|
2486
2496
|
a.uniforms.push({
|
|
2487
2497
|
name: d.name,
|
|
2488
2498
|
format: m,
|
|
@@ -2674,11 +2684,11 @@ class vr extends at {
|
|
|
2674
2684
|
}
|
|
2675
2685
|
switch (s || b.warn(`Unsetting binding "${n}" in render pipeline "${this.id}"`)(), a.type) {
|
|
2676
2686
|
case "uniform":
|
|
2677
|
-
if (!(s instanceof
|
|
2687
|
+
if (!(s instanceof V) && !(s.buffer instanceof V))
|
|
2678
2688
|
throw new Error("buffer value");
|
|
2679
2689
|
break;
|
|
2680
2690
|
case "texture":
|
|
2681
|
-
if (!(s instanceof
|
|
2691
|
+
if (!(s instanceof M || s instanceof U || s instanceof z))
|
|
2682
2692
|
throw new Error(`${this} Bad texture binding for ${n}`);
|
|
2683
2693
|
break;
|
|
2684
2694
|
case "sampler":
|
|
@@ -2818,7 +2828,7 @@ class vr extends at {
|
|
|
2818
2828
|
const { name: c } = s, l = e.getUniformBlockIndex(this.handle, c);
|
|
2819
2829
|
if (l === 4294967295)
|
|
2820
2830
|
throw new Error(`Invalid uniform block name ${c}`);
|
|
2821
|
-
e.uniformBlockBinding(this.handle, n, l), a instanceof
|
|
2831
|
+
e.uniformBlockBinding(this.handle, n, l), a instanceof V ? e.bindBufferBase(35345, n, a.handle) : e.bindBufferRange(
|
|
2822
2832
|
35345,
|
|
2823
2833
|
n,
|
|
2824
2834
|
// @ts-expect-error
|
|
@@ -2830,14 +2840,14 @@ class vr extends at {
|
|
|
2830
2840
|
), n += 1;
|
|
2831
2841
|
break;
|
|
2832
2842
|
case "texture":
|
|
2833
|
-
if (!(a instanceof
|
|
2843
|
+
if (!(a instanceof M || a instanceof U || a instanceof z))
|
|
2834
2844
|
throw new Error("texture");
|
|
2835
2845
|
let u;
|
|
2836
|
-
if (a instanceof
|
|
2846
|
+
if (a instanceof M)
|
|
2837
2847
|
u = a.texture;
|
|
2838
|
-
else if (a instanceof
|
|
2848
|
+
else if (a instanceof U)
|
|
2839
2849
|
u = a;
|
|
2840
|
-
else if (a instanceof
|
|
2850
|
+
else if (a instanceof z && a.colorAttachments[0] instanceof M)
|
|
2841
2851
|
b.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(), u = a.colorAttachments[0].texture;
|
|
2842
2852
|
else
|
|
2843
2853
|
throw new Error("No texture");
|
|
@@ -2873,7 +2883,7 @@ function Sr(r, t) {
|
|
|
2873
2883
|
}
|
|
2874
2884
|
return e;
|
|
2875
2885
|
}
|
|
2876
|
-
class Tr extends
|
|
2886
|
+
class Tr extends ae {
|
|
2877
2887
|
constructor(e) {
|
|
2878
2888
|
super(e, {});
|
|
2879
2889
|
o(this, "device");
|
|
@@ -2949,8 +2959,8 @@ function Ar(r, t) {
|
|
|
2949
2959
|
const { framebuffer: d, destroyFramebuffer: m } = Ue(e);
|
|
2950
2960
|
let p;
|
|
2951
2961
|
try {
|
|
2952
|
-
const w = u, v = s || d.width,
|
|
2953
|
-
r.gl.bindBuffer(35051, w.handle), p = r.gl.bindFramebuffer(36160, d.handle), r.gl.readPixels(l[0], l[1], v,
|
|
2962
|
+
const w = u, v = s || d.width, _ = a || d.height, E = $e(d.colorAttachments[0].texture.props.format), He = E.format, qe = E.type;
|
|
2963
|
+
r.gl.bindBuffer(35051, w.handle), p = r.gl.bindFramebuffer(36160, d.handle), r.gl.readPixels(l[0], l[1], v, _, He, qe, h);
|
|
2954
2964
|
} finally {
|
|
2955
2965
|
r.gl.bindBuffer(35051, null), p !== void 0 && r.gl.bindFramebuffer(36160, p), m && d.destroy();
|
|
2956
2966
|
}
|
|
@@ -2982,25 +2992,25 @@ function Er(r, t) {
|
|
|
2982
2992
|
// depthOrArrayLayers = 0
|
|
2983
2993
|
} = t;
|
|
2984
2994
|
const { framebuffer: u, destroyFramebuffer: h } = Ue(e), [f, g] = n, [d, m, p] = s, w = r.gl.bindFramebuffer(36160, u.handle);
|
|
2985
|
-
let v,
|
|
2986
|
-
if (a instanceof
|
|
2987
|
-
v = a, c = Number.isFinite(c) ? c : v.width, l = Number.isFinite(l) ? l : v.height, v._bind(0),
|
|
2995
|
+
let v, _;
|
|
2996
|
+
if (a instanceof U)
|
|
2997
|
+
v = a, c = Number.isFinite(c) ? c : v.width, l = Number.isFinite(l) ? l : v.height, v._bind(0), _ = v.glTarget;
|
|
2988
2998
|
else
|
|
2989
2999
|
throw new Error("invalid destination");
|
|
2990
|
-
switch (
|
|
3000
|
+
switch (_) {
|
|
2991
3001
|
case 3553:
|
|
2992
3002
|
case 34067:
|
|
2993
|
-
r.gl.copyTexSubImage2D(
|
|
3003
|
+
r.gl.copyTexSubImage2D(_, i, d, m, f, g, c, l);
|
|
2994
3004
|
break;
|
|
2995
3005
|
case 35866:
|
|
2996
3006
|
case 32879:
|
|
2997
|
-
r.gl.copyTexSubImage3D(
|
|
3007
|
+
r.gl.copyTexSubImage3D(_, i, d, m, p, f, g, c, l);
|
|
2998
3008
|
break;
|
|
2999
3009
|
}
|
|
3000
3010
|
v && v._unbind(), r.gl.bindFramebuffer(36160, w), h && u.destroy();
|
|
3001
3011
|
}
|
|
3002
3012
|
function Ue(r) {
|
|
3003
|
-
if (r instanceof
|
|
3013
|
+
if (r instanceof B) {
|
|
3004
3014
|
const { width: t, height: e, id: i } = r;
|
|
3005
3015
|
return { framebuffer: r.device.createFramebuffer({
|
|
3006
3016
|
id: `framebuffer-for-${i}`,
|
|
@@ -3012,7 +3022,7 @@ function Ue(r) {
|
|
|
3012
3022
|
return { framebuffer: r, destroyFramebuffer: !1 };
|
|
3013
3023
|
}
|
|
3014
3024
|
const Lr = [1, 2, 4, 8];
|
|
3015
|
-
class Br extends
|
|
3025
|
+
class Br extends ne {
|
|
3016
3026
|
constructor(e, i) {
|
|
3017
3027
|
var a;
|
|
3018
3028
|
super(e, i);
|
|
@@ -3059,7 +3069,7 @@ class Br extends ie {
|
|
|
3059
3069
|
i.framebuffer = this.props.framebuffer || null, this.props.depthReadOnly && (i.depthMask = !this.props.depthReadOnly), i.stencilMask = this.props.stencilReadOnly ? 0 : 1, i[35977] = this.props.discard, e.viewport && (e.viewport.length >= 6 ? (i.viewport = e.viewport.slice(0, 4), i.depthRange = [
|
|
3060
3070
|
e.viewport[4],
|
|
3061
3071
|
e.viewport[5]
|
|
3062
|
-
]) : i.viewport = e.viewport), e.scissorRect && (i.scissorTest = !0, i.scissor = e.scissorRect), e.blendConstant && (i.blendColor = e.blendConstant), e.stencilReference && (console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"), i[2967] = e.stencilReference), "colorMask" in e && (i.colorMask = Lr.map((n) => !!(n & e.colorMask))), this.glParameters = i,
|
|
3072
|
+
]) : i.viewport = e.viewport), e.scissorRect && (i.scissorTest = !0, i.scissor = e.scissorRect), e.blendConstant && (i.blendColor = e.blendConstant), e.stencilReference && (console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"), i[2967] = e.stencilReference), "colorMask" in e && (i.colorMask = Lr.map((n) => !!(n & e.colorMask))), this.glParameters = i, R(this.device.gl, i);
|
|
3063
3073
|
}
|
|
3064
3074
|
beginOcclusionQuery(e) {
|
|
3065
3075
|
const i = this.props.occlusionQuerySet;
|
|
@@ -3078,7 +3088,7 @@ class Br extends ie {
|
|
|
3078
3088
|
let i = 0;
|
|
3079
3089
|
this.props.clearColors && this.props.clearColors.forEach((n, s) => {
|
|
3080
3090
|
n && this.clearColorBuffer(s, n);
|
|
3081
|
-
}), this.props.clearColor !== !1 && this.props.clearColors === void 0 && (i |= 16384, e.clearColor = this.props.clearColor), this.props.clearDepth !== !1 && (i |= 256, e.clearDepth = this.props.clearDepth), this.props.clearStencil !== !1 && (i |= 1024, e.clearStencil = this.props.clearStencil), i !== 0 &&
|
|
3091
|
+
}), this.props.clearColor !== !1 && this.props.clearColors === void 0 && (i |= 16384, e.clearColor = this.props.clearColor), this.props.clearDepth !== !1 && (i |= 256, e.clearDepth = this.props.clearDepth), this.props.clearStencil !== !1 && (i |= 1024, e.clearStencil = this.props.clearStencil), i !== 0 && N(this.device.gl, e, () => {
|
|
3082
3092
|
this.device.gl.clear(i);
|
|
3083
3093
|
});
|
|
3084
3094
|
}
|
|
@@ -3086,7 +3096,7 @@ class Br extends ie {
|
|
|
3086
3096
|
* WebGL2 - clear a specific color buffer
|
|
3087
3097
|
*/
|
|
3088
3098
|
clearColorBuffer(e = 0, i = [0, 0, 0, 0]) {
|
|
3089
|
-
|
|
3099
|
+
N(this.device.gl, { framebuffer: this.props.framebuffer }, () => {
|
|
3090
3100
|
switch (i.constructor) {
|
|
3091
3101
|
case Int8Array:
|
|
3092
3102
|
case Int16Array:
|
|
@@ -3108,7 +3118,7 @@ class Br extends ie {
|
|
|
3108
3118
|
});
|
|
3109
3119
|
}
|
|
3110
3120
|
}
|
|
3111
|
-
class De extends
|
|
3121
|
+
class De extends se {
|
|
3112
3122
|
constructor(e, i) {
|
|
3113
3123
|
super(e, i);
|
|
3114
3124
|
o(this, "device");
|
|
@@ -3160,7 +3170,7 @@ function Cr(r) {
|
|
|
3160
3170
|
c < a - c ? (t.copyWithin(i + c, i, i + c), c *= 2) : (t.copyWithin(i + c, i, i + a - c), c = a);
|
|
3161
3171
|
return r.target;
|
|
3162
3172
|
}
|
|
3163
|
-
class
|
|
3173
|
+
class me extends oe {
|
|
3164
3174
|
// Create a VertexArray
|
|
3165
3175
|
constructor(e, i) {
|
|
3166
3176
|
super(e, i);
|
|
@@ -3268,7 +3278,7 @@ class be extends ae {
|
|
|
3268
3278
|
* TODO - convert classic arrays based on known type?
|
|
3269
3279
|
*/
|
|
3270
3280
|
_enable(e, i = !0) {
|
|
3271
|
-
const s =
|
|
3281
|
+
const s = me.isConstantAttributeZeroSupported(this.device) || e !== 0;
|
|
3272
3282
|
(i || s) && (e = Number(e), this.device.gl.bindVertexArray(this.handle), i ? this.device.gl.enableVertexAttribArray(e) : this.device.gl.disableVertexAttribArray(e), this.device.gl.bindVertexArray(null));
|
|
3273
3283
|
}
|
|
3274
3284
|
/**
|
|
@@ -3300,7 +3310,7 @@ function kr(r, t) {
|
|
|
3300
3310
|
return !1;
|
|
3301
3311
|
return !0;
|
|
3302
3312
|
}
|
|
3303
|
-
class Dr extends
|
|
3313
|
+
class Dr extends ce {
|
|
3304
3314
|
constructor(e, i) {
|
|
3305
3315
|
super(e, i);
|
|
3306
3316
|
o(this, "device");
|
|
@@ -3365,7 +3375,7 @@ class Dr extends oe {
|
|
|
3365
3375
|
// PRIVATE METHODS
|
|
3366
3376
|
/** Extract offsets for bindBufferRange */
|
|
3367
3377
|
_getBufferRange(e) {
|
|
3368
|
-
if (e instanceof
|
|
3378
|
+
if (e instanceof V)
|
|
3369
3379
|
return { buffer: e, byteOffset: 0, byteLength: e.byteLength };
|
|
3370
3380
|
const { buffer: i, byteOffset: n = 0, byteLength: s = e.buffer.byteLength } = e;
|
|
3371
3381
|
return { buffer: i, byteOffset: n, byteLength: s };
|
|
@@ -3400,7 +3410,7 @@ class Dr extends oe {
|
|
|
3400
3410
|
function Ge(r) {
|
|
3401
3411
|
return typeof r == "number" ? Number.isInteger(r) : /^\d+$/.test(r);
|
|
3402
3412
|
}
|
|
3403
|
-
class Gr extends
|
|
3413
|
+
class Gr extends le {
|
|
3404
3414
|
// Create a query class
|
|
3405
3415
|
constructor(e, i) {
|
|
3406
3416
|
super(e, i);
|
|
@@ -3561,7 +3571,7 @@ const Rr = {
|
|
|
3561
3571
|
36269: "uint32"
|
|
3562
3572
|
};
|
|
3563
3573
|
function Ir(r, t) {
|
|
3564
|
-
var
|
|
3574
|
+
var _;
|
|
3565
3575
|
const {
|
|
3566
3576
|
sourceX: e = 0,
|
|
3567
3577
|
sourceY: i = 0,
|
|
@@ -3579,7 +3589,7 @@ function Ir(r, t) {
|
|
|
3579
3589
|
} = t || {};
|
|
3580
3590
|
const { framebuffer: f, deleteFramebuffer: g } = Xe(r), { gl: d, handle: m } = f;
|
|
3581
3591
|
a || (a = f.width), c || (c = f.height);
|
|
3582
|
-
const p = (
|
|
3592
|
+
const p = (_ = f.colorAttachments[n]) == null ? void 0 : _.texture;
|
|
3583
3593
|
if (!p)
|
|
3584
3594
|
throw new Error(`Invalid framebuffer attachment ${n}`);
|
|
3585
3595
|
l = (p == null ? void 0 : p.depth) || 1, u || (u = (p == null ? void 0 : p.glFormat) || 6408), h || (h = (p == null ? void 0 : p.glType) || 5121), s = zr(s, h, u, a, c);
|
|
@@ -3611,7 +3621,7 @@ function Or(r, t) {
|
|
|
3611
3621
|
}), m.destroy(), f && h.destroy(), d;
|
|
3612
3622
|
}
|
|
3613
3623
|
function Xe(r) {
|
|
3614
|
-
return r instanceof
|
|
3624
|
+
return r instanceof q ? { framebuffer: r, deleteFramebuffer: !1 } : { framebuffer: $r(r), deleteFramebuffer: !0 };
|
|
3615
3625
|
}
|
|
3616
3626
|
function $r(r, t) {
|
|
3617
3627
|
const { device: e, width: i, height: n, id: s } = r;
|
|
@@ -3688,7 +3698,7 @@ class jr extends pe {
|
|
|
3688
3698
|
return b.log(1, `Not creating a new Device, instead returning a reference to Device ${n.id} already attached to WebGL context`, n)(), n._reused = !0, n;
|
|
3689
3699
|
throw new Error(`WebGL context already attached to device ${n.id}`);
|
|
3690
3700
|
}
|
|
3691
|
-
this.handle = c, this.gl = c, this.spectorJS = ut({ ...this.props, gl: this.handle }), this.gl.device = this, this.gl._version = 2, this.info = Et(this.gl, this._extensions), this.limits = new Ut(this.gl), this.features = new Vt(this.gl, this._extensions, this.props._disabledFeatures), this.props._initializeFeatures && this.features.initializeFeatures(), new
|
|
3701
|
+
this.handle = c, this.gl = c, this.spectorJS = ut({ ...this.props, gl: this.handle }), this.gl.device = this, this.gl._version = 2, this.info = Et(this.gl, this._extensions), this.limits = new Ut(this.gl), this.features = new Vt(this.gl, this._extensions, this.props._disabledFeatures), this.props._initializeFeatures && this.features.initializeFeatures(), new F(this.gl, {
|
|
3692
3702
|
log: (...d) => b.log(1, ...d)()
|
|
3693
3703
|
}).trackState(this.gl, { copyState: !1 });
|
|
3694
3704
|
const u = e.debugWebGL || e.debug, h = e.debugWebGL;
|
|
@@ -3736,10 +3746,10 @@ class jr extends pe {
|
|
|
3736
3746
|
}
|
|
3737
3747
|
createBuffer(e) {
|
|
3738
3748
|
const i = this._normalizeBufferProps(e);
|
|
3739
|
-
return new
|
|
3749
|
+
return new V(this, i);
|
|
3740
3750
|
}
|
|
3741
3751
|
createTexture(e) {
|
|
3742
|
-
return new
|
|
3752
|
+
return new U(this, e);
|
|
3743
3753
|
}
|
|
3744
3754
|
createExternalTexture(e) {
|
|
3745
3755
|
throw new Error("createExternalTexture() not implemented");
|
|
@@ -3751,10 +3761,10 @@ class jr extends pe {
|
|
|
3751
3761
|
return new Kt(this, e);
|
|
3752
3762
|
}
|
|
3753
3763
|
createFramebuffer(e) {
|
|
3754
|
-
return new
|
|
3764
|
+
return new z(this, e);
|
|
3755
3765
|
}
|
|
3756
3766
|
createVertexArray(e) {
|
|
3757
|
-
return new
|
|
3767
|
+
return new me(this, e);
|
|
3758
3768
|
}
|
|
3759
3769
|
createTransformFeedback(e) {
|
|
3760
3770
|
return new Dr(this, e);
|
|
@@ -3791,13 +3801,13 @@ class jr extends pe {
|
|
|
3791
3801
|
return Or(e, i);
|
|
3792
3802
|
}
|
|
3793
3803
|
setParametersWebGL(e) {
|
|
3794
|
-
|
|
3804
|
+
R(this.gl, e);
|
|
3795
3805
|
}
|
|
3796
3806
|
getParametersWebGL(e) {
|
|
3797
3807
|
return Re(this.gl, e);
|
|
3798
3808
|
}
|
|
3799
3809
|
withParametersWebGL(e, i) {
|
|
3800
|
-
return
|
|
3810
|
+
return N(this.gl, e, i);
|
|
3801
3811
|
}
|
|
3802
3812
|
resetWebGL() {
|
|
3803
3813
|
b.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")(), vt(this.gl);
|
|
@@ -3823,11 +3833,11 @@ class jr extends pe {
|
|
|
3823
3833
|
}
|
|
3824
3834
|
/** Save current WebGL context state onto an internal stack */
|
|
3825
3835
|
pushState() {
|
|
3826
|
-
|
|
3836
|
+
F.get(this.gl).push();
|
|
3827
3837
|
}
|
|
3828
3838
|
/** Restores previously saved context state */
|
|
3829
3839
|
popState() {
|
|
3830
|
-
|
|
3840
|
+
F.get(this.gl).pop();
|
|
3831
3841
|
}
|
|
3832
3842
|
/**
|
|
3833
3843
|
* Returns the GL.<KEY> constant that corresponds to a numeric value of a GL constant
|
|
@@ -3874,7 +3884,7 @@ class jr extends pe {
|
|
|
3874
3884
|
}
|
|
3875
3885
|
/** Ensure extensions are only requested once */
|
|
3876
3886
|
getExtension(e) {
|
|
3877
|
-
return
|
|
3887
|
+
return W(this.gl, e, this._extensions), this._extensions;
|
|
3878
3888
|
}
|
|
3879
3889
|
// INTERNAL SUPPORT METHODS FOR WEBGL RESOURCES
|
|
3880
3890
|
/**
|
|
@@ -3920,4 +3930,4 @@ function Xr(r, t) {
|
|
|
3920
3930
|
export {
|
|
3921
3931
|
jr as WebGLDevice
|
|
3922
3932
|
};
|
|
3923
|
-
//# sourceMappingURL=webgl-device-
|
|
3933
|
+
//# sourceMappingURL=webgl-device-BeV8-7_B.js.map
|