pixi.js 7.1.1 → 7.1.2
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 +57 -60
- package/dist/pixi.js.map +1 -1
- package/dist/pixi.min.js +51 -51
- package/dist/pixi.min.js.map +1 -1
- package/dist/pixi.min.mjs +54 -54
- package/dist/pixi.min.mjs.map +1 -1
- package/dist/pixi.mjs +57 -60
- package/dist/pixi.mjs.map +1 -1
- package/package.json +31 -31
package/dist/pixi.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* pixi.js - v7.1.
|
|
3
|
-
* Compiled
|
|
2
|
+
* pixi.js - v7.1.2
|
|
3
|
+
* Compiled Tue, 31 Jan 2023 14:52:16 UTC
|
|
4
4
|
*
|
|
5
5
|
* pixi.js is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -224,16 +224,15 @@ var PIXI = (function (exports) {
|
|
|
224
224
|
RESOLUTION: 1,
|
|
225
225
|
RENDER_OPTIONS: {
|
|
226
226
|
view: null,
|
|
227
|
-
|
|
227
|
+
width: 800,
|
|
228
|
+
height: 600,
|
|
228
229
|
autoDensity: false,
|
|
229
230
|
backgroundColor: 0,
|
|
230
231
|
backgroundAlpha: 1,
|
|
231
|
-
premultipliedAlpha: true,
|
|
232
232
|
clearBeforeRender: true,
|
|
233
|
+
antialias: false,
|
|
234
|
+
premultipliedAlpha: true,
|
|
233
235
|
preserveDrawingBuffer: false,
|
|
234
|
-
width: 800,
|
|
235
|
-
height: 600,
|
|
236
|
-
legacy: false,
|
|
237
236
|
hello: false
|
|
238
237
|
},
|
|
239
238
|
CREATE_IMAGE_BITMAP: false,
|
|
@@ -10458,7 +10457,7 @@ ${this.fragmentSrc}`;
|
|
|
10458
10457
|
const renderer = this.renderer;
|
|
10459
10458
|
renderer.emitWithCustomOptions(renderer.runners.init, options);
|
|
10460
10459
|
if (options.hello) {
|
|
10461
|
-
console.log(`PixiJS ${"7.1.
|
|
10460
|
+
console.log(`PixiJS ${"7.1.2"} - ${renderer.rendererLogId} - https://pixijs.com`);
|
|
10462
10461
|
}
|
|
10463
10462
|
renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
|
|
10464
10463
|
}
|
|
@@ -11964,8 +11963,8 @@ ${this.fragmentSrc}`;
|
|
|
11964
11963
|
preserveDrawingBuffer: options.preserveDrawingBuffer
|
|
11965
11964
|
}
|
|
11966
11965
|
};
|
|
11967
|
-
this.startup.run(startupOptions);
|
|
11968
11966
|
this.options = options;
|
|
11967
|
+
this.startup.run(startupOptions);
|
|
11969
11968
|
}
|
|
11970
11969
|
static test(options) {
|
|
11971
11970
|
if (options?.forceCanvas) {
|
|
@@ -12649,7 +12648,7 @@ ${this.fragmentSrc}`;
|
|
|
12649
12648
|
}
|
|
12650
12649
|
}
|
|
12651
12650
|
|
|
12652
|
-
const VERSION = "7.1.
|
|
12651
|
+
const VERSION = "7.1.2";
|
|
12653
12652
|
|
|
12654
12653
|
class Bounds {
|
|
12655
12654
|
constructor() {
|
|
@@ -16905,9 +16904,6 @@ ${e}`);
|
|
|
16905
16904
|
return checkDataUrl(url, validFontMIMEs) || checkExtension(url, validFontExtensions);
|
|
16906
16905
|
},
|
|
16907
16906
|
async load(url, options) {
|
|
16908
|
-
if (!globalThis.navigator.onLine) {
|
|
16909
|
-
throw new Error("[loadWebFont] Cannot load font - navigator is offline");
|
|
16910
|
-
}
|
|
16911
16907
|
const fonts = settings.ADAPTER.getFontFaceSet();
|
|
16912
16908
|
if (fonts) {
|
|
16913
16909
|
const fontFaces = [];
|
|
@@ -17193,9 +17189,14 @@ ${e}`);
|
|
|
17193
17189
|
|
|
17194
17190
|
class Resolver {
|
|
17195
17191
|
constructor() {
|
|
17196
|
-
this.
|
|
17197
|
-
|
|
17198
|
-
|
|
17192
|
+
this._defaultBundleIdentifierOptions = {
|
|
17193
|
+
connector: "-",
|
|
17194
|
+
createBundleAssetId: (bundleId, assetId) => `${bundleId}${this._bundleIdConnector}${assetId}`,
|
|
17195
|
+
extractAssetIdFromBundle: (bundleId, assetBundleId) => assetBundleId.replace(`${bundleId}${this._bundleIdConnector}`, "")
|
|
17196
|
+
};
|
|
17197
|
+
this._bundleIdConnector = this._defaultBundleIdentifierOptions.connector;
|
|
17198
|
+
this._createBundleAssetId = this._defaultBundleIdentifierOptions.createBundleAssetId;
|
|
17199
|
+
this._extractAssetIdFromBundle = this._defaultBundleIdentifierOptions.extractAssetIdFromBundle;
|
|
17199
17200
|
this._assetMap = {};
|
|
17200
17201
|
this._preferredOrder = [];
|
|
17201
17202
|
this._parsers = [];
|
|
@@ -17235,12 +17236,15 @@ ${e}`);
|
|
|
17235
17236
|
return this._parsers;
|
|
17236
17237
|
}
|
|
17237
17238
|
reset() {
|
|
17239
|
+
this.setBundleIdentifier(this._defaultBundleIdentifierOptions);
|
|
17240
|
+
this._assetMap = {};
|
|
17238
17241
|
this._preferredOrder = [];
|
|
17239
17242
|
this._resolverHash = {};
|
|
17240
|
-
this._assetMap = {};
|
|
17241
17243
|
this._rootPath = null;
|
|
17242
17244
|
this._basePath = null;
|
|
17243
17245
|
this._manifest = null;
|
|
17246
|
+
this._bundles = {};
|
|
17247
|
+
this._defaultSearchParams = null;
|
|
17244
17248
|
}
|
|
17245
17249
|
setDefaultSearchParams(searchParams) {
|
|
17246
17250
|
if (typeof searchParams === "string") {
|
|
@@ -17286,7 +17290,7 @@ ${e}`);
|
|
|
17286
17290
|
add(keysIn, assetsIn, data) {
|
|
17287
17291
|
const keys = convertToList(keysIn);
|
|
17288
17292
|
keys.forEach((key) => {
|
|
17289
|
-
if (this.
|
|
17293
|
+
if (this.hasKey(key)) {
|
|
17290
17294
|
console.warn(`[Resolver] already has key: ${key} overwriting`);
|
|
17291
17295
|
}
|
|
17292
17296
|
});
|
|
@@ -17400,6 +17404,12 @@ ${e}`);
|
|
|
17400
17404
|
});
|
|
17401
17405
|
return singleAsset ? result[keys[0]] : result;
|
|
17402
17406
|
}
|
|
17407
|
+
hasKey(key) {
|
|
17408
|
+
return !!this._assetMap[key];
|
|
17409
|
+
}
|
|
17410
|
+
hasBundle(key) {
|
|
17411
|
+
return !!this._bundles[key];
|
|
17412
|
+
}
|
|
17403
17413
|
_getPreferredOrder(assets) {
|
|
17404
17414
|
for (let i = 0; i < assets.length; i++) {
|
|
17405
17415
|
const asset = assets[0];
|
|
@@ -17489,6 +17499,9 @@ ${e}`);
|
|
|
17489
17499
|
this.resolver.add(url.src, url);
|
|
17490
17500
|
return url.src;
|
|
17491
17501
|
}
|
|
17502
|
+
if (!this.resolver.hasKey(url)) {
|
|
17503
|
+
this.resolver.add(url, url);
|
|
17504
|
+
}
|
|
17492
17505
|
return url;
|
|
17493
17506
|
});
|
|
17494
17507
|
const resolveResults = this.resolver.resolve(urlArray);
|
|
@@ -18529,42 +18542,10 @@ ${e}`);
|
|
|
18529
18542
|
throw new Error("Extract.base64() requires ICanvas.toDataURL or ICanvas.convertToBlob to be implemented");
|
|
18530
18543
|
}
|
|
18531
18544
|
canvas(target, frame) {
|
|
18532
|
-
const
|
|
18533
|
-
let resolution;
|
|
18534
|
-
let flipY = false;
|
|
18535
|
-
let renderTexture;
|
|
18536
|
-
let generated = false;
|
|
18537
|
-
if (target) {
|
|
18538
|
-
if (target instanceof RenderTexture) {
|
|
18539
|
-
renderTexture = target;
|
|
18540
|
-
} else {
|
|
18541
|
-
renderTexture = this.renderer.generateTexture(target);
|
|
18542
|
-
generated = true;
|
|
18543
|
-
}
|
|
18544
|
-
}
|
|
18545
|
-
if (renderTexture) {
|
|
18546
|
-
resolution = renderTexture.baseTexture.resolution;
|
|
18547
|
-
frame = frame ?? renderTexture.frame;
|
|
18548
|
-
flipY = false;
|
|
18549
|
-
renderer.renderTexture.bind(renderTexture);
|
|
18550
|
-
} else {
|
|
18551
|
-
resolution = renderer.resolution;
|
|
18552
|
-
if (!frame) {
|
|
18553
|
-
frame = TEMP_RECT;
|
|
18554
|
-
frame.width = renderer.width;
|
|
18555
|
-
frame.height = renderer.height;
|
|
18556
|
-
}
|
|
18557
|
-
flipY = true;
|
|
18558
|
-
renderer.renderTexture.bind(null);
|
|
18559
|
-
}
|
|
18560
|
-
const width = Math.round(frame.width * resolution);
|
|
18561
|
-
const height = Math.round(frame.height * resolution);
|
|
18545
|
+
const { pixels, width, height, flipY } = this._rawPixels(target, frame);
|
|
18562
18546
|
let canvasBuffer = new CanvasRenderTarget(width, height, 1);
|
|
18563
|
-
const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);
|
|
18564
|
-
const gl = renderer.gl;
|
|
18565
|
-
gl.readPixels(Math.round(frame.x * resolution), Math.round(frame.y * resolution), width, height, gl.RGBA, gl.UNSIGNED_BYTE, webglPixels);
|
|
18566
18547
|
const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);
|
|
18567
|
-
_Extract.arrayPostDivide(
|
|
18548
|
+
_Extract.arrayPostDivide(pixels, canvasData.data);
|
|
18568
18549
|
canvasBuffer.context.putImageData(canvasData, 0, 0);
|
|
18569
18550
|
if (flipY) {
|
|
18570
18551
|
const target2 = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);
|
|
@@ -18573,27 +18554,43 @@ ${e}`);
|
|
|
18573
18554
|
canvasBuffer.destroy();
|
|
18574
18555
|
canvasBuffer = target2;
|
|
18575
18556
|
}
|
|
18576
|
-
if (generated) {
|
|
18577
|
-
renderTexture.destroy(true);
|
|
18578
|
-
}
|
|
18579
18557
|
return canvasBuffer.canvas;
|
|
18580
18558
|
}
|
|
18581
18559
|
pixels(target, frame) {
|
|
18560
|
+
const { pixels } = this._rawPixels(target, frame);
|
|
18561
|
+
_Extract.arrayPostDivide(pixels, pixels);
|
|
18562
|
+
return pixels;
|
|
18563
|
+
}
|
|
18564
|
+
_rawPixels(target, frame) {
|
|
18582
18565
|
const renderer = this.renderer;
|
|
18583
18566
|
let resolution;
|
|
18567
|
+
let flipY = false;
|
|
18584
18568
|
let renderTexture;
|
|
18585
18569
|
let generated = false;
|
|
18586
18570
|
if (target) {
|
|
18587
18571
|
if (target instanceof RenderTexture) {
|
|
18588
18572
|
renderTexture = target;
|
|
18589
18573
|
} else {
|
|
18590
|
-
|
|
18574
|
+
const multisample = renderer.context.webGLVersion >= 2 ? renderer.multisample : MSAA_QUALITY.NONE;
|
|
18575
|
+
renderTexture = this.renderer.generateTexture(target, { multisample });
|
|
18576
|
+
if (multisample !== MSAA_QUALITY.NONE) {
|
|
18577
|
+
const resolvedTexture = RenderTexture.create({
|
|
18578
|
+
width: renderTexture.width,
|
|
18579
|
+
height: renderTexture.height
|
|
18580
|
+
});
|
|
18581
|
+
renderer.framebuffer.bind(renderTexture.framebuffer);
|
|
18582
|
+
renderer.framebuffer.blit(resolvedTexture.framebuffer);
|
|
18583
|
+
renderer.framebuffer.bind(null);
|
|
18584
|
+
renderTexture.destroy(true);
|
|
18585
|
+
renderTexture = resolvedTexture;
|
|
18586
|
+
}
|
|
18591
18587
|
generated = true;
|
|
18592
18588
|
}
|
|
18593
18589
|
}
|
|
18594
18590
|
if (renderTexture) {
|
|
18595
18591
|
resolution = renderTexture.baseTexture.resolution;
|
|
18596
18592
|
frame = frame ?? renderTexture.frame;
|
|
18593
|
+
flipY = false;
|
|
18597
18594
|
renderer.renderTexture.bind(renderTexture);
|
|
18598
18595
|
} else {
|
|
18599
18596
|
resolution = renderer.resolution;
|
|
@@ -18602,18 +18599,18 @@ ${e}`);
|
|
|
18602
18599
|
frame.width = renderer.width;
|
|
18603
18600
|
frame.height = renderer.height;
|
|
18604
18601
|
}
|
|
18602
|
+
flipY = true;
|
|
18605
18603
|
renderer.renderTexture.bind(null);
|
|
18606
18604
|
}
|
|
18607
18605
|
const width = Math.round(frame.width * resolution);
|
|
18608
18606
|
const height = Math.round(frame.height * resolution);
|
|
18609
|
-
const
|
|
18607
|
+
const pixels = new Uint8Array(BYTES_PER_PIXEL * width * height);
|
|
18610
18608
|
const gl = renderer.gl;
|
|
18611
|
-
gl.readPixels(Math.round(frame.x * resolution), Math.round(frame.y * resolution), width, height, gl.RGBA, gl.UNSIGNED_BYTE,
|
|
18609
|
+
gl.readPixels(Math.round(frame.x * resolution), Math.round(frame.y * resolution), width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels);
|
|
18612
18610
|
if (generated) {
|
|
18613
18611
|
renderTexture.destroy(true);
|
|
18614
18612
|
}
|
|
18615
|
-
|
|
18616
|
-
return webglPixels;
|
|
18613
|
+
return { pixels, width, height, flipY };
|
|
18617
18614
|
}
|
|
18618
18615
|
destroy() {
|
|
18619
18616
|
this.renderer = null;
|