Initial
This commit is contained in:
27
resources/app/node_modules/@pixi/basis/lib/Basis.js
generated
vendored
Normal file
27
resources/app/node_modules/@pixi/basis/lib/Basis.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
var compressedTextures = require("@pixi/compressed-textures"), core = require("@pixi/core"), BASIS_FORMATS = /* @__PURE__ */ ((BASIS_FORMATS2) => (BASIS_FORMATS2[BASIS_FORMATS2.cTFETC1 = 0] = "cTFETC1", BASIS_FORMATS2[BASIS_FORMATS2.cTFETC2 = 1] = "cTFETC2", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC1 = 2] = "cTFBC1", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC3 = 3] = "cTFBC3", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC4 = 4] = "cTFBC4", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC5 = 5] = "cTFBC5", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC7 = 6] = "cTFBC7", BASIS_FORMATS2[BASIS_FORMATS2.cTFPVRTC1_4_RGB = 8] = "cTFPVRTC1_4_RGB", BASIS_FORMATS2[BASIS_FORMATS2.cTFPVRTC1_4_RGBA = 9] = "cTFPVRTC1_4_RGBA", BASIS_FORMATS2[BASIS_FORMATS2.cTFASTC_4x4 = 10] = "cTFASTC_4x4", BASIS_FORMATS2[BASIS_FORMATS2.cTFATC_RGB = 11] = "cTFATC_RGB", BASIS_FORMATS2[BASIS_FORMATS2.cTFATC_RGBA_INTERPOLATED_ALPHA = 12] = "cTFATC_RGBA_INTERPOLATED_ALPHA", BASIS_FORMATS2[BASIS_FORMATS2.cTFRGBA32 = 13] = "cTFRGBA32", BASIS_FORMATS2[BASIS_FORMATS2.cTFRGB565 = 14] = "cTFRGB565", BASIS_FORMATS2[BASIS_FORMATS2.cTFBGR565 = 15] = "cTFBGR565", BASIS_FORMATS2[BASIS_FORMATS2.cTFRGBA4444 = 16] = "cTFRGBA4444", BASIS_FORMATS2))(BASIS_FORMATS || {});
|
||||
const BASIS_FORMAT_TO_INTERNAL_FORMAT = {
|
||||
0: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL,
|
||||
2: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT,
|
||||
3: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
||||
8: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
||||
9: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
||||
11: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL,
|
||||
10: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR,
|
||||
6: compressedTextures.INTERNAL_FORMATS.COMPRESSED_RGBA_BPTC_UNORM_EXT
|
||||
}, BASIS_FORMAT_TO_TYPE = {
|
||||
13: core.TYPES.UNSIGNED_BYTE,
|
||||
14: core.TYPES.UNSIGNED_SHORT_5_6_5,
|
||||
16: core.TYPES.UNSIGNED_SHORT_4_4_4_4
|
||||
}, INTERNAL_FORMAT_TO_BASIS_FORMAT = Object.keys(BASIS_FORMAT_TO_INTERNAL_FORMAT).map((key) => Number(key)).reduce((reverseMap, basisFormat) => (reverseMap[BASIS_FORMAT_TO_INTERNAL_FORMAT[basisFormat]] = basisFormat, reverseMap), {}), BASIS_FORMATS_ALPHA = {
|
||||
3: !0,
|
||||
9: !0,
|
||||
10: !0,
|
||||
6: !0
|
||||
};
|
||||
exports.BASIS_FORMATS = BASIS_FORMATS;
|
||||
exports.BASIS_FORMATS_ALPHA = BASIS_FORMATS_ALPHA;
|
||||
exports.BASIS_FORMAT_TO_INTERNAL_FORMAT = BASIS_FORMAT_TO_INTERNAL_FORMAT;
|
||||
exports.BASIS_FORMAT_TO_TYPE = BASIS_FORMAT_TO_TYPE;
|
||||
exports.INTERNAL_FORMAT_TO_BASIS_FORMAT = INTERNAL_FORMAT_TO_BASIS_FORMAT;
|
||||
//# sourceMappingURL=Basis.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/Basis.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/Basis.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
30
resources/app/node_modules/@pixi/basis/lib/Basis.mjs
generated
vendored
Normal file
30
resources/app/node_modules/@pixi/basis/lib/Basis.mjs
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { INTERNAL_FORMATS } from "@pixi/compressed-textures";
|
||||
import { TYPES } from "@pixi/core";
|
||||
var BASIS_FORMATS = /* @__PURE__ */ ((BASIS_FORMATS2) => (BASIS_FORMATS2[BASIS_FORMATS2.cTFETC1 = 0] = "cTFETC1", BASIS_FORMATS2[BASIS_FORMATS2.cTFETC2 = 1] = "cTFETC2", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC1 = 2] = "cTFBC1", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC3 = 3] = "cTFBC3", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC4 = 4] = "cTFBC4", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC5 = 5] = "cTFBC5", BASIS_FORMATS2[BASIS_FORMATS2.cTFBC7 = 6] = "cTFBC7", BASIS_FORMATS2[BASIS_FORMATS2.cTFPVRTC1_4_RGB = 8] = "cTFPVRTC1_4_RGB", BASIS_FORMATS2[BASIS_FORMATS2.cTFPVRTC1_4_RGBA = 9] = "cTFPVRTC1_4_RGBA", BASIS_FORMATS2[BASIS_FORMATS2.cTFASTC_4x4 = 10] = "cTFASTC_4x4", BASIS_FORMATS2[BASIS_FORMATS2.cTFATC_RGB = 11] = "cTFATC_RGB", BASIS_FORMATS2[BASIS_FORMATS2.cTFATC_RGBA_INTERPOLATED_ALPHA = 12] = "cTFATC_RGBA_INTERPOLATED_ALPHA", BASIS_FORMATS2[BASIS_FORMATS2.cTFRGBA32 = 13] = "cTFRGBA32", BASIS_FORMATS2[BASIS_FORMATS2.cTFRGB565 = 14] = "cTFRGB565", BASIS_FORMATS2[BASIS_FORMATS2.cTFBGR565 = 15] = "cTFBGR565", BASIS_FORMATS2[BASIS_FORMATS2.cTFRGBA4444 = 16] = "cTFRGBA4444", BASIS_FORMATS2))(BASIS_FORMATS || {});
|
||||
const BASIS_FORMAT_TO_INTERNAL_FORMAT = {
|
||||
0: INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL,
|
||||
2: INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT,
|
||||
3: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
||||
8: INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
||||
9: INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
||||
11: INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL,
|
||||
10: INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR,
|
||||
6: INTERNAL_FORMATS.COMPRESSED_RGBA_BPTC_UNORM_EXT
|
||||
}, BASIS_FORMAT_TO_TYPE = {
|
||||
13: TYPES.UNSIGNED_BYTE,
|
||||
14: TYPES.UNSIGNED_SHORT_5_6_5,
|
||||
16: TYPES.UNSIGNED_SHORT_4_4_4_4
|
||||
}, INTERNAL_FORMAT_TO_BASIS_FORMAT = Object.keys(BASIS_FORMAT_TO_INTERNAL_FORMAT).map((key) => Number(key)).reduce((reverseMap, basisFormat) => (reverseMap[BASIS_FORMAT_TO_INTERNAL_FORMAT[basisFormat]] = basisFormat, reverseMap), {}), BASIS_FORMATS_ALPHA = {
|
||||
3: !0,
|
||||
9: !0,
|
||||
10: !0,
|
||||
6: !0
|
||||
};
|
||||
export {
|
||||
BASIS_FORMATS,
|
||||
BASIS_FORMATS_ALPHA,
|
||||
BASIS_FORMAT_TO_INTERNAL_FORMAT,
|
||||
BASIS_FORMAT_TO_TYPE,
|
||||
INTERNAL_FORMAT_TO_BASIS_FORMAT
|
||||
};
|
||||
//# sourceMappingURL=Basis.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/Basis.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/Basis.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
89
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.js
generated
vendored
Normal file
89
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
var TranscoderWorkerWrapper = require("./TranscoderWorkerWrapper.js");
|
||||
const _TranscoderWorker = class _TranscoderWorker2 {
|
||||
constructor() {
|
||||
this.requests = {}, this.onMessage = (e) => {
|
||||
const data = e.data;
|
||||
if (data.type === "init") {
|
||||
if (!data.success)
|
||||
throw new Error("BasisResource.TranscoderWorker failed to initialize.");
|
||||
this.isInit = !0, this.onInit();
|
||||
} else if (data.type === "transcode") {
|
||||
--this.load;
|
||||
const requestID = data.requestID;
|
||||
data.success ? this.requests[requestID].resolve(data) : this.requests[requestID].reject(), delete this.requests[requestID];
|
||||
}
|
||||
}, this.isInit = !1, this.load = 0, this.initPromise = new Promise((resolve) => {
|
||||
this.onInit = resolve;
|
||||
}), _TranscoderWorker2.wasmSource || console.warn("resources.BasisResource.TranscoderWorker has not been given the transcoder WASM binary!"), this.worker = new Worker(_TranscoderWorker2.workerURL), this.worker.onmessage = this.onMessage, this.worker.postMessage({
|
||||
type: "init",
|
||||
jsSource: _TranscoderWorker2.jsSource,
|
||||
wasmSource: _TranscoderWorker2.wasmSource
|
||||
});
|
||||
}
|
||||
/** Generated URL for the transcoder worker script. */
|
||||
static get workerURL() {
|
||||
if (!_TranscoderWorker2._workerURL) {
|
||||
let workerSource = TranscoderWorkerWrapper.TranscoderWorkerWrapper.toString();
|
||||
const beginIndex = workerSource.indexOf("{"), endIndex = workerSource.lastIndexOf("}");
|
||||
workerSource = workerSource.slice(beginIndex + 1, endIndex), _TranscoderWorker2.jsSource && (workerSource = `${_TranscoderWorker2.jsSource}
|
||||
${workerSource}`), _TranscoderWorker2._workerURL = URL.createObjectURL(new Blob([workerSource]));
|
||||
}
|
||||
return _TranscoderWorker2._workerURL;
|
||||
}
|
||||
/** @returns a promise that is resolved when the web-worker is initialized */
|
||||
initAsync() {
|
||||
return this.initPromise;
|
||||
}
|
||||
/**
|
||||
* Creates a promise that will resolve when the transcoding of a *.basis file is complete.
|
||||
* @param basisData - *.basis file contents
|
||||
* @param rgbaFormat - transcoding format for RGBA files
|
||||
* @param rgbFormat - transcoding format for RGB files
|
||||
* @returns a promise that is resolved with the transcoding response of the web-worker
|
||||
*/
|
||||
async transcodeAsync(basisData, rgbaFormat, rgbFormat) {
|
||||
++this.load;
|
||||
const requestID = _TranscoderWorker2._tempID++, requestPromise = new Promise((resolve, reject) => {
|
||||
this.requests[requestID] = {
|
||||
resolve,
|
||||
reject
|
||||
};
|
||||
});
|
||||
return this.worker.postMessage({
|
||||
requestID,
|
||||
basisData,
|
||||
rgbaFormat,
|
||||
rgbFormat,
|
||||
type: "transcode"
|
||||
}), requestPromise;
|
||||
}
|
||||
/**
|
||||
* Loads the transcoder source code
|
||||
* @param jsURL - URL to the javascript basis transcoder
|
||||
* @param wasmURL - URL to the wasm basis transcoder
|
||||
* @returns A promise that resolves when both the js and wasm transcoders have been loaded.
|
||||
*/
|
||||
static loadTranscoder(jsURL, wasmURL) {
|
||||
const jsPromise = fetch(jsURL).then((res) => res.text()).then((text) => {
|
||||
_TranscoderWorker2.jsSource = text;
|
||||
}), wasmPromise = fetch(wasmURL).then((res) => res.arrayBuffer()).then((arrayBuffer) => {
|
||||
_TranscoderWorker2.wasmSource = arrayBuffer;
|
||||
});
|
||||
return Promise.all([jsPromise, wasmPromise]).then((data) => (this._onTranscoderInitializedResolve(), data));
|
||||
}
|
||||
/**
|
||||
* Set the transcoder source code directly
|
||||
* @param jsSource - source for the javascript basis transcoder
|
||||
* @param wasmSource - source for the wasm basis transcoder
|
||||
*/
|
||||
static setTranscoder(jsSource, wasmSource) {
|
||||
_TranscoderWorker2.jsSource = jsSource, _TranscoderWorker2.wasmSource = wasmSource;
|
||||
}
|
||||
};
|
||||
_TranscoderWorker.onTranscoderInitialized = new Promise((resolve) => {
|
||||
_TranscoderWorker._onTranscoderInitializedResolve = resolve;
|
||||
}), _TranscoderWorker._tempID = 0;
|
||||
let TranscoderWorker = _TranscoderWorker;
|
||||
exports.TranscoderWorker = TranscoderWorker;
|
||||
//# sourceMappingURL=TranscoderWorker.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
90
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.mjs
generated
vendored
Normal file
90
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.mjs
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
import { TranscoderWorkerWrapper } from "./TranscoderWorkerWrapper.mjs";
|
||||
const _TranscoderWorker = class _TranscoderWorker2 {
|
||||
constructor() {
|
||||
this.requests = {}, this.onMessage = (e) => {
|
||||
const data = e.data;
|
||||
if (data.type === "init") {
|
||||
if (!data.success)
|
||||
throw new Error("BasisResource.TranscoderWorker failed to initialize.");
|
||||
this.isInit = !0, this.onInit();
|
||||
} else if (data.type === "transcode") {
|
||||
--this.load;
|
||||
const requestID = data.requestID;
|
||||
data.success ? this.requests[requestID].resolve(data) : this.requests[requestID].reject(), delete this.requests[requestID];
|
||||
}
|
||||
}, this.isInit = !1, this.load = 0, this.initPromise = new Promise((resolve) => {
|
||||
this.onInit = resolve;
|
||||
}), _TranscoderWorker2.wasmSource || console.warn("resources.BasisResource.TranscoderWorker has not been given the transcoder WASM binary!"), this.worker = new Worker(_TranscoderWorker2.workerURL), this.worker.onmessage = this.onMessage, this.worker.postMessage({
|
||||
type: "init",
|
||||
jsSource: _TranscoderWorker2.jsSource,
|
||||
wasmSource: _TranscoderWorker2.wasmSource
|
||||
});
|
||||
}
|
||||
/** Generated URL for the transcoder worker script. */
|
||||
static get workerURL() {
|
||||
if (!_TranscoderWorker2._workerURL) {
|
||||
let workerSource = TranscoderWorkerWrapper.toString();
|
||||
const beginIndex = workerSource.indexOf("{"), endIndex = workerSource.lastIndexOf("}");
|
||||
workerSource = workerSource.slice(beginIndex + 1, endIndex), _TranscoderWorker2.jsSource && (workerSource = `${_TranscoderWorker2.jsSource}
|
||||
${workerSource}`), _TranscoderWorker2._workerURL = URL.createObjectURL(new Blob([workerSource]));
|
||||
}
|
||||
return _TranscoderWorker2._workerURL;
|
||||
}
|
||||
/** @returns a promise that is resolved when the web-worker is initialized */
|
||||
initAsync() {
|
||||
return this.initPromise;
|
||||
}
|
||||
/**
|
||||
* Creates a promise that will resolve when the transcoding of a *.basis file is complete.
|
||||
* @param basisData - *.basis file contents
|
||||
* @param rgbaFormat - transcoding format for RGBA files
|
||||
* @param rgbFormat - transcoding format for RGB files
|
||||
* @returns a promise that is resolved with the transcoding response of the web-worker
|
||||
*/
|
||||
async transcodeAsync(basisData, rgbaFormat, rgbFormat) {
|
||||
++this.load;
|
||||
const requestID = _TranscoderWorker2._tempID++, requestPromise = new Promise((resolve, reject) => {
|
||||
this.requests[requestID] = {
|
||||
resolve,
|
||||
reject
|
||||
};
|
||||
});
|
||||
return this.worker.postMessage({
|
||||
requestID,
|
||||
basisData,
|
||||
rgbaFormat,
|
||||
rgbFormat,
|
||||
type: "transcode"
|
||||
}), requestPromise;
|
||||
}
|
||||
/**
|
||||
* Loads the transcoder source code
|
||||
* @param jsURL - URL to the javascript basis transcoder
|
||||
* @param wasmURL - URL to the wasm basis transcoder
|
||||
* @returns A promise that resolves when both the js and wasm transcoders have been loaded.
|
||||
*/
|
||||
static loadTranscoder(jsURL, wasmURL) {
|
||||
const jsPromise = fetch(jsURL).then((res) => res.text()).then((text) => {
|
||||
_TranscoderWorker2.jsSource = text;
|
||||
}), wasmPromise = fetch(wasmURL).then((res) => res.arrayBuffer()).then((arrayBuffer) => {
|
||||
_TranscoderWorker2.wasmSource = arrayBuffer;
|
||||
});
|
||||
return Promise.all([jsPromise, wasmPromise]).then((data) => (this._onTranscoderInitializedResolve(), data));
|
||||
}
|
||||
/**
|
||||
* Set the transcoder source code directly
|
||||
* @param jsSource - source for the javascript basis transcoder
|
||||
* @param wasmSource - source for the wasm basis transcoder
|
||||
*/
|
||||
static setTranscoder(jsSource, wasmSource) {
|
||||
_TranscoderWorker2.jsSource = jsSource, _TranscoderWorker2.wasmSource = wasmSource;
|
||||
}
|
||||
};
|
||||
_TranscoderWorker.onTranscoderInitialized = new Promise((resolve) => {
|
||||
_TranscoderWorker._onTranscoderInitializedResolve = resolve;
|
||||
}), _TranscoderWorker._tempID = 0;
|
||||
let TranscoderWorker = _TranscoderWorker;
|
||||
export {
|
||||
TranscoderWorker
|
||||
};
|
||||
//# sourceMappingURL=TranscoderWorker.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorker.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
65
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.js
generated
vendored
Normal file
65
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
function TranscoderWorkerWrapper() {
|
||||
let basisBinding;
|
||||
const messageHandlers = {
|
||||
init: (message) => self.BASIS ? (self.BASIS({ wasmBinary: message.wasmSource }).then((basisLibrary) => {
|
||||
basisLibrary.initializeBasis(), basisBinding = basisLibrary, self.postMessage({
|
||||
type: "init",
|
||||
success: !0
|
||||
});
|
||||
}), null) : (console.warn("jsSource was not prepended?"), {
|
||||
type: "init",
|
||||
success: !1
|
||||
}),
|
||||
transcode(message) {
|
||||
const basisData = message.basisData, BASIS = basisBinding, data = basisData, basisFile = new BASIS.BasisFile(data), imageCount = basisFile.getNumImages(), basisFormat = basisFile.getHasAlpha() ? message.rgbaFormat : message.rgbFormat, basisFallbackFormat = 14, imageArray = new Array(imageCount);
|
||||
let fallbackMode = !1;
|
||||
if (!basisFile.startTranscoding())
|
||||
return basisFile.close(), basisFile.delete(), {
|
||||
type: "transcode",
|
||||
requestID: message.requestID,
|
||||
success: !1,
|
||||
imageArray: null
|
||||
};
|
||||
for (let i = 0; i < imageCount; i++) {
|
||||
const levels = basisFile.getNumLevels(i), imageResource = {
|
||||
imageID: i,
|
||||
levelArray: new Array(),
|
||||
width: null,
|
||||
height: null
|
||||
};
|
||||
for (let j = 0; j < levels; j++) {
|
||||
const format = fallbackMode ? basisFallbackFormat : basisFormat, width = basisFile.getImageWidth(i, j), height = basisFile.getImageHeight(i, j), byteSize = basisFile.getImageTranscodedSizeInBytes(i, j, format), alignedWidth = width + 3 & -4, alignedHeight = height + 3 & -4;
|
||||
j === 0 && (imageResource.width = alignedWidth, imageResource.height = alignedHeight);
|
||||
const imageBuffer = new Uint8Array(byteSize);
|
||||
if (!basisFile.transcodeImage(imageBuffer, i, j, format, !1, !1)) {
|
||||
if (fallbackMode)
|
||||
return console.error(`Basis failed to transcode image ${i}, level ${j}!`), { type: "transcode", requestID: message.requestID, success: !1 };
|
||||
console.warn(`Basis failed to transcode image ${i}, level ${j}! Retrying to an uncompressed texture format!`), i = -1, fallbackMode = !0;
|
||||
break;
|
||||
}
|
||||
imageResource.levelArray.push({
|
||||
levelID: j,
|
||||
levelWidth: width,
|
||||
levelHeight: height,
|
||||
levelBuffer: imageBuffer
|
||||
});
|
||||
}
|
||||
imageArray[i] = imageResource;
|
||||
}
|
||||
return basisFile.close(), basisFile.delete(), {
|
||||
type: "transcode",
|
||||
requestID: message.requestID,
|
||||
success: !0,
|
||||
basisFormat: fallbackMode ? basisFallbackFormat : basisFormat,
|
||||
imageArray
|
||||
};
|
||||
}
|
||||
};
|
||||
self.onmessage = (e) => {
|
||||
const msg = e.data, response = messageHandlers[msg.type](msg);
|
||||
response && self.postMessage(response);
|
||||
};
|
||||
}
|
||||
exports.TranscoderWorkerWrapper = TranscoderWorkerWrapper;
|
||||
//# sourceMappingURL=TranscoderWorkerWrapper.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.mjs
generated
vendored
Normal file
66
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.mjs
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
function TranscoderWorkerWrapper() {
|
||||
let basisBinding;
|
||||
const messageHandlers = {
|
||||
init: (message) => self.BASIS ? (self.BASIS({ wasmBinary: message.wasmSource }).then((basisLibrary) => {
|
||||
basisLibrary.initializeBasis(), basisBinding = basisLibrary, self.postMessage({
|
||||
type: "init",
|
||||
success: !0
|
||||
});
|
||||
}), null) : (console.warn("jsSource was not prepended?"), {
|
||||
type: "init",
|
||||
success: !1
|
||||
}),
|
||||
transcode(message) {
|
||||
const basisData = message.basisData, BASIS = basisBinding, data = basisData, basisFile = new BASIS.BasisFile(data), imageCount = basisFile.getNumImages(), basisFormat = basisFile.getHasAlpha() ? message.rgbaFormat : message.rgbFormat, basisFallbackFormat = 14, imageArray = new Array(imageCount);
|
||||
let fallbackMode = !1;
|
||||
if (!basisFile.startTranscoding())
|
||||
return basisFile.close(), basisFile.delete(), {
|
||||
type: "transcode",
|
||||
requestID: message.requestID,
|
||||
success: !1,
|
||||
imageArray: null
|
||||
};
|
||||
for (let i = 0; i < imageCount; i++) {
|
||||
const levels = basisFile.getNumLevels(i), imageResource = {
|
||||
imageID: i,
|
||||
levelArray: new Array(),
|
||||
width: null,
|
||||
height: null
|
||||
};
|
||||
for (let j = 0; j < levels; j++) {
|
||||
const format = fallbackMode ? basisFallbackFormat : basisFormat, width = basisFile.getImageWidth(i, j), height = basisFile.getImageHeight(i, j), byteSize = basisFile.getImageTranscodedSizeInBytes(i, j, format), alignedWidth = width + 3 & -4, alignedHeight = height + 3 & -4;
|
||||
j === 0 && (imageResource.width = alignedWidth, imageResource.height = alignedHeight);
|
||||
const imageBuffer = new Uint8Array(byteSize);
|
||||
if (!basisFile.transcodeImage(imageBuffer, i, j, format, !1, !1)) {
|
||||
if (fallbackMode)
|
||||
return console.error(`Basis failed to transcode image ${i}, level ${j}!`), { type: "transcode", requestID: message.requestID, success: !1 };
|
||||
console.warn(`Basis failed to transcode image ${i}, level ${j}! Retrying to an uncompressed texture format!`), i = -1, fallbackMode = !0;
|
||||
break;
|
||||
}
|
||||
imageResource.levelArray.push({
|
||||
levelID: j,
|
||||
levelWidth: width,
|
||||
levelHeight: height,
|
||||
levelBuffer: imageBuffer
|
||||
});
|
||||
}
|
||||
imageArray[i] = imageResource;
|
||||
}
|
||||
return basisFile.close(), basisFile.delete(), {
|
||||
type: "transcode",
|
||||
requestID: message.requestID,
|
||||
success: !0,
|
||||
basisFormat: fallbackMode ? basisFallbackFormat : basisFormat,
|
||||
imageArray
|
||||
};
|
||||
}
|
||||
};
|
||||
self.onmessage = (e) => {
|
||||
const msg = e.data, response = messageHandlers[msg.type](msg);
|
||||
response && self.postMessage(response);
|
||||
};
|
||||
}
|
||||
export {
|
||||
TranscoderWorkerWrapper
|
||||
};
|
||||
//# sourceMappingURL=TranscoderWorkerWrapper.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/TranscoderWorkerWrapper.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
resources/app/node_modules/@pixi/basis/lib/index.js
generated
vendored
Normal file
14
resources/app/node_modules/@pixi/basis/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
var Basis = require("./Basis.js");
|
||||
require("./loader/index.js");
|
||||
var TranscoderWorker = require("./TranscoderWorker.js"), BasisParser = require("./loader/BasisParser.js"), detectBasis = require("./loader/detectBasis.js"), loadBasis = require("./loader/loadBasis.js");
|
||||
exports.BASIS_FORMATS = Basis.BASIS_FORMATS;
|
||||
exports.BASIS_FORMATS_ALPHA = Basis.BASIS_FORMATS_ALPHA;
|
||||
exports.BASIS_FORMAT_TO_INTERNAL_FORMAT = Basis.BASIS_FORMAT_TO_INTERNAL_FORMAT;
|
||||
exports.BASIS_FORMAT_TO_TYPE = Basis.BASIS_FORMAT_TO_TYPE;
|
||||
exports.INTERNAL_FORMAT_TO_BASIS_FORMAT = Basis.INTERNAL_FORMAT_TO_BASIS_FORMAT;
|
||||
exports.TranscoderWorker = TranscoderWorker.TranscoderWorker;
|
||||
exports.BasisParser = BasisParser.BasisParser;
|
||||
exports.detectBasis = detectBasis.detectBasis;
|
||||
exports.loadBasis = loadBasis.loadBasis;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/index.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
||||
18
resources/app/node_modules/@pixi/basis/lib/index.mjs
generated
vendored
Normal file
18
resources/app/node_modules/@pixi/basis/lib/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { BASIS_FORMATS, BASIS_FORMATS_ALPHA, BASIS_FORMAT_TO_INTERNAL_FORMAT, BASIS_FORMAT_TO_TYPE, INTERNAL_FORMAT_TO_BASIS_FORMAT } from "./Basis.mjs";
|
||||
import "./loader/index.mjs";
|
||||
import { TranscoderWorker } from "./TranscoderWorker.mjs";
|
||||
import { BasisParser } from "./loader/BasisParser.mjs";
|
||||
import { detectBasis } from "./loader/detectBasis.mjs";
|
||||
import { loadBasis } from "./loader/loadBasis.mjs";
|
||||
export {
|
||||
BASIS_FORMATS,
|
||||
BASIS_FORMATS_ALPHA,
|
||||
BASIS_FORMAT_TO_INTERNAL_FORMAT,
|
||||
BASIS_FORMAT_TO_TYPE,
|
||||
BasisParser,
|
||||
INTERNAL_FORMAT_TO_BASIS_FORMAT,
|
||||
TranscoderWorker,
|
||||
detectBasis,
|
||||
loadBasis
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/index.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
||||
203
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.js
generated
vendored
Normal file
203
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.js
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
"use strict";
|
||||
var compressedTextures = require("@pixi/compressed-textures"), core = require("@pixi/core"), Basis = require("../Basis.js"), TranscoderWorker = require("../TranscoderWorker.js");
|
||||
const _BasisParser = class _BasisParser2 {
|
||||
/**
|
||||
* Runs transcoding and populates imageArray. It will run the transcoding in a web worker
|
||||
* if they are available.
|
||||
* @private
|
||||
*/
|
||||
static async transcode(arrayBuffer) {
|
||||
let resources;
|
||||
return typeof Worker < "u" && _BasisParser2.TranscoderWorker.wasmSource ? resources = await _BasisParser2.transcodeAsync(arrayBuffer) : resources = _BasisParser2.transcodeSync(arrayBuffer), resources;
|
||||
}
|
||||
/**
|
||||
* Finds a suitable worker for transcoding and sends a transcoding request
|
||||
* @private
|
||||
* @async
|
||||
*/
|
||||
static async transcodeAsync(arrayBuffer) {
|
||||
!_BasisParser2.defaultRGBAFormat && !_BasisParser2.defaultRGBFormat && _BasisParser2.autoDetectFormats();
|
||||
const workerPool = _BasisParser2.workerPool;
|
||||
let leastLoad = 268435456, worker = null;
|
||||
for (let i = 0, j = workerPool.length; i < j; i++)
|
||||
workerPool[i].load < leastLoad && (worker = workerPool[i], leastLoad = worker.load);
|
||||
worker || (worker = new TranscoderWorker.TranscoderWorker(), workerPool.push(worker)), await worker.initAsync();
|
||||
const response = await worker.transcodeAsync(
|
||||
new Uint8Array(arrayBuffer),
|
||||
_BasisParser2.defaultRGBAFormat.basisFormat,
|
||||
_BasisParser2.defaultRGBFormat.basisFormat
|
||||
), basisFormat = response.basisFormat, imageArray = response.imageArray, fallbackMode = basisFormat > 12;
|
||||
let imageResources;
|
||||
if (fallbackMode)
|
||||
imageResources = imageArray.map(
|
||||
(image) => new core.BufferResource(
|
||||
new Uint16Array(image.levelArray[0].levelBuffer.buffer),
|
||||
{
|
||||
width: image.width,
|
||||
height: image.height
|
||||
}
|
||||
)
|
||||
);
|
||||
else {
|
||||
const format = Basis.BASIS_FORMAT_TO_INTERNAL_FORMAT[response.basisFormat];
|
||||
imageResources = new Array(imageArray.length);
|
||||
for (let i = 0, j = imageArray.length; i < j; i++)
|
||||
imageResources[i] = new compressedTextures.CompressedTextureResource(null, {
|
||||
format,
|
||||
width: imageArray[i].width,
|
||||
height: imageArray[i].height,
|
||||
levelBuffers: imageArray[i].levelArray,
|
||||
levels: imageArray[i].levelArray.length
|
||||
});
|
||||
}
|
||||
return imageResources.basisFormat = basisFormat, imageResources;
|
||||
}
|
||||
/**
|
||||
* Runs transcoding on the main thread.
|
||||
* @private
|
||||
*/
|
||||
static transcodeSync(arrayBuffer) {
|
||||
!_BasisParser2.defaultRGBAFormat && !_BasisParser2.defaultRGBFormat && _BasisParser2.autoDetectFormats();
|
||||
const BASIS = _BasisParser2.basisBinding, data = new Uint8Array(arrayBuffer), basisFile = new BASIS.BasisFile(data), imageCount = basisFile.getNumImages(), basisFormat = basisFile.getHasAlpha() ? _BasisParser2.defaultRGBAFormat.basisFormat : _BasisParser2.defaultRGBFormat.basisFormat, basisFallbackFormat = Basis.BASIS_FORMATS.cTFRGB565, imageResources = new Array(imageCount);
|
||||
let fallbackMode = _BasisParser2.fallbackMode;
|
||||
if (!basisFile.startTranscoding())
|
||||
return console.error("Basis failed to start transcoding!"), basisFile.close(), basisFile.delete(), null;
|
||||
for (let i = 0; i < imageCount; i++) {
|
||||
const levels = fallbackMode ? 1 : basisFile.getNumLevels(i), width = basisFile.getImageWidth(i, 0), height = basisFile.getImageHeight(i, 0), alignedWidth = width + 3 & -4, alignedHeight = height + 3 & -4, imageLevels = new Array(levels);
|
||||
for (let j = 0; j < levels; j++) {
|
||||
const levelWidth = basisFile.getImageWidth(i, j), levelHeight = basisFile.getImageHeight(i, j), byteSize = basisFile.getImageTranscodedSizeInBytes(
|
||||
i,
|
||||
0,
|
||||
fallbackMode ? basisFallbackFormat : basisFormat
|
||||
);
|
||||
if (imageLevels[j] = {
|
||||
levelID: j,
|
||||
levelBuffer: new Uint8Array(byteSize),
|
||||
levelWidth,
|
||||
levelHeight
|
||||
}, !basisFile.transcodeImage(
|
||||
imageLevels[j].levelBuffer,
|
||||
i,
|
||||
0,
|
||||
fallbackMode ? basisFallbackFormat : basisFormat,
|
||||
!1,
|
||||
!1
|
||||
))
|
||||
if (fallbackMode) {
|
||||
console.error(`Basis failed to transcode image ${i}, level 0!`);
|
||||
break;
|
||||
} else {
|
||||
i = -1, fallbackMode = !0, console.warn(`Basis failed to transcode image ${i}, level 0 to a compressed texture format. Retrying to an uncompressed fallback format!`);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let imageResource;
|
||||
fallbackMode ? imageResource = new core.BufferResource(
|
||||
new Uint16Array(imageLevels[0].levelBuffer.buffer),
|
||||
{ width, height }
|
||||
) : imageResource = new compressedTextures.CompressedTextureResource(null, {
|
||||
format: Basis.BASIS_FORMAT_TO_INTERNAL_FORMAT[basisFormat],
|
||||
width: alignedWidth,
|
||||
height: alignedHeight,
|
||||
levelBuffers: imageLevels,
|
||||
levels
|
||||
}), imageResources[i] = imageResource;
|
||||
}
|
||||
basisFile.close(), basisFile.delete();
|
||||
const transcodedResources = imageResources;
|
||||
return transcodedResources.basisFormat = fallbackMode ? basisFallbackFormat : basisFormat, transcodedResources;
|
||||
}
|
||||
/**
|
||||
* Detects the available compressed texture formats on the device.
|
||||
* @param extensions - extensions provided by a WebGL context
|
||||
* @ignore
|
||||
*/
|
||||
static autoDetectFormats(extensions) {
|
||||
if (!extensions) {
|
||||
const gl = core.settings.ADAPTER.createCanvas().getContext("webgl");
|
||||
if (!gl) {
|
||||
console.error("WebGL not available for BASIS transcoding. Silently failing.");
|
||||
return;
|
||||
}
|
||||
extensions = {
|
||||
bptc: gl.getExtension("EXT_texture_compression_bptc"),
|
||||
astc: gl.getExtension("WEBGL_compressed_texture_astc"),
|
||||
etc: gl.getExtension("WEBGL_compressed_texture_etc"),
|
||||
s3tc: gl.getExtension("WEBGL_compressed_texture_s3tc"),
|
||||
s3tc_sRGB: gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
|
||||
/* eslint-disable-line camelcase */
|
||||
pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
|
||||
etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
|
||||
atc: gl.getExtension("WEBGL_compressed_texture_atc")
|
||||
};
|
||||
}
|
||||
const supportedFormats = {};
|
||||
for (const key in extensions) {
|
||||
const extension = extensions[key];
|
||||
extension && Object.assign(supportedFormats, Object.getPrototypeOf(extension));
|
||||
}
|
||||
for (let i = 0; i < 2; i++) {
|
||||
const detectWithAlpha = !!i;
|
||||
let internalFormat, basisFormat;
|
||||
for (const id in supportedFormats)
|
||||
if (internalFormat = supportedFormats[id], basisFormat = Basis.INTERNAL_FORMAT_TO_BASIS_FORMAT[internalFormat], basisFormat !== void 0 && (detectWithAlpha && Basis.BASIS_FORMATS_ALPHA[basisFormat] || !detectWithAlpha && !Basis.BASIS_FORMATS_ALPHA[basisFormat]))
|
||||
break;
|
||||
internalFormat ? _BasisParser2[detectWithAlpha ? "defaultRGBAFormat" : "defaultRGBFormat"] = {
|
||||
textureFormat: internalFormat,
|
||||
basisFormat
|
||||
} : (_BasisParser2[detectWithAlpha ? "defaultRGBAFormat" : "defaultRGBFormat"] = {
|
||||
textureFormat: core.TYPES.UNSIGNED_SHORT_5_6_5,
|
||||
basisFormat: Basis.BASIS_FORMATS.cTFRGB565
|
||||
}, _BasisParser2.fallbackMode = !0);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Binds the basis_universal transcoder to decompress *.basis files. You must initialize the transcoder library yourself.
|
||||
* @example
|
||||
* import { BasisParser } from '@pixi/basis';
|
||||
*
|
||||
* // BASIS() returns a Promise-like object
|
||||
* globalThis.BASIS().then((basisLibrary) =>
|
||||
* {
|
||||
* // Initialize basis-library; otherwise, transcoded results maybe corrupt!
|
||||
* basisLibrary.initializeBasis();
|
||||
*
|
||||
* // Bind BasisParser to the transcoder
|
||||
* BasisParser.bindTranscoder(basisLibrary);
|
||||
* });
|
||||
* @param basisLibrary - the initialized transcoder library
|
||||
* @private
|
||||
*/
|
||||
static bindTranscoder(basisLibrary) {
|
||||
_BasisParser2.basisBinding = basisLibrary;
|
||||
}
|
||||
/**
|
||||
* Loads the transcoder source code for use in {@link PIXI.BasisParser.TranscoderWorker}.
|
||||
* @private
|
||||
* @param jsURL - URL to the javascript basis transcoder
|
||||
* @param wasmURL - URL to the wasm basis transcoder
|
||||
*/
|
||||
static loadTranscoder(jsURL, wasmURL) {
|
||||
return _BasisParser2.TranscoderWorker.loadTranscoder(jsURL, wasmURL);
|
||||
}
|
||||
/**
|
||||
* Set the transcoder source code directly
|
||||
* @private
|
||||
* @param jsSource - source for the javascript basis transcoder
|
||||
* @param wasmSource - source for the wasm basis transcoder
|
||||
*/
|
||||
static setTranscoder(jsSource, wasmSource) {
|
||||
_BasisParser2.TranscoderWorker.setTranscoder(jsSource, wasmSource);
|
||||
}
|
||||
static get TRANSCODER_WORKER_POOL_LIMIT() {
|
||||
return this.workerPool.length || 1;
|
||||
}
|
||||
static set TRANSCODER_WORKER_POOL_LIMIT(limit) {
|
||||
for (let i = this.workerPool.length; i < limit; i++)
|
||||
this.workerPool[i] = new TranscoderWorker.TranscoderWorker(), this.workerPool[i].initAsync();
|
||||
}
|
||||
};
|
||||
_BasisParser.fallbackMode = !1, _BasisParser.workerPool = [], _BasisParser.TranscoderWorker = TranscoderWorker.TranscoderWorker;
|
||||
let BasisParser = _BasisParser;
|
||||
exports.BasisParser = BasisParser;
|
||||
//# sourceMappingURL=BasisParser.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
207
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.mjs
generated
vendored
Normal file
207
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.mjs
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
import { CompressedTextureResource } from "@pixi/compressed-textures";
|
||||
import { BufferResource, settings, TYPES } from "@pixi/core";
|
||||
import { BASIS_FORMAT_TO_INTERNAL_FORMAT, BASIS_FORMATS, INTERNAL_FORMAT_TO_BASIS_FORMAT, BASIS_FORMATS_ALPHA } from "../Basis.mjs";
|
||||
import { TranscoderWorker } from "../TranscoderWorker.mjs";
|
||||
const _BasisParser = class _BasisParser2 {
|
||||
/**
|
||||
* Runs transcoding and populates imageArray. It will run the transcoding in a web worker
|
||||
* if they are available.
|
||||
* @private
|
||||
*/
|
||||
static async transcode(arrayBuffer) {
|
||||
let resources;
|
||||
return typeof Worker < "u" && _BasisParser2.TranscoderWorker.wasmSource ? resources = await _BasisParser2.transcodeAsync(arrayBuffer) : resources = _BasisParser2.transcodeSync(arrayBuffer), resources;
|
||||
}
|
||||
/**
|
||||
* Finds a suitable worker for transcoding and sends a transcoding request
|
||||
* @private
|
||||
* @async
|
||||
*/
|
||||
static async transcodeAsync(arrayBuffer) {
|
||||
!_BasisParser2.defaultRGBAFormat && !_BasisParser2.defaultRGBFormat && _BasisParser2.autoDetectFormats();
|
||||
const workerPool = _BasisParser2.workerPool;
|
||||
let leastLoad = 268435456, worker = null;
|
||||
for (let i = 0, j = workerPool.length; i < j; i++)
|
||||
workerPool[i].load < leastLoad && (worker = workerPool[i], leastLoad = worker.load);
|
||||
worker || (worker = new TranscoderWorker(), workerPool.push(worker)), await worker.initAsync();
|
||||
const response = await worker.transcodeAsync(
|
||||
new Uint8Array(arrayBuffer),
|
||||
_BasisParser2.defaultRGBAFormat.basisFormat,
|
||||
_BasisParser2.defaultRGBFormat.basisFormat
|
||||
), basisFormat = response.basisFormat, imageArray = response.imageArray, fallbackMode = basisFormat > 12;
|
||||
let imageResources;
|
||||
if (fallbackMode)
|
||||
imageResources = imageArray.map(
|
||||
(image) => new BufferResource(
|
||||
new Uint16Array(image.levelArray[0].levelBuffer.buffer),
|
||||
{
|
||||
width: image.width,
|
||||
height: image.height
|
||||
}
|
||||
)
|
||||
);
|
||||
else {
|
||||
const format = BASIS_FORMAT_TO_INTERNAL_FORMAT[response.basisFormat];
|
||||
imageResources = new Array(imageArray.length);
|
||||
for (let i = 0, j = imageArray.length; i < j; i++)
|
||||
imageResources[i] = new CompressedTextureResource(null, {
|
||||
format,
|
||||
width: imageArray[i].width,
|
||||
height: imageArray[i].height,
|
||||
levelBuffers: imageArray[i].levelArray,
|
||||
levels: imageArray[i].levelArray.length
|
||||
});
|
||||
}
|
||||
return imageResources.basisFormat = basisFormat, imageResources;
|
||||
}
|
||||
/**
|
||||
* Runs transcoding on the main thread.
|
||||
* @private
|
||||
*/
|
||||
static transcodeSync(arrayBuffer) {
|
||||
!_BasisParser2.defaultRGBAFormat && !_BasisParser2.defaultRGBFormat && _BasisParser2.autoDetectFormats();
|
||||
const BASIS = _BasisParser2.basisBinding, data = new Uint8Array(arrayBuffer), basisFile = new BASIS.BasisFile(data), imageCount = basisFile.getNumImages(), basisFormat = basisFile.getHasAlpha() ? _BasisParser2.defaultRGBAFormat.basisFormat : _BasisParser2.defaultRGBFormat.basisFormat, basisFallbackFormat = BASIS_FORMATS.cTFRGB565, imageResources = new Array(imageCount);
|
||||
let fallbackMode = _BasisParser2.fallbackMode;
|
||||
if (!basisFile.startTranscoding())
|
||||
return console.error("Basis failed to start transcoding!"), basisFile.close(), basisFile.delete(), null;
|
||||
for (let i = 0; i < imageCount; i++) {
|
||||
const levels = fallbackMode ? 1 : basisFile.getNumLevels(i), width = basisFile.getImageWidth(i, 0), height = basisFile.getImageHeight(i, 0), alignedWidth = width + 3 & -4, alignedHeight = height + 3 & -4, imageLevels = new Array(levels);
|
||||
for (let j = 0; j < levels; j++) {
|
||||
const levelWidth = basisFile.getImageWidth(i, j), levelHeight = basisFile.getImageHeight(i, j), byteSize = basisFile.getImageTranscodedSizeInBytes(
|
||||
i,
|
||||
0,
|
||||
fallbackMode ? basisFallbackFormat : basisFormat
|
||||
);
|
||||
if (imageLevels[j] = {
|
||||
levelID: j,
|
||||
levelBuffer: new Uint8Array(byteSize),
|
||||
levelWidth,
|
||||
levelHeight
|
||||
}, !basisFile.transcodeImage(
|
||||
imageLevels[j].levelBuffer,
|
||||
i,
|
||||
0,
|
||||
fallbackMode ? basisFallbackFormat : basisFormat,
|
||||
!1,
|
||||
!1
|
||||
))
|
||||
if (fallbackMode) {
|
||||
console.error(`Basis failed to transcode image ${i}, level 0!`);
|
||||
break;
|
||||
} else {
|
||||
i = -1, fallbackMode = !0, console.warn(`Basis failed to transcode image ${i}, level 0 to a compressed texture format. Retrying to an uncompressed fallback format!`);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
let imageResource;
|
||||
fallbackMode ? imageResource = new BufferResource(
|
||||
new Uint16Array(imageLevels[0].levelBuffer.buffer),
|
||||
{ width, height }
|
||||
) : imageResource = new CompressedTextureResource(null, {
|
||||
format: BASIS_FORMAT_TO_INTERNAL_FORMAT[basisFormat],
|
||||
width: alignedWidth,
|
||||
height: alignedHeight,
|
||||
levelBuffers: imageLevels,
|
||||
levels
|
||||
}), imageResources[i] = imageResource;
|
||||
}
|
||||
basisFile.close(), basisFile.delete();
|
||||
const transcodedResources = imageResources;
|
||||
return transcodedResources.basisFormat = fallbackMode ? basisFallbackFormat : basisFormat, transcodedResources;
|
||||
}
|
||||
/**
|
||||
* Detects the available compressed texture formats on the device.
|
||||
* @param extensions - extensions provided by a WebGL context
|
||||
* @ignore
|
||||
*/
|
||||
static autoDetectFormats(extensions) {
|
||||
if (!extensions) {
|
||||
const gl = settings.ADAPTER.createCanvas().getContext("webgl");
|
||||
if (!gl) {
|
||||
console.error("WebGL not available for BASIS transcoding. Silently failing.");
|
||||
return;
|
||||
}
|
||||
extensions = {
|
||||
bptc: gl.getExtension("EXT_texture_compression_bptc"),
|
||||
astc: gl.getExtension("WEBGL_compressed_texture_astc"),
|
||||
etc: gl.getExtension("WEBGL_compressed_texture_etc"),
|
||||
s3tc: gl.getExtension("WEBGL_compressed_texture_s3tc"),
|
||||
s3tc_sRGB: gl.getExtension("WEBGL_compressed_texture_s3tc_srgb"),
|
||||
/* eslint-disable-line camelcase */
|
||||
pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
|
||||
etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
|
||||
atc: gl.getExtension("WEBGL_compressed_texture_atc")
|
||||
};
|
||||
}
|
||||
const supportedFormats = {};
|
||||
for (const key in extensions) {
|
||||
const extension = extensions[key];
|
||||
extension && Object.assign(supportedFormats, Object.getPrototypeOf(extension));
|
||||
}
|
||||
for (let i = 0; i < 2; i++) {
|
||||
const detectWithAlpha = !!i;
|
||||
let internalFormat, basisFormat;
|
||||
for (const id in supportedFormats)
|
||||
if (internalFormat = supportedFormats[id], basisFormat = INTERNAL_FORMAT_TO_BASIS_FORMAT[internalFormat], basisFormat !== void 0 && (detectWithAlpha && BASIS_FORMATS_ALPHA[basisFormat] || !detectWithAlpha && !BASIS_FORMATS_ALPHA[basisFormat]))
|
||||
break;
|
||||
internalFormat ? _BasisParser2[detectWithAlpha ? "defaultRGBAFormat" : "defaultRGBFormat"] = {
|
||||
textureFormat: internalFormat,
|
||||
basisFormat
|
||||
} : (_BasisParser2[detectWithAlpha ? "defaultRGBAFormat" : "defaultRGBFormat"] = {
|
||||
textureFormat: TYPES.UNSIGNED_SHORT_5_6_5,
|
||||
basisFormat: BASIS_FORMATS.cTFRGB565
|
||||
}, _BasisParser2.fallbackMode = !0);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Binds the basis_universal transcoder to decompress *.basis files. You must initialize the transcoder library yourself.
|
||||
* @example
|
||||
* import { BasisParser } from '@pixi/basis';
|
||||
*
|
||||
* // BASIS() returns a Promise-like object
|
||||
* globalThis.BASIS().then((basisLibrary) =>
|
||||
* {
|
||||
* // Initialize basis-library; otherwise, transcoded results maybe corrupt!
|
||||
* basisLibrary.initializeBasis();
|
||||
*
|
||||
* // Bind BasisParser to the transcoder
|
||||
* BasisParser.bindTranscoder(basisLibrary);
|
||||
* });
|
||||
* @param basisLibrary - the initialized transcoder library
|
||||
* @private
|
||||
*/
|
||||
static bindTranscoder(basisLibrary) {
|
||||
_BasisParser2.basisBinding = basisLibrary;
|
||||
}
|
||||
/**
|
||||
* Loads the transcoder source code for use in {@link PIXI.BasisParser.TranscoderWorker}.
|
||||
* @private
|
||||
* @param jsURL - URL to the javascript basis transcoder
|
||||
* @param wasmURL - URL to the wasm basis transcoder
|
||||
*/
|
||||
static loadTranscoder(jsURL, wasmURL) {
|
||||
return _BasisParser2.TranscoderWorker.loadTranscoder(jsURL, wasmURL);
|
||||
}
|
||||
/**
|
||||
* Set the transcoder source code directly
|
||||
* @private
|
||||
* @param jsSource - source for the javascript basis transcoder
|
||||
* @param wasmSource - source for the wasm basis transcoder
|
||||
*/
|
||||
static setTranscoder(jsSource, wasmSource) {
|
||||
_BasisParser2.TranscoderWorker.setTranscoder(jsSource, wasmSource);
|
||||
}
|
||||
static get TRANSCODER_WORKER_POOL_LIMIT() {
|
||||
return this.workerPool.length || 1;
|
||||
}
|
||||
static set TRANSCODER_WORKER_POOL_LIMIT(limit) {
|
||||
for (let i = this.workerPool.length; i < limit; i++)
|
||||
this.workerPool[i] = new TranscoderWorker(), this.workerPool[i].initAsync();
|
||||
}
|
||||
};
|
||||
_BasisParser.fallbackMode = !1, _BasisParser.workerPool = [], _BasisParser.TranscoderWorker = TranscoderWorker;
|
||||
let BasisParser = _BasisParser;
|
||||
export {
|
||||
BasisParser
|
||||
};
|
||||
//# sourceMappingURL=BasisParser.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/BasisParser.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.js
generated
vendored
Normal file
14
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
var core = require("@pixi/core"), BasisParser = require("./BasisParser.js");
|
||||
const detectBasis = {
|
||||
extension: {
|
||||
type: core.ExtensionType.DetectionParser,
|
||||
priority: 3
|
||||
},
|
||||
test: async () => !!(BasisParser.BasisParser.basisBinding && BasisParser.BasisParser.TranscoderWorker.wasmSource),
|
||||
add: async (formats) => [...formats, "basis"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "basis")
|
||||
};
|
||||
core.extensions.add(detectBasis);
|
||||
exports.detectBasis = detectBasis;
|
||||
//# sourceMappingURL=detectBasis.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectBasis.js","sources":["../../src/loader/detectBasis.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { BasisParser } from './BasisParser';\n\nimport type { FormatDetectionParser } from '@pixi/assets';\n\nexport const detectBasis = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 3,\n },\n test: async (): Promise<boolean> => !!(BasisParser.basisBinding && BasisParser.TranscoderWorker.wasmSource),\n add: async (formats) => [...formats, 'basis'],\n remove: async (formats) => formats.filter((f) => f !== 'basis'),\n} as FormatDetectionParser;\n\nextensions.add(detectBasis);\n"],"names":["ExtensionType","BasisParser","extensions"],"mappings":";;AAKO,MAAM,cAAc;AAAA,EACvB,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8B,CAAC,EAAEC,YAAY,YAAA,gBAAgBA,wBAAY,iBAAiB;AAAA,EAChG,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,OAAO;AAAA,EAC5C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,OAAO;AAClE;AAEAC,KAAAA,WAAW,IAAI,WAAW;;"}
|
||||
16
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.mjs
generated
vendored
Normal file
16
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.mjs
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ExtensionType, extensions } from "@pixi/core";
|
||||
import { BasisParser } from "./BasisParser.mjs";
|
||||
const detectBasis = {
|
||||
extension: {
|
||||
type: ExtensionType.DetectionParser,
|
||||
priority: 3
|
||||
},
|
||||
test: async () => !!(BasisParser.basisBinding && BasisParser.TranscoderWorker.wasmSource),
|
||||
add: async (formats) => [...formats, "basis"],
|
||||
remove: async (formats) => formats.filter((f) => f !== "basis")
|
||||
};
|
||||
extensions.add(detectBasis);
|
||||
export {
|
||||
detectBasis
|
||||
};
|
||||
//# sourceMappingURL=detectBasis.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/detectBasis.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectBasis.mjs","sources":["../../src/loader/detectBasis.ts"],"sourcesContent":["import { extensions, ExtensionType } from '@pixi/core';\nimport { BasisParser } from './BasisParser';\n\nimport type { FormatDetectionParser } from '@pixi/assets';\n\nexport const detectBasis = {\n extension: {\n type: ExtensionType.DetectionParser,\n priority: 3,\n },\n test: async (): Promise<boolean> => !!(BasisParser.basisBinding && BasisParser.TranscoderWorker.wasmSource),\n add: async (formats) => [...formats, 'basis'],\n remove: async (formats) => formats.filter((f) => f !== 'basis'),\n} as FormatDetectionParser;\n\nextensions.add(detectBasis);\n"],"names":[],"mappings":";;AAKO,MAAM,cAAc;AAAA,EACvB,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU;AAAA,EACd;AAAA,EACA,MAAM,YAA8B,CAAC,EAAE,YAAY,gBAAgB,YAAY,iBAAiB;AAAA,EAChG,KAAK,OAAO,YAAY,CAAC,GAAG,SAAS,OAAO;AAAA,EAC5C,QAAQ,OAAO,YAAY,QAAQ,OAAO,CAAC,MAAM,MAAM,OAAO;AAClE;AAEA,WAAW,IAAI,WAAW;"}
|
||||
6
resources/app/node_modules/@pixi/basis/lib/loader/index.js
generated
vendored
Normal file
6
resources/app/node_modules/@pixi/basis/lib/loader/index.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
var BasisParser = require("./BasisParser.js"), detectBasis = require("./detectBasis.js"), loadBasis = require("./loadBasis.js");
|
||||
exports.BasisParser = BasisParser.BasisParser;
|
||||
exports.detectBasis = detectBasis.detectBasis;
|
||||
exports.loadBasis = loadBasis.loadBasis;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/index.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
||||
9
resources/app/node_modules/@pixi/basis/lib/loader/index.mjs
generated
vendored
Normal file
9
resources/app/node_modules/@pixi/basis/lib/loader/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { BasisParser } from "./BasisParser.mjs";
|
||||
import { detectBasis } from "./detectBasis.mjs";
|
||||
import { loadBasis } from "./loadBasis.mjs";
|
||||
export {
|
||||
BasisParser,
|
||||
detectBasis,
|
||||
loadBasis
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/index.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
||||
32
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.js
generated
vendored
Normal file
32
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
var assets = require("@pixi/assets"), compressedTextures = require("@pixi/compressed-textures"), core = require("@pixi/core"), Basis = require("../Basis.js"), TranscoderWorker = require("../TranscoderWorker.js"), BasisParser = require("./BasisParser.js");
|
||||
const loadBasis = {
|
||||
extension: {
|
||||
type: core.ExtensionType.LoadParser,
|
||||
priority: assets.LoaderParserPriority.High
|
||||
},
|
||||
name: "loadBasis",
|
||||
test(url) {
|
||||
return assets.checkExtension(url, ".basis");
|
||||
},
|
||||
async load(url, asset, loader) {
|
||||
await TranscoderWorker.TranscoderWorker.onTranscoderInitialized;
|
||||
const arrayBuffer = await (await core.settings.ADAPTER.fetch(url)).arrayBuffer(), resources = await BasisParser.BasisParser.transcode(arrayBuffer), type = Basis.BASIS_FORMAT_TO_TYPE[resources.basisFormat], format = resources.basisFormat !== Basis.BASIS_FORMATS.cTFRGBA32 ? core.FORMATS.RGB : core.FORMATS.RGBA, textures = resources.map((resource) => {
|
||||
const base = new core.BaseTexture(resource, {
|
||||
mipmap: resource instanceof compressedTextures.CompressedTextureResource && resource.levels > 1 ? core.MIPMAP_MODES.ON_MANUAL : core.MIPMAP_MODES.OFF,
|
||||
alphaMode: core.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,
|
||||
type,
|
||||
format,
|
||||
...asset.data
|
||||
});
|
||||
return assets.createTexture(base, loader, url);
|
||||
});
|
||||
return textures.length === 1 ? textures[0] : textures;
|
||||
},
|
||||
unload(texture) {
|
||||
Array.isArray(texture) ? texture.forEach((t) => t.destroy(!0)) : texture.destroy(!0);
|
||||
}
|
||||
};
|
||||
core.extensions.add(loadBasis);
|
||||
exports.loadBasis = loadBasis;
|
||||
//# sourceMappingURL=loadBasis.js.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.js.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadBasis.js","sources":["../../src/loader/loadBasis.ts"],"sourcesContent":["import { checkExtension, createTexture, LoaderParserPriority } from '@pixi/assets';\nimport { CompressedTextureResource } from '@pixi/compressed-textures';\nimport { ALPHA_MODES, BaseTexture, extensions, ExtensionType, FORMATS, MIPMAP_MODES, settings } from '@pixi/core';\nimport { BASIS_FORMAT_TO_TYPE, BASIS_FORMATS } from '../Basis';\nimport { TranscoderWorker } from '../TranscoderWorker';\nimport { BasisParser } from './BasisParser';\n\nimport type { Loader, LoaderParser, ResolvedAsset } from '@pixi/assets';\nimport type { IBaseTextureOptions, Texture, TYPES } from '@pixi/core';\n\n/** Load BASIS textures! */\nexport const loadBasis = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.High,\n },\n\n name: 'loadBasis',\n\n test(url: string): boolean\n {\n return checkExtension(url, '.basis');\n },\n\n async load(url: string, asset: ResolvedAsset, loader: Loader): Promise<Texture | Texture[]>\n {\n await TranscoderWorker.onTranscoderInitialized;\n\n // get an array buffer...\n const response = await settings.ADAPTER.fetch(url);\n\n const arrayBuffer = await response.arrayBuffer();\n\n const resources = await BasisParser.transcode(arrayBuffer);\n\n const type: TYPES = BASIS_FORMAT_TO_TYPE[resources.basisFormat];\n const format: FORMATS = resources.basisFormat !== BASIS_FORMATS.cTFRGBA32 ? FORMATS.RGB : FORMATS.RGBA;\n\n const textures = resources.map((resource) =>\n {\n const base = new BaseTexture(resource, {\n mipmap: resource instanceof CompressedTextureResource && resource.levels > 1\n ? MIPMAP_MODES.ON_MANUAL\n : MIPMAP_MODES.OFF,\n alphaMode: ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,\n type,\n format,\n ...asset.data,\n });\n\n return createTexture(base, loader, url);\n });\n\n return textures.length === 1 ? textures[0] : textures;\n },\n\n unload(texture): void\n {\n if (Array.isArray(texture))\n {\n texture.forEach((t) => t.destroy(true));\n }\n else\n {\n texture.destroy(true);\n }\n }\n\n} as LoaderParser<Texture | Texture[], IBaseTextureOptions>;\n\nextensions.add(loadBasis);\n"],"names":["ExtensionType","LoaderParserPriority","checkExtension","TranscoderWorker","settings","BasisParser","BASIS_FORMAT_TO_TYPE","BASIS_FORMATS","FORMATS","BaseTexture","CompressedTextureResource","MIPMAP_MODES","ALPHA_MODES","createTexture","extensions"],"mappings":";;AAWO,MAAM,YAAY;AAAA,EACrB,WAAW;AAAA,IACP,MAAMA,KAAc,cAAA;AAAA,IACpB,UAAUC,OAAqB,qBAAA;AAAA,EACnC;AAAA,EAEA,MAAM;AAAA,EAEN,KAAK,KACL;AACW,WAAAC,OAAA,eAAe,KAAK,QAAQ;AAAA,EACvC;AAAA,EAEA,MAAM,KAAK,KAAa,OAAsB,QAC9C;AACI,UAAMC,iBAAAA,iBAAiB;AAKvB,UAAM,cAAc,OAFH,MAAMC,KAAA,SAAS,QAAQ,MAAM,GAAG,GAEd,eAE7B,YAAY,MAAMC,YAAAA,YAAY,UAAU,WAAW,GAEnD,OAAcC,MAAAA,qBAAqB,UAAU,WAAW,GACxD,SAAkB,UAAU,gBAAgBC,MAAc,cAAA,YAAYC,KAAAA,QAAQ,MAAMA,KAAAA,QAAQ,MAE5F,WAAW,UAAU,IAAI,CAAC,aAChC;AACU,YAAA,OAAO,IAAIC,KAAA,YAAY,UAAU;AAAA,QACnC,QAAQ,oBAAoBC,mBAA6B,6BAAA,SAAS,SAAS,IACrEC,KAAA,aAAa,YACbA,KAAAA,aAAa;AAAA,QACnB,WAAWC,KAAY,YAAA;AAAA,QACvB;AAAA,QACA;AAAA,QACA,GAAG,MAAM;AAAA,MAAA,CACZ;AAEM,aAAAC,qBAAc,MAAM,QAAQ,GAAG;AAAA,IAAA,CACzC;AAED,WAAO,SAAS,WAAW,IAAI,SAAS,CAAC,IAAI;AAAA,EACjD;AAAA,EAEA,OAAO,SACP;AACQ,UAAM,QAAQ,OAAO,IAErB,QAAQ,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAI,CAAC,IAItC,QAAQ,QAAQ,EAAI;AAAA,EAE5B;AAEJ;AAEAC,KAAAA,WAAW,IAAI,SAAS;;"}
|
||||
38
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.mjs
generated
vendored
Normal file
38
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.mjs
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { LoaderParserPriority, checkExtension, createTexture } from "@pixi/assets";
|
||||
import { CompressedTextureResource } from "@pixi/compressed-textures";
|
||||
import { ExtensionType, settings, FORMATS, BaseTexture, MIPMAP_MODES, ALPHA_MODES, extensions } from "@pixi/core";
|
||||
import { BASIS_FORMAT_TO_TYPE, BASIS_FORMATS } from "../Basis.mjs";
|
||||
import { TranscoderWorker } from "../TranscoderWorker.mjs";
|
||||
import { BasisParser } from "./BasisParser.mjs";
|
||||
const loadBasis = {
|
||||
extension: {
|
||||
type: ExtensionType.LoadParser,
|
||||
priority: LoaderParserPriority.High
|
||||
},
|
||||
name: "loadBasis",
|
||||
test(url) {
|
||||
return checkExtension(url, ".basis");
|
||||
},
|
||||
async load(url, asset, loader) {
|
||||
await TranscoderWorker.onTranscoderInitialized;
|
||||
const arrayBuffer = await (await settings.ADAPTER.fetch(url)).arrayBuffer(), resources = await BasisParser.transcode(arrayBuffer), type = BASIS_FORMAT_TO_TYPE[resources.basisFormat], format = resources.basisFormat !== BASIS_FORMATS.cTFRGBA32 ? FORMATS.RGB : FORMATS.RGBA, textures = resources.map((resource) => {
|
||||
const base = new BaseTexture(resource, {
|
||||
mipmap: resource instanceof CompressedTextureResource && resource.levels > 1 ? MIPMAP_MODES.ON_MANUAL : MIPMAP_MODES.OFF,
|
||||
alphaMode: ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,
|
||||
type,
|
||||
format,
|
||||
...asset.data
|
||||
});
|
||||
return createTexture(base, loader, url);
|
||||
});
|
||||
return textures.length === 1 ? textures[0] : textures;
|
||||
},
|
||||
unload(texture) {
|
||||
Array.isArray(texture) ? texture.forEach((t) => t.destroy(!0)) : texture.destroy(!0);
|
||||
}
|
||||
};
|
||||
extensions.add(loadBasis);
|
||||
export {
|
||||
loadBasis
|
||||
};
|
||||
//# sourceMappingURL=loadBasis.mjs.map
|
||||
1
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.mjs.map
generated
vendored
Normal file
1
resources/app/node_modules/@pixi/basis/lib/loader/loadBasis.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"loadBasis.mjs","sources":["../../src/loader/loadBasis.ts"],"sourcesContent":["import { checkExtension, createTexture, LoaderParserPriority } from '@pixi/assets';\nimport { CompressedTextureResource } from '@pixi/compressed-textures';\nimport { ALPHA_MODES, BaseTexture, extensions, ExtensionType, FORMATS, MIPMAP_MODES, settings } from '@pixi/core';\nimport { BASIS_FORMAT_TO_TYPE, BASIS_FORMATS } from '../Basis';\nimport { TranscoderWorker } from '../TranscoderWorker';\nimport { BasisParser } from './BasisParser';\n\nimport type { Loader, LoaderParser, ResolvedAsset } from '@pixi/assets';\nimport type { IBaseTextureOptions, Texture, TYPES } from '@pixi/core';\n\n/** Load BASIS textures! */\nexport const loadBasis = {\n extension: {\n type: ExtensionType.LoadParser,\n priority: LoaderParserPriority.High,\n },\n\n name: 'loadBasis',\n\n test(url: string): boolean\n {\n return checkExtension(url, '.basis');\n },\n\n async load(url: string, asset: ResolvedAsset, loader: Loader): Promise<Texture | Texture[]>\n {\n await TranscoderWorker.onTranscoderInitialized;\n\n // get an array buffer...\n const response = await settings.ADAPTER.fetch(url);\n\n const arrayBuffer = await response.arrayBuffer();\n\n const resources = await BasisParser.transcode(arrayBuffer);\n\n const type: TYPES = BASIS_FORMAT_TO_TYPE[resources.basisFormat];\n const format: FORMATS = resources.basisFormat !== BASIS_FORMATS.cTFRGBA32 ? FORMATS.RGB : FORMATS.RGBA;\n\n const textures = resources.map((resource) =>\n {\n const base = new BaseTexture(resource, {\n mipmap: resource instanceof CompressedTextureResource && resource.levels > 1\n ? MIPMAP_MODES.ON_MANUAL\n : MIPMAP_MODES.OFF,\n alphaMode: ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,\n type,\n format,\n ...asset.data,\n });\n\n return createTexture(base, loader, url);\n });\n\n return textures.length === 1 ? textures[0] : textures;\n },\n\n unload(texture): void\n {\n if (Array.isArray(texture))\n {\n texture.forEach((t) => t.destroy(true));\n }\n else\n {\n texture.destroy(true);\n }\n }\n\n} as LoaderParser<Texture | Texture[], IBaseTextureOptions>;\n\nextensions.add(loadBasis);\n"],"names":[],"mappings":";;;;;;AAWO,MAAM,YAAY;AAAA,EACrB,WAAW;AAAA,IACP,MAAM,cAAc;AAAA,IACpB,UAAU,qBAAqB;AAAA,EACnC;AAAA,EAEA,MAAM;AAAA,EAEN,KAAK,KACL;AACW,WAAA,eAAe,KAAK,QAAQ;AAAA,EACvC;AAAA,EAEA,MAAM,KAAK,KAAa,OAAsB,QAC9C;AACI,UAAM,iBAAiB;AAKvB,UAAM,cAAc,OAFH,MAAM,SAAS,QAAQ,MAAM,GAAG,GAEd,eAE7B,YAAY,MAAM,YAAY,UAAU,WAAW,GAEnD,OAAc,qBAAqB,UAAU,WAAW,GACxD,SAAkB,UAAU,gBAAgB,cAAc,YAAY,QAAQ,MAAM,QAAQ,MAE5F,WAAW,UAAU,IAAI,CAAC,aAChC;AACU,YAAA,OAAO,IAAI,YAAY,UAAU;AAAA,QACnC,QAAQ,oBAAoB,6BAA6B,SAAS,SAAS,IACrE,aAAa,YACb,aAAa;AAAA,QACnB,WAAW,YAAY;AAAA,QACvB;AAAA,QACA;AAAA,QACA,GAAG,MAAM;AAAA,MAAA,CACZ;AAEM,aAAA,cAAc,MAAM,QAAQ,GAAG;AAAA,IAAA,CACzC;AAED,WAAO,SAAS,WAAW,IAAI,SAAS,CAAC,IAAI;AAAA,EACjD;AAAA,EAEA,OAAO,SACP;AACQ,UAAM,QAAQ,OAAO,IAErB,QAAQ,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAI,CAAC,IAItC,QAAQ,QAAQ,EAAI;AAAA,EAE5B;AAEJ;AAEA,WAAW,IAAI,SAAS;"}
|
||||
Reference in New Issue
Block a user