pixi.js 7.0.2 → 7.1.0-alpha
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/pixi.js +254 -226
- package/dist/pixi.js.map +1 -1
- package/dist/pixi.min.js +35 -35
- package/dist/pixi.min.js.map +1 -1
- package/dist/pixi.min.mjs +35 -35
- package/dist/pixi.min.mjs.map +1 -1
- package/dist/pixi.mjs +254 -227
- package/dist/pixi.mjs.map +1 -1
- package/package.json +31 -31
package/dist/pixi.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* pixi.js - v7.0
|
|
3
|
-
* Compiled
|
|
2
|
+
* pixi.js - v7.1.0-alpha
|
|
3
|
+
* Compiled Thu, 10 Nov 2022 16:24:03 UTC
|
|
4
4
|
*
|
|
5
5
|
* pixi.js is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -480,6 +480,9 @@ const extensions$1 = {
|
|
|
480
480
|
},
|
|
481
481
|
handleByList(type, list) {
|
|
482
482
|
return this.handle(type, (extension) => {
|
|
483
|
+
if (list.includes(extension.ref)) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
483
486
|
list.push(extension.ref);
|
|
484
487
|
list.sort((a, b) => (b.priority ?? -1) - (a.priority ?? -1));
|
|
485
488
|
}, (extension) => {
|
|
@@ -5814,7 +5817,7 @@ class BaseImageResource extends Resource {
|
|
|
5814
5817
|
return false;
|
|
5815
5818
|
}
|
|
5816
5819
|
} else if (typeof HTMLVideoElement !== "undefined" && source instanceof HTMLVideoElement) {
|
|
5817
|
-
if (source.readyState <= 1) {
|
|
5820
|
+
if (source.readyState <= 1 && source.buffered.length === 0) {
|
|
5818
5821
|
return false;
|
|
5819
5822
|
}
|
|
5820
5823
|
}
|
|
@@ -7020,7 +7023,7 @@ class RenderTexturePool {
|
|
|
7020
7023
|
RenderTexturePool.SCREEN_KEY = -1;
|
|
7021
7024
|
|
|
7022
7025
|
class Attribute {
|
|
7023
|
-
constructor(buffer, size = 0, normalized = false, type = TYPES.FLOAT, stride, start, instance) {
|
|
7026
|
+
constructor(buffer, size = 0, normalized = false, type = TYPES.FLOAT, stride, start, instance, divisor = 1) {
|
|
7024
7027
|
this.buffer = buffer;
|
|
7025
7028
|
this.size = size;
|
|
7026
7029
|
this.normalized = normalized;
|
|
@@ -7028,6 +7031,7 @@ class Attribute {
|
|
|
7028
7031
|
this.stride = stride;
|
|
7029
7032
|
this.start = start;
|
|
7030
7033
|
this.instance = instance;
|
|
7034
|
+
this.divisor = divisor;
|
|
7031
7035
|
}
|
|
7032
7036
|
destroy() {
|
|
7033
7037
|
this.buffer = null;
|
|
@@ -8535,7 +8539,7 @@ class GeometrySystem {
|
|
|
8535
8539
|
gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start);
|
|
8536
8540
|
if (attribute.instance) {
|
|
8537
8541
|
if (this.hasInstance) {
|
|
8538
|
-
gl.vertexAttribDivisor(location,
|
|
8542
|
+
gl.vertexAttribDivisor(location, attribute.divisor);
|
|
8539
8543
|
} else {
|
|
8540
8544
|
throw new Error("geometry error, GPU Instancing is not supported on this device");
|
|
8541
8545
|
}
|
|
@@ -11361,7 +11365,7 @@ class StartupSystem {
|
|
|
11361
11365
|
const renderer = this.renderer;
|
|
11362
11366
|
renderer.emitWithCustomOptions(renderer.runners.init, options);
|
|
11363
11367
|
if (options.hello) {
|
|
11364
|
-
console.log(`PixiJS ${"7.0
|
|
11368
|
+
console.log(`PixiJS ${"7.1.0-alpha"} - ${renderer.rendererLogId} - https://pixijs.com`);
|
|
11365
11369
|
}
|
|
11366
11370
|
renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
|
|
11367
11371
|
}
|
|
@@ -11487,7 +11491,17 @@ const _Renderer = class extends SystemManager {
|
|
|
11487
11491
|
projectionMatrix: new Matrix()
|
|
11488
11492
|
}, true);
|
|
11489
11493
|
const systemConfig = {
|
|
11490
|
-
runners: [
|
|
11494
|
+
runners: [
|
|
11495
|
+
"init",
|
|
11496
|
+
"destroy",
|
|
11497
|
+
"contextChange",
|
|
11498
|
+
"resolutionChange",
|
|
11499
|
+
"reset",
|
|
11500
|
+
"update",
|
|
11501
|
+
"postrender",
|
|
11502
|
+
"prerender",
|
|
11503
|
+
"resize"
|
|
11504
|
+
],
|
|
11491
11505
|
systems: _Renderer.__systems,
|
|
11492
11506
|
priority: [
|
|
11493
11507
|
"_view",
|
|
@@ -11582,6 +11596,10 @@ const _Renderer = class extends SystemManager {
|
|
|
11582
11596
|
get resolution() {
|
|
11583
11597
|
return this._view.resolution;
|
|
11584
11598
|
}
|
|
11599
|
+
set resolution(value) {
|
|
11600
|
+
this._view.resolution = value;
|
|
11601
|
+
this.runners.resolutionChange.emit(value);
|
|
11602
|
+
}
|
|
11585
11603
|
get autoDensity() {
|
|
11586
11604
|
return this._view.autoDensity;
|
|
11587
11605
|
}
|
|
@@ -12330,7 +12348,7 @@ ObjectRendererSystem.extension = {
|
|
|
12330
12348
|
};
|
|
12331
12349
|
extensions$1.add(ObjectRendererSystem);
|
|
12332
12350
|
|
|
12333
|
-
const VERSION = "7.0
|
|
12351
|
+
const VERSION = "7.1.0-alpha";
|
|
12334
12352
|
|
|
12335
12353
|
var fragment$6 = "varying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform float uAlpha;\n\nvoid main(void)\n{\n gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;\n}\n";
|
|
12336
12354
|
|
|
@@ -14223,7 +14241,7 @@ class Sprite extends Container {
|
|
|
14223
14241
|
if (this._roundPixels) {
|
|
14224
14242
|
const resolution = settings.RESOLUTION;
|
|
14225
14243
|
for (let i = 0; i < vertexData.length; ++i) {
|
|
14226
|
-
vertexData[i] = Math.round(
|
|
14244
|
+
vertexData[i] = Math.round(vertexData[i] * resolution) / resolution;
|
|
14227
14245
|
}
|
|
14228
14246
|
}
|
|
14229
14247
|
}
|
|
@@ -15386,6 +15404,9 @@ class EventSystem {
|
|
|
15386
15404
|
this.setTargetElement(view);
|
|
15387
15405
|
this.resolution = resolution;
|
|
15388
15406
|
}
|
|
15407
|
+
resolutionChange(resolution) {
|
|
15408
|
+
this.resolution = resolution;
|
|
15409
|
+
}
|
|
15389
15410
|
destroy() {
|
|
15390
15411
|
this.setTargetElement(null);
|
|
15391
15412
|
this.renderer = null;
|
|
@@ -16570,222 +16591,6 @@ class Resolver {
|
|
|
16570
16591
|
}
|
|
16571
16592
|
}
|
|
16572
16593
|
|
|
16573
|
-
class AssetsClass {
|
|
16574
|
-
constructor() {
|
|
16575
|
-
this._detections = [];
|
|
16576
|
-
this._initialized = false;
|
|
16577
|
-
this.resolver = new Resolver();
|
|
16578
|
-
this.loader = new Loader();
|
|
16579
|
-
this.cache = Cache;
|
|
16580
|
-
this._backgroundLoader = new BackgroundLoader(this.loader);
|
|
16581
|
-
this._backgroundLoader.active = true;
|
|
16582
|
-
this.reset();
|
|
16583
|
-
}
|
|
16584
|
-
async init(options = {}) {
|
|
16585
|
-
if (this._initialized) {
|
|
16586
|
-
return;
|
|
16587
|
-
}
|
|
16588
|
-
this._initialized = true;
|
|
16589
|
-
if (options.basePath) {
|
|
16590
|
-
this.resolver.basePath = options.basePath;
|
|
16591
|
-
}
|
|
16592
|
-
if (options.manifest) {
|
|
16593
|
-
let manifest = options.manifest;
|
|
16594
|
-
if (typeof manifest === "string") {
|
|
16595
|
-
manifest = await this.load(manifest);
|
|
16596
|
-
}
|
|
16597
|
-
this.resolver.addManifest(manifest);
|
|
16598
|
-
}
|
|
16599
|
-
const resolutionPref = options.texturePreference?.resolution ?? 1;
|
|
16600
|
-
const resolution = typeof resolutionPref === "number" ? [resolutionPref] : resolutionPref;
|
|
16601
|
-
let formats = [];
|
|
16602
|
-
if (options.texturePreference?.format) {
|
|
16603
|
-
const formatPref = options.texturePreference?.format;
|
|
16604
|
-
formats = typeof formatPref === "string" ? [formatPref] : formatPref;
|
|
16605
|
-
for (const detection of this._detections) {
|
|
16606
|
-
if (!await detection.test()) {
|
|
16607
|
-
formats = await detection.remove(formats);
|
|
16608
|
-
}
|
|
16609
|
-
}
|
|
16610
|
-
} else {
|
|
16611
|
-
for (const detection of this._detections) {
|
|
16612
|
-
if (await detection.test()) {
|
|
16613
|
-
formats = await detection.add(formats);
|
|
16614
|
-
}
|
|
16615
|
-
}
|
|
16616
|
-
}
|
|
16617
|
-
this.resolver.prefer({
|
|
16618
|
-
params: {
|
|
16619
|
-
format: formats,
|
|
16620
|
-
resolution
|
|
16621
|
-
}
|
|
16622
|
-
});
|
|
16623
|
-
}
|
|
16624
|
-
add(keysIn, assetsIn, data) {
|
|
16625
|
-
this.resolver.add(keysIn, assetsIn, data);
|
|
16626
|
-
}
|
|
16627
|
-
async load(urls, onProgress) {
|
|
16628
|
-
if (!this._initialized) {
|
|
16629
|
-
await this.init();
|
|
16630
|
-
}
|
|
16631
|
-
const singleAsset = isSingleItem(urls);
|
|
16632
|
-
const urlArray = convertToList(urls).map((url) => {
|
|
16633
|
-
if (typeof url !== "string") {
|
|
16634
|
-
this.resolver.add(url.src, url);
|
|
16635
|
-
return url.src;
|
|
16636
|
-
}
|
|
16637
|
-
return url;
|
|
16638
|
-
});
|
|
16639
|
-
const resolveResults = this.resolver.resolve(urlArray);
|
|
16640
|
-
const out = await this._mapLoadToResolve(resolveResults, onProgress);
|
|
16641
|
-
return singleAsset ? out[urlArray[0]] : out;
|
|
16642
|
-
}
|
|
16643
|
-
addBundle(bundleId, assets) {
|
|
16644
|
-
this.resolver.addBundle(bundleId, assets);
|
|
16645
|
-
}
|
|
16646
|
-
async loadBundle(bundleIds, onProgress) {
|
|
16647
|
-
if (!this._initialized) {
|
|
16648
|
-
await this.init();
|
|
16649
|
-
}
|
|
16650
|
-
let singleAsset = false;
|
|
16651
|
-
if (typeof bundleIds === "string") {
|
|
16652
|
-
singleAsset = true;
|
|
16653
|
-
bundleIds = [bundleIds];
|
|
16654
|
-
}
|
|
16655
|
-
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
|
16656
|
-
const out = {};
|
|
16657
|
-
const keys = Object.keys(resolveResults);
|
|
16658
|
-
let count = 0;
|
|
16659
|
-
let total = 0;
|
|
16660
|
-
const _onProgress = () => {
|
|
16661
|
-
onProgress?.(++count / total);
|
|
16662
|
-
};
|
|
16663
|
-
const promises = keys.map((bundleId) => {
|
|
16664
|
-
const resolveResult = resolveResults[bundleId];
|
|
16665
|
-
total += Object.keys(resolveResult).length;
|
|
16666
|
-
return this._mapLoadToResolve(resolveResult, _onProgress).then((resolveResult2) => {
|
|
16667
|
-
out[bundleId] = resolveResult2;
|
|
16668
|
-
});
|
|
16669
|
-
});
|
|
16670
|
-
await Promise.all(promises);
|
|
16671
|
-
return singleAsset ? out[bundleIds[0]] : out;
|
|
16672
|
-
}
|
|
16673
|
-
async backgroundLoad(urls) {
|
|
16674
|
-
if (!this._initialized) {
|
|
16675
|
-
await this.init();
|
|
16676
|
-
}
|
|
16677
|
-
if (typeof urls === "string") {
|
|
16678
|
-
urls = [urls];
|
|
16679
|
-
}
|
|
16680
|
-
const resolveResults = this.resolver.resolve(urls);
|
|
16681
|
-
this._backgroundLoader.add(Object.values(resolveResults));
|
|
16682
|
-
}
|
|
16683
|
-
async backgroundLoadBundle(bundleIds) {
|
|
16684
|
-
if (!this._initialized) {
|
|
16685
|
-
await this.init();
|
|
16686
|
-
}
|
|
16687
|
-
if (typeof bundleIds === "string") {
|
|
16688
|
-
bundleIds = [bundleIds];
|
|
16689
|
-
}
|
|
16690
|
-
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
|
16691
|
-
Object.values(resolveResults).forEach((resolveResult) => {
|
|
16692
|
-
this._backgroundLoader.add(Object.values(resolveResult));
|
|
16693
|
-
});
|
|
16694
|
-
}
|
|
16695
|
-
reset() {
|
|
16696
|
-
this.resolver.reset();
|
|
16697
|
-
this.loader.reset();
|
|
16698
|
-
this.cache.reset();
|
|
16699
|
-
this._initialized = false;
|
|
16700
|
-
}
|
|
16701
|
-
get(keys) {
|
|
16702
|
-
if (typeof keys === "string") {
|
|
16703
|
-
return Cache.get(keys);
|
|
16704
|
-
}
|
|
16705
|
-
const assets = {};
|
|
16706
|
-
for (let i = 0; i < keys.length; i++) {
|
|
16707
|
-
assets[i] = Cache.get(keys[i]);
|
|
16708
|
-
}
|
|
16709
|
-
return assets;
|
|
16710
|
-
}
|
|
16711
|
-
async _mapLoadToResolve(resolveResults, onProgress) {
|
|
16712
|
-
const resolveArray = Object.values(resolveResults);
|
|
16713
|
-
const resolveKeys = Object.keys(resolveResults);
|
|
16714
|
-
this._backgroundLoader.active = false;
|
|
16715
|
-
const loadedAssets = await this.loader.load(resolveArray, onProgress);
|
|
16716
|
-
this._backgroundLoader.active = true;
|
|
16717
|
-
const out = {};
|
|
16718
|
-
resolveArray.forEach((resolveResult, i) => {
|
|
16719
|
-
const asset = loadedAssets[resolveResult.src];
|
|
16720
|
-
const keys = [resolveResult.src];
|
|
16721
|
-
if (resolveResult.alias) {
|
|
16722
|
-
keys.push(...resolveResult.alias);
|
|
16723
|
-
}
|
|
16724
|
-
out[resolveKeys[i]] = asset;
|
|
16725
|
-
Cache.set(keys, asset);
|
|
16726
|
-
});
|
|
16727
|
-
return out;
|
|
16728
|
-
}
|
|
16729
|
-
async unload(urls) {
|
|
16730
|
-
if (!this._initialized) {
|
|
16731
|
-
await this.init();
|
|
16732
|
-
}
|
|
16733
|
-
const urlArray = convertToList(urls).map((url) => typeof url !== "string" ? url.src : url);
|
|
16734
|
-
const resolveResults = this.resolver.resolve(urlArray);
|
|
16735
|
-
await this._unloadFromResolved(resolveResults);
|
|
16736
|
-
}
|
|
16737
|
-
async unloadBundle(bundleIds) {
|
|
16738
|
-
if (!this._initialized) {
|
|
16739
|
-
await this.init();
|
|
16740
|
-
}
|
|
16741
|
-
bundleIds = convertToList(bundleIds);
|
|
16742
|
-
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
|
16743
|
-
const promises = Object.keys(resolveResults).map((bundleId) => this._unloadFromResolved(resolveResults[bundleId]));
|
|
16744
|
-
await Promise.all(promises);
|
|
16745
|
-
}
|
|
16746
|
-
async _unloadFromResolved(resolveResult) {
|
|
16747
|
-
const resolveArray = Object.values(resolveResult);
|
|
16748
|
-
resolveArray.forEach((resolveResult2) => {
|
|
16749
|
-
Cache.remove(resolveResult2.src);
|
|
16750
|
-
});
|
|
16751
|
-
await this.loader.unload(resolveArray);
|
|
16752
|
-
}
|
|
16753
|
-
get detections() {
|
|
16754
|
-
return this._detections;
|
|
16755
|
-
}
|
|
16756
|
-
}
|
|
16757
|
-
const Assets = new AssetsClass();
|
|
16758
|
-
extensions$1.handleByList(ExtensionType.LoadParser, Assets.loader.parsers).handleByList(ExtensionType.ResolveParser, Assets.resolver.parsers).handleByList(ExtensionType.CacheParser, Assets.cache.parsers).handleByList(ExtensionType.DetectionParser, Assets.detections);
|
|
16759
|
-
|
|
16760
|
-
const assetKeyMap = {
|
|
16761
|
-
loader: ExtensionType.LoadParser,
|
|
16762
|
-
resolver: ExtensionType.ResolveParser,
|
|
16763
|
-
cache: ExtensionType.CacheParser,
|
|
16764
|
-
detection: ExtensionType.DetectionParser
|
|
16765
|
-
};
|
|
16766
|
-
extensions$1.handle(ExtensionType.Asset, (extension) => {
|
|
16767
|
-
const ref = extension.ref;
|
|
16768
|
-
Object.entries(assetKeyMap).filter(([key]) => !!ref[key]).forEach(([key, type]) => extensions$1.add(Object.assign(ref[key], { extension: ref[key].extension ?? type })));
|
|
16769
|
-
}, (extension) => {
|
|
16770
|
-
const ref = extension.ref;
|
|
16771
|
-
Object.keys(assetKeyMap).filter((key) => !!ref[key]).forEach((key) => extensions$1.remove(ref[key]));
|
|
16772
|
-
});
|
|
16773
|
-
|
|
16774
|
-
const cacheTextureArray = {
|
|
16775
|
-
extension: ExtensionType.CacheParser,
|
|
16776
|
-
test: (asset) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),
|
|
16777
|
-
getCacheableAssets: (keys, asset) => {
|
|
16778
|
-
const out = {};
|
|
16779
|
-
keys.forEach((key) => {
|
|
16780
|
-
asset.forEach((item, i) => {
|
|
16781
|
-
out[key + (i === 0 ? "" : i + 1)] = item;
|
|
16782
|
-
});
|
|
16783
|
-
});
|
|
16784
|
-
return out;
|
|
16785
|
-
}
|
|
16786
|
-
};
|
|
16787
|
-
extensions$1.add(cacheTextureArray);
|
|
16788
|
-
|
|
16789
16594
|
var LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => {
|
|
16790
16595
|
LoaderParserPriority2[LoaderParserPriority2["Low"] = 0] = "Low";
|
|
16791
16596
|
LoaderParserPriority2[LoaderParserPriority2["Normal"] = 1] = "Normal";
|
|
@@ -17151,6 +16956,228 @@ const loadSVG = {
|
|
|
17151
16956
|
unload: loadTextures.unload
|
|
17152
16957
|
};
|
|
17153
16958
|
|
|
16959
|
+
class AssetsClass {
|
|
16960
|
+
constructor() {
|
|
16961
|
+
this._detections = [];
|
|
16962
|
+
this._initialized = false;
|
|
16963
|
+
this.resolver = new Resolver();
|
|
16964
|
+
this.loader = new Loader();
|
|
16965
|
+
this.cache = Cache;
|
|
16966
|
+
this._backgroundLoader = new BackgroundLoader(this.loader);
|
|
16967
|
+
this._backgroundLoader.active = true;
|
|
16968
|
+
this.reset();
|
|
16969
|
+
}
|
|
16970
|
+
async init(options = {}) {
|
|
16971
|
+
if (this._initialized) {
|
|
16972
|
+
return;
|
|
16973
|
+
}
|
|
16974
|
+
this._initialized = true;
|
|
16975
|
+
if (options.basePath) {
|
|
16976
|
+
this.resolver.basePath = options.basePath;
|
|
16977
|
+
}
|
|
16978
|
+
if (options.manifest) {
|
|
16979
|
+
let manifest = options.manifest;
|
|
16980
|
+
if (typeof manifest === "string") {
|
|
16981
|
+
manifest = await this.load(manifest);
|
|
16982
|
+
}
|
|
16983
|
+
this.resolver.addManifest(manifest);
|
|
16984
|
+
}
|
|
16985
|
+
const resolutionPref = options.texturePreference?.resolution ?? 1;
|
|
16986
|
+
const resolution = typeof resolutionPref === "number" ? [resolutionPref] : resolutionPref;
|
|
16987
|
+
let formats = [];
|
|
16988
|
+
if (options.texturePreference?.format) {
|
|
16989
|
+
const formatPref = options.texturePreference?.format;
|
|
16990
|
+
formats = typeof formatPref === "string" ? [formatPref] : formatPref;
|
|
16991
|
+
for (const detection of this._detections) {
|
|
16992
|
+
if (!await detection.test()) {
|
|
16993
|
+
formats = await detection.remove(formats);
|
|
16994
|
+
}
|
|
16995
|
+
}
|
|
16996
|
+
} else {
|
|
16997
|
+
for (const detection of this._detections) {
|
|
16998
|
+
if (await detection.test()) {
|
|
16999
|
+
formats = await detection.add(formats);
|
|
17000
|
+
}
|
|
17001
|
+
}
|
|
17002
|
+
}
|
|
17003
|
+
this.resolver.prefer({
|
|
17004
|
+
params: {
|
|
17005
|
+
format: formats,
|
|
17006
|
+
resolution
|
|
17007
|
+
}
|
|
17008
|
+
});
|
|
17009
|
+
}
|
|
17010
|
+
add(keysIn, assetsIn, data) {
|
|
17011
|
+
this.resolver.add(keysIn, assetsIn, data);
|
|
17012
|
+
}
|
|
17013
|
+
async load(urls, onProgress) {
|
|
17014
|
+
if (!this._initialized) {
|
|
17015
|
+
await this.init();
|
|
17016
|
+
}
|
|
17017
|
+
const singleAsset = isSingleItem(urls);
|
|
17018
|
+
const urlArray = convertToList(urls).map((url) => {
|
|
17019
|
+
if (typeof url !== "string") {
|
|
17020
|
+
this.resolver.add(url.src, url);
|
|
17021
|
+
return url.src;
|
|
17022
|
+
}
|
|
17023
|
+
return url;
|
|
17024
|
+
});
|
|
17025
|
+
const resolveResults = this.resolver.resolve(urlArray);
|
|
17026
|
+
const out = await this._mapLoadToResolve(resolveResults, onProgress);
|
|
17027
|
+
return singleAsset ? out[urlArray[0]] : out;
|
|
17028
|
+
}
|
|
17029
|
+
addBundle(bundleId, assets) {
|
|
17030
|
+
this.resolver.addBundle(bundleId, assets);
|
|
17031
|
+
}
|
|
17032
|
+
async loadBundle(bundleIds, onProgress) {
|
|
17033
|
+
if (!this._initialized) {
|
|
17034
|
+
await this.init();
|
|
17035
|
+
}
|
|
17036
|
+
let singleAsset = false;
|
|
17037
|
+
if (typeof bundleIds === "string") {
|
|
17038
|
+
singleAsset = true;
|
|
17039
|
+
bundleIds = [bundleIds];
|
|
17040
|
+
}
|
|
17041
|
+
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
|
17042
|
+
const out = {};
|
|
17043
|
+
const keys = Object.keys(resolveResults);
|
|
17044
|
+
let count = 0;
|
|
17045
|
+
let total = 0;
|
|
17046
|
+
const _onProgress = () => {
|
|
17047
|
+
onProgress?.(++count / total);
|
|
17048
|
+
};
|
|
17049
|
+
const promises = keys.map((bundleId) => {
|
|
17050
|
+
const resolveResult = resolveResults[bundleId];
|
|
17051
|
+
total += Object.keys(resolveResult).length;
|
|
17052
|
+
return this._mapLoadToResolve(resolveResult, _onProgress).then((resolveResult2) => {
|
|
17053
|
+
out[bundleId] = resolveResult2;
|
|
17054
|
+
});
|
|
17055
|
+
});
|
|
17056
|
+
await Promise.all(promises);
|
|
17057
|
+
return singleAsset ? out[bundleIds[0]] : out;
|
|
17058
|
+
}
|
|
17059
|
+
async backgroundLoad(urls) {
|
|
17060
|
+
if (!this._initialized) {
|
|
17061
|
+
await this.init();
|
|
17062
|
+
}
|
|
17063
|
+
if (typeof urls === "string") {
|
|
17064
|
+
urls = [urls];
|
|
17065
|
+
}
|
|
17066
|
+
const resolveResults = this.resolver.resolve(urls);
|
|
17067
|
+
this._backgroundLoader.add(Object.values(resolveResults));
|
|
17068
|
+
}
|
|
17069
|
+
async backgroundLoadBundle(bundleIds) {
|
|
17070
|
+
if (!this._initialized) {
|
|
17071
|
+
await this.init();
|
|
17072
|
+
}
|
|
17073
|
+
if (typeof bundleIds === "string") {
|
|
17074
|
+
bundleIds = [bundleIds];
|
|
17075
|
+
}
|
|
17076
|
+
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
|
17077
|
+
Object.values(resolveResults).forEach((resolveResult) => {
|
|
17078
|
+
this._backgroundLoader.add(Object.values(resolveResult));
|
|
17079
|
+
});
|
|
17080
|
+
}
|
|
17081
|
+
reset() {
|
|
17082
|
+
this.resolver.reset();
|
|
17083
|
+
this.loader.reset();
|
|
17084
|
+
this.cache.reset();
|
|
17085
|
+
this._initialized = false;
|
|
17086
|
+
}
|
|
17087
|
+
get(keys) {
|
|
17088
|
+
if (typeof keys === "string") {
|
|
17089
|
+
return Cache.get(keys);
|
|
17090
|
+
}
|
|
17091
|
+
const assets = {};
|
|
17092
|
+
for (let i = 0; i < keys.length; i++) {
|
|
17093
|
+
assets[i] = Cache.get(keys[i]);
|
|
17094
|
+
}
|
|
17095
|
+
return assets;
|
|
17096
|
+
}
|
|
17097
|
+
async _mapLoadToResolve(resolveResults, onProgress) {
|
|
17098
|
+
const resolveArray = Object.values(resolveResults);
|
|
17099
|
+
const resolveKeys = Object.keys(resolveResults);
|
|
17100
|
+
this._backgroundLoader.active = false;
|
|
17101
|
+
const loadedAssets = await this.loader.load(resolveArray, onProgress);
|
|
17102
|
+
this._backgroundLoader.active = true;
|
|
17103
|
+
const out = {};
|
|
17104
|
+
resolveArray.forEach((resolveResult, i) => {
|
|
17105
|
+
const asset = loadedAssets[resolveResult.src];
|
|
17106
|
+
const keys = [resolveResult.src];
|
|
17107
|
+
if (resolveResult.alias) {
|
|
17108
|
+
keys.push(...resolveResult.alias);
|
|
17109
|
+
}
|
|
17110
|
+
out[resolveKeys[i]] = asset;
|
|
17111
|
+
Cache.set(keys, asset);
|
|
17112
|
+
});
|
|
17113
|
+
return out;
|
|
17114
|
+
}
|
|
17115
|
+
async unload(urls) {
|
|
17116
|
+
if (!this._initialized) {
|
|
17117
|
+
await this.init();
|
|
17118
|
+
}
|
|
17119
|
+
const urlArray = convertToList(urls).map((url) => typeof url !== "string" ? url.src : url);
|
|
17120
|
+
const resolveResults = this.resolver.resolve(urlArray);
|
|
17121
|
+
await this._unloadFromResolved(resolveResults);
|
|
17122
|
+
}
|
|
17123
|
+
async unloadBundle(bundleIds) {
|
|
17124
|
+
if (!this._initialized) {
|
|
17125
|
+
await this.init();
|
|
17126
|
+
}
|
|
17127
|
+
bundleIds = convertToList(bundleIds);
|
|
17128
|
+
const resolveResults = this.resolver.resolveBundle(bundleIds);
|
|
17129
|
+
const promises = Object.keys(resolveResults).map((bundleId) => this._unloadFromResolved(resolveResults[bundleId]));
|
|
17130
|
+
await Promise.all(promises);
|
|
17131
|
+
}
|
|
17132
|
+
async _unloadFromResolved(resolveResult) {
|
|
17133
|
+
const resolveArray = Object.values(resolveResult);
|
|
17134
|
+
resolveArray.forEach((resolveResult2) => {
|
|
17135
|
+
Cache.remove(resolveResult2.src);
|
|
17136
|
+
});
|
|
17137
|
+
await this.loader.unload(resolveArray);
|
|
17138
|
+
}
|
|
17139
|
+
get detections() {
|
|
17140
|
+
return this._detections;
|
|
17141
|
+
}
|
|
17142
|
+
get preferWorker() {
|
|
17143
|
+
return loadTextures.config.preferWorker;
|
|
17144
|
+
}
|
|
17145
|
+
set preferWorker(value) {
|
|
17146
|
+
loadTextures.config.preferWorker = value;
|
|
17147
|
+
}
|
|
17148
|
+
}
|
|
17149
|
+
const Assets = new AssetsClass();
|
|
17150
|
+
extensions$1.handleByList(ExtensionType.LoadParser, Assets.loader.parsers).handleByList(ExtensionType.ResolveParser, Assets.resolver.parsers).handleByList(ExtensionType.CacheParser, Assets.cache.parsers).handleByList(ExtensionType.DetectionParser, Assets.detections);
|
|
17151
|
+
|
|
17152
|
+
const assetKeyMap = {
|
|
17153
|
+
loader: ExtensionType.LoadParser,
|
|
17154
|
+
resolver: ExtensionType.ResolveParser,
|
|
17155
|
+
cache: ExtensionType.CacheParser,
|
|
17156
|
+
detection: ExtensionType.DetectionParser
|
|
17157
|
+
};
|
|
17158
|
+
extensions$1.handle(ExtensionType.Asset, (extension) => {
|
|
17159
|
+
const ref = extension.ref;
|
|
17160
|
+
Object.entries(assetKeyMap).filter(([key]) => !!ref[key]).forEach(([key, type]) => extensions$1.add(Object.assign(ref[key], { extension: ref[key].extension ?? type })));
|
|
17161
|
+
}, (extension) => {
|
|
17162
|
+
const ref = extension.ref;
|
|
17163
|
+
Object.keys(assetKeyMap).filter((key) => !!ref[key]).forEach((key) => extensions$1.remove(ref[key]));
|
|
17164
|
+
});
|
|
17165
|
+
|
|
17166
|
+
const cacheTextureArray = {
|
|
17167
|
+
extension: ExtensionType.CacheParser,
|
|
17168
|
+
test: (asset) => Array.isArray(asset) && asset.every((t) => t instanceof Texture),
|
|
17169
|
+
getCacheableAssets: (keys, asset) => {
|
|
17170
|
+
const out = {};
|
|
17171
|
+
keys.forEach((key) => {
|
|
17172
|
+
asset.forEach((item, i) => {
|
|
17173
|
+
out[key + (i === 0 ? "" : i + 1)] = item;
|
|
17174
|
+
});
|
|
17175
|
+
});
|
|
17176
|
+
return out;
|
|
17177
|
+
}
|
|
17178
|
+
};
|
|
17179
|
+
extensions$1.add(cacheTextureArray);
|
|
17180
|
+
|
|
17154
17181
|
const resolveTextureUrl = {
|
|
17155
17182
|
extension: ExtensionType.ResolveParser,
|
|
17156
17183
|
test: loadTextures.test,
|
|
@@ -20097,7 +20124,7 @@ const _Mesh = class extends Container {
|
|
|
20097
20124
|
if (this._roundPixels) {
|
|
20098
20125
|
const resolution = settings.RESOLUTION;
|
|
20099
20126
|
for (let i = 0; i < vertexData.length; ++i) {
|
|
20100
|
-
vertexData[i] = Math.round(
|
|
20127
|
+
vertexData[i] = Math.round(vertexData[i] * resolution) / resolution;
|
|
20101
20128
|
}
|
|
20102
20129
|
}
|
|
20103
20130
|
this.vertexDirty = vertexDirtyId;
|
|
@@ -23951,5 +23978,5 @@ const filters = {
|
|
|
23951
23978
|
NoiseFilter
|
|
23952
23979
|
};
|
|
23953
23980
|
|
|
23954
|
-
export { ALPHA_MODES, AbstractMultiResource, AccessibilityManager, AnimatedSprite, Application, ArrayResource, Assets, AssetsClass, Attribute, BLEND_MODES, BUFFER_BITS, BUFFER_TYPE, BackgroundSystem, BaseImageResource, BasePrepare, BaseRenderTexture, BaseTexture, BatchDrawCall, BatchGeometry, BatchRenderer, BatchShaderGenerator, BatchSystem, BatchTextureArray, BitmapFont, BitmapFontData, BitmapText, BlobResource, Bounds, BrowserAdapter, Buffer, BufferResource, BufferSystem, CLEAR_MODES, COLOR_MASK_BITS, Cache, CanvasResource, Circle, CompressedTextureResource, Container, ContextSystem, CountLimiter, CubeResource, DEG_TO_RAD, DRAW_MODES, DisplayObject, ENV, Ellipse, EventBoundary, EventSystem, ExtensionType, Extract, FORMATS, FORMATS_TO_COMPONENTS, FederatedDisplayObject, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FillStyle, Filter, FilterState, FilterSystem, Framebuffer, FramebufferSystem, GC_MODES, GLFramebuffer, GLProgram, GLTexture, GRAPHICS_CURVES, GenerateTextureSystem, Geometry, GeometrySystem, Graphics, GraphicsData, GraphicsGeometry, IGLUniformData, INSTALLED, INTERNAL_FORMATS, INTERNAL_FORMAT_TO_BYTES_PER_PIXEL, ImageBitmapResource, ImageResource, LINE_CAP, LINE_JOIN, LineStyle, LoaderParserPriority, MASK_TYPES, MIPMAP_MODES, MSAA_QUALITY, MaskData, MaskSystem, Matrix, Mesh, MeshBatchUvs, MeshGeometry, MeshMaterial, MultisampleSystem, NineSlicePlane, ObjectRenderer, ObjectRendererSystem, ObservablePoint, PI_2, PRECISION, ParticleContainer, ParticleRenderer, PlaneGeometry, PluginSystem, Point, Polygon, Prepare, Program, ProjectionSystem, Quad, QuadUv, RAD_TO_DEG, RENDERER_TYPE, Rectangle, RenderTexture, RenderTexturePool, RenderTextureSystem, Renderer, ResizePlugin, Resource, RopeGeometry, RoundedRectangle, Runner, SAMPLER_TYPES, SCALE_MODES, SHAPES, SVGResource, ScissorSystem, Shader, ShaderSystem, SimpleMesh, SimplePlane, SimpleRope, Sprite, SpriteMaskFilter, Spritesheet, StartupSystem, State, StateSystem, StencilSystem, SystemManager, TARGETS, TEXT_GRADIENT, TYPES, TYPES_TO_BYTES_PER_COMPONENT, TYPES_TO_BYTES_PER_PIXEL, TemporaryDisplayObject, Text, TextFormat, TextMetrics, TextStyle, Texture, TextureGCSystem, TextureMatrix, TextureSystem, TextureUvs, Ticker, TickerPlugin, TilingSprite, TilingSpriteRenderer, TimeLimiter, Transform, TransformFeedback, TransformFeedbackSystem, UPDATE_PRIORITY, UniformGroup, VERSION, VideoResource, ViewSystem, ViewableBuffer, WRAP_MODES, XMLFormat, XMLStringFormat, accessibleTarget, autoDetectFormat, autoDetectRenderer, autoDetectResource, cacheTextureArray, checkExtension, checkMaxIfStatementsInShader, convertToList, createStringVariations, createTexture, createUBOElements, defaultFilterVertex, defaultVertex$1 as defaultVertex, detectAvif, detectCompressedTextures, detectDefaults, detectWebp, extensions$1 as extensions, filters, generateProgram, generateUniformBufferSync, getFontFamilyName, getTestContext, getUBOData, graphicsUtils, groupD8, isMobile, isSingleItem, loadBitmapFont, loadDDS, loadImageBitmap, loadJson, loadKTX, loadSVG, loadTextures, loadTxt, loadWebFont, parseDDS, parseKTX, resolveCompressedTextureUrl, resolveTextureUrl, settings, spritesheetAsset, uniformParsers, index as utils };
|
|
23981
|
+
export { ALPHA_MODES, AbstractMultiResource, AccessibilityManager, AnimatedSprite, Application, ArrayResource, Assets, AssetsClass, Attribute, BLEND_MODES, BUFFER_BITS, BUFFER_TYPE, BackgroundSystem, BaseImageResource, BasePrepare, BaseRenderTexture, BaseTexture, BatchDrawCall, BatchGeometry, BatchRenderer, BatchShaderGenerator, BatchSystem, BatchTextureArray, BitmapFont, BitmapFontData, BitmapText, BlobResource, Bounds, BrowserAdapter, Buffer, BufferResource, BufferSystem, CLEAR_MODES, COLOR_MASK_BITS, Cache, CanvasResource, Circle, CompressedTextureResource, Container, ContextSystem, CountLimiter, CubeResource, DEG_TO_RAD, DRAW_MODES, DisplayObject, ENV, Ellipse, EventBoundary, EventSystem, ExtensionType, Extract, FORMATS, FORMATS_TO_COMPONENTS, FederatedDisplayObject, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FillStyle, Filter, FilterState, FilterSystem, Framebuffer, FramebufferSystem, GC_MODES, GLFramebuffer, GLProgram, GLTexture, GRAPHICS_CURVES, GenerateTextureSystem, Geometry, GeometrySystem, Graphics, GraphicsData, GraphicsGeometry, IGLUniformData, INSTALLED, INTERNAL_FORMATS, INTERNAL_FORMAT_TO_BYTES_PER_PIXEL, ImageBitmapResource, ImageResource, LINE_CAP, LINE_JOIN, LineStyle, LoaderParserPriority, MASK_TYPES, MIPMAP_MODES, MSAA_QUALITY, MaskData, MaskSystem, Matrix, Mesh, MeshBatchUvs, MeshGeometry, MeshMaterial, MultisampleSystem, NineSlicePlane, ObjectRenderer, ObjectRendererSystem, ObservablePoint, PI_2, PRECISION, ParticleContainer, ParticleRenderer, PlaneGeometry, PluginSystem, Point, Polygon, Prepare, Program, ProjectionSystem, Quad, QuadUv, RAD_TO_DEG, RENDERER_TYPE, Rectangle, RenderTexture, RenderTexturePool, RenderTextureSystem, Renderer, ResizePlugin, Resource, RopeGeometry, RoundedRectangle, Runner, SAMPLER_TYPES, SCALE_MODES, SHAPES, SVGResource, ScissorSystem, Shader, ShaderSystem, SimpleMesh, SimplePlane, SimpleRope, Sprite, SpriteMaskFilter, Spritesheet, StartupSystem, State, StateSystem, StencilSystem, SystemManager, TARGETS, TEXT_GRADIENT, TYPES, TYPES_TO_BYTES_PER_COMPONENT, TYPES_TO_BYTES_PER_PIXEL, TemporaryDisplayObject, Text, TextFormat, TextMetrics, TextStyle, Texture, TextureGCSystem, TextureMatrix, TextureSystem, TextureUvs, Ticker, TickerPlugin, TilingSprite, TilingSpriteRenderer, TimeLimiter, Transform, TransformFeedback, TransformFeedbackSystem, UPDATE_PRIORITY, UniformGroup, VERSION, VideoResource, ViewSystem, ViewableBuffer, WRAP_MODES, XMLFormat, XMLStringFormat, accessibleTarget, autoDetectFormat, autoDetectRenderer, autoDetectResource, cacheTextureArray, checkExtension, checkMaxIfStatementsInShader, convertToList, createStringVariations, createTexture, createUBOElements, defaultFilterVertex, defaultVertex$1 as defaultVertex, detectAvif, detectCompressedTextures, detectDefaults, detectWebp, extensions$1 as extensions, filters, generateProgram, generateUniformBufferSync, getFontFamilyName, getTestContext, getUBOData, graphicsUtils, groupD8, isMobile, isSingleItem, loadBitmapFont, loadDDS, loadImageBitmap, loadJson, loadKTX, loadSVG, loadTextures, loadTxt, loadWebFont, parseDDS, parseKTX, resolveCompressedTextureUrl, resolveTextureUrl, settings, spritesheetAsset, uniformParsers, unsafeEvalSupported, index as utils };
|
|
23955
23982
|
//# sourceMappingURL=pixi.mjs.map
|