wuepgg3-track 3.0.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{SharedSystems-Czb8QUFv.mjs → SharedSystems-CQUTbUIx.mjs} +675 -433
- package/dist/{WebGLRenderer-Bd4vvqtJ.mjs → WebGLRenderer-zlVosyby.mjs} +417 -382
- package/dist/{WebGPURenderer-CVU5sf4P.mjs → WebGPURenderer-OAybUJeH.mjs} +277 -258
- package/dist/{browserAll-CZ03TD2_.mjs → browserAll-Byje74wY.mjs} +2 -2
- package/dist/{colorToUniform-BwrjBKZW.mjs → colorToUniform-COOzkdM9.mjs} +9 -8
- package/dist/components/GenomeView/TrackComponents/BamComponents/BamAnnotation.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/CategoricalComponents/CategoricalAnnotation.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/DynseqComponents/DynseqTrackComponents.d.ts +2 -3
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/GenomeAlignComponents.d.ts +3 -1
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/HorizontalFragment.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/GenomeAlignComponents/MultiAlignmentViewCalculator.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/GroupedTrackManager.d.ts +3 -0
- package/dist/components/GenomeView/TrackComponents/InteractionComponents/InteractionTrackComponent.d.ts +4 -15
- package/dist/components/GenomeView/TrackComponents/MethylcComponents/MethylCTrackComputation.d.ts +5 -13
- package/dist/components/GenomeView/TrackComponents/QBedComponents/QBedTrackComponents.d.ts +9 -26
- package/dist/components/GenomeView/TrackComponents/RulerComponents/Ruler.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/VcfComponents/Vcf.d.ts +1 -0
- package/dist/components/GenomeView/TrackComponents/VcfComponents/VcfTrack.d.ts +5 -24
- package/dist/components/GenomeView/TrackComponents/bedComponents/FiberTrackComponent.d.ts +5 -39
- package/dist/components/GenomeView/TrackComponents/commonComponents/HoverToolTips/HoverToolTip.d.ts +5 -0
- package/dist/components/GenomeView/TrackComponents/commonComponents/OutsideClickDetector.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/TrackLegend.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationArrows.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalAggregator.d.ts +2 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/numerical/NumericalTrack.d.ts +3 -1
- package/dist/components/GenomeView/TrackComponents/commonComponents/stats/BoxplotTrackComponents.d.ts +3 -37
- package/dist/components/GenomeView/TrackComponents/displayModeComponentMap.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/BackgroundedText.d.ts +1 -1
- package/dist/components/GenomeView/TrackComponents/geneAnnotationTrackComponents/GeneDetail.d.ts +2 -2
- package/dist/components/GenomeView/genomeNavigator/Ruler.d.ts +1 -1
- package/dist/components/GenomeView/genomeNavigator/SelectableGenomeArea.d.ts +1 -1
- package/dist/components/GenomeView/genomeNavigator/SelectedRegionBox.d.ts +1 -1
- package/dist/genome-hub/GenomeSerializer.d.ts +1 -1
- package/dist/genome-hub/genome-schema.d.ts +1 -2
- package/dist/getLocalData/LocalBigSource.d.ts +47 -0
- package/dist/getRemoteData/BigSourceWorker.d.ts +47 -0
- package/dist/getRemoteData/BigSourceWorkerGmod.d.ts +14 -5
- package/dist/getRemoteData/VcfSource.d.ts +9 -0
- package/dist/getRemoteData/hicSource.d.ts +1 -1
- package/dist/getRemoteData/io/remoteFile.d.ts +1 -1
- package/dist/getRemoteData/tabixSource.d.ts +18 -0
- package/dist/getRemoteData/vendor/bbi-js/main/bigwig.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/bin.d.ts +20 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/das.d.ts +6 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/jszlib.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/sha1.d.ts +1 -0
- package/dist/getRemoteData/vendor/bbi-js/utils/spans.d.ts +13 -0
- package/dist/{index-lRQCOP9E.mjs → index-BRD1ij9p.mjs} +64989 -66773
- package/dist/index.es.js +11 -11
- package/dist/index.umd.js +239 -228
- package/dist/{init-Bk9eSswv.mjs → init-DVJ9vOmS.mjs} +370 -355
- package/dist/models/AlignmentSegment.d.ts +1 -1
- package/dist/models/AlignmentStringUtils.d.ts +1 -1
- package/dist/models/BamAlignment.d.ts +1 -1
- package/dist/models/BedRecord.d.ts +1 -1
- package/dist/models/Chromosome.d.ts +1 -1
- package/dist/models/ChromosomeInterval.d.ts +1 -1
- package/dist/models/DisplayedRegionModel.d.ts +1 -1
- package/dist/models/Feature.d.ts +2 -2
- package/dist/models/FeatureAggregator.d.ts +4 -5
- package/dist/models/FeatureArranger.d.ts +7 -1
- package/dist/models/NavigationContext.d.ts +2 -1
- package/dist/models/OpenInterval.d.ts +1 -1
- package/dist/models/Snp.d.ts +1 -1
- package/dist/models/TrackModel.d.ts +3 -1
- package/dist/models/genomes/allGenomes.d.ts +20 -0
- package/dist/models/genomes/mCalJa1.2.pat.X/mCalJa1.2.pat.X.d.ts +17 -0
- package/dist/models/getXSpan/FeaturePlacer.d.ts +2 -9
- package/dist/models/trackModels/trackProps.d.ts +1 -0
- package/dist/style.css +1 -1
- package/dist/trackConfigs/config-menu-components.tsx/ColorConfig.d.ts +2 -1
- package/dist/trackConfigs/config-menu-components.tsx/DownsamplingConfig.d.ts +8 -0
- package/dist/trackConfigs/config-menu-components.tsx/NumberConfig.d.ts +1 -1
- package/dist/types/track-container.d.ts +1 -0
- package/dist/webworkerAll-I0QzCLqb.mjs +2 -0
- package/package.json +2 -4
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/createNewTrackState.d.ts +0 -18
- package/dist/components/GenomeView/TrackComponents/CommonTrackStateChangeFunctions.tsx/getDataAfterConfigChange.d.ts +0 -11
- package/dist/components/GenomeView/TrackComponents/bedComponents/BedcolorTrack.d.ts +0 -6
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/AnnotationTrack.d.ts +0 -25
- package/dist/components/GenomeView/TrackComponents/commonComponents/annotation/FullDisplayMode.d.ts +0 -45
- package/dist/components/testCustomGenome.d.ts +0 -505
- package/dist/getRemoteData/JasparSource.d.ts +0 -8
- package/dist/webworkerAll-D7VsNxkY.mjs +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { F as
|
|
3
|
-
var
|
|
1
|
+
import { x as Fe, n as oe, M as g, G as Le, a as He, y as le, E as u, e as F, z as w, F as We, H as L, I as y, R as H, J as ue, K as ze, v as m, d as p, k as G, w as W, L as Q, N as Ve, h as Z, B as C, l as A, O as Ne, u as S, m as T, Q as P, V as je, b as qe, W as de, X as ce, Y as he, Z as fe, C as U, _ as $e, $ as I, a0 as ee, D as z, a1 as Ke, P as Ye, i as Je, T as te, a2 as re, a3 as v, a4 as Xe, a5 as Qe } from "./index-BRD1ij9p.mjs";
|
|
2
|
+
import { F as Ze, S as et, B as pe, c as tt } from "./colorToUniform-COOzkdM9.mjs";
|
|
3
|
+
var rt = `in vec2 vMaskCoord;
|
|
4
4
|
in vec2 vTextureCoord;
|
|
5
5
|
|
|
6
6
|
uniform sampler2D uTexture;
|
|
@@ -34,7 +34,7 @@ void main(void)
|
|
|
34
34
|
|
|
35
35
|
finalColor = original * a;
|
|
36
36
|
}
|
|
37
|
-
`,
|
|
37
|
+
`, st = `in vec2 aPosition;
|
|
38
38
|
|
|
39
39
|
out vec2 vTextureCoord;
|
|
40
40
|
out vec2 vMaskCoord;
|
|
@@ -71,7 +71,7 @@ void main(void)
|
|
|
71
71
|
vTextureCoord = filterTextureCoord(aPosition);
|
|
72
72
|
vMaskCoord = getFilterCoord(aPosition);
|
|
73
73
|
}
|
|
74
|
-
`,
|
|
74
|
+
`, se = `struct GlobalFilterUniforms {
|
|
75
75
|
uInputSize:vec4<f32>,
|
|
76
76
|
uInputPixel:vec4<f32>,
|
|
77
77
|
uInputClamp:vec4<f32>,
|
|
@@ -170,25 +170,25 @@ fn mainFragment(
|
|
|
170
170
|
return source * a;
|
|
171
171
|
}
|
|
172
172
|
`;
|
|
173
|
-
class
|
|
173
|
+
class at extends Ze {
|
|
174
174
|
constructor(e) {
|
|
175
|
-
const { sprite: t, ...r } = e, s = new
|
|
176
|
-
uFilterMatrix: { value: new
|
|
175
|
+
const { sprite: t, ...r } = e, s = new Fe(t.texture), a = new oe({
|
|
176
|
+
uFilterMatrix: { value: new g(), type: "mat3x3<f32>" },
|
|
177
177
|
uMaskClamp: { value: s.uClampFrame, type: "vec4<f32>" },
|
|
178
178
|
uAlpha: { value: 1, type: "f32" },
|
|
179
179
|
uInverse: { value: e.inverse ? 1 : 0, type: "f32" }
|
|
180
|
-
}), i =
|
|
180
|
+
}), i = Le.from({
|
|
181
181
|
vertex: {
|
|
182
|
-
source:
|
|
182
|
+
source: se,
|
|
183
183
|
entryPoint: "mainVertex"
|
|
184
184
|
},
|
|
185
185
|
fragment: {
|
|
186
|
-
source:
|
|
186
|
+
source: se,
|
|
187
187
|
entryPoint: "mainFragment"
|
|
188
188
|
}
|
|
189
|
-
}), o =
|
|
190
|
-
vertex:
|
|
191
|
-
fragment:
|
|
189
|
+
}), o = He.from({
|
|
190
|
+
vertex: st,
|
|
191
|
+
fragment: rt,
|
|
192
192
|
name: "mask-filter"
|
|
193
193
|
});
|
|
194
194
|
super({
|
|
@@ -197,7 +197,7 @@ class rt extends Xe {
|
|
|
197
197
|
glProgram: o,
|
|
198
198
|
clipToViewport: !1,
|
|
199
199
|
resources: {
|
|
200
|
-
filterUniforms:
|
|
200
|
+
filterUniforms: a,
|
|
201
201
|
uMaskTexture: t.texture.source
|
|
202
202
|
}
|
|
203
203
|
}), this.sprite = t, this._textureMatrix = s;
|
|
@@ -215,17 +215,17 @@ class rt extends Xe {
|
|
|
215
215
|
).prepend(this._textureMatrix.mapCoord), this.resources.uMaskTexture = this.sprite.texture.source, e.applyFilter(this, t, r, s);
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
const
|
|
218
|
+
const V = class me {
|
|
219
219
|
constructor(e, t) {
|
|
220
220
|
var r, s;
|
|
221
|
-
this.state =
|
|
221
|
+
this.state = et.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);
|
|
222
222
|
}
|
|
223
223
|
static getBatcher(e) {
|
|
224
224
|
return new this._availableBatchers[e]();
|
|
225
225
|
}
|
|
226
226
|
buildStart(e) {
|
|
227
227
|
let t = this._batchersByInstructionSet[e.uid];
|
|
228
|
-
t || (t = this._batchersByInstructionSet[e.uid] = /* @__PURE__ */ Object.create(null), t.default || (t.default = new
|
|
228
|
+
t || (t = this._batchersByInstructionSet[e.uid] = /* @__PURE__ */ Object.create(null), t.default || (t.default = new le({
|
|
229
229
|
maxTextures: this.renderer.limits.maxBatchableTextures
|
|
230
230
|
}))), this._activeBatches = t, this._activeBatch = this._activeBatches.default;
|
|
231
231
|
for (const r in this._activeBatches)
|
|
@@ -235,7 +235,7 @@ const z = class he {
|
|
|
235
235
|
if (this._activeBatch.name !== e.batcherName) {
|
|
236
236
|
this._activeBatch.break(t);
|
|
237
237
|
let r = this._activeBatches[e.batcherName];
|
|
238
|
-
r || (r = this._activeBatches[e.batcherName] =
|
|
238
|
+
r || (r = this._activeBatches[e.batcherName] = me.getBatcher(e.batcherName), r.begin()), this._activeBatch = r;
|
|
239
239
|
}
|
|
240
240
|
this._activeBatch.add(e);
|
|
241
241
|
}
|
|
@@ -246,15 +246,15 @@ const z = class he {
|
|
|
246
246
|
this._activeBatch.break(e);
|
|
247
247
|
const t = this._activeBatches;
|
|
248
248
|
for (const r in t) {
|
|
249
|
-
const s = t[r],
|
|
250
|
-
|
|
249
|
+
const s = t[r], a = s.geometry;
|
|
250
|
+
a.indexBuffer.setDataWithSize(s.indexBuffer, s.indexSize, !0), a.buffers[0].setDataWithSize(s.attributeBuffer.float32View, s.attributeSize, !1);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
upload(e) {
|
|
254
254
|
const t = this._batchersByInstructionSet[e.uid];
|
|
255
255
|
for (const r in t) {
|
|
256
|
-
const s = t[r],
|
|
257
|
-
s.dirty && (s.dirty = !1,
|
|
256
|
+
const s = t[r], a = s.geometry;
|
|
257
|
+
s.dirty && (s.dirty = !1, a.buffers[0].update(s.attributeSize * 4));
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
execute(e) {
|
|
@@ -271,7 +271,7 @@ const z = class he {
|
|
|
271
271
|
this._activeBatches = null;
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
|
-
|
|
274
|
+
V.extension = {
|
|
275
275
|
type: [
|
|
276
276
|
u.WebGLPipes,
|
|
277
277
|
u.WebGPUPipes,
|
|
@@ -279,11 +279,11 @@ z.extension = {
|
|
|
279
279
|
],
|
|
280
280
|
name: "batch"
|
|
281
281
|
};
|
|
282
|
-
|
|
283
|
-
let
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const
|
|
282
|
+
V._availableBatchers = /* @__PURE__ */ Object.create(null);
|
|
283
|
+
let ge = V;
|
|
284
|
+
F.handleByMap(u.Batcher, ge._availableBatchers);
|
|
285
|
+
F.add(le);
|
|
286
|
+
const At = {
|
|
287
287
|
name: "texture-bit",
|
|
288
288
|
vertex: {
|
|
289
289
|
header: (
|
|
@@ -321,7 +321,7 @@ const Bt = {
|
|
|
321
321
|
`
|
|
322
322
|
)
|
|
323
323
|
}
|
|
324
|
-
},
|
|
324
|
+
}, It = {
|
|
325
325
|
name: "texture-bit",
|
|
326
326
|
vertex: {
|
|
327
327
|
header: (
|
|
@@ -353,11 +353,11 @@ const Bt = {
|
|
|
353
353
|
`
|
|
354
354
|
)
|
|
355
355
|
}
|
|
356
|
-
},
|
|
357
|
-
class
|
|
356
|
+
}, nt = new L();
|
|
357
|
+
class it extends ue {
|
|
358
358
|
constructor() {
|
|
359
|
-
super(), this.filters = [new
|
|
360
|
-
sprite: new
|
|
359
|
+
super(), this.filters = [new at({
|
|
360
|
+
sprite: new ze(m.EMPTY),
|
|
361
361
|
inverse: !1,
|
|
362
362
|
resolution: "inherit",
|
|
363
363
|
antialias: "inherit"
|
|
@@ -376,7 +376,7 @@ class at extends ie {
|
|
|
376
376
|
this.filters[0].inverse = e;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
class
|
|
379
|
+
class _e {
|
|
380
380
|
constructor(e) {
|
|
381
381
|
this._activeMaskStage = [], this._renderer = e;
|
|
382
382
|
}
|
|
@@ -390,12 +390,12 @@ class pe {
|
|
|
390
390
|
canBundle: !1,
|
|
391
391
|
maskedContainer: t
|
|
392
392
|
}), e.inverse = t._maskOptions.inverse, e.renderMaskToTexture) {
|
|
393
|
-
const
|
|
394
|
-
|
|
393
|
+
const a = e.mask;
|
|
394
|
+
a.includeInBuild = !0, a.collectRenderables(
|
|
395
395
|
r,
|
|
396
396
|
s,
|
|
397
397
|
null
|
|
398
|
-
),
|
|
398
|
+
), a.includeInBuild = !1;
|
|
399
399
|
}
|
|
400
400
|
s.renderPipes.batch.break(r), r.add({
|
|
401
401
|
renderPipeId: "alphaMask",
|
|
@@ -418,23 +418,23 @@ class pe {
|
|
|
418
418
|
execute(e) {
|
|
419
419
|
const t = this._renderer, r = e.mask.renderMaskToTexture;
|
|
420
420
|
if (e.action === "pushMaskBegin") {
|
|
421
|
-
const s =
|
|
421
|
+
const s = w.get(it);
|
|
422
422
|
if (s.inverse = e.inverse, r) {
|
|
423
423
|
e.mask.mask.measurable = !0;
|
|
424
|
-
const
|
|
425
|
-
e.mask.mask.measurable = !1,
|
|
426
|
-
const i = t.renderTarget.renderTarget.colorTexture.source, o =
|
|
427
|
-
|
|
428
|
-
|
|
424
|
+
const a = We(e.mask.mask, !0, nt);
|
|
425
|
+
e.mask.mask.measurable = !1, a.ceil();
|
|
426
|
+
const i = t.renderTarget.renderTarget.colorTexture.source, o = y.getOptimalTexture(
|
|
427
|
+
a.width,
|
|
428
|
+
a.height,
|
|
429
429
|
i._resolution,
|
|
430
430
|
i.antialias
|
|
431
431
|
);
|
|
432
432
|
t.renderTarget.push(o, !0), t.globalUniforms.push({
|
|
433
|
-
offset:
|
|
433
|
+
offset: a,
|
|
434
434
|
worldColor: 4294967295
|
|
435
435
|
});
|
|
436
436
|
const l = s.sprite;
|
|
437
|
-
l.texture = o, l.worldTransform.tx =
|
|
437
|
+
l.texture = o, l.worldTransform.tx = a.minX, l.worldTransform.ty = a.minY, this._activeMaskStage.push({
|
|
438
438
|
filterEffect: s,
|
|
439
439
|
maskedContainer: e.maskedContainer,
|
|
440
440
|
filterTexture: o
|
|
@@ -446,7 +446,7 @@ class pe {
|
|
|
446
446
|
});
|
|
447
447
|
} else if (e.action === "pushMaskEnd") {
|
|
448
448
|
const s = this._activeMaskStage[this._activeMaskStage.length - 1];
|
|
449
|
-
r && (t.type ===
|
|
449
|
+
r && (t.type === H.WEBGL && t.renderTarget.finishRenderPass(), t.renderTarget.pop(), t.globalUniforms.pop()), t.filter.push({
|
|
450
450
|
renderPipeId: "filter",
|
|
451
451
|
action: "pushFilter",
|
|
452
452
|
container: s.maskedContainer,
|
|
@@ -456,14 +456,14 @@ class pe {
|
|
|
456
456
|
} else if (e.action === "popMaskEnd") {
|
|
457
457
|
t.filter.pop();
|
|
458
458
|
const s = this._activeMaskStage.pop();
|
|
459
|
-
r &&
|
|
459
|
+
r && y.returnTexture(s.filterTexture), w.return(s.filterEffect);
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
destroy() {
|
|
463
463
|
this._renderer = null, this._activeMaskStage = null;
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
|
-
|
|
466
|
+
_e.extension = {
|
|
467
467
|
type: [
|
|
468
468
|
u.WebGLPipes,
|
|
469
469
|
u.WebGPUPipes,
|
|
@@ -471,7 +471,7 @@ pe.extension = {
|
|
|
471
471
|
],
|
|
472
472
|
name: "alphaMask"
|
|
473
473
|
};
|
|
474
|
-
class
|
|
474
|
+
class ve {
|
|
475
475
|
constructor(e) {
|
|
476
476
|
this._colorStack = [], this._colorStackIndex = 0, this._currentColor = 0, this._renderer = e;
|
|
477
477
|
}
|
|
@@ -480,8 +480,8 @@ class me {
|
|
|
480
480
|
}
|
|
481
481
|
push(e, t, r) {
|
|
482
482
|
this._renderer.renderPipes.batch.break(r);
|
|
483
|
-
const
|
|
484
|
-
|
|
483
|
+
const a = this._colorStack;
|
|
484
|
+
a[this._colorStackIndex] = a[this._colorStackIndex - 1] & e.mask;
|
|
485
485
|
const i = this._colorStack[this._colorStackIndex];
|
|
486
486
|
i !== this._currentColor && (this._currentColor = i, r.add({
|
|
487
487
|
renderPipeId: "colorMask",
|
|
@@ -491,9 +491,9 @@ class me {
|
|
|
491
491
|
}
|
|
492
492
|
pop(e, t, r) {
|
|
493
493
|
this._renderer.renderPipes.batch.break(r);
|
|
494
|
-
const
|
|
494
|
+
const a = this._colorStack;
|
|
495
495
|
this._colorStackIndex--;
|
|
496
|
-
const i =
|
|
496
|
+
const i = a[this._colorStackIndex - 1];
|
|
497
497
|
i !== this._currentColor && (this._currentColor = i, r.add({
|
|
498
498
|
renderPipeId: "colorMask",
|
|
499
499
|
colorMask: i,
|
|
@@ -507,7 +507,7 @@ class me {
|
|
|
507
507
|
this._renderer = null, this._colorStack = null;
|
|
508
508
|
}
|
|
509
509
|
}
|
|
510
|
-
|
|
510
|
+
ve.extension = {
|
|
511
511
|
type: [
|
|
512
512
|
u.WebGLPipes,
|
|
513
513
|
u.WebGPUPipes,
|
|
@@ -515,26 +515,26 @@ me.extension = {
|
|
|
515
515
|
],
|
|
516
516
|
name: "colorMask"
|
|
517
517
|
};
|
|
518
|
-
class
|
|
518
|
+
class xe {
|
|
519
519
|
constructor(e) {
|
|
520
520
|
this._maskStackHash = {}, this._maskHash = /* @__PURE__ */ new WeakMap(), this._renderer = e;
|
|
521
521
|
}
|
|
522
522
|
push(e, t, r) {
|
|
523
523
|
var s;
|
|
524
|
-
const
|
|
525
|
-
i.renderPipes.batch.break(r), i.renderPipes.blendMode.setBlendMode(
|
|
524
|
+
const a = e, i = this._renderer;
|
|
525
|
+
i.renderPipes.batch.break(r), i.renderPipes.blendMode.setBlendMode(a.mask, "none", r), r.add({
|
|
526
526
|
renderPipeId: "stencilMask",
|
|
527
527
|
action: "pushMaskBegin",
|
|
528
528
|
mask: e,
|
|
529
529
|
inverse: t._maskOptions.inverse,
|
|
530
530
|
canBundle: !1
|
|
531
531
|
});
|
|
532
|
-
const o =
|
|
533
|
-
o.includeInBuild = !0, this._maskHash.has(
|
|
532
|
+
const o = a.mask;
|
|
533
|
+
o.includeInBuild = !0, this._maskHash.has(a) || this._maskHash.set(a, {
|
|
534
534
|
instructionsStart: 0,
|
|
535
535
|
instructionsLength: 0
|
|
536
536
|
});
|
|
537
|
-
const l = this._maskHash.get(
|
|
537
|
+
const l = this._maskHash.get(a);
|
|
538
538
|
l.instructionsStart = r.instructionSize, o.collectRenderables(
|
|
539
539
|
r,
|
|
540
540
|
i,
|
|
@@ -548,12 +548,12 @@ class ve {
|
|
|
548
548
|
});
|
|
549
549
|
const d = r.instructionSize - l.instructionsStart - 1;
|
|
550
550
|
l.instructionsLength = d;
|
|
551
|
-
const
|
|
552
|
-
(s = this._maskStackHash)[
|
|
551
|
+
const h = i.renderTarget.renderTarget.uid;
|
|
552
|
+
(s = this._maskStackHash)[h] ?? (s[h] = 0);
|
|
553
553
|
}
|
|
554
554
|
pop(e, t, r) {
|
|
555
|
-
const s = e,
|
|
556
|
-
|
|
555
|
+
const s = e, a = this._renderer;
|
|
556
|
+
a.renderPipes.batch.break(r), a.renderPipes.blendMode.setBlendMode(s.mask, "none", r), r.add({
|
|
557
557
|
renderPipeId: "stencilMask",
|
|
558
558
|
action: "popMaskBegin",
|
|
559
559
|
inverse: t._maskOptions.inverse,
|
|
@@ -571,14 +571,14 @@ class ve {
|
|
|
571
571
|
execute(e) {
|
|
572
572
|
var t;
|
|
573
573
|
const r = this._renderer, s = r.renderTarget.renderTarget.uid;
|
|
574
|
-
let
|
|
575
|
-
e.action === "pushMaskBegin" ? (r.renderTarget.ensureDepthStencil(), r.stencil.setStencilMode(
|
|
574
|
+
let a = (t = this._maskStackHash)[s] ?? (t[s] = 0);
|
|
575
|
+
e.action === "pushMaskBegin" ? (r.renderTarget.ensureDepthStencil(), r.stencil.setStencilMode(p.RENDERING_MASK_ADD, a), a++, r.colorMask.setMask(0)) : e.action === "pushMaskEnd" ? (e.inverse ? r.stencil.setStencilMode(p.INVERSE_MASK_ACTIVE, a) : r.stencil.setStencilMode(p.MASK_ACTIVE, a), r.colorMask.setMask(15)) : e.action === "popMaskBegin" ? (r.colorMask.setMask(0), a !== 0 ? r.stencil.setStencilMode(p.RENDERING_MASK_REMOVE, a) : (r.renderTarget.clear(null, G.STENCIL), r.stencil.setStencilMode(p.DISABLED, a)), a--) : e.action === "popMaskEnd" && (e.inverse ? r.stencil.setStencilMode(p.INVERSE_MASK_ACTIVE, a) : r.stencil.setStencilMode(p.MASK_ACTIVE, a), r.colorMask.setMask(15)), this._maskStackHash[s] = a;
|
|
576
576
|
}
|
|
577
577
|
destroy() {
|
|
578
578
|
this._renderer = null, this._maskStackHash = null, this._maskHash = null;
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
|
|
581
|
+
xe.extension = {
|
|
582
582
|
type: [
|
|
583
583
|
u.WebGLPipes,
|
|
584
584
|
u.WebGPUPipes,
|
|
@@ -586,35 +586,35 @@ ve.extension = {
|
|
|
586
586
|
],
|
|
587
587
|
name: "stencilMask"
|
|
588
588
|
};
|
|
589
|
-
function
|
|
590
|
-
for (const t in
|
|
591
|
-
const r =
|
|
592
|
-
s ? (r.format ?? (r.format = s.format), r.offset ?? (r.offset = s.offset), r.instance ?? (r.instance = s.instance)) :
|
|
589
|
+
function Dt(n, e) {
|
|
590
|
+
for (const t in n.attributes) {
|
|
591
|
+
const r = n.attributes[t], s = e[t];
|
|
592
|
+
s ? (r.format ?? (r.format = s.format), r.offset ?? (r.offset = s.offset), r.instance ?? (r.instance = s.instance)) : W(`Attribute ${t} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`);
|
|
593
593
|
}
|
|
594
|
-
|
|
594
|
+
ot(n);
|
|
595
595
|
}
|
|
596
|
-
function
|
|
597
|
-
const { buffers: e, attributes: t } =
|
|
598
|
-
for (const
|
|
599
|
-
const i = e[
|
|
596
|
+
function ot(n) {
|
|
597
|
+
const { buffers: e, attributes: t } = n, r = {}, s = {};
|
|
598
|
+
for (const a in e) {
|
|
599
|
+
const i = e[a];
|
|
600
600
|
r[i.uid] = 0, s[i.uid] = 0;
|
|
601
601
|
}
|
|
602
|
-
for (const
|
|
603
|
-
const i = t[
|
|
604
|
-
r[i.buffer.uid] +=
|
|
602
|
+
for (const a in t) {
|
|
603
|
+
const i = t[a];
|
|
604
|
+
r[i.buffer.uid] += Q(i.format).stride;
|
|
605
605
|
}
|
|
606
|
-
for (const
|
|
607
|
-
const i = t[
|
|
608
|
-
i.stride ?? (i.stride = r[i.buffer.uid]), i.start ?? (i.start = s[i.buffer.uid]), s[i.buffer.uid] +=
|
|
606
|
+
for (const a in t) {
|
|
607
|
+
const i = t[a];
|
|
608
|
+
i.stride ?? (i.stride = r[i.buffer.uid]), i.start ?? (i.start = s[i.buffer.uid]), s[i.buffer.uid] += Q(i.format).stride;
|
|
609
609
|
}
|
|
610
610
|
}
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
|
|
611
|
+
const b = [];
|
|
612
|
+
b[p.NONE] = void 0;
|
|
613
|
+
b[p.DISABLED] = {
|
|
614
614
|
stencilWriteMask: 0,
|
|
615
615
|
stencilReadMask: 0
|
|
616
616
|
};
|
|
617
|
-
|
|
617
|
+
b[p.RENDERING_MASK_ADD] = {
|
|
618
618
|
stencilFront: {
|
|
619
619
|
compare: "equal",
|
|
620
620
|
passOp: "increment-clamp"
|
|
@@ -624,7 +624,7 @@ _[f.RENDERING_MASK_ADD] = {
|
|
|
624
624
|
passOp: "increment-clamp"
|
|
625
625
|
}
|
|
626
626
|
};
|
|
627
|
-
|
|
627
|
+
b[p.RENDERING_MASK_REMOVE] = {
|
|
628
628
|
stencilFront: {
|
|
629
629
|
compare: "equal",
|
|
630
630
|
passOp: "decrement-clamp"
|
|
@@ -634,7 +634,7 @@ _[f.RENDERING_MASK_REMOVE] = {
|
|
|
634
634
|
passOp: "decrement-clamp"
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
|
-
|
|
637
|
+
b[p.MASK_ACTIVE] = {
|
|
638
638
|
stencilWriteMask: 0,
|
|
639
639
|
stencilFront: {
|
|
640
640
|
compare: "equal",
|
|
@@ -645,7 +645,7 @@ _[f.MASK_ACTIVE] = {
|
|
|
645
645
|
passOp: "keep"
|
|
646
646
|
}
|
|
647
647
|
};
|
|
648
|
-
|
|
648
|
+
b[p.INVERSE_MASK_ACTIVE] = {
|
|
649
649
|
stencilWriteMask: 0,
|
|
650
650
|
stencilFront: {
|
|
651
651
|
compare: "not-equal",
|
|
@@ -656,7 +656,7 @@ _[f.INVERSE_MASK_ACTIVE] = {
|
|
|
656
656
|
passOp: "keep"
|
|
657
657
|
}
|
|
658
658
|
};
|
|
659
|
-
class
|
|
659
|
+
class Et {
|
|
660
660
|
constructor(e) {
|
|
661
661
|
this._syncFunctionHash = /* @__PURE__ */ Object.create(null), this._adaptor = e, this._systemCheck();
|
|
662
662
|
}
|
|
@@ -666,14 +666,14 @@ class It {
|
|
|
666
666
|
* @private
|
|
667
667
|
*/
|
|
668
668
|
_systemCheck() {
|
|
669
|
-
if (!
|
|
669
|
+
if (!Ve())
|
|
670
670
|
throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.");
|
|
671
671
|
}
|
|
672
672
|
ensureUniformGroup(e) {
|
|
673
673
|
const t = this.getUniformGroupData(e);
|
|
674
|
-
e.buffer || (e.buffer = new
|
|
674
|
+
e.buffer || (e.buffer = new Z({
|
|
675
675
|
data: new Float32Array(t.layout.size / 4),
|
|
676
|
-
usage:
|
|
676
|
+
usage: C.UNIFORM | C.COPY_DST
|
|
677
677
|
}));
|
|
678
678
|
}
|
|
679
679
|
getUniformGroupData(e) {
|
|
@@ -683,9 +683,9 @@ class It {
|
|
|
683
683
|
const t = e._signature;
|
|
684
684
|
let r = this._syncFunctionHash[t];
|
|
685
685
|
if (!r) {
|
|
686
|
-
const s = Object.keys(e.uniformStructures).map((o) => e.uniformStructures[o]),
|
|
686
|
+
const s = Object.keys(e.uniformStructures).map((o) => e.uniformStructures[o]), a = this._adaptor.createUboElements(s), i = this._generateUboSync(a.uboElements);
|
|
687
687
|
r = this._syncFunctionHash[t] = {
|
|
688
|
-
layout:
|
|
688
|
+
layout: a,
|
|
689
689
|
syncFunction: i
|
|
690
690
|
};
|
|
691
691
|
}
|
|
@@ -696,12 +696,12 @@ class It {
|
|
|
696
696
|
}
|
|
697
697
|
syncUniformGroup(e, t, r) {
|
|
698
698
|
const s = this.getUniformGroupData(e);
|
|
699
|
-
e.buffer || (e.buffer = new
|
|
699
|
+
e.buffer || (e.buffer = new Z({
|
|
700
700
|
data: new Float32Array(s.layout.size / 4),
|
|
701
|
-
usage:
|
|
701
|
+
usage: C.UNIFORM | C.COPY_DST
|
|
702
702
|
}));
|
|
703
|
-
let
|
|
704
|
-
return t || (t = e.buffer.data,
|
|
703
|
+
let a = null;
|
|
704
|
+
return t || (t = e.buffer.data, a = e.buffer.dataInt32), r || (r = 0), s.syncFunction(e.uniforms, t, a, r), !0;
|
|
705
705
|
}
|
|
706
706
|
updateUniformGroup(e) {
|
|
707
707
|
if (e.isStatic && !e._dirtyId)
|
|
@@ -714,11 +714,11 @@ class It {
|
|
|
714
714
|
this._syncFunctionHash = null;
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
const
|
|
717
|
+
const M = [
|
|
718
718
|
// uploading pixi matrix object to mat3
|
|
719
719
|
{
|
|
720
720
|
type: "mat3x3<f32>",
|
|
721
|
-
test: (
|
|
721
|
+
test: (n) => n.value.a !== void 0,
|
|
722
722
|
ubo: `
|
|
723
723
|
var matrix = uv[name].toArray(true);
|
|
724
724
|
data[offset] = matrix[0];
|
|
@@ -738,7 +738,7 @@ const C = [
|
|
|
738
738
|
// uploading a pixi rectangle as a vec4
|
|
739
739
|
{
|
|
740
740
|
type: "vec4<f32>",
|
|
741
|
-
test: (
|
|
741
|
+
test: (n) => n.type === "vec4<f32>" && n.size === 1 && n.value.width !== void 0,
|
|
742
742
|
ubo: `
|
|
743
743
|
v = uv[name];
|
|
744
744
|
data[offset] = v.x;
|
|
@@ -761,7 +761,7 @@ const C = [
|
|
|
761
761
|
// uploading a pixi point as a vec2
|
|
762
762
|
{
|
|
763
763
|
type: "vec2<f32>",
|
|
764
|
-
test: (
|
|
764
|
+
test: (n) => n.type === "vec2<f32>" && n.size === 1 && n.value.x !== void 0,
|
|
765
765
|
ubo: `
|
|
766
766
|
v = uv[name];
|
|
767
767
|
data[offset] = v.x;
|
|
@@ -780,7 +780,7 @@ const C = [
|
|
|
780
780
|
// uploading a pixi color as a vec4
|
|
781
781
|
{
|
|
782
782
|
type: "vec4<f32>",
|
|
783
|
-
test: (
|
|
783
|
+
test: (n) => n.type === "vec4<f32>" && n.size === 1 && n.value.red !== void 0,
|
|
784
784
|
ubo: `
|
|
785
785
|
v = uv[name];
|
|
786
786
|
data[offset] = v.red;
|
|
@@ -803,7 +803,7 @@ const C = [
|
|
|
803
803
|
// uploading a pixi color as a vec3
|
|
804
804
|
{
|
|
805
805
|
type: "vec3<f32>",
|
|
806
|
-
test: (
|
|
806
|
+
test: (n) => n.type === "vec3<f32>" && n.size === 1 && n.value.red !== void 0,
|
|
807
807
|
ubo: `
|
|
808
808
|
v = uv[name];
|
|
809
809
|
data[offset] = v.red;
|
|
@@ -822,7 +822,7 @@ const C = [
|
|
|
822
822
|
`
|
|
823
823
|
}
|
|
824
824
|
];
|
|
825
|
-
function
|
|
825
|
+
function Ot(n, e, t, r) {
|
|
826
826
|
const s = [`
|
|
827
827
|
var v = null;
|
|
828
828
|
var v2 = null;
|
|
@@ -831,34 +831,34 @@ function Gt(a, e, t, r) {
|
|
|
831
831
|
var name = null;
|
|
832
832
|
var arrayOffset = null;
|
|
833
833
|
`];
|
|
834
|
-
let
|
|
835
|
-
for (let o = 0; o <
|
|
836
|
-
const l =
|
|
837
|
-
let
|
|
838
|
-
for (let
|
|
839
|
-
if (
|
|
840
|
-
|
|
834
|
+
let a = 0;
|
|
835
|
+
for (let o = 0; o < n.length; o++) {
|
|
836
|
+
const l = n[o], d = l.data.name;
|
|
837
|
+
let h = !1, c = 0;
|
|
838
|
+
for (let f = 0; f < M.length; f++)
|
|
839
|
+
if (M[f].test(l.data)) {
|
|
840
|
+
c = l.offset / 4, s.push(
|
|
841
841
|
`name = "${d}";`,
|
|
842
|
-
`offset += ${
|
|
843
|
-
|
|
844
|
-
),
|
|
842
|
+
`offset += ${c - a};`,
|
|
843
|
+
M[f][e] || M[f].ubo
|
|
844
|
+
), h = !0;
|
|
845
845
|
break;
|
|
846
846
|
}
|
|
847
|
-
if (!
|
|
847
|
+
if (!h)
|
|
848
848
|
if (l.data.size > 1)
|
|
849
|
-
|
|
849
|
+
c = l.offset / 4, s.push(t(l, c - a));
|
|
850
850
|
else {
|
|
851
|
-
const
|
|
852
|
-
|
|
851
|
+
const f = r[l.data.type];
|
|
852
|
+
c = l.offset / 4, s.push(
|
|
853
853
|
/* wgsl */
|
|
854
854
|
`
|
|
855
855
|
v = uv.${d};
|
|
856
|
-
offset += ${
|
|
857
|
-
${
|
|
856
|
+
offset += ${c - a};
|
|
857
|
+
${f};
|
|
858
858
|
`
|
|
859
859
|
);
|
|
860
860
|
}
|
|
861
|
-
|
|
861
|
+
a = c;
|
|
862
862
|
}
|
|
863
863
|
const i = s.join(`
|
|
864
864
|
`);
|
|
@@ -870,14 +870,14 @@ function Gt(a, e, t, r) {
|
|
|
870
870
|
i
|
|
871
871
|
);
|
|
872
872
|
}
|
|
873
|
-
function
|
|
873
|
+
function _(n, e) {
|
|
874
874
|
return `
|
|
875
|
-
for (let i = 0; i < ${
|
|
876
|
-
data[offset + (((i / ${
|
|
875
|
+
for (let i = 0; i < ${n * e}; i++) {
|
|
876
|
+
data[offset + (((i / ${n})|0) * 4) + (i % ${n})] = v[i];
|
|
877
877
|
}
|
|
878
878
|
`;
|
|
879
879
|
}
|
|
880
|
-
const
|
|
880
|
+
const lt = {
|
|
881
881
|
f32: `
|
|
882
882
|
data[offset] = v;`,
|
|
883
883
|
i32: `
|
|
@@ -925,14 +925,14 @@ const it = {
|
|
|
925
925
|
for (let i = 0; i < 16; i++) {
|
|
926
926
|
data[offset + i] = v[i];
|
|
927
927
|
}`,
|
|
928
|
-
"mat3x2<f32>":
|
|
929
|
-
"mat4x2<f32>":
|
|
930
|
-
"mat2x3<f32>":
|
|
931
|
-
"mat4x3<f32>":
|
|
932
|
-
"mat2x4<f32>":
|
|
933
|
-
"mat3x4<f32>":
|
|
934
|
-
},
|
|
935
|
-
...
|
|
928
|
+
"mat3x2<f32>": _(3, 2),
|
|
929
|
+
"mat4x2<f32>": _(4, 2),
|
|
930
|
+
"mat2x3<f32>": _(2, 3),
|
|
931
|
+
"mat4x3<f32>": _(4, 3),
|
|
932
|
+
"mat2x4<f32>": _(2, 4),
|
|
933
|
+
"mat3x4<f32>": _(3, 4)
|
|
934
|
+
}, Ft = {
|
|
935
|
+
...lt,
|
|
936
936
|
"mat2x2<f32>": `
|
|
937
937
|
data[offset] = v[0];
|
|
938
938
|
data[offset + 1] = v[1];
|
|
@@ -940,36 +940,36 @@ const it = {
|
|
|
940
940
|
data[offset + 3] = v[3];
|
|
941
941
|
`
|
|
942
942
|
};
|
|
943
|
-
function
|
|
944
|
-
const i =
|
|
945
|
-
return
|
|
943
|
+
function ut(n, e, t, r, s, a) {
|
|
944
|
+
const i = a ? 1 : -1;
|
|
945
|
+
return n.identity(), n.a = 1 / r * 2, n.d = i * (1 / s * 2), n.tx = -1 - e * n.a, n.ty = -i - t * n.d, n;
|
|
946
946
|
}
|
|
947
947
|
const x = /* @__PURE__ */ new Map();
|
|
948
|
-
|
|
949
|
-
function
|
|
950
|
-
if (!x.has(
|
|
948
|
+
Ne.register(x);
|
|
949
|
+
function be(n, e) {
|
|
950
|
+
if (!x.has(n)) {
|
|
951
951
|
const t = new m({
|
|
952
|
-
source: new
|
|
953
|
-
resource:
|
|
952
|
+
source: new A({
|
|
953
|
+
resource: n,
|
|
954
954
|
...e
|
|
955
955
|
})
|
|
956
956
|
}), r = () => {
|
|
957
|
-
x.get(
|
|
957
|
+
x.get(n) === t && x.delete(n);
|
|
958
958
|
};
|
|
959
|
-
t.once("destroy", r), t.source.once("destroy", r), x.set(
|
|
959
|
+
t.once("destroy", r), t.source.once("destroy", r), x.set(n, t);
|
|
960
960
|
}
|
|
961
|
-
return x.get(
|
|
961
|
+
return x.get(n);
|
|
962
962
|
}
|
|
963
|
-
function
|
|
964
|
-
const e =
|
|
963
|
+
function dt(n) {
|
|
964
|
+
const e = n.colorTexture.source.resource;
|
|
965
965
|
return globalThis.HTMLCanvasElement && e instanceof HTMLCanvasElement && document.body.contains(e);
|
|
966
966
|
}
|
|
967
|
-
const
|
|
967
|
+
const ye = class Te {
|
|
968
968
|
/**
|
|
969
969
|
* @param [descriptor] - Options for creating a render target.
|
|
970
970
|
*/
|
|
971
971
|
constructor(e = {}) {
|
|
972
|
-
if (this.uid =
|
|
972
|
+
if (this.uid = S("renderTarget"), this.colorTextures = [], this.dirtyId = 0, this.isRoot = !1, this._size = new Float32Array(2), this._managedColorTextures = !1, e = { ...Te.defaultOptions, ...e }, this.stencil = e.stencil, this.depth = e.depth, this.isRoot = e.isRoot, typeof e.colorTextures == "number") {
|
|
973
973
|
this._managedColorTextures = !0;
|
|
974
974
|
for (let t = 0; t < e.colorTextures; t++)
|
|
975
975
|
this.colorTextures.push(
|
|
@@ -1030,8 +1030,8 @@ const xe = class _e {
|
|
|
1030
1030
|
}));
|
|
1031
1031
|
}
|
|
1032
1032
|
resize(e, t, r = this.resolution, s = !1) {
|
|
1033
|
-
this.dirtyId++, this.colorTextures.forEach((
|
|
1034
|
-
s && i === 0 ||
|
|
1033
|
+
this.dirtyId++, this.colorTextures.forEach((a, i) => {
|
|
1034
|
+
s && i === 0 || a.source.resize(e, t, r);
|
|
1035
1035
|
}), this.depthStencilTexture && this.depthStencilTexture.source.resize(e, t, r);
|
|
1036
1036
|
}
|
|
1037
1037
|
destroy() {
|
|
@@ -1040,7 +1040,7 @@ const xe = class _e {
|
|
|
1040
1040
|
}), this.depthStencilTexture && (this.depthStencilTexture.destroy(), delete this.depthStencilTexture);
|
|
1041
1041
|
}
|
|
1042
1042
|
};
|
|
1043
|
-
|
|
1043
|
+
ye.defaultOptions = {
|
|
1044
1044
|
/** the width of the RenderTarget */
|
|
1045
1045
|
width: 0,
|
|
1046
1046
|
/** the height of the RenderTarget */
|
|
@@ -1059,10 +1059,10 @@ xe.defaultOptions = {
|
|
|
1059
1059
|
/** is this a root element, true if this is gl context owners render target */
|
|
1060
1060
|
isRoot: !1
|
|
1061
1061
|
};
|
|
1062
|
-
let
|
|
1063
|
-
class
|
|
1062
|
+
let D = ye;
|
|
1063
|
+
class Lt {
|
|
1064
1064
|
constructor(e) {
|
|
1065
|
-
this.rootViewPort = new
|
|
1065
|
+
this.rootViewPort = new P(), this.viewport = new P(), this.onRenderTargetChange = new je("onRenderTargetChange"), this.projectionMatrix = new g(), 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");
|
|
1066
1066
|
}
|
|
1067
1067
|
/** called when dev wants to finish a render pass */
|
|
1068
1068
|
finishRenderPass() {
|
|
@@ -1082,13 +1082,13 @@ class Dt {
|
|
|
1082
1082
|
clearColor: r,
|
|
1083
1083
|
frame: s
|
|
1084
1084
|
}) {
|
|
1085
|
-
var
|
|
1085
|
+
var a, i;
|
|
1086
1086
|
this._renderTargetStack.length = 0, this.push(
|
|
1087
1087
|
e,
|
|
1088
1088
|
t,
|
|
1089
1089
|
r,
|
|
1090
1090
|
s
|
|
1091
|
-
), this.rootViewPort.copyFrom(this.viewport), this.rootRenderTarget = this.renderTarget, this.renderingToScreen =
|
|
1091
|
+
), this.rootViewPort.copyFrom(this.viewport), this.rootRenderTarget = this.renderTarget, this.renderingToScreen = dt(this.rootRenderTarget), (i = (a = this.adaptor).prerender) == null || i.call(a, this.rootRenderTarget);
|
|
1092
1092
|
}
|
|
1093
1093
|
postrender() {
|
|
1094
1094
|
var e, t;
|
|
@@ -1107,26 +1107,26 @@ class Dt {
|
|
|
1107
1107
|
* @returns the render target that was bound
|
|
1108
1108
|
*/
|
|
1109
1109
|
bind(e, t = !0, r, s) {
|
|
1110
|
-
const
|
|
1111
|
-
this.renderTarget =
|
|
1112
|
-
const o = this.getGpuRenderTarget(
|
|
1113
|
-
(
|
|
1114
|
-
const l =
|
|
1110
|
+
const a = this.getRenderTarget(e), i = this.renderTarget !== a;
|
|
1111
|
+
this.renderTarget = a, this.renderSurface = e;
|
|
1112
|
+
const o = this.getGpuRenderTarget(a);
|
|
1113
|
+
(a.pixelWidth !== o.width || a.pixelHeight !== o.height) && (this.adaptor.resizeGpuRenderTarget(a), o.width = a.pixelWidth, o.height = a.pixelHeight);
|
|
1114
|
+
const l = a.colorTexture, d = this.viewport, h = l.pixelWidth, c = l.pixelHeight;
|
|
1115
1115
|
if (!s && e instanceof m && (s = e.frame), s) {
|
|
1116
|
-
const
|
|
1117
|
-
d.x = s.x *
|
|
1116
|
+
const f = l._resolution;
|
|
1117
|
+
d.x = s.x * f + 0.5 | 0, d.y = s.y * f + 0.5 | 0, d.width = s.width * f + 0.5 | 0, d.height = s.height * f + 0.5 | 0;
|
|
1118
1118
|
} else
|
|
1119
|
-
d.x = 0, d.y = 0, d.width =
|
|
1120
|
-
return
|
|
1119
|
+
d.x = 0, d.y = 0, d.width = h, d.height = c;
|
|
1120
|
+
return ut(
|
|
1121
1121
|
this.projectionMatrix,
|
|
1122
1122
|
0,
|
|
1123
1123
|
0,
|
|
1124
1124
|
d.width / l.resolution,
|
|
1125
1125
|
d.height / l.resolution,
|
|
1126
|
-
!
|
|
1127
|
-
), this.adaptor.startRenderPass(
|
|
1126
|
+
!a.isRoot
|
|
1127
|
+
), this.adaptor.startRenderPass(a, t, r, d), i && this.onRenderTargetChange.emit(a), a;
|
|
1128
1128
|
}
|
|
1129
|
-
clear(e, t =
|
|
1129
|
+
clear(e, t = G.ALL, r) {
|
|
1130
1130
|
t && (e && (e = this.getRenderTarget(e)), this.adaptor.clear(
|
|
1131
1131
|
e || this.renderTarget,
|
|
1132
1132
|
t,
|
|
@@ -1144,12 +1144,12 @@ class Dt {
|
|
|
1144
1144
|
* @param clearColor - the color to clear to
|
|
1145
1145
|
* @param frame - the frame to use when rendering to the render surface
|
|
1146
1146
|
*/
|
|
1147
|
-
push(e, t =
|
|
1148
|
-
const
|
|
1147
|
+
push(e, t = G.ALL, r, s) {
|
|
1148
|
+
const a = this.bind(e, t, r, s);
|
|
1149
1149
|
return this._renderTargetStack.push({
|
|
1150
|
-
renderTarget:
|
|
1150
|
+
renderTarget: a,
|
|
1151
1151
|
frame: s
|
|
1152
|
-
}),
|
|
1152
|
+
}), a;
|
|
1153
1153
|
}
|
|
1154
1154
|
/** Pops the current render target from the renderer and restores the previous render target. */
|
|
1155
1155
|
pop() {
|
|
@@ -1206,15 +1206,15 @@ class Dt {
|
|
|
1206
1206
|
* @param originDest.x - the x origin of the paste
|
|
1207
1207
|
* @param originDest.y - the y origin of the paste
|
|
1208
1208
|
*/
|
|
1209
|
-
copyToTexture(e, t, r, s,
|
|
1210
|
-
r.x < 0 && (s.width += r.x,
|
|
1209
|
+
copyToTexture(e, t, r, s, a) {
|
|
1210
|
+
r.x < 0 && (s.width += r.x, a.x -= r.x, r.x = 0), r.y < 0 && (s.height += r.y, a.y -= r.y, r.y = 0);
|
|
1211
1211
|
const { pixelWidth: i, pixelHeight: o } = e;
|
|
1212
1212
|
return s.width = Math.min(s.width, i - r.x), s.height = Math.min(s.height, o - r.y), this.adaptor.copyToTexture(
|
|
1213
1213
|
e,
|
|
1214
1214
|
t,
|
|
1215
1215
|
r,
|
|
1216
1216
|
s,
|
|
1217
|
-
|
|
1217
|
+
a
|
|
1218
1218
|
);
|
|
1219
1219
|
}
|
|
1220
1220
|
/**
|
|
@@ -1232,9 +1232,9 @@ class Dt {
|
|
|
1232
1232
|
}
|
|
1233
1233
|
_initRenderTarget(e) {
|
|
1234
1234
|
let t = null;
|
|
1235
|
-
return
|
|
1235
|
+
return A.test(e) && (e = be(e).source), e instanceof D ? t = e : e instanceof T && (t = new D({
|
|
1236
1236
|
colorTextures: [e]
|
|
1237
|
-
}), e.source instanceof
|
|
1237
|
+
}), e.source instanceof A && (t.isRoot = !0), e.once("destroy", () => {
|
|
1238
1238
|
t.destroy(), this._renderSurfaceToRenderTargetHash.delete(e);
|
|
1239
1239
|
const r = this._gpuRenderTargetHash[t.uid];
|
|
1240
1240
|
r && (this._gpuRenderTargetHash[t.uid] = null, this.adaptor.destroyGpuRenderTarget(r));
|
|
@@ -1247,7 +1247,7 @@ class Dt {
|
|
|
1247
1247
|
this.renderTarget = null, this.renderSurface = null;
|
|
1248
1248
|
}
|
|
1249
1249
|
}
|
|
1250
|
-
class
|
|
1250
|
+
class Ht extends qe {
|
|
1251
1251
|
/**
|
|
1252
1252
|
* Create a new Buffer Resource.
|
|
1253
1253
|
* @param options - The options for the buffer resource
|
|
@@ -1258,10 +1258,10 @@ class Ot extends Ve {
|
|
|
1258
1258
|
* If not provided, then it will use the size of the buffer.
|
|
1259
1259
|
*/
|
|
1260
1260
|
constructor({ buffer: e, offset: t, size: r }) {
|
|
1261
|
-
super(), this.uid =
|
|
1261
|
+
super(), this.uid = S("buffer"), this._resourceType = "bufferResource", this._touched = 0, this._resourceId = S("resource"), this._bufferResource = !0, this.destroyed = !1, this.buffer = e, this.offset = t | 0, this.size = r, this.buffer.on("change", this.onBufferChange, this);
|
|
1262
1262
|
}
|
|
1263
1263
|
onBufferChange() {
|
|
1264
|
-
this._resourceId =
|
|
1264
|
+
this._resourceId = S("resource"), this.emit("change", this);
|
|
1265
1265
|
}
|
|
1266
1266
|
/**
|
|
1267
1267
|
* Destroys this resource. Make sure the underlying buffer is not used anywhere else
|
|
@@ -1272,7 +1272,7 @@ class Ot extends Ve {
|
|
|
1272
1272
|
this.destroyed = !0, e && this.buffer.destroy(), this.emit("change", this), this.buffer = null, this.removeAllListeners();
|
|
1273
1273
|
}
|
|
1274
1274
|
}
|
|
1275
|
-
class
|
|
1275
|
+
class ke {
|
|
1276
1276
|
constructor(e) {
|
|
1277
1277
|
this._renderer = e;
|
|
1278
1278
|
}
|
|
@@ -1293,7 +1293,7 @@ class be {
|
|
|
1293
1293
|
this._renderer = null;
|
|
1294
1294
|
}
|
|
1295
1295
|
}
|
|
1296
|
-
|
|
1296
|
+
ke.extension = {
|
|
1297
1297
|
type: [
|
|
1298
1298
|
u.WebGLPipes,
|
|
1299
1299
|
u.WebGPUPipes,
|
|
@@ -1301,15 +1301,15 @@ be.extension = {
|
|
|
1301
1301
|
],
|
|
1302
1302
|
name: "customRender"
|
|
1303
1303
|
};
|
|
1304
|
-
function
|
|
1305
|
-
const t =
|
|
1304
|
+
function E(n, e) {
|
|
1305
|
+
const t = n.instructionSet, r = t.instructions;
|
|
1306
1306
|
for (let s = 0; s < t.instructionSize; s++) {
|
|
1307
|
-
const
|
|
1308
|
-
e[
|
|
1307
|
+
const a = r[s];
|
|
1308
|
+
e[a.renderPipeId].execute(a);
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
|
-
const
|
|
1312
|
-
class
|
|
1311
|
+
const ct = new g();
|
|
1312
|
+
class Ce {
|
|
1313
1313
|
constructor(e) {
|
|
1314
1314
|
this._renderer = e;
|
|
1315
1315
|
}
|
|
@@ -1323,16 +1323,16 @@ class Te {
|
|
|
1323
1323
|
this._renderer = null;
|
|
1324
1324
|
}
|
|
1325
1325
|
_addRenderableDirect(e, t) {
|
|
1326
|
-
this._renderer.renderPipes.batch.break(t), e._batchableRenderGroup && (
|
|
1326
|
+
this._renderer.renderPipes.batch.break(t), e._batchableRenderGroup && (w.return(e._batchableRenderGroup), e._batchableRenderGroup = null), t.add(e);
|
|
1327
1327
|
}
|
|
1328
1328
|
_addRenderableCacheAsTexture(e, t) {
|
|
1329
|
-
const r = e._batchableRenderGroup ?? (e._batchableRenderGroup =
|
|
1329
|
+
const r = e._batchableRenderGroup ?? (e._batchableRenderGroup = w.get(pe));
|
|
1330
1330
|
r.renderable = e.root, r.transform = e.root.relativeGroupTransform, r.texture = e.texture, r.bounds = e._textureBounds, t.add(e), this._renderer.renderPipes.blendMode.pushBlendMode(e, e.root.groupBlendMode, t), this._renderer.renderPipes.batch.addToBatch(r, t), this._renderer.renderPipes.blendMode.popBlendMode(t);
|
|
1331
1331
|
}
|
|
1332
1332
|
_executeCacheAsTexture(e) {
|
|
1333
1333
|
if (e.textureNeedsUpdate) {
|
|
1334
1334
|
e.textureNeedsUpdate = !1;
|
|
1335
|
-
const t =
|
|
1335
|
+
const t = ct.identity().translate(
|
|
1336
1336
|
-e._textureBounds.x,
|
|
1337
1337
|
-e._textureBounds.y
|
|
1338
1338
|
);
|
|
@@ -1340,7 +1340,7 @@ class Te {
|
|
|
1340
1340
|
worldTransformMatrix: t,
|
|
1341
1341
|
worldColor: 4294967295,
|
|
1342
1342
|
offset: { x: 0, y: 0 }
|
|
1343
|
-
}),
|
|
1343
|
+
}), E(e, this._renderer.renderPipes), this._renderer.renderTarget.finishRenderPass(), this._renderer.renderTarget.pop(), this._renderer.globalUniforms.pop();
|
|
1344
1344
|
}
|
|
1345
1345
|
e._batchableRenderGroup._batcher.updateElement(e._batchableRenderGroup), e._batchableRenderGroup._batcher.geometry.buffers[0].update();
|
|
1346
1346
|
}
|
|
@@ -1348,10 +1348,10 @@ class Te {
|
|
|
1348
1348
|
this._renderer.globalUniforms.push({
|
|
1349
1349
|
worldTransformMatrix: e.inverseParentTextureTransform,
|
|
1350
1350
|
worldColor: e.worldColorAlpha
|
|
1351
|
-
}),
|
|
1351
|
+
}), E(e, this._renderer.renderPipes), this._renderer.globalUniforms.pop();
|
|
1352
1352
|
}
|
|
1353
1353
|
}
|
|
1354
|
-
|
|
1354
|
+
Ce.extension = {
|
|
1355
1355
|
type: [
|
|
1356
1356
|
u.WebGLPipes,
|
|
1357
1357
|
u.WebGPUPipes,
|
|
@@ -1359,97 +1359,97 @@ Te.extension = {
|
|
|
1359
1359
|
],
|
|
1360
1360
|
name: "renderGroup"
|
|
1361
1361
|
};
|
|
1362
|
-
function
|
|
1362
|
+
function O(n, e) {
|
|
1363
1363
|
e || (e = 0);
|
|
1364
|
-
for (let t = e; t <
|
|
1365
|
-
|
|
1364
|
+
for (let t = e; t < n.length && n[t]; t++)
|
|
1365
|
+
n[t] = null;
|
|
1366
1366
|
}
|
|
1367
|
-
const
|
|
1368
|
-
function
|
|
1369
|
-
|
|
1370
|
-
const t =
|
|
1367
|
+
const ht = new U(), ae = ce | he | fe;
|
|
1368
|
+
function Me(n, e = !1) {
|
|
1369
|
+
ft(n);
|
|
1370
|
+
const t = n.childrenToUpdate, r = n.updateTick++;
|
|
1371
1371
|
for (const s in t) {
|
|
1372
|
-
const
|
|
1372
|
+
const a = Number(s), i = t[s], o = i.list, l = i.index;
|
|
1373
1373
|
for (let d = 0; d < l; d++) {
|
|
1374
|
-
const
|
|
1375
|
-
|
|
1374
|
+
const h = o[d];
|
|
1375
|
+
h.parentRenderGroup === n && h.relativeRenderGroupDepth === a && Se(h, r, 0);
|
|
1376
1376
|
}
|
|
1377
|
-
|
|
1377
|
+
O(o, l), i.index = 0;
|
|
1378
1378
|
}
|
|
1379
1379
|
if (e)
|
|
1380
|
-
for (let s = 0; s <
|
|
1381
|
-
|
|
1380
|
+
for (let s = 0; s < n.renderGroupChildren.length; s++)
|
|
1381
|
+
Me(n.renderGroupChildren[s], e);
|
|
1382
1382
|
}
|
|
1383
|
-
function
|
|
1384
|
-
const e =
|
|
1383
|
+
function ft(n) {
|
|
1384
|
+
const e = n.root;
|
|
1385
1385
|
let t;
|
|
1386
|
-
if (
|
|
1387
|
-
const r =
|
|
1388
|
-
|
|
1386
|
+
if (n.renderGroupParent) {
|
|
1387
|
+
const r = n.renderGroupParent;
|
|
1388
|
+
n.worldTransform.appendFrom(
|
|
1389
1389
|
e.relativeGroupTransform,
|
|
1390
1390
|
r.worldTransform
|
|
1391
|
-
),
|
|
1391
|
+
), n.worldColor = de(
|
|
1392
1392
|
e.groupColor,
|
|
1393
1393
|
r.worldColor
|
|
1394
1394
|
), t = e.groupAlpha * r.worldAlpha;
|
|
1395
1395
|
} else
|
|
1396
|
-
|
|
1397
|
-
t = t < 0 ? 0 : t > 1 ? 1 : t,
|
|
1396
|
+
n.worldTransform.copyFrom(e.localTransform), n.worldColor = e.localColor, t = e.localAlpha;
|
|
1397
|
+
t = t < 0 ? 0 : t > 1 ? 1 : t, n.worldAlpha = t, n.worldColorAlpha = n.worldColor + ((t * 255 | 0) << 24);
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1400
|
-
if (e ===
|
|
1399
|
+
function Se(n, e, t) {
|
|
1400
|
+
if (e === n.updateTick)
|
|
1401
1401
|
return;
|
|
1402
|
-
|
|
1403
|
-
const r =
|
|
1404
|
-
|
|
1405
|
-
const s =
|
|
1406
|
-
if (s && !s.renderGroup ? (t |=
|
|
1402
|
+
n.updateTick = e, n.didChange = !1;
|
|
1403
|
+
const r = n.localTransform;
|
|
1404
|
+
n.updateLocalTransform();
|
|
1405
|
+
const s = n.parent;
|
|
1406
|
+
if (s && !s.renderGroup ? (t |= n._updateFlags, n.relativeGroupTransform.appendFrom(
|
|
1407
1407
|
r,
|
|
1408
1408
|
s.relativeGroupTransform
|
|
1409
|
-
), t &
|
|
1410
|
-
const
|
|
1409
|
+
), t & ae && ne(n, s, t)) : (t = n._updateFlags, n.relativeGroupTransform.copyFrom(r), t & ae && ne(n, ht, t)), !n.renderGroup) {
|
|
1410
|
+
const a = n.children, i = a.length;
|
|
1411
1411
|
for (let d = 0; d < i; d++)
|
|
1412
|
-
|
|
1413
|
-
const o =
|
|
1412
|
+
Se(a[d], e, t);
|
|
1413
|
+
const o = n.parentRenderGroup, l = n;
|
|
1414
1414
|
l.renderPipeId && !o.structureDidChange && o.updateRenderable(l);
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
|
-
function
|
|
1418
|
-
if (t &
|
|
1419
|
-
|
|
1420
|
-
|
|
1417
|
+
function ne(n, e, t) {
|
|
1418
|
+
if (t & he) {
|
|
1419
|
+
n.groupColor = de(
|
|
1420
|
+
n.localColor,
|
|
1421
1421
|
e.groupColor
|
|
1422
1422
|
);
|
|
1423
|
-
let r =
|
|
1424
|
-
r = r < 0 ? 0 : r > 1 ? 1 : r,
|
|
1423
|
+
let r = n.localAlpha * e.groupAlpha;
|
|
1424
|
+
r = r < 0 ? 0 : r > 1 ? 1 : r, n.groupAlpha = r, n.groupColorAlpha = n.groupColor + ((r * 255 | 0) << 24);
|
|
1425
1425
|
}
|
|
1426
|
-
t &
|
|
1426
|
+
t & fe && (n.groupBlendMode = n.localBlendMode === "inherit" ? e.groupBlendMode : n.localBlendMode), t & ce && (n.globalDisplayStatus = n.localDisplayStatus & e.globalDisplayStatus), n._updateFlags = 0;
|
|
1427
1427
|
}
|
|
1428
|
-
function
|
|
1429
|
-
const { list: t } =
|
|
1428
|
+
function pt(n, e) {
|
|
1429
|
+
const { list: t } = n.childrenRenderablesToUpdate;
|
|
1430
1430
|
let r = !1;
|
|
1431
|
-
for (let s = 0; s <
|
|
1432
|
-
const
|
|
1433
|
-
if (r = e[
|
|
1431
|
+
for (let s = 0; s < n.childrenRenderablesToUpdate.index; s++) {
|
|
1432
|
+
const a = t[s];
|
|
1433
|
+
if (r = e[a.renderPipeId].validateRenderable(a), r)
|
|
1434
1434
|
break;
|
|
1435
1435
|
}
|
|
1436
|
-
return
|
|
1436
|
+
return n.structureDidChange = r, r;
|
|
1437
1437
|
}
|
|
1438
|
-
const
|
|
1439
|
-
class
|
|
1438
|
+
const mt = new g();
|
|
1439
|
+
class Re {
|
|
1440
1440
|
constructor(e) {
|
|
1441
1441
|
this._renderer = e;
|
|
1442
1442
|
}
|
|
1443
1443
|
render({ container: e, transform: t }) {
|
|
1444
1444
|
const r = e.parent, s = e.renderGroup.renderGroupParent;
|
|
1445
1445
|
e.parent = null, e.renderGroup.renderGroupParent = null;
|
|
1446
|
-
const
|
|
1446
|
+
const a = this._renderer, i = mt;
|
|
1447
1447
|
t && (i.copyFrom(e.renderGroup.localTransform), e.renderGroup.localTransform.copyFrom(t));
|
|
1448
|
-
const o =
|
|
1449
|
-
this._updateCachedRenderGroups(e.renderGroup, null), this._updateRenderGroups(e.renderGroup),
|
|
1448
|
+
const o = a.renderPipes;
|
|
1449
|
+
this._updateCachedRenderGroups(e.renderGroup, null), this._updateRenderGroups(e.renderGroup), a.globalUniforms.start({
|
|
1450
1450
|
worldTransformMatrix: t ? e.renderGroup.localTransform : e.renderGroup.worldTransform,
|
|
1451
1451
|
worldColor: e.renderGroup.worldColorAlpha
|
|
1452
|
-
}),
|
|
1452
|
+
}), E(e.renderGroup, o), o.uniformBatch && o.uniformBatch.renderEnd(), t && e.renderGroup.localTransform.copyFrom(i), e.parent = r, e.renderGroup.renderGroupParent = s;
|
|
1453
1453
|
}
|
|
1454
1454
|
destroy() {
|
|
1455
1455
|
this._renderer = null;
|
|
@@ -1467,39 +1467,39 @@ class Ce {
|
|
|
1467
1467
|
const r = e.root.getLocalBounds();
|
|
1468
1468
|
r.ceil();
|
|
1469
1469
|
const s = e.texture;
|
|
1470
|
-
e.texture &&
|
|
1471
|
-
const
|
|
1470
|
+
e.texture && y.returnTexture(e.texture, !0);
|
|
1471
|
+
const a = this._renderer, i = e.textureOptions.resolution || a.view.resolution, o = e.textureOptions.antialias ?? a.view.antialias, l = e.textureOptions.scaleMode ?? "linear", d = y.getOptimalTexture(
|
|
1472
1472
|
r.width,
|
|
1473
1473
|
r.height,
|
|
1474
1474
|
i,
|
|
1475
1475
|
o
|
|
1476
1476
|
);
|
|
1477
|
-
d._source.style = new
|
|
1477
|
+
d._source.style = new $e({ scaleMode: l }), e.texture = d, e._textureBounds || (e._textureBounds = new L()), e._textureBounds.copyFrom(r), s !== e.texture && e.renderGroupParent && (e.renderGroupParent.structureDidChange = !0);
|
|
1478
1478
|
}
|
|
1479
|
-
} else e.texture && (
|
|
1479
|
+
} else e.texture && (y.returnTexture(e.texture, !0), e.texture = null);
|
|
1480
1480
|
}
|
|
1481
1481
|
_updateRenderGroups(e) {
|
|
1482
1482
|
const t = this._renderer, r = t.renderPipes;
|
|
1483
|
-
if (e.runOnRender(t), e.instructionSet.renderPipes = r, e.structureDidChange ?
|
|
1483
|
+
if (e.runOnRender(t), e.instructionSet.renderPipes = r, e.structureDidChange ? O(e.childrenRenderablesToUpdate.list, 0) : pt(e, r), Me(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))
|
|
1484
1484
|
for (let s = 0; s < e.renderGroupChildren.length; s++)
|
|
1485
1485
|
this._updateRenderGroups(e.renderGroupChildren[s]);
|
|
1486
1486
|
}
|
|
1487
1487
|
_updateRenderables(e) {
|
|
1488
1488
|
const { list: t, index: r } = e.childrenRenderablesToUpdate;
|
|
1489
1489
|
for (let s = 0; s < r; s++) {
|
|
1490
|
-
const
|
|
1491
|
-
|
|
1490
|
+
const a = t[s];
|
|
1491
|
+
a.didViewUpdate && e.updateRenderable(a);
|
|
1492
1492
|
}
|
|
1493
|
-
|
|
1493
|
+
O(t, r);
|
|
1494
1494
|
}
|
|
1495
1495
|
_buildInstructions(e, t) {
|
|
1496
1496
|
const r = e.root, s = e.instructionSet;
|
|
1497
1497
|
s.reset();
|
|
1498
|
-
const
|
|
1499
|
-
i.batch.buildStart(s), i.blendMode.buildStart(), i.colorMask.buildStart(), r.sortableChildren && r.sortChildren(), r.collectRenderablesWithEffects(s,
|
|
1498
|
+
const a = t.renderPipes ? t : t.batch.renderer, i = a.renderPipes;
|
|
1499
|
+
i.batch.buildStart(s), i.blendMode.buildStart(), i.colorMask.buildStart(), r.sortableChildren && r.sortChildren(), r.collectRenderablesWithEffects(s, a, null), i.batch.buildEnd(s), i.blendMode.buildEnd(s);
|
|
1500
1500
|
}
|
|
1501
1501
|
}
|
|
1502
|
-
|
|
1502
|
+
Re.extension = {
|
|
1503
1503
|
type: [
|
|
1504
1504
|
u.WebGLSystem,
|
|
1505
1505
|
u.WebGPUSystem,
|
|
@@ -1507,7 +1507,7 @@ Ce.extension = {
|
|
|
1507
1507
|
],
|
|
1508
1508
|
name: "renderGroup"
|
|
1509
1509
|
};
|
|
1510
|
-
class
|
|
1510
|
+
class we {
|
|
1511
1511
|
constructor(e) {
|
|
1512
1512
|
this._renderer = e;
|
|
1513
1513
|
}
|
|
@@ -1533,14 +1533,14 @@ class Me {
|
|
|
1533
1533
|
return e._gpuData[this._renderer.uid] || this._initGPUSprite(e);
|
|
1534
1534
|
}
|
|
1535
1535
|
_initGPUSprite(e) {
|
|
1536
|
-
const t = new
|
|
1536
|
+
const t = new pe();
|
|
1537
1537
|
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;
|
|
1538
1538
|
}
|
|
1539
1539
|
destroy() {
|
|
1540
1540
|
this._renderer = null;
|
|
1541
1541
|
}
|
|
1542
1542
|
}
|
|
1543
|
-
|
|
1543
|
+
we.extension = {
|
|
1544
1544
|
type: [
|
|
1545
1545
|
u.WebGLPipes,
|
|
1546
1546
|
u.WebGPUPipes,
|
|
@@ -1548,23 +1548,23 @@ Me.extension = {
|
|
|
1548
1548
|
],
|
|
1549
1549
|
name: "sprite"
|
|
1550
1550
|
};
|
|
1551
|
-
const
|
|
1551
|
+
const N = class Pe {
|
|
1552
1552
|
constructor() {
|
|
1553
|
-
this.clearBeforeRender = !0, this._backgroundColor = new
|
|
1553
|
+
this.clearBeforeRender = !0, this._backgroundColor = new I(0), this.color = this._backgroundColor, this.alpha = 1;
|
|
1554
1554
|
}
|
|
1555
1555
|
/**
|
|
1556
1556
|
* initiates the background system
|
|
1557
1557
|
* @param options - the options for the background colors
|
|
1558
1558
|
*/
|
|
1559
1559
|
init(e) {
|
|
1560
|
-
e = { ...
|
|
1560
|
+
e = { ...Pe.defaultOptions, ...e }, this.clearBeforeRender = e.clearBeforeRender, this.color = e.background || e.backgroundColor || this._backgroundColor, this.alpha = e.backgroundAlpha, this._backgroundColor.setAlpha(e.backgroundAlpha);
|
|
1561
1561
|
}
|
|
1562
1562
|
/** The background color to fill if not transparent */
|
|
1563
1563
|
get color() {
|
|
1564
1564
|
return this._backgroundColor;
|
|
1565
1565
|
}
|
|
1566
1566
|
set color(e) {
|
|
1567
|
-
|
|
1567
|
+
I.shared.setValue(e).alpha < 1 && this._backgroundColor.alpha === 1 && W(
|
|
1568
1568
|
"Cannot set a transparent background on an opaque canvas. To enable transparency, set backgroundAlpha < 1 when initializing your Application."
|
|
1569
1569
|
), this._backgroundColor.setValue(e);
|
|
1570
1570
|
}
|
|
@@ -1586,7 +1586,7 @@ const W = class Se {
|
|
|
1586
1586
|
destroy() {
|
|
1587
1587
|
}
|
|
1588
1588
|
};
|
|
1589
|
-
|
|
1589
|
+
N.extension = {
|
|
1590
1590
|
type: [
|
|
1591
1591
|
u.WebGLSystem,
|
|
1592
1592
|
u.WebGPUSystem,
|
|
@@ -1595,7 +1595,7 @@ W.extension = {
|
|
|
1595
1595
|
name: "background",
|
|
1596
1596
|
priority: 0
|
|
1597
1597
|
};
|
|
1598
|
-
|
|
1598
|
+
N.defaultOptions = {
|
|
1599
1599
|
/**
|
|
1600
1600
|
* {@link WebGLOptions.backgroundAlpha}
|
|
1601
1601
|
* @default 1
|
|
@@ -1612,16 +1612,16 @@ W.defaultOptions = {
|
|
|
1612
1612
|
*/
|
|
1613
1613
|
clearBeforeRender: !0
|
|
1614
1614
|
};
|
|
1615
|
-
let
|
|
1616
|
-
const
|
|
1617
|
-
|
|
1618
|
-
if (!
|
|
1615
|
+
let gt = N;
|
|
1616
|
+
const k = {};
|
|
1617
|
+
F.handle(u.BlendMode, (n) => {
|
|
1618
|
+
if (!n.name)
|
|
1619
1619
|
throw new Error("BlendMode extension must have a name property");
|
|
1620
|
-
|
|
1621
|
-
}, (
|
|
1622
|
-
delete
|
|
1620
|
+
k[n.name] = n.ref;
|
|
1621
|
+
}, (n) => {
|
|
1622
|
+
delete k[n.name];
|
|
1623
1623
|
});
|
|
1624
|
-
class
|
|
1624
|
+
class Ue {
|
|
1625
1625
|
constructor(e) {
|
|
1626
1626
|
this._blendModeStack = [], this._isAdvanced = !1, this._filterHash = /* @__PURE__ */ Object.create(null), this._renderer = e, this._renderer.runners.prerender.add(this);
|
|
1627
1627
|
}
|
|
@@ -1655,34 +1655,34 @@ class we {
|
|
|
1655
1655
|
* @param instructionSet - The instruction set being built.
|
|
1656
1656
|
*/
|
|
1657
1657
|
setBlendMode(e, t, r) {
|
|
1658
|
-
var
|
|
1659
|
-
const s = e instanceof
|
|
1658
|
+
var a;
|
|
1659
|
+
const s = e instanceof ee;
|
|
1660
1660
|
if (this._activeBlendMode === t) {
|
|
1661
|
-
this._isAdvanced && e && !s && ((
|
|
1661
|
+
this._isAdvanced && e && !s && ((a = this._renderableList) == null || a.push(e));
|
|
1662
1662
|
return;
|
|
1663
1663
|
}
|
|
1664
|
-
this._isAdvanced && this._endAdvancedBlendMode(r), this._activeBlendMode = t, e && (this._isAdvanced = !!
|
|
1664
|
+
this._isAdvanced && this._endAdvancedBlendMode(r), this._activeBlendMode = t, e && (this._isAdvanced = !!k[t], this._isAdvanced && this._beginAdvancedBlendMode(e, r));
|
|
1665
1665
|
}
|
|
1666
1666
|
_beginAdvancedBlendMode(e, t) {
|
|
1667
1667
|
this._renderer.renderPipes.batch.break(t);
|
|
1668
1668
|
const r = this._activeBlendMode;
|
|
1669
|
-
if (!
|
|
1670
|
-
|
|
1669
|
+
if (!k[r]) {
|
|
1670
|
+
W(`Unable to assign BlendMode: '${r}'. You may want to include: import 'pixi.js/advanced-blend-modes'`);
|
|
1671
1671
|
return;
|
|
1672
1672
|
}
|
|
1673
|
-
const s = this._ensureFilterEffect(r),
|
|
1673
|
+
const s = this._ensureFilterEffect(r), a = e instanceof ee, i = {
|
|
1674
1674
|
renderPipeId: "filter",
|
|
1675
1675
|
action: "pushFilter",
|
|
1676
1676
|
filterEffect: s,
|
|
1677
|
-
renderables:
|
|
1678
|
-
container:
|
|
1677
|
+
renderables: a ? null : [e],
|
|
1678
|
+
container: a ? e.root : null,
|
|
1679
1679
|
canBundle: !1
|
|
1680
1680
|
};
|
|
1681
1681
|
this._renderableList = i.renderables, t.add(i);
|
|
1682
1682
|
}
|
|
1683
1683
|
_ensureFilterEffect(e) {
|
|
1684
1684
|
let t = this._filterHash[e];
|
|
1685
|
-
return t || (t = this._filterHash[e] = new
|
|
1685
|
+
return t || (t = this._filterHash[e] = new ue(), t.filters = [new k[e]()]), t;
|
|
1686
1686
|
}
|
|
1687
1687
|
_endAdvancedBlendMode(e) {
|
|
1688
1688
|
this._isAdvanced = !1, this._renderableList = null, this._renderer.renderPipes.batch.break(e), e.add({
|
|
@@ -1715,7 +1715,7 @@ class we {
|
|
|
1715
1715
|
this._filterHash = null;
|
|
1716
1716
|
}
|
|
1717
1717
|
}
|
|
1718
|
-
|
|
1718
|
+
Ue.extension = {
|
|
1719
1719
|
type: [
|
|
1720
1720
|
u.WebGLPipes,
|
|
1721
1721
|
u.WebGPUPipes,
|
|
@@ -1723,17 +1723,17 @@ we.extension = {
|
|
|
1723
1723
|
],
|
|
1724
1724
|
name: "blendMode"
|
|
1725
1725
|
};
|
|
1726
|
-
const
|
|
1726
|
+
const B = {
|
|
1727
1727
|
png: "image/png",
|
|
1728
1728
|
jpg: "image/jpeg",
|
|
1729
1729
|
webp: "image/webp"
|
|
1730
|
-
},
|
|
1730
|
+
}, j = class Be {
|
|
1731
1731
|
/** @param renderer - The renderer this System works for. */
|
|
1732
1732
|
constructor(e) {
|
|
1733
1733
|
this._renderer = e;
|
|
1734
1734
|
}
|
|
1735
1735
|
_normalizeOptions(e, t = {}) {
|
|
1736
|
-
return e instanceof
|
|
1736
|
+
return e instanceof U || e instanceof m ? {
|
|
1737
1737
|
target: e,
|
|
1738
1738
|
...t
|
|
1739
1739
|
} : {
|
|
@@ -1774,7 +1774,7 @@ const R = {
|
|
|
1774
1774
|
* @category rendering
|
|
1775
1775
|
*/
|
|
1776
1776
|
async image(e) {
|
|
1777
|
-
const t =
|
|
1777
|
+
const t = z.get().createImage();
|
|
1778
1778
|
return t.src = await this.base64(e), t;
|
|
1779
1779
|
}
|
|
1780
1780
|
/**
|
|
@@ -1812,27 +1812,27 @@ const R = {
|
|
|
1812
1812
|
async base64(e) {
|
|
1813
1813
|
e = this._normalizeOptions(
|
|
1814
1814
|
e,
|
|
1815
|
-
|
|
1815
|
+
Be.defaultImageOptions
|
|
1816
1816
|
);
|
|
1817
1817
|
const { format: t, quality: r } = e, s = this.canvas(e);
|
|
1818
1818
|
if (s.toBlob !== void 0)
|
|
1819
|
-
return new Promise((
|
|
1819
|
+
return new Promise((a, i) => {
|
|
1820
1820
|
s.toBlob((o) => {
|
|
1821
1821
|
if (!o) {
|
|
1822
1822
|
i(new Error("ICanvas.toBlob failed!"));
|
|
1823
1823
|
return;
|
|
1824
1824
|
}
|
|
1825
1825
|
const l = new FileReader();
|
|
1826
|
-
l.onload = () =>
|
|
1827
|
-
},
|
|
1826
|
+
l.onload = () => a(l.result), l.onerror = i, l.readAsDataURL(o);
|
|
1827
|
+
}, B[t], r);
|
|
1828
1828
|
});
|
|
1829
1829
|
if (s.toDataURL !== void 0)
|
|
1830
|
-
return s.toDataURL(
|
|
1830
|
+
return s.toDataURL(B[t], r);
|
|
1831
1831
|
if (s.convertToBlob !== void 0) {
|
|
1832
|
-
const
|
|
1832
|
+
const a = await s.convertToBlob({ type: B[t], quality: r });
|
|
1833
1833
|
return new Promise((i, o) => {
|
|
1834
1834
|
const l = new FileReader();
|
|
1835
|
-
l.onload = () => i(l.result), l.onerror = o, l.readAsDataURL(
|
|
1835
|
+
l.onload = () => i(l.result), l.onerror = o, l.readAsDataURL(a);
|
|
1836
1836
|
});
|
|
1837
1837
|
}
|
|
1838
1838
|
throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented");
|
|
@@ -1882,8 +1882,8 @@ const R = {
|
|
|
1882
1882
|
const t = e.target, r = this._renderer;
|
|
1883
1883
|
if (t instanceof m)
|
|
1884
1884
|
return r.texture.generateCanvas(t);
|
|
1885
|
-
const s = r.textureGenerator.generateTexture(e),
|
|
1886
|
-
return s.destroy(!0),
|
|
1885
|
+
const s = r.textureGenerator.generateTexture(e), a = r.texture.generateCanvas(s);
|
|
1886
|
+
return s.destroy(!0), a;
|
|
1887
1887
|
}
|
|
1888
1888
|
/**
|
|
1889
1889
|
* Returns a one-dimensional array containing the pixel data of the entire texture in RGBA order,
|
|
@@ -1917,8 +1917,8 @@ const R = {
|
|
|
1917
1917
|
*/
|
|
1918
1918
|
pixels(e) {
|
|
1919
1919
|
e = this._normalizeOptions(e);
|
|
1920
|
-
const t = e.target, r = this._renderer, s = t instanceof m ? t : r.textureGenerator.generateTexture(e),
|
|
1921
|
-
return t instanceof
|
|
1920
|
+
const t = e.target, r = this._renderer, s = t instanceof m ? t : r.textureGenerator.generateTexture(e), a = r.texture.getPixels(s);
|
|
1921
|
+
return t instanceof U && s.destroy(!0), a;
|
|
1922
1922
|
}
|
|
1923
1923
|
/**
|
|
1924
1924
|
* Creates a texture from a display object or existing texture.
|
|
@@ -2036,34 +2036,44 @@ const R = {
|
|
|
2036
2036
|
e = this._normalizeOptions(e);
|
|
2037
2037
|
const r = this.canvas(e), s = r.toDataURL();
|
|
2038
2038
|
console.log(`[Pixi Texture] ${r.width}px ${r.height}px`);
|
|
2039
|
-
const
|
|
2039
|
+
const a = [
|
|
2040
2040
|
"font-size: 1px;",
|
|
2041
2041
|
`padding: ${t}px 300px;`,
|
|
2042
2042
|
`background: url(${s}) no-repeat;`,
|
|
2043
2043
|
"background-size: contain;"
|
|
2044
2044
|
].join(" ");
|
|
2045
|
-
console.log("%c ",
|
|
2045
|
+
console.log("%c ", a);
|
|
2046
2046
|
}
|
|
2047
2047
|
destroy() {
|
|
2048
2048
|
this._renderer = null;
|
|
2049
2049
|
}
|
|
2050
2050
|
};
|
|
2051
|
-
|
|
2051
|
+
j.extension = {
|
|
2052
2052
|
type: [
|
|
2053
2053
|
u.WebGLSystem,
|
|
2054
2054
|
u.WebGPUSystem
|
|
2055
2055
|
],
|
|
2056
2056
|
name: "extract"
|
|
2057
2057
|
};
|
|
2058
|
-
|
|
2058
|
+
j.defaultImageOptions = {
|
|
2059
2059
|
format: "png",
|
|
2060
2060
|
quality: 1
|
|
2061
2061
|
};
|
|
2062
|
-
let
|
|
2063
|
-
class
|
|
2062
|
+
let _t = j;
|
|
2063
|
+
class q extends m {
|
|
2064
|
+
/**
|
|
2065
|
+
* Creates a RenderTexture. Pass `dynamic: true` in options to allow resizing after creation.
|
|
2066
|
+
* @param options - Options for the RenderTexture, including width, height, and dynamic.
|
|
2067
|
+
* @returns A new RenderTexture instance.
|
|
2068
|
+
* @example
|
|
2069
|
+
* const rt = RenderTexture.create({ width: 100, height: 100, dynamic: true });
|
|
2070
|
+
* rt.resize(500, 500);
|
|
2071
|
+
*/
|
|
2064
2072
|
static create(e) {
|
|
2065
|
-
|
|
2066
|
-
|
|
2073
|
+
const { dynamic: t, ...r } = e;
|
|
2074
|
+
return new q({
|
|
2075
|
+
source: new T(r),
|
|
2076
|
+
dynamic: t ?? !1
|
|
2067
2077
|
});
|
|
2068
2078
|
}
|
|
2069
2079
|
/**
|
|
@@ -2077,8 +2087,8 @@ class N extends m {
|
|
|
2077
2087
|
return this.source.resize(e, t, r), this;
|
|
2078
2088
|
}
|
|
2079
2089
|
}
|
|
2080
|
-
const vt = new
|
|
2081
|
-
class
|
|
2090
|
+
const vt = new P(), xt = new L(), bt = [0, 0, 0, 0];
|
|
2091
|
+
class Ge {
|
|
2082
2092
|
constructor(e) {
|
|
2083
2093
|
this._renderer = e;
|
|
2084
2094
|
}
|
|
@@ -2120,43 +2130,231 @@ class Re {
|
|
|
2120
2130
|
*/
|
|
2121
2131
|
generateTexture(e) {
|
|
2122
2132
|
var d;
|
|
2123
|
-
e instanceof
|
|
2133
|
+
e instanceof U && (e = {
|
|
2124
2134
|
target: e,
|
|
2125
2135
|
frame: void 0,
|
|
2126
2136
|
textureSourceOptions: {},
|
|
2127
2137
|
resolution: void 0
|
|
2128
2138
|
});
|
|
2129
2139
|
const t = e.resolution || this._renderer.resolution, r = e.antialias || this._renderer.view.antialias, s = e.target;
|
|
2130
|
-
let
|
|
2131
|
-
|
|
2132
|
-
const i = ((d = e.frame) == null ? void 0 : d.copyTo(vt)) ||
|
|
2140
|
+
let a = e.clearColor;
|
|
2141
|
+
a ? a = Array.isArray(a) && a.length === 4 ? a : I.shared.setValue(a).toArray() : a = bt;
|
|
2142
|
+
const i = ((d = e.frame) == null ? void 0 : d.copyTo(vt)) || Ke(s, xt).rectangle;
|
|
2133
2143
|
i.width = Math.max(i.width, 1 / t) | 0, i.height = Math.max(i.height, 1 / t) | 0;
|
|
2134
|
-
const o =
|
|
2144
|
+
const o = q.create({
|
|
2135
2145
|
...e.textureSourceOptions,
|
|
2136
2146
|
width: i.width,
|
|
2137
2147
|
height: i.height,
|
|
2138
2148
|
resolution: t,
|
|
2139
2149
|
antialias: r
|
|
2140
|
-
}), l =
|
|
2150
|
+
}), l = g.shared.translate(-i.x, -i.y);
|
|
2141
2151
|
return this._renderer.render({
|
|
2142
2152
|
container: s,
|
|
2143
2153
|
transform: l,
|
|
2144
2154
|
target: o,
|
|
2145
|
-
clearColor:
|
|
2155
|
+
clearColor: a
|
|
2146
2156
|
}), o.source.updateMipmaps(), o;
|
|
2147
2157
|
}
|
|
2148
2158
|
destroy() {
|
|
2149
2159
|
this._renderer = null;
|
|
2150
2160
|
}
|
|
2151
2161
|
}
|
|
2152
|
-
|
|
2162
|
+
Ge.extension = {
|
|
2153
2163
|
type: [
|
|
2154
2164
|
u.WebGLSystem,
|
|
2155
2165
|
u.WebGPUSystem
|
|
2156
2166
|
],
|
|
2157
2167
|
name: "textureGenerator"
|
|
2158
2168
|
};
|
|
2159
|
-
class
|
|
2169
|
+
const $ = class Ae {
|
|
2170
|
+
/**
|
|
2171
|
+
* Creates a new GCSystem instance.
|
|
2172
|
+
* @param renderer - The renderer this garbage collection system works for
|
|
2173
|
+
*/
|
|
2174
|
+
constructor(e) {
|
|
2175
|
+
this._managedResources = [], this._managedResourceHashes = [], this._ready = !1, this._renderer = e;
|
|
2176
|
+
}
|
|
2177
|
+
/**
|
|
2178
|
+
* Initializes the garbage collection system with the provided options.
|
|
2179
|
+
* @param options - Configuration options
|
|
2180
|
+
*/
|
|
2181
|
+
init(e) {
|
|
2182
|
+
e = { ...Ae.defaultOptions, ...e }, this.maxUnusedTime = e.gcMaxUnusedTime, this._frequency = e.gcFrequency, this.enabled = e.gcActive, this.now = performance.now();
|
|
2183
|
+
}
|
|
2184
|
+
/**
|
|
2185
|
+
* Gets whether the garbage collection system is currently enabled.
|
|
2186
|
+
* @returns True if GC is enabled, false otherwise
|
|
2187
|
+
*/
|
|
2188
|
+
get enabled() {
|
|
2189
|
+
return !!this._handler;
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Enables or disables the garbage collection system.
|
|
2193
|
+
* When enabled, schedules periodic cleanup of resources.
|
|
2194
|
+
* When disabled, cancels all scheduled cleanups.
|
|
2195
|
+
*/
|
|
2196
|
+
set enabled(e) {
|
|
2197
|
+
this.enabled !== e && (e ? this._handler = this._renderer.scheduler.repeat(
|
|
2198
|
+
() => {
|
|
2199
|
+
this._ready = !0;
|
|
2200
|
+
},
|
|
2201
|
+
this._frequency,
|
|
2202
|
+
!1
|
|
2203
|
+
) : (this._renderer.scheduler.cancel(this._handler), this._handler = 0));
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* Called before rendering. Updates the current timestamp.
|
|
2207
|
+
* @param options - The render options
|
|
2208
|
+
* @param options.container - The container to render
|
|
2209
|
+
*/
|
|
2210
|
+
prerender({ container: e }) {
|
|
2211
|
+
this.now = performance.now(), e.renderGroup.gcTick = this._renderer.tick++, this._updateInstructionGCTick(e.renderGroup, e.renderGroup.gcTick);
|
|
2212
|
+
}
|
|
2213
|
+
/** Performs garbage collection after rendering. */
|
|
2214
|
+
postrender() {
|
|
2215
|
+
!this._ready || !this.enabled || (this.run(), this._ready = !1);
|
|
2216
|
+
}
|
|
2217
|
+
/**
|
|
2218
|
+
* Updates the GC tick counter for a render group and its children.
|
|
2219
|
+
* @param renderGroup - The render group to update
|
|
2220
|
+
* @param gcTick - The new tick value
|
|
2221
|
+
*/
|
|
2222
|
+
_updateInstructionGCTick(e, t) {
|
|
2223
|
+
e.instructionSet.gcTick = t;
|
|
2224
|
+
for (const r of e.renderGroupChildren)
|
|
2225
|
+
this._updateInstructionGCTick(r, t);
|
|
2226
|
+
}
|
|
2227
|
+
/**
|
|
2228
|
+
* Registers a resource for garbage collection tracking.
|
|
2229
|
+
* @param resource - The resource to track
|
|
2230
|
+
* @param type - The type of resource to track
|
|
2231
|
+
*/
|
|
2232
|
+
addResource(e, t) {
|
|
2233
|
+
var s, a;
|
|
2234
|
+
if (e._gcLastUsed !== -1) {
|
|
2235
|
+
e._gcLastUsed = this.now, (s = e._onTouch) == null || s.call(e, this.now);
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
const r = this._managedResources.length;
|
|
2239
|
+
e._gcData = {
|
|
2240
|
+
index: r,
|
|
2241
|
+
type: t
|
|
2242
|
+
}, e._gcLastUsed = this.now, (a = e._onTouch) == null || a.call(e, this.now), e.once("unload", this.removeResource, this), this._managedResources.push(e);
|
|
2243
|
+
}
|
|
2244
|
+
/**
|
|
2245
|
+
* Removes a resource from garbage collection tracking.
|
|
2246
|
+
* Call this when manually destroying a resource.
|
|
2247
|
+
* @param resource - The resource to stop tracking
|
|
2248
|
+
*/
|
|
2249
|
+
removeResource(e) {
|
|
2250
|
+
const t = e._gcData;
|
|
2251
|
+
if (!t)
|
|
2252
|
+
return;
|
|
2253
|
+
const r = t.index, s = this._managedResources.length - 1;
|
|
2254
|
+
if (r !== s) {
|
|
2255
|
+
const a = this._managedResources[s];
|
|
2256
|
+
this._managedResources[r] = a, a._gcData.index = r;
|
|
2257
|
+
}
|
|
2258
|
+
this._managedResources.length--, e._gcData = null, e._gcLastUsed = -1;
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2261
|
+
* Registers a hash-based resource collection for garbage collection tracking.
|
|
2262
|
+
* Resources in the hash will be automatically tracked and cleaned up when unused.
|
|
2263
|
+
* @param context - The object containing the hash property
|
|
2264
|
+
* @param hash - The property name on context that holds the resource hash
|
|
2265
|
+
* @param type - The type of resources in the hash ('resource' or 'renderable')
|
|
2266
|
+
* @param priority - Processing priority (lower values are processed first)
|
|
2267
|
+
*/
|
|
2268
|
+
addResourceHash(e, t, r, s = 0) {
|
|
2269
|
+
this._managedResourceHashes.push({
|
|
2270
|
+
context: e,
|
|
2271
|
+
hash: t,
|
|
2272
|
+
type: r,
|
|
2273
|
+
priority: s
|
|
2274
|
+
}), this._managedResourceHashes.sort((a, i) => a.priority - i.priority);
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Performs garbage collection by cleaning up unused resources.
|
|
2278
|
+
* Removes resources that haven't been used for longer than maxUnusedTime.
|
|
2279
|
+
*/
|
|
2280
|
+
run() {
|
|
2281
|
+
const e = performance.now(), t = this._managedResourceHashes;
|
|
2282
|
+
for (const s of t)
|
|
2283
|
+
this.runOnHash(s, e);
|
|
2284
|
+
let r = 0;
|
|
2285
|
+
for (let s = 0; s < this._managedResources.length; s++) {
|
|
2286
|
+
const a = this._managedResources[s];
|
|
2287
|
+
r = this.runOnResource(a, e, r);
|
|
2288
|
+
}
|
|
2289
|
+
this._managedResources.length = r;
|
|
2290
|
+
}
|
|
2291
|
+
updateRenderableGCTick(e, t) {
|
|
2292
|
+
var a, i;
|
|
2293
|
+
const r = e.renderGroup ?? e.parentRenderGroup, s = ((a = r == null ? void 0 : r.instructionSet) == null ? void 0 : a.gcTick) ?? -1;
|
|
2294
|
+
((r == null ? void 0 : r.gcTick) ?? 0) === s && (e._gcLastUsed = t, (i = e._onTouch) == null || i.call(e, t));
|
|
2295
|
+
}
|
|
2296
|
+
runOnResource(e, t, r) {
|
|
2297
|
+
const s = e._gcData;
|
|
2298
|
+
return s.type === "renderable" && this.updateRenderableGCTick(e, t), t - e._gcLastUsed < this.maxUnusedTime || !e.autoGarbageCollect ? (this._managedResources[r] = e, s.index = r, r++) : (e.unload(), e._gcData = null, e._gcLastUsed = -1, e.off("unload", this.removeResource, this)), r;
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Creates a clone of the hash, copying all non-null entries up to (but not including) the stop key.
|
|
2302
|
+
* @param hashValue - The original hash to clone from
|
|
2303
|
+
* @param stopKey - The key to stop at (exclusive)
|
|
2304
|
+
* @returns A new hash object with copied entries
|
|
2305
|
+
*/
|
|
2306
|
+
_createHashClone(e, t) {
|
|
2307
|
+
const r = /* @__PURE__ */ Object.create(null);
|
|
2308
|
+
for (const s in e) {
|
|
2309
|
+
if (s === t)
|
|
2310
|
+
break;
|
|
2311
|
+
e[s] !== null && (r[s] = e[s]);
|
|
2312
|
+
}
|
|
2313
|
+
return r;
|
|
2314
|
+
}
|
|
2315
|
+
runOnHash(e, t) {
|
|
2316
|
+
var d;
|
|
2317
|
+
const { context: r, hash: s, type: a } = e, i = r[s];
|
|
2318
|
+
let o = null, l = 0;
|
|
2319
|
+
for (const h in i) {
|
|
2320
|
+
const c = i[h];
|
|
2321
|
+
if (c === null) {
|
|
2322
|
+
l++, l === 1e4 && !o && (o = this._createHashClone(i, h));
|
|
2323
|
+
continue;
|
|
2324
|
+
}
|
|
2325
|
+
if (c._gcLastUsed === -1) {
|
|
2326
|
+
c._gcLastUsed = t, (d = c._onTouch) == null || d.call(c, t), o && (o[h] = c);
|
|
2327
|
+
continue;
|
|
2328
|
+
}
|
|
2329
|
+
a === "renderable" && this.updateRenderableGCTick(c, t), !(t - c._gcLastUsed < this.maxUnusedTime) && c.autoGarbageCollect ? (o || (l + 1 !== 1e4 ? (i[h] = null, l++) : o = this._createHashClone(i, h)), c.unload(), c._gcData = null, c._gcLastUsed = -1) : o && (o[h] = c);
|
|
2330
|
+
}
|
|
2331
|
+
o && (r[s] = o);
|
|
2332
|
+
}
|
|
2333
|
+
/** Cleans up the garbage collection system. Disables GC and removes all tracked resources. */
|
|
2334
|
+
destroy() {
|
|
2335
|
+
this.enabled = !1, this._managedResources.forEach((e) => {
|
|
2336
|
+
e.off("unload", this.removeResource, this);
|
|
2337
|
+
}), this._managedResources.length = 0, this._managedResourceHashes.length = 0, this._renderer = null;
|
|
2338
|
+
}
|
|
2339
|
+
};
|
|
2340
|
+
$.extension = {
|
|
2341
|
+
type: [
|
|
2342
|
+
u.WebGLSystem,
|
|
2343
|
+
u.WebGPUSystem
|
|
2344
|
+
],
|
|
2345
|
+
name: "gc",
|
|
2346
|
+
priority: 0
|
|
2347
|
+
};
|
|
2348
|
+
$.defaultOptions = {
|
|
2349
|
+
/** Enable/disable the garbage collector */
|
|
2350
|
+
gcActive: !0,
|
|
2351
|
+
/** Time in ms before an unused resource is collected (default 1 minute) */
|
|
2352
|
+
gcMaxUnusedTime: 6e4,
|
|
2353
|
+
/** How often to run garbage collection in ms (default 30 seconds) */
|
|
2354
|
+
gcFrequency: 3e4
|
|
2355
|
+
};
|
|
2356
|
+
let yt = $;
|
|
2357
|
+
class Ie {
|
|
2160
2358
|
constructor(e) {
|
|
2161
2359
|
this._stackIndex = 0, this._globalUniformDataStack = [], this._uniformsPool = [], this._activeUniforms = [], this._bindGroupPool = [], this._activeBindGroups = [], this._renderer = e;
|
|
2162
2360
|
}
|
|
@@ -2176,35 +2374,35 @@ class Be {
|
|
|
2176
2374
|
projectionMatrix: t,
|
|
2177
2375
|
worldTransformMatrix: r,
|
|
2178
2376
|
worldColor: s,
|
|
2179
|
-
offset:
|
|
2377
|
+
offset: a
|
|
2180
2378
|
}) {
|
|
2181
2379
|
const i = this._renderer.renderTarget.renderTarget, o = this._stackIndex ? this._globalUniformDataStack[this._stackIndex - 1] : {
|
|
2182
|
-
worldTransformMatrix: new
|
|
2380
|
+
worldTransformMatrix: new g(),
|
|
2183
2381
|
worldColor: 4294967295,
|
|
2184
|
-
offset: new
|
|
2382
|
+
offset: new Ye()
|
|
2185
2383
|
}, l = {
|
|
2186
2384
|
projectionMatrix: t || this._renderer.renderTarget.projectionMatrix,
|
|
2187
2385
|
resolution: e || i.size,
|
|
2188
2386
|
worldTransformMatrix: r || o.worldTransformMatrix,
|
|
2189
2387
|
worldColor: s || o.worldColor,
|
|
2190
|
-
offset:
|
|
2388
|
+
offset: a || o.offset,
|
|
2191
2389
|
bindGroup: null
|
|
2192
2390
|
}, d = this._uniformsPool.pop() || this._createUniforms();
|
|
2193
2391
|
this._activeUniforms.push(d);
|
|
2194
|
-
const
|
|
2195
|
-
|
|
2392
|
+
const h = d.uniforms;
|
|
2393
|
+
h.uProjectionMatrix = l.projectionMatrix, h.uResolution = l.resolution, h.uWorldTransformMatrix.copyFrom(l.worldTransformMatrix), h.uWorldTransformMatrix.tx -= l.offset.x, h.uWorldTransformMatrix.ty -= l.offset.y, tt(
|
|
2196
2394
|
l.worldColor,
|
|
2197
|
-
|
|
2395
|
+
h.uWorldColorAlpha,
|
|
2198
2396
|
0
|
|
2199
2397
|
), d.update();
|
|
2200
|
-
let
|
|
2201
|
-
this._renderer.renderPipes.uniformBatch ?
|
|
2398
|
+
let c;
|
|
2399
|
+
this._renderer.renderPipes.uniformBatch ? c = this._renderer.renderPipes.uniformBatch.getUniformBindGroup(d, !1) : (c = this._bindGroupPool.pop() || new Je(), this._activeBindGroups.push(c), c.setResource(d, 0)), l.bindGroup = c, this._currentGlobalUniformData = l;
|
|
2202
2400
|
}
|
|
2203
2401
|
push(e) {
|
|
2204
2402
|
this.bind(e), this._globalUniformDataStack[this._stackIndex++] = this._currentGlobalUniformData;
|
|
2205
2403
|
}
|
|
2206
2404
|
pop() {
|
|
2207
|
-
this._currentGlobalUniformData = this._globalUniformDataStack[--this._stackIndex - 1], this._renderer.type ===
|
|
2405
|
+
this._currentGlobalUniformData = this._globalUniformDataStack[--this._stackIndex - 1], this._renderer.type === H.WEBGL && this._currentGlobalUniformData.bindGroup.resources[0].update();
|
|
2208
2406
|
}
|
|
2209
2407
|
get bindGroup() {
|
|
2210
2408
|
return this._currentGlobalUniformData.bindGroup;
|
|
@@ -2216,9 +2414,9 @@ class Be {
|
|
|
2216
2414
|
return this._currentGlobalUniformData.bindGroup.resources[0];
|
|
2217
2415
|
}
|
|
2218
2416
|
_createUniforms() {
|
|
2219
|
-
return new
|
|
2220
|
-
uProjectionMatrix: { value: new
|
|
2221
|
-
uWorldTransformMatrix: { value: new
|
|
2417
|
+
return new oe({
|
|
2418
|
+
uProjectionMatrix: { value: new g(), type: "mat3x3<f32>" },
|
|
2419
|
+
uWorldTransformMatrix: { value: new g(), type: "mat3x3<f32>" },
|
|
2222
2420
|
// TODO - someone smart - set this to be a unorm8x4 rather than a vec4<f32>
|
|
2223
2421
|
uWorldColorAlpha: { value: new Float32Array(4), type: "vec4<f32>" },
|
|
2224
2422
|
uResolution: { value: [0, 0], type: "vec2<f32>" }
|
|
@@ -2230,7 +2428,7 @@ class Be {
|
|
|
2230
2428
|
this._renderer = null, this._globalUniformDataStack.length = 0, this._uniformsPool.length = 0, this._activeUniforms.length = 0, this._bindGroupPool.length = 0, this._activeBindGroups.length = 0, this._currentGlobalUniformData = null;
|
|
2231
2429
|
}
|
|
2232
2430
|
}
|
|
2233
|
-
|
|
2431
|
+
Ie.extension = {
|
|
2234
2432
|
type: [
|
|
2235
2433
|
u.WebGLSystem,
|
|
2236
2434
|
u.WebGPUSystem,
|
|
@@ -2238,14 +2436,14 @@ Be.extension = {
|
|
|
2238
2436
|
],
|
|
2239
2437
|
name: "globalUniforms"
|
|
2240
2438
|
};
|
|
2241
|
-
let
|
|
2242
|
-
class
|
|
2439
|
+
let Tt = 1;
|
|
2440
|
+
class De {
|
|
2243
2441
|
constructor() {
|
|
2244
2442
|
this._tasks = [], this._offset = 0;
|
|
2245
2443
|
}
|
|
2246
2444
|
/** Initializes the scheduler system and starts the ticker. */
|
|
2247
2445
|
init() {
|
|
2248
|
-
|
|
2446
|
+
te.system.add(this._update, this);
|
|
2249
2447
|
}
|
|
2250
2448
|
/**
|
|
2251
2449
|
* Schedules a repeating task.
|
|
@@ -2255,13 +2453,13 @@ class Ue {
|
|
|
2255
2453
|
* @returns The unique identifier for the scheduled task.
|
|
2256
2454
|
*/
|
|
2257
2455
|
repeat(e, t, r = !0) {
|
|
2258
|
-
const s =
|
|
2259
|
-
let
|
|
2260
|
-
return r && (this._offset += 1e3,
|
|
2456
|
+
const s = Tt++;
|
|
2457
|
+
let a = 0;
|
|
2458
|
+
return r && (this._offset += 1e3, a = this._offset), this._tasks.push({
|
|
2261
2459
|
func: e,
|
|
2262
2460
|
duration: t,
|
|
2263
2461
|
start: performance.now(),
|
|
2264
|
-
offset:
|
|
2462
|
+
offset: a,
|
|
2265
2463
|
last: performance.now(),
|
|
2266
2464
|
repeat: !0,
|
|
2267
2465
|
id: s
|
|
@@ -2297,10 +2495,10 @@ class Ue {
|
|
|
2297
2495
|
* @internal
|
|
2298
2496
|
*/
|
|
2299
2497
|
destroy() {
|
|
2300
|
-
|
|
2498
|
+
te.system.remove(this._update, this), this._tasks.length = 0;
|
|
2301
2499
|
}
|
|
2302
2500
|
}
|
|
2303
|
-
|
|
2501
|
+
De.extension = {
|
|
2304
2502
|
type: [
|
|
2305
2503
|
u.WebGLSystem,
|
|
2306
2504
|
u.WebGPUSystem,
|
|
@@ -2309,12 +2507,12 @@ Ue.extension = {
|
|
|
2309
2507
|
name: "scheduler",
|
|
2310
2508
|
priority: 0
|
|
2311
2509
|
};
|
|
2312
|
-
let
|
|
2313
|
-
function
|
|
2314
|
-
if (!
|
|
2315
|
-
if (
|
|
2510
|
+
let ie = !1;
|
|
2511
|
+
function kt(n) {
|
|
2512
|
+
if (!ie) {
|
|
2513
|
+
if (z.get().getNavigator().userAgent.toLowerCase().indexOf("chrome") > -1) {
|
|
2316
2514
|
const e = [
|
|
2317
|
-
`%c %c %c %c %c PixiJS %c v${
|
|
2515
|
+
`%c %c %c %c %c PixiJS %c v${re} (${n}) http://www.pixijs.com/
|
|
2318
2516
|
|
|
2319
2517
|
`,
|
|
2320
2518
|
"background: #E72264; padding:5px 0;",
|
|
@@ -2325,11 +2523,11 @@ function bt(a) {
|
|
|
2325
2523
|
"color: #E72264; background: #FFFFFF; padding:5px 0;"
|
|
2326
2524
|
];
|
|
2327
2525
|
globalThis.console.log(...e);
|
|
2328
|
-
} else globalThis.console && globalThis.console.log(`PixiJS ${
|
|
2329
|
-
|
|
2526
|
+
} else globalThis.console && globalThis.console.log(`PixiJS ${re} - ${n} - http://www.pixijs.com/`);
|
|
2527
|
+
ie = !0;
|
|
2330
2528
|
}
|
|
2331
2529
|
}
|
|
2332
|
-
class
|
|
2530
|
+
class K {
|
|
2333
2531
|
constructor(e) {
|
|
2334
2532
|
this._renderer = e;
|
|
2335
2533
|
}
|
|
@@ -2340,11 +2538,11 @@ class j {
|
|
|
2340
2538
|
init(e) {
|
|
2341
2539
|
if (e.hello) {
|
|
2342
2540
|
let t = this._renderer.name;
|
|
2343
|
-
this._renderer.type ===
|
|
2541
|
+
this._renderer.type === H.WEBGL && (t += ` ${this._renderer.context.webGLVersion}`), kt(t);
|
|
2344
2542
|
}
|
|
2345
2543
|
}
|
|
2346
2544
|
}
|
|
2347
|
-
|
|
2545
|
+
K.extension = {
|
|
2348
2546
|
type: [
|
|
2349
2547
|
u.WebGLSystem,
|
|
2350
2548
|
u.WebGPUSystem,
|
|
@@ -2353,34 +2551,34 @@ j.extension = {
|
|
|
2353
2551
|
name: "hello",
|
|
2354
2552
|
priority: -2
|
|
2355
2553
|
};
|
|
2356
|
-
|
|
2554
|
+
K.defaultOptions = {
|
|
2357
2555
|
/** {@link WebGLOptions.hello} */
|
|
2358
2556
|
hello: !1
|
|
2359
2557
|
};
|
|
2360
|
-
function
|
|
2558
|
+
function Ct(n) {
|
|
2361
2559
|
let e = !1;
|
|
2362
|
-
for (const r in
|
|
2363
|
-
if (
|
|
2560
|
+
for (const r in n)
|
|
2561
|
+
if (n[r] == null) {
|
|
2364
2562
|
e = !0;
|
|
2365
2563
|
break;
|
|
2366
2564
|
}
|
|
2367
2565
|
if (!e)
|
|
2368
|
-
return
|
|
2566
|
+
return n;
|
|
2369
2567
|
const t = /* @__PURE__ */ Object.create(null);
|
|
2370
|
-
for (const r in
|
|
2371
|
-
const s =
|
|
2568
|
+
for (const r in n) {
|
|
2569
|
+
const s = n[r];
|
|
2372
2570
|
s && (t[r] = s);
|
|
2373
2571
|
}
|
|
2374
2572
|
return t;
|
|
2375
2573
|
}
|
|
2376
|
-
function
|
|
2574
|
+
function Mt(n) {
|
|
2377
2575
|
let e = 0;
|
|
2378
|
-
for (let t = 0; t <
|
|
2379
|
-
|
|
2380
|
-
return
|
|
2576
|
+
for (let t = 0; t < n.length; t++)
|
|
2577
|
+
n[t] == null ? e++ : n[t - e] = n[t];
|
|
2578
|
+
return n.length -= e, n;
|
|
2381
2579
|
}
|
|
2382
|
-
let
|
|
2383
|
-
const
|
|
2580
|
+
let St = 0;
|
|
2581
|
+
const Y = class Ee {
|
|
2384
2582
|
/**
|
|
2385
2583
|
* Creates a new RenderableGCSystem instance.
|
|
2386
2584
|
* @param renderer - The renderer this garbage collection system works for
|
|
@@ -2393,7 +2591,7 @@ const $ = class Ae {
|
|
|
2393
2591
|
* @param options - Configuration options for the renderer
|
|
2394
2592
|
*/
|
|
2395
2593
|
init(e) {
|
|
2396
|
-
e = { ...
|
|
2594
|
+
e = { ...Ee.defaultOptions, ...e }, this.maxUnusedTime = e.renderableGCMaxUnusedTime, this._frequency = e.renderableGCFrequency, this.enabled = e.renderableGCActive;
|
|
2397
2595
|
}
|
|
2398
2596
|
/**
|
|
2399
2597
|
* Gets whether the garbage collection system is currently enabled.
|
|
@@ -2415,13 +2613,13 @@ const $ = class Ae {
|
|
|
2415
2613
|
), this._hashHandler = this._renderer.scheduler.repeat(
|
|
2416
2614
|
() => {
|
|
2417
2615
|
for (const t of this._managedHashes)
|
|
2418
|
-
t.context[t.hash] =
|
|
2616
|
+
t.context[t.hash] = Ct(t.context[t.hash]);
|
|
2419
2617
|
},
|
|
2420
2618
|
this._frequency
|
|
2421
2619
|
), this._arrayHandler = this._renderer.scheduler.repeat(
|
|
2422
2620
|
() => {
|
|
2423
2621
|
for (const t of this._managedArrays)
|
|
2424
|
-
|
|
2622
|
+
Mt(t.context[t.hash]);
|
|
2425
2623
|
},
|
|
2426
2624
|
this._frequency
|
|
2427
2625
|
)) : (this._renderer.scheduler.cancel(this._handler), this._renderer.scheduler.cancel(this._hashHandler), this._renderer.scheduler.cancel(this._arrayHandler)));
|
|
@@ -2450,7 +2648,7 @@ const $ = class Ae {
|
|
|
2450
2648
|
prerender({
|
|
2451
2649
|
container: e
|
|
2452
2650
|
}) {
|
|
2453
|
-
this._now = performance.now(), e.renderGroup.gcTick =
|
|
2651
|
+
this._now = performance.now(), e.renderGroup.gcTick = St++, this._updateInstructionGCTick(e.renderGroup, e.renderGroup.gcTick);
|
|
2454
2652
|
}
|
|
2455
2653
|
/**
|
|
2456
2654
|
* Starts tracking a renderable for garbage collection.
|
|
@@ -2464,7 +2662,7 @@ const $ = class Ae {
|
|
|
2464
2662
|
* Removes renderables that haven't been used for longer than maxUnusedTime.
|
|
2465
2663
|
*/
|
|
2466
2664
|
run() {
|
|
2467
|
-
var
|
|
2665
|
+
var a;
|
|
2468
2666
|
const e = this._now, t = this._managedRenderables, r = this._renderer.renderPipes;
|
|
2469
2667
|
let s = 0;
|
|
2470
2668
|
for (let i = 0; i < t.length; i++) {
|
|
@@ -2473,11 +2671,11 @@ const $ = class Ae {
|
|
|
2473
2671
|
s++;
|
|
2474
2672
|
continue;
|
|
2475
2673
|
}
|
|
2476
|
-
const l = o.renderGroup ?? o.parentRenderGroup, d = ((
|
|
2674
|
+
const l = o.renderGroup ?? o.parentRenderGroup, d = ((a = l == null ? void 0 : l.instructionSet) == null ? void 0 : a.gcTick) ?? -1;
|
|
2477
2675
|
if (((l == null ? void 0 : l.gcTick) ?? 0) === d && (o._lastUsed = e), e - o._lastUsed > this.maxUnusedTime) {
|
|
2478
2676
|
if (!o.destroyed) {
|
|
2479
|
-
const
|
|
2480
|
-
l && (l.structureDidChange = !0),
|
|
2677
|
+
const h = r;
|
|
2678
|
+
l && (l.structureDidChange = !0), h[o.renderPipeId].destroyRenderable(o);
|
|
2481
2679
|
}
|
|
2482
2680
|
o._lastUsed = -1, s++, o.off("destroyed", this._removeRenderable, this);
|
|
2483
2681
|
} else
|
|
@@ -2508,7 +2706,7 @@ const $ = class Ae {
|
|
|
2508
2706
|
this._updateInstructionGCTick(r, t);
|
|
2509
2707
|
}
|
|
2510
2708
|
};
|
|
2511
|
-
|
|
2709
|
+
Y.extension = {
|
|
2512
2710
|
type: [
|
|
2513
2711
|
u.WebGLSystem,
|
|
2514
2712
|
u.WebGPUSystem
|
|
@@ -2516,7 +2714,7 @@ $.extension = {
|
|
|
2516
2714
|
name: "renderableGC",
|
|
2517
2715
|
priority: 0
|
|
2518
2716
|
};
|
|
2519
|
-
|
|
2717
|
+
Y.defaultOptions = {
|
|
2520
2718
|
/** Enable/disable the garbage collector */
|
|
2521
2719
|
renderableGCActive: !0,
|
|
2522
2720
|
/** Time in ms before an unused resource is collected (default 1 minute) */
|
|
@@ -2524,45 +2722,88 @@ $.defaultOptions = {
|
|
|
2524
2722
|
/** How often to run garbage collection in ms (default 30 seconds) */
|
|
2525
2723
|
renderableGCFrequency: 3e4
|
|
2526
2724
|
};
|
|
2527
|
-
let
|
|
2528
|
-
const
|
|
2529
|
-
/**
|
|
2530
|
-
|
|
2531
|
-
|
|
2725
|
+
let Rt = Y;
|
|
2726
|
+
const J = class R {
|
|
2727
|
+
/**
|
|
2728
|
+
* Frame count since started.
|
|
2729
|
+
* @readonly
|
|
2730
|
+
* @deprecated since 8.15.0
|
|
2731
|
+
*/
|
|
2732
|
+
get count() {
|
|
2733
|
+
return this._renderer.tick;
|
|
2532
2734
|
}
|
|
2533
|
-
|
|
2534
|
-
|
|
2735
|
+
/**
|
|
2736
|
+
* Frame count since last garbage collection.
|
|
2737
|
+
* @readonly
|
|
2738
|
+
* @deprecated since 8.15.0
|
|
2739
|
+
*/
|
|
2740
|
+
get checkCount() {
|
|
2741
|
+
return this._checkCount;
|
|
2742
|
+
}
|
|
2743
|
+
set checkCount(e) {
|
|
2744
|
+
v("8.15.0", "TextureGCSystem.run is deprecated, please use the GCSystem instead."), this._checkCount = e;
|
|
2535
2745
|
}
|
|
2536
2746
|
/**
|
|
2537
|
-
*
|
|
2538
|
-
*
|
|
2747
|
+
* Maximum idle frames before a texture is destroyed by garbage collection.
|
|
2748
|
+
* @see TextureGCSystem.defaultMaxIdle
|
|
2749
|
+
* @deprecated since 8.15.0
|
|
2539
2750
|
*/
|
|
2540
|
-
|
|
2541
|
-
this._renderer.
|
|
2751
|
+
get maxIdle() {
|
|
2752
|
+
return this._renderer.gc.maxUnusedTime / 1e3 * 60;
|
|
2753
|
+
}
|
|
2754
|
+
set maxIdle(e) {
|
|
2755
|
+
v("8.15.0", "TextureGCSystem.run is deprecated, please use the GCSystem instead."), this._renderer.gc.maxUnusedTime = e / 60 * 1e3;
|
|
2756
|
+
}
|
|
2757
|
+
/**
|
|
2758
|
+
* Frames between two garbage collections.
|
|
2759
|
+
* @see TextureGCSystem.defaultCheckCountMax
|
|
2760
|
+
* @deprecated since 8.15.0
|
|
2761
|
+
*/
|
|
2762
|
+
// eslint-disable-next-line dot-notation
|
|
2763
|
+
get checkCountMax() {
|
|
2764
|
+
return Math.floor(this._renderer.gc._frequency / 1e3);
|
|
2765
|
+
}
|
|
2766
|
+
set checkCountMax(e) {
|
|
2767
|
+
v("8.15.0", "TextureGCSystem.run is deprecated, please use the GCSystem instead.");
|
|
2768
|
+
}
|
|
2769
|
+
/**
|
|
2770
|
+
* Current garbage collection mode.
|
|
2771
|
+
* @see TextureGCSystem.defaultMode
|
|
2772
|
+
* @deprecated since 8.15.0
|
|
2773
|
+
*/
|
|
2774
|
+
get active() {
|
|
2775
|
+
return this._renderer.gc.enabled;
|
|
2776
|
+
}
|
|
2777
|
+
set active(e) {
|
|
2778
|
+
v("8.15.0", "TextureGCSystem.run is deprecated, please use the GCSystem instead."), this._renderer.gc.enabled = e;
|
|
2779
|
+
}
|
|
2780
|
+
/** @param renderer - The renderer this System works for. */
|
|
2781
|
+
constructor(e) {
|
|
2782
|
+
this._renderer = e, this._checkCount = 0;
|
|
2783
|
+
}
|
|
2784
|
+
init(e) {
|
|
2785
|
+
e.textureGCActive !== R.defaultOptions.textureGCActive && (this.active = e.textureGCActive), e.textureGCMaxIdle !== R.defaultOptions.textureGCMaxIdle && (this.maxIdle = e.textureGCMaxIdle), e.textureGCCheckCountMax !== R.defaultOptions.textureGCCheckCountMax && (this.checkCountMax = e.textureGCCheckCountMax);
|
|
2542
2786
|
}
|
|
2543
2787
|
/**
|
|
2544
2788
|
* Checks to see when the last time a texture was used.
|
|
2545
2789
|
* If the texture has not been used for a specified amount of time, it will be removed from the GPU.
|
|
2790
|
+
* @deprecated since 8.15.0
|
|
2546
2791
|
*/
|
|
2547
2792
|
run() {
|
|
2548
|
-
|
|
2549
|
-
for (let t = 0; t < e.length; t++) {
|
|
2550
|
-
const r = e[t];
|
|
2551
|
-
r.autoGarbageCollect && r.resource && r._touched > -1 && this.count - r._touched > this.maxIdle && (r._touched = -1, r.unload());
|
|
2552
|
-
}
|
|
2793
|
+
v("8.15.0", "TextureGCSystem.run is deprecated, please use the GCSystem instead."), this._renderer.gc.run();
|
|
2553
2794
|
}
|
|
2554
2795
|
destroy() {
|
|
2555
2796
|
this._renderer = null;
|
|
2556
2797
|
}
|
|
2557
2798
|
};
|
|
2558
|
-
|
|
2799
|
+
J.extension = {
|
|
2559
2800
|
type: [
|
|
2560
2801
|
u.WebGLSystem,
|
|
2561
2802
|
u.WebGPUSystem
|
|
2562
2803
|
],
|
|
2563
2804
|
name: "textureGC"
|
|
2564
2805
|
};
|
|
2565
|
-
|
|
2806
|
+
J.defaultOptions = {
|
|
2566
2807
|
/**
|
|
2567
2808
|
* If set to true, this will enable the garbage collector on the GPU.
|
|
2568
2809
|
* @default true
|
|
@@ -2584,8 +2825,8 @@ q.defaultOptions = {
|
|
|
2584
2825
|
*/
|
|
2585
2826
|
textureGCCheckCountMax: 600
|
|
2586
2827
|
};
|
|
2587
|
-
let
|
|
2588
|
-
const
|
|
2828
|
+
let wt = J;
|
|
2829
|
+
const X = class Oe {
|
|
2589
2830
|
/**
|
|
2590
2831
|
* Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.
|
|
2591
2832
|
* This is only supported for HTMLCanvasElement and will be ignored if the canvas is an OffscreenCanvas.
|
|
@@ -2614,9 +2855,9 @@ const K = class Ge {
|
|
|
2614
2855
|
*/
|
|
2615
2856
|
init(e) {
|
|
2616
2857
|
e = {
|
|
2617
|
-
...
|
|
2858
|
+
...Oe.defaultOptions,
|
|
2618
2859
|
...e
|
|
2619
|
-
}, e.view && (
|
|
2860
|
+
}, e.view && (v(Xe, "ViewSystem.view has been renamed to ViewSystem.canvas"), e.canvas = e.view), this.screen = new P(0, 0, e.width, e.height), this.canvas = e.canvas || z.get().createCanvas(), this.antialias = !!e.antialias, this.texture = be(this.canvas, e), this.renderTarget = new D({
|
|
2620
2861
|
colorTextures: [this.texture],
|
|
2621
2862
|
depth: !!e.depth,
|
|
2622
2863
|
isRoot: !0
|
|
@@ -2643,7 +2884,7 @@ const K = class Ge {
|
|
|
2643
2884
|
(typeof e == "boolean" ? e : !!(e != null && e.removeView)) && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), this.texture.destroy();
|
|
2644
2885
|
}
|
|
2645
2886
|
};
|
|
2646
|
-
|
|
2887
|
+
X.extension = {
|
|
2647
2888
|
type: [
|
|
2648
2889
|
u.WebGLSystem,
|
|
2649
2890
|
u.WebGPUSystem,
|
|
@@ -2652,7 +2893,7 @@ K.extension = {
|
|
|
2652
2893
|
name: "view",
|
|
2653
2894
|
priority: 0
|
|
2654
2895
|
};
|
|
2655
|
-
|
|
2896
|
+
X.defaultOptions = {
|
|
2656
2897
|
/**
|
|
2657
2898
|
* {@link WebGLOptions.width}
|
|
2658
2899
|
* @default 800
|
|
@@ -2674,41 +2915,42 @@ K.defaultOptions = {
|
|
|
2674
2915
|
*/
|
|
2675
2916
|
antialias: !1
|
|
2676
2917
|
};
|
|
2677
|
-
let
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
Ce,
|
|
2684
|
-
Mt,
|
|
2918
|
+
let Pt = X;
|
|
2919
|
+
const Wt = [
|
|
2920
|
+
gt,
|
|
2921
|
+
Ie,
|
|
2922
|
+
K,
|
|
2923
|
+
Pt,
|
|
2685
2924
|
Re,
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2925
|
+
yt,
|
|
2926
|
+
wt,
|
|
2927
|
+
Ge,
|
|
2928
|
+
_t,
|
|
2929
|
+
Qe,
|
|
2930
|
+
Rt,
|
|
2931
|
+
De
|
|
2932
|
+
], zt = [
|
|
2933
|
+
Ue,
|
|
2934
|
+
ge,
|
|
2691
2935
|
we,
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
pe,
|
|
2936
|
+
Ce,
|
|
2937
|
+
_e,
|
|
2938
|
+
xe,
|
|
2696
2939
|
ve,
|
|
2697
|
-
|
|
2698
|
-
be
|
|
2940
|
+
ke
|
|
2699
2941
|
];
|
|
2700
2942
|
export {
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2943
|
+
Ht as B,
|
|
2944
|
+
b as G,
|
|
2945
|
+
Lt as R,
|
|
2946
|
+
Wt as S,
|
|
2947
|
+
Et as U,
|
|
2948
|
+
zt as a,
|
|
2949
|
+
lt as b,
|
|
2950
|
+
Ot as c,
|
|
2951
|
+
M as d,
|
|
2952
|
+
Dt as e,
|
|
2953
|
+
It as f,
|
|
2954
|
+
At as t,
|
|
2955
|
+
Ft as u
|
|
2714
2956
|
};
|