wuepgg3-track 1.0.5 → 1.0.7
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/{SharedSystems-DFBznyti.mjs → SharedSystems-C2SJp7v2.mjs} +361 -145
- package/dist/{WebGLRenderer-DLhdIY16.mjs → WebGLRenderer-C0Cv1lyR.mjs} +153 -142
- package/dist/{WebGPURenderer-BtprIo-o.mjs → WebGPURenderer-Bai6qmPc.mjs} +163 -130
- package/dist/assets/fetchGenomeAlignWorker-CHwLRNww.js +18579 -0
- package/dist/{browserAll-BqCiJ8lz.mjs → browserAll-DpBfRFxm.mjs} +290 -593
- package/dist/{colorToUniform-BcHZBaJ_.mjs → colorToUniform-zJcCVLeu.mjs} +2 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/Heatmap.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/MethylcComponents/MethylCTrackComputation.d.ts +0 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/Loading.d.ts +10 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/TrackLegend.d.ts +2 -0
- package/dist/components/GenomeView/TrackComponents/renderClickTooltipMap.d.ts +3 -0
- package/dist/components/GenomeView/TrackManager.d.ts +10 -3
- package/dist/components/index.d.ts +19 -0
- package/dist/components/testCustomGenome.d.ts +505 -0
- package/dist/favicon.ico +0 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/bin.d.ts +12 -1
- package/dist/{index-B6bI9_jA.mjs → index-C5FtfFBD.mjs} +70425 -59086
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +51 -49
- package/dist/index.umd.js +316 -316
- package/dist/init-BJx0LdsJ.mjs +2823 -0
- package/dist/models/TrackModel.d.ts +6 -3
- package/dist/models/genomes/mm9/mm9.d.ts +3 -3
- package/dist/models/index.d.ts +1 -0
- package/dist/models/trackModels/trackProps.d.ts +6 -0
- package/dist/style.css +1 -1
- package/dist/track-container/index.d.ts +1 -1
- package/dist/trackConfigs/config-menu-components.tsx/TrackConfigMenu.d.ts +3 -1
- package/dist/trackConfigs/config-menu-components.tsx/TrackContextMenu.d.ts +2 -1
- package/dist/trackConfigs/config-menu-models.tsx/TrackConfig.d.ts +1 -0
- package/dist/types/track-container.d.ts +6 -7
- package/dist/webworkerAll-CuTw5v7C.mjs +2 -0
- package/package.json +5 -4
- package/dist/CanvasPool-CKMB9WFU.mjs +0 -46
- package/dist/init-DkpAc66F.mjs +0 -2871
- package/dist/webworkerAll-BvBOPbix.mjs +0 -2
- /package/dist/getRemoteData/{fetchDataWorker.d.ts → fetchData.d.ts} +0 -0
- /package/dist/getRemoteData/{fetchGenomeAlignWorker.d.ts → fetchGenomeAlign.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as fe, B as pe, c as Qe } from "./colorToUniform-
|
|
3
|
-
const me = class A extends
|
|
1
|
+
import { q as Le, G as te, t as re, u as He, k as se, M as v, v as ae, E as u, e as E, x as S, y as ze, z as O, F as b, R as F, H as ne, I as We, s as m, S as f, h as B, w as ie, J as q, K as Ve, b as K, B as k, i as U, L as M, j as T, N as w, O as Ne, a as je, Q as oe, V as le, W as ue, X as de, C as P, Y as ce, Z as $e, P as qe, c as Ke, T as Y, D as he, _ as J, $ as Ye, a0 as Je, a1 as Xe } from "./index-C5FtfFBD.mjs";
|
|
2
|
+
import { S as fe, B as pe, c as Qe } from "./colorToUniform-zJcCVLeu.mjs";
|
|
3
|
+
const me = class A extends Le {
|
|
4
4
|
/**
|
|
5
5
|
* @param options - The optional parameters of this filter.
|
|
6
6
|
*/
|
|
@@ -224,7 +224,7 @@ fn mainFragment(
|
|
|
224
224
|
`;
|
|
225
225
|
class rt extends Ze {
|
|
226
226
|
constructor(e) {
|
|
227
|
-
const { sprite: t, ...r } = e, s = new
|
|
227
|
+
const { sprite: t, ...r } = e, s = new He(t.texture), n = new se({
|
|
228
228
|
uFilterMatrix: { value: new v(), type: "mat3x3<f32>" },
|
|
229
229
|
uMaskClamp: { value: s.uClampFrame, type: "vec4<f32>" },
|
|
230
230
|
uAlpha: { value: 1, type: "f32" },
|
|
@@ -266,7 +266,7 @@ class rt extends Ze {
|
|
|
266
266
|
).prepend(this._textureMatrix.mapCoord), this.resources.uMaskTexture = this.sprite.texture.source, e.applyFilter(this, t, r, s);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
const
|
|
269
|
+
const L = class ve {
|
|
270
270
|
constructor(e, t) {
|
|
271
271
|
var r, s;
|
|
272
272
|
this.state = fe.for2d(), this._batchersByInstructionSet = /* @__PURE__ */ Object.create(null), this._activeBatches = /* @__PURE__ */ Object.create(null), this.renderer = e, this._adaptor = t, (s = (r = this._adaptor).init) == null || s.call(r, this);
|
|
@@ -276,7 +276,9 @@ const H = class ve {
|
|
|
276
276
|
}
|
|
277
277
|
buildStart(e) {
|
|
278
278
|
let t = this._batchersByInstructionSet[e.uid];
|
|
279
|
-
t || (t = this._batchersByInstructionSet[e.uid] = /* @__PURE__ */ Object.create(null), t.default || (t.default = new ae(
|
|
279
|
+
t || (t = this._batchersByInstructionSet[e.uid] = /* @__PURE__ */ Object.create(null), t.default || (t.default = new ae({
|
|
280
|
+
maxTextures: this.renderer.limits.maxBatchableTextures
|
|
281
|
+
}))), this._activeBatches = t, this._activeBatch = this._activeBatches.default;
|
|
280
282
|
for (const r in this._activeBatches)
|
|
281
283
|
this._activeBatches[r].begin();
|
|
282
284
|
}
|
|
@@ -320,7 +322,7 @@ const H = class ve {
|
|
|
320
322
|
this._activeBatches = null;
|
|
321
323
|
}
|
|
322
324
|
};
|
|
323
|
-
|
|
325
|
+
L.extension = {
|
|
324
326
|
type: [
|
|
325
327
|
u.WebGLPipes,
|
|
326
328
|
u.WebGPUPipes,
|
|
@@ -328,10 +330,10 @@ H.extension = {
|
|
|
328
330
|
],
|
|
329
331
|
name: "batch"
|
|
330
332
|
};
|
|
331
|
-
|
|
332
|
-
let
|
|
333
|
-
|
|
334
|
-
|
|
333
|
+
L._availableBatchers = /* @__PURE__ */ Object.create(null);
|
|
334
|
+
let xe = L;
|
|
335
|
+
E.handleByMap(u.Batcher, xe._availableBatchers);
|
|
336
|
+
E.add(ae);
|
|
335
337
|
const Bt = {
|
|
336
338
|
name: "texture-bit",
|
|
337
339
|
vertex: {
|
|
@@ -360,7 +362,7 @@ const Bt = {
|
|
|
360
362
|
@group(2) @binding(0) var uTexture: texture_2d<f32>;
|
|
361
363
|
@group(2) @binding(1) var uSampler: sampler;
|
|
362
364
|
|
|
363
|
-
|
|
365
|
+
|
|
364
366
|
`
|
|
365
367
|
),
|
|
366
368
|
main: (
|
|
@@ -392,7 +394,7 @@ const Bt = {
|
|
|
392
394
|
`
|
|
393
395
|
uniform sampler2D uTexture;
|
|
394
396
|
|
|
395
|
-
|
|
397
|
+
|
|
396
398
|
`
|
|
397
399
|
),
|
|
398
400
|
main: (
|
|
@@ -425,7 +427,7 @@ class at extends ne {
|
|
|
425
427
|
this.filters[0].inverse = e;
|
|
426
428
|
}
|
|
427
429
|
}
|
|
428
|
-
class
|
|
430
|
+
class ge {
|
|
429
431
|
constructor(e) {
|
|
430
432
|
this._activeMaskStage = [], this._renderer = e;
|
|
431
433
|
}
|
|
@@ -467,12 +469,12 @@ class xe {
|
|
|
467
469
|
execute(e) {
|
|
468
470
|
const t = this._renderer, r = e.mask.renderMaskToTexture;
|
|
469
471
|
if (e.action === "pushMaskBegin") {
|
|
470
|
-
const s =
|
|
472
|
+
const s = S.get(at);
|
|
471
473
|
if (s.inverse = e.inverse, r) {
|
|
472
474
|
e.mask.mask.measurable = !0;
|
|
473
475
|
const n = ze(e.mask.mask, !0, st);
|
|
474
476
|
e.mask.mask.measurable = !1, n.ceil();
|
|
475
|
-
const i = t.renderTarget.renderTarget.colorTexture.source, o =
|
|
477
|
+
const i = t.renderTarget.renderTarget.colorTexture.source, o = b.getOptimalTexture(
|
|
476
478
|
n.width,
|
|
477
479
|
n.height,
|
|
478
480
|
i._resolution,
|
|
@@ -505,14 +507,14 @@ class xe {
|
|
|
505
507
|
} else if (e.action === "popMaskEnd") {
|
|
506
508
|
t.filter.pop();
|
|
507
509
|
const s = this._activeMaskStage.pop();
|
|
508
|
-
r &&
|
|
510
|
+
r && b.returnTexture(s.filterTexture), S.return(s.filterEffect);
|
|
509
511
|
}
|
|
510
512
|
}
|
|
511
513
|
destroy() {
|
|
512
514
|
this._renderer = null, this._activeMaskStage = null;
|
|
513
515
|
}
|
|
514
516
|
}
|
|
515
|
-
|
|
517
|
+
ge.extension = {
|
|
516
518
|
type: [
|
|
517
519
|
u.WebGLPipes,
|
|
518
520
|
u.WebGPUPipes,
|
|
@@ -657,13 +659,13 @@ function nt(a) {
|
|
|
657
659
|
i.stride ?? (i.stride = r[i.buffer.uid]), i.start ?? (i.start = s[i.buffer.uid]), s[i.buffer.uid] += q(i.format).stride;
|
|
658
660
|
}
|
|
659
661
|
}
|
|
660
|
-
const
|
|
661
|
-
|
|
662
|
-
|
|
662
|
+
const g = [];
|
|
663
|
+
g[f.NONE] = void 0;
|
|
664
|
+
g[f.DISABLED] = {
|
|
663
665
|
stencilWriteMask: 0,
|
|
664
666
|
stencilReadMask: 0
|
|
665
667
|
};
|
|
666
|
-
|
|
668
|
+
g[f.RENDERING_MASK_ADD] = {
|
|
667
669
|
stencilFront: {
|
|
668
670
|
compare: "equal",
|
|
669
671
|
passOp: "increment-clamp"
|
|
@@ -673,7 +675,7 @@ _[f.RENDERING_MASK_ADD] = {
|
|
|
673
675
|
passOp: "increment-clamp"
|
|
674
676
|
}
|
|
675
677
|
};
|
|
676
|
-
|
|
678
|
+
g[f.RENDERING_MASK_REMOVE] = {
|
|
677
679
|
stencilFront: {
|
|
678
680
|
compare: "equal",
|
|
679
681
|
passOp: "decrement-clamp"
|
|
@@ -683,7 +685,7 @@ _[f.RENDERING_MASK_REMOVE] = {
|
|
|
683
685
|
passOp: "decrement-clamp"
|
|
684
686
|
}
|
|
685
687
|
};
|
|
686
|
-
|
|
688
|
+
g[f.MASK_ACTIVE] = {
|
|
687
689
|
stencilWriteMask: 0,
|
|
688
690
|
stencilFront: {
|
|
689
691
|
compare: "equal",
|
|
@@ -694,15 +696,15 @@ _[f.MASK_ACTIVE] = {
|
|
|
694
696
|
passOp: "keep"
|
|
695
697
|
}
|
|
696
698
|
};
|
|
697
|
-
|
|
699
|
+
g[f.INVERSE_MASK_ACTIVE] = {
|
|
698
700
|
stencilWriteMask: 0,
|
|
699
701
|
stencilFront: {
|
|
700
702
|
compare: "not-equal",
|
|
701
|
-
passOp: "
|
|
703
|
+
passOp: "keep"
|
|
702
704
|
},
|
|
703
705
|
stencilBack: {
|
|
704
706
|
compare: "not-equal",
|
|
705
|
-
passOp: "
|
|
707
|
+
passOp: "keep"
|
|
706
708
|
}
|
|
707
709
|
};
|
|
708
710
|
class It {
|
|
@@ -722,7 +724,7 @@ class It {
|
|
|
722
724
|
const t = this.getUniformGroupData(e);
|
|
723
725
|
e.buffer || (e.buffer = new K({
|
|
724
726
|
data: new Float32Array(t.layout.size / 4),
|
|
725
|
-
usage:
|
|
727
|
+
usage: k.UNIFORM | k.COPY_DST
|
|
726
728
|
}));
|
|
727
729
|
}
|
|
728
730
|
getUniformGroupData(e) {
|
|
@@ -747,7 +749,7 @@ class It {
|
|
|
747
749
|
const s = this.getUniformGroupData(e);
|
|
748
750
|
e.buffer || (e.buffer = new K({
|
|
749
751
|
data: new Float32Array(s.layout.size / 4),
|
|
750
|
-
usage:
|
|
752
|
+
usage: k.UNIFORM | k.COPY_DST
|
|
751
753
|
}));
|
|
752
754
|
let n = null;
|
|
753
755
|
return t || (t = e.buffer.data, n = e.buffer.dataInt32), r || (r = 0), s.syncFunction(e.uniforms, t, n, r), !0;
|
|
@@ -763,7 +765,7 @@ class It {
|
|
|
763
765
|
this._syncFunctionHash = null;
|
|
764
766
|
}
|
|
765
767
|
}
|
|
766
|
-
const
|
|
768
|
+
const C = [
|
|
767
769
|
// uploading pixi matrix object to mat3
|
|
768
770
|
{
|
|
769
771
|
type: "mat3x3<f32>",
|
|
@@ -884,12 +886,12 @@ function Gt(a, e, t, r) {
|
|
|
884
886
|
for (let o = 0; o < a.length; o++) {
|
|
885
887
|
const l = a[o], d = l.data.name;
|
|
886
888
|
let c = !1, h = 0;
|
|
887
|
-
for (let p = 0; p <
|
|
888
|
-
if (
|
|
889
|
+
for (let p = 0; p < C.length; p++)
|
|
890
|
+
if (C[p].test(l.data)) {
|
|
889
891
|
h = l.offset / 4, s.push(
|
|
890
892
|
`name = "${d}";`,
|
|
891
893
|
`offset += ${h - n};`,
|
|
892
|
-
|
|
894
|
+
C[p][e] || C[p].ubo
|
|
893
895
|
), c = !0;
|
|
894
896
|
break;
|
|
895
897
|
}
|
|
@@ -980,7 +982,7 @@ const it = {
|
|
|
980
982
|
"mat4x3<f32>": x(4, 3),
|
|
981
983
|
"mat2x4<f32>": x(2, 4),
|
|
982
984
|
"mat3x4<f32>": x(3, 4)
|
|
983
|
-
},
|
|
985
|
+
}, Dt = {
|
|
984
986
|
...it,
|
|
985
987
|
"mat2x2<f32>": `
|
|
986
988
|
data[offset] = v[0];
|
|
@@ -993,26 +995,26 @@ function ot(a, e, t, r, s, n) {
|
|
|
993
995
|
const i = n ? 1 : -1;
|
|
994
996
|
return a.identity(), a.a = 1 / r * 2, a.d = i * (1 / s * 2), a.tx = -1 - e * a.a, a.ty = -i - t * a.d, a;
|
|
995
997
|
}
|
|
996
|
-
const
|
|
997
|
-
function
|
|
998
|
-
if (!
|
|
998
|
+
const _ = /* @__PURE__ */ new Map();
|
|
999
|
+
function Te(a, e) {
|
|
1000
|
+
if (!_.has(a)) {
|
|
999
1001
|
const t = new m({
|
|
1000
1002
|
source: new U({
|
|
1001
1003
|
resource: a,
|
|
1002
1004
|
...e
|
|
1003
1005
|
})
|
|
1004
1006
|
}), r = () => {
|
|
1005
|
-
|
|
1007
|
+
_.get(a) === t && _.delete(a);
|
|
1006
1008
|
};
|
|
1007
|
-
t.once("destroy", r), t.source.once("destroy", r),
|
|
1009
|
+
t.once("destroy", r), t.source.once("destroy", r), _.set(a, t);
|
|
1008
1010
|
}
|
|
1009
|
-
return
|
|
1011
|
+
return _.get(a);
|
|
1010
1012
|
}
|
|
1011
1013
|
function lt(a) {
|
|
1012
1014
|
const e = a.colorTexture.source.resource;
|
|
1013
1015
|
return globalThis.HTMLCanvasElement && e instanceof HTMLCanvasElement && document.body.contains(e);
|
|
1014
1016
|
}
|
|
1015
|
-
const
|
|
1017
|
+
const ye = class ke {
|
|
1016
1018
|
/**
|
|
1017
1019
|
* @param [descriptor] - Options for creating a render target.
|
|
1018
1020
|
*/
|
|
@@ -1064,7 +1066,6 @@ const Te = class ke {
|
|
|
1064
1066
|
* This will ensure a depthStencil texture is created for this render target.
|
|
1065
1067
|
* Most likely called by the mask system to make sure we have stencil buffer added.
|
|
1066
1068
|
* @internal
|
|
1067
|
-
* @ignore
|
|
1068
1069
|
*/
|
|
1069
1070
|
ensureDepthStencilTexture() {
|
|
1070
1071
|
this.depthStencilTexture || (this.depthStencilTexture = new T({
|
|
@@ -1089,7 +1090,7 @@ const Te = class ke {
|
|
|
1089
1090
|
}), this.depthStencilTexture && (this.depthStencilTexture.destroy(), delete this.depthStencilTexture);
|
|
1090
1091
|
}
|
|
1091
1092
|
};
|
|
1092
|
-
|
|
1093
|
+
ye.defaultOptions = {
|
|
1093
1094
|
/** the width of the RenderTarget */
|
|
1094
1095
|
width: 0,
|
|
1095
1096
|
/** the height of the RenderTarget */
|
|
@@ -1108,8 +1109,8 @@ Te.defaultOptions = {
|
|
|
1108
1109
|
/** is this a root element, true if this is gl context owners render target */
|
|
1109
1110
|
isRoot: !1
|
|
1110
1111
|
};
|
|
1111
|
-
let I =
|
|
1112
|
-
class
|
|
1112
|
+
let I = ye;
|
|
1113
|
+
class Et {
|
|
1113
1114
|
constructor(e) {
|
|
1114
1115
|
this.rootViewPort = new w(), this.viewport = new w(), this.onRenderTargetChange = new Ne("onRenderTargetChange"), this.projectionMatrix = new v(), this.defaultClearColor = [0, 0, 0, 0], this._renderSurfaceToRenderTargetHash = /* @__PURE__ */ new Map(), this._gpuRenderTargetHash = /* @__PURE__ */ Object.create(null), this._renderTargetStack = [], this._renderer = e, e.renderableGC.addManagedHash(this, "_gpuRenderTargetHash");
|
|
1115
1116
|
}
|
|
@@ -1281,9 +1282,9 @@ class Dt {
|
|
|
1281
1282
|
}
|
|
1282
1283
|
_initRenderTarget(e) {
|
|
1283
1284
|
let t = null;
|
|
1284
|
-
return U.test(e) && (e =
|
|
1285
|
+
return U.test(e) && (e = Te(e).source), e instanceof I ? t = e : e instanceof T && (t = new I({
|
|
1285
1286
|
colorTextures: [e]
|
|
1286
|
-
}),
|
|
1287
|
+
}), e.source instanceof U && (t.isRoot = !0), e.once("destroy", () => {
|
|
1287
1288
|
t.destroy(), this._renderSurfaceToRenderTargetHash.delete(e);
|
|
1288
1289
|
const r = this._gpuRenderTargetHash[t.uid];
|
|
1289
1290
|
r && (this._gpuRenderTargetHash[t.uid] = null, this.adaptor.destroyGpuRenderTarget(r));
|
|
@@ -1358,7 +1359,7 @@ function G(a, e) {
|
|
|
1358
1359
|
}
|
|
1359
1360
|
}
|
|
1360
1361
|
const ut = new v();
|
|
1361
|
-
class
|
|
1362
|
+
class Me {
|
|
1362
1363
|
constructor(e) {
|
|
1363
1364
|
this._renderer = e;
|
|
1364
1365
|
}
|
|
@@ -1372,10 +1373,10 @@ class Se {
|
|
|
1372
1373
|
this._renderer = null;
|
|
1373
1374
|
}
|
|
1374
1375
|
_addRenderableDirect(e, t) {
|
|
1375
|
-
this._renderer.renderPipes.batch.break(t), e._batchableRenderGroup && (
|
|
1376
|
+
this._renderer.renderPipes.batch.break(t), e._batchableRenderGroup && (S.return(e._batchableRenderGroup), e._batchableRenderGroup = null), t.add(e);
|
|
1376
1377
|
}
|
|
1377
1378
|
_addRenderableCacheAsTexture(e, t) {
|
|
1378
|
-
const r = e._batchableRenderGroup ?? (e._batchableRenderGroup =
|
|
1379
|
+
const r = e._batchableRenderGroup ?? (e._batchableRenderGroup = S.get(pe));
|
|
1379
1380
|
r.renderable = e.root, r.transform = e.root.relativeGroupTransform, r.texture = e.texture, r.bounds = e._textureBounds, t.add(e), this._renderer.renderPipes.batch.addToBatch(r, t);
|
|
1380
1381
|
}
|
|
1381
1382
|
_executeCacheAsTexture(e) {
|
|
@@ -1399,7 +1400,7 @@ class Se {
|
|
|
1399
1400
|
}), G(e, this._renderer.renderPipes), this._renderer.globalUniforms.pop();
|
|
1400
1401
|
}
|
|
1401
1402
|
}
|
|
1402
|
-
|
|
1403
|
+
Me.extension = {
|
|
1403
1404
|
type: [
|
|
1404
1405
|
u.WebGLPipes,
|
|
1405
1406
|
u.WebGPUPipes,
|
|
@@ -1407,13 +1408,13 @@ Se.extension = {
|
|
|
1407
1408
|
],
|
|
1408
1409
|
name: "renderGroup"
|
|
1409
1410
|
};
|
|
1410
|
-
function
|
|
1411
|
+
function D(a, e) {
|
|
1411
1412
|
e || (e = 0);
|
|
1412
1413
|
for (let t = e; t < a.length && a[t]; t++)
|
|
1413
1414
|
a[t] = null;
|
|
1414
1415
|
}
|
|
1415
1416
|
const dt = new P(), Q = le | ue | de;
|
|
1416
|
-
function
|
|
1417
|
+
function Se(a, e = !1) {
|
|
1417
1418
|
ct(a);
|
|
1418
1419
|
const t = a.childrenToUpdate, r = a.updateTick++;
|
|
1419
1420
|
for (const s in t) {
|
|
@@ -1422,11 +1423,11 @@ function Me(a, e = !1) {
|
|
|
1422
1423
|
const c = o[d];
|
|
1423
1424
|
c.parentRenderGroup === a && c.relativeRenderGroupDepth === n && we(c, r, 0);
|
|
1424
1425
|
}
|
|
1425
|
-
|
|
1426
|
+
D(o, l), i.index = 0;
|
|
1426
1427
|
}
|
|
1427
1428
|
if (e)
|
|
1428
1429
|
for (let s = 0; s < a.renderGroupChildren.length; s++)
|
|
1429
|
-
|
|
1430
|
+
Se(a.renderGroupChildren[s], e);
|
|
1430
1431
|
}
|
|
1431
1432
|
function ct(a) {
|
|
1432
1433
|
const e = a.root;
|
|
@@ -1517,20 +1518,20 @@ class Pe {
|
|
|
1517
1518
|
const r = e.root.getLocalBounds();
|
|
1518
1519
|
r.ceil();
|
|
1519
1520
|
const s = e.texture;
|
|
1520
|
-
e.texture &&
|
|
1521
|
+
e.texture && b.returnTexture(e.texture);
|
|
1521
1522
|
const n = this._renderer, i = e.textureOptions.resolution || n.view.resolution, o = e.textureOptions.antialias ?? n.view.antialias;
|
|
1522
|
-
e.texture =
|
|
1523
|
+
e.texture = b.getOptimalTexture(
|
|
1523
1524
|
r.width,
|
|
1524
1525
|
r.height,
|
|
1525
1526
|
i,
|
|
1526
1527
|
o
|
|
1527
1528
|
), e._textureBounds || (e._textureBounds = new O()), e._textureBounds.copyFrom(r), s !== e.texture && e.renderGroupParent && (e.renderGroupParent.structureDidChange = !0);
|
|
1528
1529
|
}
|
|
1529
|
-
} else e.texture && (
|
|
1530
|
+
} else e.texture && (b.returnTexture(e.texture), e.texture = null);
|
|
1530
1531
|
}
|
|
1531
1532
|
_updateRenderGroups(e) {
|
|
1532
1533
|
const t = this._renderer, r = t.renderPipes;
|
|
1533
|
-
if (e.runOnRender(t), e.instructionSet.renderPipes = r, e.structureDidChange ?
|
|
1534
|
+
if (e.runOnRender(t), e.instructionSet.renderPipes = r, e.structureDidChange ? D(e.childrenRenderablesToUpdate.list, 0) : ht(e, r), Se(e), e.structureDidChange ? (e.structureDidChange = !1, this._buildInstructions(e, t)) : this._updateRenderables(e), e.childrenRenderablesToUpdate.index = 0, t.renderPipes.batch.upload(e.instructionSet), !(e.isCachedAsTexture && !e.textureNeedsUpdate))
|
|
1534
1535
|
for (let s = 0; s < e.renderGroupChildren.length; s++)
|
|
1535
1536
|
this._updateRenderGroups(e.renderGroupChildren[s]);
|
|
1536
1537
|
}
|
|
@@ -1540,7 +1541,7 @@ class Pe {
|
|
|
1540
1541
|
const n = t[s];
|
|
1541
1542
|
n.didViewUpdate && e.updateRenderable(n);
|
|
1542
1543
|
}
|
|
1543
|
-
|
|
1544
|
+
D(t, r);
|
|
1544
1545
|
}
|
|
1545
1546
|
_buildInstructions(e, t) {
|
|
1546
1547
|
const r = e.root, s = e.instructionSet;
|
|
@@ -1559,14 +1560,14 @@ Pe.extension = {
|
|
|
1559
1560
|
};
|
|
1560
1561
|
class Re {
|
|
1561
1562
|
constructor(e) {
|
|
1562
|
-
this.
|
|
1563
|
+
this._renderer = e;
|
|
1563
1564
|
}
|
|
1564
1565
|
addRenderable(e, t) {
|
|
1565
1566
|
const r = this._getGpuSprite(e);
|
|
1566
1567
|
e.didViewUpdate && this._updateBatchableSprite(e, r), this._renderer.renderPipes.batch.addToBatch(r, t);
|
|
1567
1568
|
}
|
|
1568
1569
|
updateRenderable(e) {
|
|
1569
|
-
const t = this.
|
|
1570
|
+
const t = this._getGpuSprite(e);
|
|
1570
1571
|
e.didViewUpdate && this._updateBatchableSprite(e, t), t._batcher.updateElement(t);
|
|
1571
1572
|
}
|
|
1572
1573
|
validateRenderable(e) {
|
|
@@ -1576,24 +1577,18 @@ class Re {
|
|
|
1576
1577
|
e._texture
|
|
1577
1578
|
);
|
|
1578
1579
|
}
|
|
1579
|
-
destroyRenderable(e) {
|
|
1580
|
-
const t = this._gpuSpriteHash[e.uid];
|
|
1581
|
-
g.return(t), this._gpuSpriteHash[e.uid] = null, e.off("destroyed", this._destroyRenderableBound);
|
|
1582
|
-
}
|
|
1583
1580
|
_updateBatchableSprite(e, t) {
|
|
1584
1581
|
t.bounds = e.visualBounds, t.texture = e._texture;
|
|
1585
1582
|
}
|
|
1586
1583
|
_getGpuSprite(e) {
|
|
1587
|
-
return
|
|
1584
|
+
return e._gpuData[this._renderer.uid] || this._initGPUSprite(e);
|
|
1588
1585
|
}
|
|
1589
1586
|
_initGPUSprite(e) {
|
|
1590
|
-
const t =
|
|
1591
|
-
return t.renderable = e, t.transform = e.groupTransform, t.texture = e._texture, t.bounds = e.visualBounds, t.roundPixels = this._renderer._roundPixels | e._roundPixels,
|
|
1587
|
+
const t = new pe();
|
|
1588
|
+
return t.renderable = e, t.transform = e.groupTransform, t.texture = e._texture, t.bounds = e.visualBounds, t.roundPixels = this._renderer._roundPixels | e._roundPixels, e._gpuData[this._renderer.uid] = t, t;
|
|
1592
1589
|
}
|
|
1593
1590
|
destroy() {
|
|
1594
|
-
|
|
1595
|
-
g.return(this._gpuSpriteHash[e]);
|
|
1596
|
-
this._gpuSpriteHash = null, this._renderer = null;
|
|
1591
|
+
this._renderer = null;
|
|
1597
1592
|
}
|
|
1598
1593
|
}
|
|
1599
1594
|
Re.extension = {
|
|
@@ -1604,7 +1599,7 @@ Re.extension = {
|
|
|
1604
1599
|
],
|
|
1605
1600
|
name: "sprite"
|
|
1606
1601
|
};
|
|
1607
|
-
const
|
|
1602
|
+
const H = class Be {
|
|
1608
1603
|
constructor() {
|
|
1609
1604
|
this.clearBeforeRender = !0, this._backgroundColor = new ce(0), this.color = this._backgroundColor, this.alpha = 1;
|
|
1610
1605
|
}
|
|
@@ -1636,12 +1631,11 @@ const L = class Be {
|
|
|
1636
1631
|
/**
|
|
1637
1632
|
* destroys the background system
|
|
1638
1633
|
* @internal
|
|
1639
|
-
* @ignore
|
|
1640
1634
|
*/
|
|
1641
1635
|
destroy() {
|
|
1642
1636
|
}
|
|
1643
1637
|
};
|
|
1644
|
-
|
|
1638
|
+
H.extension = {
|
|
1645
1639
|
type: [
|
|
1646
1640
|
u.WebGLSystem,
|
|
1647
1641
|
u.WebGPUSystem,
|
|
@@ -1650,7 +1644,7 @@ L.extension = {
|
|
|
1650
1644
|
name: "background",
|
|
1651
1645
|
priority: 0
|
|
1652
1646
|
};
|
|
1653
|
-
|
|
1647
|
+
H.defaultOptions = {
|
|
1654
1648
|
/**
|
|
1655
1649
|
* {@link WebGLOptions.backgroundAlpha}
|
|
1656
1650
|
* @default 1
|
|
@@ -1667,14 +1661,14 @@ L.defaultOptions = {
|
|
|
1667
1661
|
*/
|
|
1668
1662
|
clearBeforeRender: !0
|
|
1669
1663
|
};
|
|
1670
|
-
let pt =
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1664
|
+
let pt = H;
|
|
1665
|
+
const y = {};
|
|
1666
|
+
E.handle(u.BlendMode, (a) => {
|
|
1673
1667
|
if (!a.name)
|
|
1674
1668
|
throw new Error("BlendMode extension must have a name property");
|
|
1675
|
-
|
|
1669
|
+
y[a.name] = a.ref;
|
|
1676
1670
|
}, (a) => {
|
|
1677
|
-
delete
|
|
1671
|
+
delete y[a.name];
|
|
1678
1672
|
});
|
|
1679
1673
|
class Ue {
|
|
1680
1674
|
constructor(e) {
|
|
@@ -1694,17 +1688,17 @@ class Ue {
|
|
|
1694
1688
|
this._isAdvanced && this._renderableList.push(e);
|
|
1695
1689
|
return;
|
|
1696
1690
|
}
|
|
1697
|
-
this._activeBlendMode = t, this._isAdvanced && this._endAdvancedBlendMode(r), this._isAdvanced = !!
|
|
1691
|
+
this._activeBlendMode = t, this._isAdvanced && this._endAdvancedBlendMode(r), this._isAdvanced = !!y[t], this._isAdvanced && (this._beginAdvancedBlendMode(r), this._renderableList.push(e));
|
|
1698
1692
|
}
|
|
1699
1693
|
_beginAdvancedBlendMode(e) {
|
|
1700
1694
|
this._renderer.renderPipes.batch.break(e);
|
|
1701
1695
|
const t = this._activeBlendMode;
|
|
1702
|
-
if (!
|
|
1696
|
+
if (!y[t]) {
|
|
1703
1697
|
ie(`Unable to assign BlendMode: '${t}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);
|
|
1704
1698
|
return;
|
|
1705
1699
|
}
|
|
1706
1700
|
let r = this._filterHash[t];
|
|
1707
|
-
r || (r = this._filterHash[t] = new ne(), r.filters = [new
|
|
1701
|
+
r || (r = this._filterHash[t] = new ne(), r.filters = [new y[t]()]);
|
|
1708
1702
|
const s = {
|
|
1709
1703
|
renderPipeId: "filter",
|
|
1710
1704
|
action: "pushFilter",
|
|
@@ -1724,7 +1718,6 @@ class Ue {
|
|
|
1724
1718
|
/**
|
|
1725
1719
|
* called when the instruction build process is starting this will reset internally to the default blend mode
|
|
1726
1720
|
* @internal
|
|
1727
|
-
* @ignore
|
|
1728
1721
|
*/
|
|
1729
1722
|
buildStart() {
|
|
1730
1723
|
this._isAdvanced = !1;
|
|
@@ -1734,15 +1727,11 @@ class Ue {
|
|
|
1734
1727
|
* active, we add the final render instructions added to the instruction set
|
|
1735
1728
|
* @param instructionSet - The instruction set we are adding to
|
|
1736
1729
|
* @internal
|
|
1737
|
-
* @ignore
|
|
1738
1730
|
*/
|
|
1739
1731
|
buildEnd(e) {
|
|
1740
1732
|
this._isAdvanced && this._endAdvancedBlendMode(e);
|
|
1741
1733
|
}
|
|
1742
|
-
/**
|
|
1743
|
-
* @internal
|
|
1744
|
-
* @ignore
|
|
1745
|
-
*/
|
|
1734
|
+
/** @internal */
|
|
1746
1735
|
destroy() {
|
|
1747
1736
|
this._renderer = null, this._renderableList = null;
|
|
1748
1737
|
for (const e in this._filterHash)
|
|
@@ -1777,18 +1766,71 @@ const R = {
|
|
|
1777
1766
|
};
|
|
1778
1767
|
}
|
|
1779
1768
|
/**
|
|
1780
|
-
*
|
|
1781
|
-
* @param options -
|
|
1782
|
-
* @returns
|
|
1769
|
+
* Creates an HTMLImageElement from a display object or texture.
|
|
1770
|
+
* @param options - Options for creating the image, or the target to extract
|
|
1771
|
+
* @returns Promise that resolves with the generated HTMLImageElement
|
|
1772
|
+
* @example
|
|
1773
|
+
* ```ts
|
|
1774
|
+
* // Basic usage with a sprite
|
|
1775
|
+
* const sprite = new Sprite(texture);
|
|
1776
|
+
* const image = await renderer.extract.image(sprite);
|
|
1777
|
+
* document.body.appendChild(image);
|
|
1778
|
+
*
|
|
1779
|
+
* // Advanced usage with options
|
|
1780
|
+
* const image = await renderer.extract.image({
|
|
1781
|
+
* target: container,
|
|
1782
|
+
* format: 'webp',
|
|
1783
|
+
* quality: 0.8,
|
|
1784
|
+
* frame: new Rectangle(0, 0, 100, 100),
|
|
1785
|
+
* resolution: 2,
|
|
1786
|
+
* clearColor: '#ff0000',
|
|
1787
|
+
* antialias: true
|
|
1788
|
+
* });
|
|
1789
|
+
*
|
|
1790
|
+
* // Extract directly from a texture
|
|
1791
|
+
* const texture = Texture.from('myTexture.png');
|
|
1792
|
+
* const image = await renderer.extract.image(texture);
|
|
1793
|
+
* ```
|
|
1794
|
+
* @see {@link ExtractImageOptions} For detailed options
|
|
1795
|
+
* @see {@link ExtractSystem.base64} For base64 string output
|
|
1796
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
1797
|
+
* @category rendering
|
|
1783
1798
|
*/
|
|
1784
1799
|
async image(e) {
|
|
1785
1800
|
const t = new Image();
|
|
1786
1801
|
return t.src = await this.base64(e), t;
|
|
1787
1802
|
}
|
|
1788
1803
|
/**
|
|
1789
|
-
*
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1804
|
+
* Converts the target into a base64 encoded string.
|
|
1805
|
+
*
|
|
1806
|
+
* This method works by first creating
|
|
1807
|
+
* a canvas using `Extract.canvas` and then converting it to a base64 string.
|
|
1808
|
+
* @param options - The options for creating the base64 string, or the target to extract
|
|
1809
|
+
* @returns Promise that resolves with the base64 encoded string
|
|
1810
|
+
* @example
|
|
1811
|
+
* ```ts
|
|
1812
|
+
* // Basic usage with a sprite
|
|
1813
|
+
* const sprite = new Sprite(texture);
|
|
1814
|
+
* const base64 = await renderer.extract.base64(sprite);
|
|
1815
|
+
* console.log(base64); // data:image/png;base64,...
|
|
1816
|
+
*
|
|
1817
|
+
* // Advanced usage with options
|
|
1818
|
+
* const base64 = await renderer.extract.base64({
|
|
1819
|
+
* target: container,
|
|
1820
|
+
* format: 'webp',
|
|
1821
|
+
* quality: 0.8,
|
|
1822
|
+
* frame: new Rectangle(0, 0, 100, 100),
|
|
1823
|
+
* resolution: 2
|
|
1824
|
+
* });
|
|
1825
|
+
* ```
|
|
1826
|
+
* @throws Will throw an error if the platform doesn't support any of:
|
|
1827
|
+
* - ICanvas.toDataURL
|
|
1828
|
+
* - ICanvas.toBlob
|
|
1829
|
+
* - ICanvas.convertToBlob
|
|
1830
|
+
* @see {@link ExtractImageOptions} For detailed options
|
|
1831
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
1832
|
+
* @see {@link ExtractSystem.image} For HTMLImage output
|
|
1833
|
+
* @category rendering
|
|
1792
1834
|
*/
|
|
1793
1835
|
async base64(e) {
|
|
1794
1836
|
e = this._normalizeOptions(
|
|
@@ -1819,9 +1861,44 @@ const R = {
|
|
|
1819
1861
|
throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented");
|
|
1820
1862
|
}
|
|
1821
1863
|
/**
|
|
1822
|
-
* Creates a Canvas element, renders
|
|
1864
|
+
* Creates a Canvas element, renders the target to it and returns it.
|
|
1865
|
+
* This method is useful for creating static images or when you need direct canvas access.
|
|
1823
1866
|
* @param options - The options for creating the canvas, or the target to extract
|
|
1824
|
-
* @returns
|
|
1867
|
+
* @returns A Canvas element with the texture rendered on
|
|
1868
|
+
* @example
|
|
1869
|
+
* ```ts
|
|
1870
|
+
* // Basic canvas extraction from a sprite
|
|
1871
|
+
* const sprite = new Sprite(texture);
|
|
1872
|
+
* const canvas = renderer.extract.canvas(sprite);
|
|
1873
|
+
* document.body.appendChild(canvas);
|
|
1874
|
+
*
|
|
1875
|
+
* // Extract with custom region
|
|
1876
|
+
* const canvas = renderer.extract.canvas({
|
|
1877
|
+
* target: container,
|
|
1878
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
1879
|
+
* });
|
|
1880
|
+
*
|
|
1881
|
+
* // Extract with high resolution
|
|
1882
|
+
* const canvas = renderer.extract.canvas({
|
|
1883
|
+
* target: sprite,
|
|
1884
|
+
* resolution: 2,
|
|
1885
|
+
* clearColor: '#ff0000'
|
|
1886
|
+
* });
|
|
1887
|
+
*
|
|
1888
|
+
* // Extract directly from a texture
|
|
1889
|
+
* const texture = Texture.from('myTexture.png');
|
|
1890
|
+
* const canvas = renderer.extract.canvas(texture);
|
|
1891
|
+
*
|
|
1892
|
+
* // Extract with anti-aliasing
|
|
1893
|
+
* const canvas = renderer.extract.canvas({
|
|
1894
|
+
* target: graphics,
|
|
1895
|
+
* antialias: true
|
|
1896
|
+
* });
|
|
1897
|
+
* ```
|
|
1898
|
+
* @see {@link ExtractOptions} For detailed options
|
|
1899
|
+
* @see {@link ExtractSystem.image} For HTMLImage output
|
|
1900
|
+
* @see {@link ExtractSystem.pixels} For raw pixel data
|
|
1901
|
+
* @category rendering
|
|
1825
1902
|
*/
|
|
1826
1903
|
canvas(e) {
|
|
1827
1904
|
e = this._normalizeOptions(e);
|
|
@@ -1832,10 +1909,34 @@ const R = {
|
|
|
1832
1909
|
return s.destroy(!0), n;
|
|
1833
1910
|
}
|
|
1834
1911
|
/**
|
|
1835
|
-
*
|
|
1836
|
-
*
|
|
1912
|
+
* Returns a one-dimensional array containing the pixel data of the entire texture in RGBA order,
|
|
1913
|
+
* with integer values between 0 and 255 (inclusive).
|
|
1914
|
+
* > [!NOE] The returned array is a flat Uint8Array where every 4 values represent RGBA
|
|
1837
1915
|
* @param options - The options for extracting the image, or the target to extract
|
|
1838
|
-
* @returns
|
|
1916
|
+
* @returns One-dimensional Uint8Array containing the pixel data in RGBA format
|
|
1917
|
+
* @example
|
|
1918
|
+
* ```ts
|
|
1919
|
+
* // Basic pixel extraction
|
|
1920
|
+
* const sprite = new Sprite(texture);
|
|
1921
|
+
* const pixels = renderer.extract.pixels(sprite);
|
|
1922
|
+
* console.log(pixels[0], pixels[1], pixels[2], pixels[3]); // R,G,B,A values
|
|
1923
|
+
*
|
|
1924
|
+
* // Extract with custom region
|
|
1925
|
+
* const pixels = renderer.extract.pixels({
|
|
1926
|
+
* target: sprite,
|
|
1927
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
1928
|
+
* });
|
|
1929
|
+
*
|
|
1930
|
+
* // Extract with high resolution
|
|
1931
|
+
* const pixels = renderer.extract.pixels({
|
|
1932
|
+
* target: sprite,
|
|
1933
|
+
* resolution: 2
|
|
1934
|
+
* });
|
|
1935
|
+
* ```
|
|
1936
|
+
* @see {@link ExtractOptions} For detailed options
|
|
1937
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
1938
|
+
* @see {@link ExtractSystem.image} For image output
|
|
1939
|
+
* @category rendering
|
|
1839
1940
|
*/
|
|
1840
1941
|
pixels(e) {
|
|
1841
1942
|
e = this._normalizeOptions(e);
|
|
@@ -1843,16 +1944,94 @@ const R = {
|
|
|
1843
1944
|
return t instanceof P && s.destroy(!0), n;
|
|
1844
1945
|
}
|
|
1845
1946
|
/**
|
|
1846
|
-
*
|
|
1947
|
+
* Creates a texture from a display object or existing texture.
|
|
1948
|
+
*
|
|
1949
|
+
* This is useful for creating
|
|
1950
|
+
* reusable textures from rendered content or making copies of existing textures.
|
|
1951
|
+
* > [!NOTE] The returned texture should be destroyed when no longer needed
|
|
1847
1952
|
* @param options - The options for creating the texture, or the target to extract
|
|
1848
|
-
* @returns
|
|
1953
|
+
* @returns A new texture containing the extracted content
|
|
1954
|
+
* @example
|
|
1955
|
+
* ```ts
|
|
1956
|
+
* // Basic texture extraction from a sprite
|
|
1957
|
+
* const sprite = new Sprite(texture);
|
|
1958
|
+
* const extractedTexture = renderer.extract.texture(sprite);
|
|
1959
|
+
*
|
|
1960
|
+
* // Extract with custom region
|
|
1961
|
+
* const regionTexture = renderer.extract.texture({
|
|
1962
|
+
* target: container,
|
|
1963
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
1964
|
+
* });
|
|
1965
|
+
*
|
|
1966
|
+
* // Extract with high resolution
|
|
1967
|
+
* const hiResTexture = renderer.extract.texture({
|
|
1968
|
+
* target: sprite,
|
|
1969
|
+
* resolution: 2,
|
|
1970
|
+
* clearColor: '#ff0000'
|
|
1971
|
+
* });
|
|
1972
|
+
*
|
|
1973
|
+
* // Create a new sprite from extracted texture
|
|
1974
|
+
* const newSprite = new Sprite(
|
|
1975
|
+
* renderer.extract.texture({
|
|
1976
|
+
* target: graphics,
|
|
1977
|
+
* antialias: true
|
|
1978
|
+
* })
|
|
1979
|
+
* );
|
|
1980
|
+
*
|
|
1981
|
+
* // Clean up when done
|
|
1982
|
+
* extractedTexture.destroy(true);
|
|
1983
|
+
* ```
|
|
1984
|
+
* @see {@link ExtractOptions} For detailed options
|
|
1985
|
+
* @see {@link Texture} For texture management
|
|
1986
|
+
* @see {@link GenerateTextureSystem} For texture generation
|
|
1987
|
+
* @category rendering
|
|
1849
1988
|
*/
|
|
1850
1989
|
texture(e) {
|
|
1851
1990
|
return e = this._normalizeOptions(e), e.target instanceof m ? e.target : this._renderer.textureGenerator.generateTexture(e);
|
|
1852
1991
|
}
|
|
1853
1992
|
/**
|
|
1854
|
-
*
|
|
1993
|
+
* Extracts and downloads content from the renderer as an image file.
|
|
1994
|
+
* This is a convenient way to save screenshots or export rendered content.
|
|
1995
|
+
* > [!NOTE] The download will use PNG format regardless of the filename extension
|
|
1855
1996
|
* @param options - The options for downloading and extracting the image, or the target to extract
|
|
1997
|
+
* @example
|
|
1998
|
+
* ```ts
|
|
1999
|
+
* // Basic download with default filename
|
|
2000
|
+
* const sprite = new Sprite(texture);
|
|
2001
|
+
* renderer.extract.download(sprite); // Downloads as 'image.png'
|
|
2002
|
+
*
|
|
2003
|
+
* // Download with custom filename
|
|
2004
|
+
* renderer.extract.download({
|
|
2005
|
+
* target: sprite,
|
|
2006
|
+
* filename: 'screenshot.png'
|
|
2007
|
+
* });
|
|
2008
|
+
*
|
|
2009
|
+
* // Download with custom region
|
|
2010
|
+
* renderer.extract.download({
|
|
2011
|
+
* target: container,
|
|
2012
|
+
* filename: 'region.png',
|
|
2013
|
+
* frame: new Rectangle(0, 0, 100, 100)
|
|
2014
|
+
* });
|
|
2015
|
+
*
|
|
2016
|
+
* // Download with high resolution and background
|
|
2017
|
+
* renderer.extract.download({
|
|
2018
|
+
* target: stage,
|
|
2019
|
+
* filename: 'hd-screenshot.png',
|
|
2020
|
+
* resolution: 2,
|
|
2021
|
+
* clearColor: '#ff0000'
|
|
2022
|
+
* });
|
|
2023
|
+
*
|
|
2024
|
+
* // Download with anti-aliasing
|
|
2025
|
+
* renderer.extract.download({
|
|
2026
|
+
* target: graphics,
|
|
2027
|
+
* filename: 'smooth.png',
|
|
2028
|
+
* antialias: true
|
|
2029
|
+
* });
|
|
2030
|
+
* ```
|
|
2031
|
+
* @see {@link ExtractDownloadOptions} For detailed options
|
|
2032
|
+
* @see {@link ExtractSystem.image} For creating images without download
|
|
2033
|
+
* @see {@link ExtractSystem.canvas} For canvas output
|
|
2034
|
+
* @category rendering
|
|
1856
2035
|
*/
|
|
1857
2036
|
download(e) {
|
|
1858
2037
|
e = this._normalizeOptions(e);
|
|
@@ -1861,7 +2040,19 @@ const R = {
|
|
|
1861
2040
|
}
|
|
1862
2041
|
/**
|
|
1863
2042
|
* Logs the target to the console as an image. This is a useful way to debug what's happening in the renderer.
|
|
2043
|
+
* The image will be displayed in the browser's console using CSS background images.
|
|
1864
2044
|
* @param options - The options for logging the image, or the target to log
|
|
2045
|
+
* @param options.width - The width of the logged image preview in the console (in pixels)
|
|
2046
|
+
* @example
|
|
2047
|
+
* ```ts
|
|
2048
|
+
* // Basic usage
|
|
2049
|
+
* const sprite = new Sprite(texture);
|
|
2050
|
+
* renderer.extract.log(sprite);
|
|
2051
|
+
* ```
|
|
2052
|
+
* @see {@link ExtractSystem.canvas} For getting raw canvas output
|
|
2053
|
+
* @see {@link ExtractSystem.pixels} For raw pixel data
|
|
2054
|
+
* @category rendering
|
|
2055
|
+
* @advanced
|
|
1865
2056
|
*/
|
|
1866
2057
|
log(e) {
|
|
1867
2058
|
const t = e.width ?? 200;
|
|
@@ -1888,9 +2079,7 @@ z.extension = {
|
|
|
1888
2079
|
name: "extract"
|
|
1889
2080
|
};
|
|
1890
2081
|
z.defaultImageOptions = {
|
|
1891
|
-
/** The format of the image. */
|
|
1892
2082
|
format: "png",
|
|
1893
|
-
/** The quality of the image. */
|
|
1894
2083
|
quality: 1
|
|
1895
2084
|
};
|
|
1896
2085
|
let mt = z;
|
|
@@ -1911,21 +2100,46 @@ class W extends m {
|
|
|
1911
2100
|
return this.source.resize(e, t, r), this;
|
|
1912
2101
|
}
|
|
1913
2102
|
}
|
|
1914
|
-
const vt = new w(),
|
|
2103
|
+
const vt = new w(), xt = new O(), gt = [0, 0, 0, 0];
|
|
1915
2104
|
class Ie {
|
|
1916
2105
|
constructor(e) {
|
|
1917
2106
|
this._renderer = e;
|
|
1918
2107
|
}
|
|
1919
2108
|
/**
|
|
1920
|
-
*
|
|
1921
|
-
* This
|
|
1922
|
-
* @param
|
|
1923
|
-
* @
|
|
1924
|
-
* @
|
|
1925
|
-
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
*
|
|
2109
|
+
* Creates a texture from a display object that can be used for creating sprites and other textures.
|
|
2110
|
+
* This is particularly useful for optimizing performance when a complex container needs to be reused.
|
|
2111
|
+
* @param options - Generate texture options or a container to convert to texture
|
|
2112
|
+
* @returns A new RenderTexture containing the rendered display object
|
|
2113
|
+
* @example
|
|
2114
|
+
* ```ts
|
|
2115
|
+
* // Basic usage with a container
|
|
2116
|
+
* const container = new Container();
|
|
2117
|
+
* container.addChild(
|
|
2118
|
+
* new Graphics()
|
|
2119
|
+
* .circle(0, 0, 50)
|
|
2120
|
+
* .fill('red')
|
|
2121
|
+
* );
|
|
2122
|
+
*
|
|
2123
|
+
* const texture = renderer.textureGenerator.generateTexture(container);
|
|
2124
|
+
*
|
|
2125
|
+
* // Advanced usage with options
|
|
2126
|
+
* const texture = renderer.textureGenerator.generateTexture({
|
|
2127
|
+
* target: container,
|
|
2128
|
+
* frame: new Rectangle(0, 0, 100, 100), // Specific region
|
|
2129
|
+
* resolution: 2, // High DPI
|
|
2130
|
+
* clearColor: '#ff0000', // Red background
|
|
2131
|
+
* antialias: true // Smooth edges
|
|
2132
|
+
* });
|
|
2133
|
+
*
|
|
2134
|
+
* // Create a sprite from the generated texture
|
|
2135
|
+
* const sprite = new Sprite(texture);
|
|
2136
|
+
*
|
|
2137
|
+
* // Clean up when done
|
|
2138
|
+
* texture.destroy(true);
|
|
2139
|
+
* ```
|
|
2140
|
+
* @see {@link GenerateTextureOptions} For detailed texture generation options
|
|
2141
|
+
* @see {@link RenderTexture} For the type of texture created
|
|
2142
|
+
* @category rendering
|
|
1929
2143
|
*/
|
|
1930
2144
|
generateTexture(e) {
|
|
1931
2145
|
var d;
|
|
@@ -1937,8 +2151,8 @@ class Ie {
|
|
|
1937
2151
|
});
|
|
1938
2152
|
const t = e.resolution || this._renderer.resolution, r = e.antialias || this._renderer.view.antialias, s = e.target;
|
|
1939
2153
|
let n = e.clearColor;
|
|
1940
|
-
n ? n = Array.isArray(n) && n.length === 4 ? n : ce.shared.setValue(n).toArray() : n =
|
|
1941
|
-
const i = ((d = e.frame) == null ? void 0 : d.copyTo(vt)) || $e(s,
|
|
2154
|
+
n ? n = Array.isArray(n) && n.length === 4 ? n : ce.shared.setValue(n).toArray() : n = gt;
|
|
2155
|
+
const i = ((d = e.frame) == null ? void 0 : d.copyTo(vt)) || $e(s, xt).rectangle;
|
|
1942
2156
|
i.width = Math.max(i.width, 1 / t) | 0, i.height = Math.max(i.height, 1 / t) | 0;
|
|
1943
2157
|
const o = W.create({
|
|
1944
2158
|
...e.textureSourceOptions,
|
|
@@ -2048,7 +2262,7 @@ Ge.extension = {
|
|
|
2048
2262
|
name: "globalUniforms"
|
|
2049
2263
|
};
|
|
2050
2264
|
let _t = 1;
|
|
2051
|
-
class
|
|
2265
|
+
class De {
|
|
2052
2266
|
constructor() {
|
|
2053
2267
|
this._tasks = [], this._offset = 0;
|
|
2054
2268
|
}
|
|
@@ -2104,13 +2318,12 @@ class Ee {
|
|
|
2104
2318
|
/**
|
|
2105
2319
|
* Destroys the scheduler system and removes all tasks.
|
|
2106
2320
|
* @internal
|
|
2107
|
-
* @ignore
|
|
2108
2321
|
*/
|
|
2109
2322
|
destroy() {
|
|
2110
2323
|
Y.system.remove(this._update, this), this._tasks.length = 0;
|
|
2111
2324
|
}
|
|
2112
2325
|
}
|
|
2113
|
-
|
|
2326
|
+
De.extension = {
|
|
2114
2327
|
type: [
|
|
2115
2328
|
u.WebGLSystem,
|
|
2116
2329
|
u.WebGPUSystem,
|
|
@@ -2167,7 +2380,7 @@ V.defaultOptions = {
|
|
|
2167
2380
|
/** {@link WebGLOptions.hello} */
|
|
2168
2381
|
hello: !1
|
|
2169
2382
|
};
|
|
2170
|
-
function
|
|
2383
|
+
function Tt(a) {
|
|
2171
2384
|
let e = !1;
|
|
2172
2385
|
for (const r in a)
|
|
2173
2386
|
if (a[r] == null) {
|
|
@@ -2183,14 +2396,14 @@ function yt(a) {
|
|
|
2183
2396
|
}
|
|
2184
2397
|
return t;
|
|
2185
2398
|
}
|
|
2186
|
-
function
|
|
2399
|
+
function yt(a) {
|
|
2187
2400
|
let e = 0;
|
|
2188
2401
|
for (let t = 0; t < a.length; t++)
|
|
2189
2402
|
a[t] == null ? e++ : a[t - e] = a[t];
|
|
2190
2403
|
return a.length -= e, a;
|
|
2191
2404
|
}
|
|
2192
2405
|
let kt = 0;
|
|
2193
|
-
const N = class
|
|
2406
|
+
const N = class Ee {
|
|
2194
2407
|
/**
|
|
2195
2408
|
* Creates a new RenderableGCSystem instance.
|
|
2196
2409
|
* @param renderer - The renderer this garbage collection system works for
|
|
@@ -2203,7 +2416,7 @@ const N = class De {
|
|
|
2203
2416
|
* @param options - Configuration options for the renderer
|
|
2204
2417
|
*/
|
|
2205
2418
|
init(e) {
|
|
2206
|
-
e = { ...
|
|
2419
|
+
e = { ...Ee.defaultOptions, ...e }, this.maxUnusedTime = e.renderableGCMaxUnusedTime, this._frequency = e.renderableGCFrequency, this.enabled = e.renderableGCActive;
|
|
2207
2420
|
}
|
|
2208
2421
|
/**
|
|
2209
2422
|
* Gets whether the garbage collection system is currently enabled.
|
|
@@ -2225,13 +2438,13 @@ const N = class De {
|
|
|
2225
2438
|
), this._hashHandler = this._renderer.scheduler.repeat(
|
|
2226
2439
|
() => {
|
|
2227
2440
|
for (const t of this._managedHashes)
|
|
2228
|
-
t.context[t.hash] =
|
|
2441
|
+
t.context[t.hash] = Tt(t.context[t.hash]);
|
|
2229
2442
|
},
|
|
2230
2443
|
this._frequency
|
|
2231
2444
|
), this._arrayHandler = this._renderer.scheduler.repeat(
|
|
2232
2445
|
() => {
|
|
2233
2446
|
for (const t of this._managedArrays)
|
|
2234
|
-
|
|
2447
|
+
yt(t.context[t.hash]);
|
|
2235
2448
|
},
|
|
2236
2449
|
this._frequency
|
|
2237
2450
|
)) : (this._renderer.scheduler.cancel(this._handler), this._renderer.scheduler.cancel(this._hashHandler), this._renderer.scheduler.cancel(this._arrayHandler)));
|
|
@@ -2380,7 +2593,7 @@ j.defaultOptions = {
|
|
|
2380
2593
|
textureGCActive: !0,
|
|
2381
2594
|
/**
|
|
2382
2595
|
* @deprecated since 8.3.0
|
|
2383
|
-
* @see {@link
|
|
2596
|
+
* @see {@link TextureGCSystemOptions.textureGCMaxIdle}
|
|
2384
2597
|
*/
|
|
2385
2598
|
textureGCAMaxIdle: null,
|
|
2386
2599
|
/**
|
|
@@ -2394,12 +2607,12 @@ j.defaultOptions = {
|
|
|
2394
2607
|
*/
|
|
2395
2608
|
textureGCCheckCountMax: 600
|
|
2396
2609
|
};
|
|
2397
|
-
let
|
|
2610
|
+
let Mt = j;
|
|
2398
2611
|
const $ = class Fe {
|
|
2399
2612
|
/**
|
|
2400
2613
|
* Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.
|
|
2401
2614
|
* This is only supported for HTMLCanvasElement and will be ignored if the canvas is an OffscreenCanvas.
|
|
2402
|
-
* @
|
|
2615
|
+
* @type {boolean}
|
|
2403
2616
|
*/
|
|
2404
2617
|
get autoDensity() {
|
|
2405
2618
|
return this.texture.source.autoDensity;
|
|
@@ -2426,7 +2639,7 @@ const $ = class Fe {
|
|
|
2426
2639
|
e = {
|
|
2427
2640
|
...Fe.defaultOptions,
|
|
2428
2641
|
...e
|
|
2429
|
-
}, e.view && (Ye(Je, "ViewSystem.view has been renamed to ViewSystem.canvas"), e.canvas = e.view), this.screen = new w(0, 0, e.width, e.height), this.canvas = e.canvas || he.get().createCanvas(), this.antialias = !!e.antialias, this.texture =
|
|
2642
|
+
}, e.view && (Ye(Je, "ViewSystem.view has been renamed to ViewSystem.canvas"), e.canvas = e.view), this.screen = new w(0, 0, e.width, e.height), this.canvas = e.canvas || he.get().createCanvas(), this.antialias = !!e.antialias, this.texture = Te(this.canvas, e), this.renderTarget = new I({
|
|
2430
2643
|
colorTextures: [this.texture],
|
|
2431
2644
|
depth: !!e.depth,
|
|
2432
2645
|
isRoot: !0
|
|
@@ -2444,7 +2657,10 @@ const $ = class Fe {
|
|
|
2444
2657
|
/**
|
|
2445
2658
|
* Destroys this System and optionally removes the canvas from the dom.
|
|
2446
2659
|
* @param {options | false} options - The options for destroying the view, or "false".
|
|
2447
|
-
* @
|
|
2660
|
+
* @example
|
|
2661
|
+
* viewSystem.destroy();
|
|
2662
|
+
* viewSystem.destroy(true);
|
|
2663
|
+
* viewSystem.destroy({ removeView: true });
|
|
2448
2664
|
*/
|
|
2449
2665
|
destroy(e = !1) {
|
|
2450
2666
|
(typeof e == "boolean" ? e : !!(e != null && e.removeView)) && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
|
|
@@ -2481,41 +2697,41 @@ $.defaultOptions = {
|
|
|
2481
2697
|
*/
|
|
2482
2698
|
antialias: !1
|
|
2483
2699
|
};
|
|
2484
|
-
let
|
|
2700
|
+
let St = $;
|
|
2485
2701
|
const Ft = [
|
|
2486
2702
|
pt,
|
|
2487
2703
|
Ge,
|
|
2488
2704
|
V,
|
|
2489
|
-
Mt,
|
|
2490
|
-
Pe,
|
|
2491
2705
|
St,
|
|
2706
|
+
Pe,
|
|
2707
|
+
Mt,
|
|
2492
2708
|
Ie,
|
|
2493
2709
|
mt,
|
|
2494
2710
|
Xe,
|
|
2495
2711
|
Ct,
|
|
2496
|
-
|
|
2497
|
-
],
|
|
2712
|
+
De
|
|
2713
|
+
], Lt = [
|
|
2498
2714
|
Ue,
|
|
2499
|
-
ge,
|
|
2500
|
-
Re,
|
|
2501
|
-
Se,
|
|
2502
2715
|
xe,
|
|
2716
|
+
Re,
|
|
2717
|
+
Me,
|
|
2718
|
+
ge,
|
|
2503
2719
|
be,
|
|
2504
2720
|
_e,
|
|
2505
2721
|
Ce
|
|
2506
2722
|
];
|
|
2507
2723
|
export {
|
|
2508
2724
|
Ot as B,
|
|
2509
|
-
|
|
2510
|
-
|
|
2725
|
+
g as G,
|
|
2726
|
+
Et as R,
|
|
2511
2727
|
Ft as S,
|
|
2512
2728
|
It as U,
|
|
2513
|
-
|
|
2729
|
+
Lt as a,
|
|
2514
2730
|
it as b,
|
|
2515
2731
|
Gt as c,
|
|
2516
|
-
|
|
2732
|
+
C as d,
|
|
2517
2733
|
At as e,
|
|
2518
2734
|
Ut as f,
|
|
2519
2735
|
Bt as t,
|
|
2520
|
-
|
|
2736
|
+
Dt as u
|
|
2521
2737
|
};
|