pixi.js 7.3.3 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pixi.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.3.3
3
- * Compiled Mon, 01 Jan 2024 14:18:14 UTC
2
+ * pixi.js - v7.4.0
3
+ * Compiled Sat, 27 Jan 2024 00:20:54 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -2055,20 +2055,20 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2055
2055
  trimCanvas,
2056
2056
  uid,
2057
2057
  url
2058
- }, __defProp$d = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$e = Object.getOwnPropertySymbols, __hasOwnProp$e = Object.prototype.hasOwnProperty, __propIsEnum$e = Object.prototype.propertyIsEnumerable, __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$d = (a2, b2) => {
2058
+ }, __defProp$d = Object.defineProperty, __defProps$5 = Object.defineProperties, __getOwnPropDescs$5 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$e = Object.getOwnPropertySymbols, __hasOwnProp$e = Object.prototype.hasOwnProperty, __propIsEnum$e = Object.prototype.propertyIsEnumerable, __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$d = (a2, b2) => {
2059
2059
  for (var prop in b2 || (b2 = {}))
2060
2060
  __hasOwnProp$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2061
2061
  if (__getOwnPropSymbols$e)
2062
2062
  for (var prop of __getOwnPropSymbols$e(b2))
2063
2063
  __propIsEnum$e.call(b2, prop) && __defNormalProp$d(a2, prop, b2[prop]);
2064
2064
  return a2;
2065
- }, __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2)), ExtensionType = /* @__PURE__ */ ((ExtensionType2) => (ExtensionType2.Renderer = "renderer", ExtensionType2.Application = "application", ExtensionType2.RendererSystem = "renderer-webgl-system", ExtensionType2.RendererPlugin = "renderer-webgl-plugin", ExtensionType2.CanvasRendererSystem = "renderer-canvas-system", ExtensionType2.CanvasRendererPlugin = "renderer-canvas-plugin", ExtensionType2.Asset = "asset", ExtensionType2.LoadParser = "load-parser", ExtensionType2.ResolveParser = "resolve-parser", ExtensionType2.CacheParser = "cache-parser", ExtensionType2.DetectionParser = "detection-parser", ExtensionType2))(ExtensionType || {});
2065
+ }, __spreadProps$5 = (a2, b2) => __defProps$5(a2, __getOwnPropDescs$5(b2)), ExtensionType = /* @__PURE__ */ ((ExtensionType2) => (ExtensionType2.Renderer = "renderer", ExtensionType2.Application = "application", ExtensionType2.RendererSystem = "renderer-webgl-system", ExtensionType2.RendererPlugin = "renderer-webgl-plugin", ExtensionType2.CanvasRendererSystem = "renderer-canvas-system", ExtensionType2.CanvasRendererPlugin = "renderer-canvas-plugin", ExtensionType2.Asset = "asset", ExtensionType2.LoadParser = "load-parser", ExtensionType2.ResolveParser = "resolve-parser", ExtensionType2.CacheParser = "cache-parser", ExtensionType2.DetectionParser = "detection-parser", ExtensionType2))(ExtensionType || {});
2066
2066
  const normalizeExtension = (ext) => {
2067
2067
  if (typeof ext == "function" || typeof ext == "object" && ext.extension) {
2068
2068
  if (!ext.extension)
2069
2069
  throw new Error("Extension class must have an extension object");
2070
2070
  const metadata = typeof ext.extension != "object" ? { type: ext.extension } : ext.extension;
2071
- ext = __spreadProps$4(__spreadValues$d({}, metadata), { ref: ext });
2071
+ ext = __spreadProps$5(__spreadValues$d({}, metadata), { ref: ext });
2072
2072
  }
2073
2073
  if (typeof ext == "object")
2074
2074
  ext = __spreadValues$d({}, ext);
@@ -2106,8 +2106,9 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2106
2106
  add(...extensions2) {
2107
2107
  return extensions2.map(normalizeExtension).forEach((ext) => {
2108
2108
  ext.type.forEach((type) => {
2109
+ var _a2, _b;
2109
2110
  const handlers = this._addHandlers, queue = this._queue;
2110
- handlers[type] ? handlers[type](ext) : (queue[type] = queue[type] || [], queue[type].push(ext));
2111
+ handlers[type] ? (_b = handlers[type]) == null || _b.call(handlers, ext) : (queue[type] = queue[type] || [], (_a2 = queue[type]) == null || _a2.push(ext));
2111
2112
  });
2112
2113
  }), this;
2113
2114
  },
@@ -2119,12 +2120,13 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2119
2120
  * @returns {PIXI.extensions} For chaining.
2120
2121
  */
2121
2122
  handle(type, onAdd, onRemove) {
2123
+ var _a2;
2122
2124
  const addHandlers = this._addHandlers, removeHandlers = this._removeHandlers;
2123
2125
  if (addHandlers[type] || removeHandlers[type])
2124
2126
  throw new Error(`Extension type ${type} already has a handler`);
2125
2127
  addHandlers[type] = onAdd, removeHandlers[type] = onRemove;
2126
2128
  const queue = this._queue;
2127
- return queue[type] && (queue[type].forEach((ext) => onAdd(ext)), delete queue[type]), this;
2129
+ return queue[type] && ((_a2 = queue[type]) == null || _a2.forEach((ext) => onAdd(ext)), delete queue[type]), this;
2128
2130
  },
2129
2131
  /**
2130
2132
  * Handle a type, but using a map by `name` property.
@@ -2136,10 +2138,10 @@ Deprecated since v${version}`), console.warn(stack))), warnings[message] = !0;
2136
2138
  return this.handle(
2137
2139
  type,
2138
2140
  (extension) => {
2139
- map2[extension.name] = extension.ref;
2141
+ extension.name && (map2[extension.name] = extension.ref);
2140
2142
  },
2141
2143
  (extension) => {
2142
- delete map2[extension.name];
2144
+ extension.name && delete map2[extension.name];
2143
2145
  }
2144
2146
  );
2145
2147
  },
@@ -2358,7 +2360,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2358
2360
  }
2359
2361
  class Runner {
2360
2362
  /**
2361
- * @param name - The function name that will be executed on the listeners added to this Runner.
2363
+ * @param {string} name - The function name that will be executed on the listeners added to this Runner.
2362
2364
  */
2363
2365
  constructor(name) {
2364
2366
  this.items = [], this._name = name, this._aliasCount = 0;
@@ -2423,7 +2425,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2423
2425
  }
2424
2426
  /** Remove all references, don't use after this. */
2425
2427
  destroy() {
2426
- this.removeAll(), this.items = null, this._name = null;
2428
+ this.removeAll(), this.items.length = 0, this._name = "";
2427
2429
  }
2428
2430
  /**
2429
2431
  * `true` if there are no this Runner contains no listeners
@@ -2434,7 +2436,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2434
2436
  }
2435
2437
  /**
2436
2438
  * The name of the runner.
2437
- * @readonly
2439
+ * @type {string}
2438
2440
  */
2439
2441
  get name() {
2440
2442
  return this._name;
@@ -2624,7 +2626,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2624
2626
  alphaMode: ALPHA_MODES.NPM
2625
2627
  }, _BaseTexture = class _BaseTexture2 extends EventEmitter {
2626
2628
  /**
2627
- * @param {PIXI.Resource|HTMLImageElement|HTMLVideoElement|ImageBitmap|ICanvas|string} [resource=null] -
2629
+ * @param {PIXI.Resource|PIXI.ImageSource|string} [resource=null] -
2628
2630
  * The current resource to use, for things that aren't Resource objects, will be converted
2629
2631
  * into a Resource.
2630
2632
  * @param options - Collection of options, default options inherited from {@link PIXI.BaseTexture.defaultOptions}.
@@ -2802,7 +2804,7 @@ else `), i2 < maxIfs - 1 && (src += `if(test == ${i2}.0){}`);
2802
2804
  * source is an image url or an image element and not in the base texture
2803
2805
  * cache, it will be created and loaded.
2804
2806
  * @static
2805
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas|string|string[]} source - The
2807
+ * @param {PIXI.ImageSource|string|string[]} source - The
2806
2808
  * source to create base texture from.
2807
2809
  * @param options - See {@link PIXI.BaseTexture}'s constructor for options.
2808
2810
  * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id
@@ -5590,7 +5592,8 @@ void main(void)
5590
5592
  etc1: gl.getExtension("WEBGL_compressed_texture_etc1"),
5591
5593
  pvrtc: gl.getExtension("WEBGL_compressed_texture_pvrtc") || gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
5592
5594
  atc: gl.getExtension("WEBGL_compressed_texture_atc"),
5593
- astc: gl.getExtension("WEBGL_compressed_texture_astc")
5595
+ astc: gl.getExtension("WEBGL_compressed_texture_astc"),
5596
+ bptc: gl.getExtension("EXT_texture_compression_bptc")
5594
5597
  };
5595
5598
  this.webGLVersion === 1 ? Object.assign(this.extensions, common, {
5596
5599
  drawBuffers: gl.getExtension("WEBGL_draw_buffers"),
@@ -5826,10 +5829,10 @@ void main(void)
5826
5829
  }
5827
5830
  class BaseImageResource extends Resource {
5828
5831
  /**
5829
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} source
5832
+ * @param {PIXI.ImageSourcee} source
5830
5833
  */
5831
5834
  constructor(source) {
5832
- const sourceAny = source, width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width, height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;
5835
+ const sourceAny = source, width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.displayWidth || sourceAny.width, height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.displayHeight || sourceAny.height;
5833
5836
  super(width, height), this.source = source, this.noSubImage = !1;
5834
5837
  }
5835
5838
  /**
@@ -5846,7 +5849,7 @@ void main(void)
5846
5849
  * @param renderer - Upload to the renderer
5847
5850
  * @param baseTexture - Reference to parent texture
5848
5851
  * @param glTexture
5849
- * @param {HTMLImageElement|HTMLVideoElement|ImageBitmap|PIXI.ICanvas} [source] - (optional)
5852
+ * @param {PIXI.ImageSourcee} [source] - (optional)
5850
5853
  * @returns - true is success
5851
5854
  */
5852
5855
  upload(renderer, baseTexture, glTexture, source) {
@@ -8296,7 +8299,7 @@ void main(void)
8296
8299
  */
8297
8300
  run(options) {
8298
8301
  const { renderer } = this;
8299
- renderer.runners.init.emit(renderer.options), options.hello && console.log(`PixiJS 7.3.3 - ${renderer.rendererLogId} - https://pixijs.com`), renderer.resize(renderer.screen.width, renderer.screen.height);
8302
+ renderer.runners.init.emit(renderer.options), options.hello && console.log(`PixiJS 7.4.0 - ${renderer.rendererLogId} - https://pixijs.com`), renderer.resize(renderer.screen.width, renderer.screen.height);
8300
8303
  }
8301
8304
  destroy() {
8302
8305
  }
@@ -10584,6 +10587,23 @@ void main(void)
10584
10587
  */
10585
10588
  _SVGResource.SVG_SIZE = /<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;
10586
10589
  let SVGResource = _SVGResource;
10590
+ class VideoFrameResource extends BaseImageResource {
10591
+ /**
10592
+ * @param source - Image element to use
10593
+ */
10594
+ // eslint-disable-next-line @typescript-eslint/no-useless-constructor
10595
+ constructor(source) {
10596
+ super(source);
10597
+ }
10598
+ /**
10599
+ * Used to auto-detect the type of resource.
10600
+ * @param {*} source - The source object
10601
+ * @returns {boolean} `true` if source is an VideoFrame
10602
+ */
10603
+ static test(source) {
10604
+ return !!globalThis.VideoFrame && source instanceof globalThis.VideoFrame;
10605
+ }
10606
+ }
10587
10607
  const _VideoResource = class _VideoResource2 extends BaseImageResource {
10588
10608
  /**
10589
10609
  * @param {HTMLVideoElement|object|string|Array<string|object>} source - Video element to use.
@@ -10591,7 +10611,8 @@ void main(void)
10591
10611
  * @param {boolean} [options.autoLoad=true] - Start loading the video immediately
10592
10612
  * @param {boolean} [options.autoPlay=true] - Start playing video immediately
10593
10613
  * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.
10594
- * Leave at 0 to update at every render.
10614
+ * If 0, `requestVideoFrameCallback` is used to update the texture.
10615
+ * If `requestVideoFrameCallback` is not available, the texture is updated every render.
10595
10616
  * @param {boolean} [options.crossorigin=true] - Load image using cross origin
10596
10617
  * @param {boolean} [options.loop=false] - Loops the video
10597
10618
  * @param {boolean} [options.muted=false] - Mutes the video audio, useful for autoplay
@@ -10705,7 +10726,8 @@ void main(void)
10705
10726
  value !== this._autoUpdate && (this._autoUpdate = value, this._configureAutoUpdate());
10706
10727
  }
10707
10728
  /**
10708
- * How many times a second to update the texture from the video. Leave at 0 to update at every render.
10729
+ * How many times a second to update the texture from the video. If 0, `requestVideoFrameCallback` is used to
10730
+ * update the texture. If `requestVideoFrameCallback` is not available, the texture is updated every render.
10709
10731
  * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.
10710
10732
  */
10711
10733
  get updateFPS() {
@@ -10744,6 +10766,7 @@ void main(void)
10744
10766
  ImageResource,
10745
10767
  CanvasResource,
10746
10768
  VideoResource,
10769
+ VideoFrameResource,
10747
10770
  SVGResource,
10748
10771
  BufferResource,
10749
10772
  CubeResource,
@@ -10766,7 +10789,7 @@ void main(void)
10766
10789
  this.disposeRunner.emit(this, !1);
10767
10790
  }
10768
10791
  }
10769
- const VERSION = "7.3.3";
10792
+ const VERSION = "7.4.0";
10770
10793
  class Bounds {
10771
10794
  constructor() {
10772
10795
  this.minX = 1 / 0, this.minY = 1 / 0, this.maxX = -1 / 0, this.maxY = -1 / 0, this.rect = null, this.updateID = -1;
@@ -14980,8 +15003,12 @@ void main()
14980
15003
  * });
14981
15004
  */
14982
15005
  addEventListener(type, listener, options) {
14983
- const capture = typeof options == "boolean" && options || typeof options == "object" && options.capture, context2 = typeof listener == "function" ? void 0 : listener;
14984
- type = capture ? `${type}capture` : type, listener = typeof listener == "function" ? listener : listener.handleEvent, this.on(type, listener, context2);
15006
+ const capture = typeof options == "boolean" && options || typeof options == "object" && options.capture, signal = typeof options == "object" ? options.signal : void 0, once = typeof options == "object" ? options.once === !0 : !1, context2 = typeof listener == "function" ? void 0 : listener;
15007
+ type = capture ? `${type}capture` : type;
15008
+ const listenerFn = typeof listener == "function" ? listener : listener.handleEvent, emitter = this;
15009
+ signal && signal.addEventListener("abort", () => {
15010
+ emitter.off(type, listenerFn, context2);
15011
+ }), once ? emitter.once(type, listenerFn, context2) : emitter.on(type, listenerFn, context2);
14985
15012
  },
14986
15013
  /**
14987
15014
  * Unlike `off` or `removeListener` which are methods from EventEmitter, `removeEventListener`
@@ -15561,14 +15588,14 @@ void main()
15561
15588
  }
15562
15589
  }
15563
15590
  const Cache = new CacheClass();
15564
- var __defProp$9 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$9 = Object.getOwnPropertySymbols, __hasOwnProp$9 = Object.prototype.hasOwnProperty, __propIsEnum$9 = Object.prototype.propertyIsEnumerable, __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$9 = (a2, b2) => {
15591
+ var __defProp$9 = Object.defineProperty, __defProps$4 = Object.defineProperties, __getOwnPropDescs$4 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$9 = Object.getOwnPropertySymbols, __hasOwnProp$9 = Object.prototype.hasOwnProperty, __propIsEnum$9 = Object.prototype.propertyIsEnumerable, __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$9 = (a2, b2) => {
15565
15592
  for (var prop in b2 || (b2 = {}))
15566
15593
  __hasOwnProp$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15567
15594
  if (__getOwnPropSymbols$9)
15568
15595
  for (var prop of __getOwnPropSymbols$9(b2))
15569
15596
  __propIsEnum$9.call(b2, prop) && __defNormalProp$9(a2, prop, b2[prop]);
15570
15597
  return a2;
15571
- }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15598
+ }, __spreadProps$4 = (a2, b2) => __defProps$4(a2, __getOwnPropDescs$4(b2));
15572
15599
  class Loader {
15573
15600
  constructor() {
15574
15601
  this._parsers = [], this._parsersValidated = !1, this.parsers = new Proxy(this._parsers, {
@@ -15658,7 +15685,7 @@ ${e2}`);
15658
15685
  }
15659
15686
  /** validates our parsers, right now it only checks for name conflicts but we can add more here as required! */
15660
15687
  _validateParsers() {
15661
- this._parsersValidated = !0, this._parserHash = this._parsers.filter((parser) => parser.name).reduce((hash, parser) => (hash[parser.name] && console.warn(`[Assets] loadParser name conflict "${parser.name}"`), __spreadProps$3(__spreadValues$9({}, hash), { [parser.name]: parser })), {});
15688
+ this._parsersValidated = !0, this._parserHash = this._parsers.filter((parser) => parser.name).reduce((hash, parser) => (hash[parser.name] && console.warn(`[Assets] loadParser name conflict "${parser.name}"`), __spreadProps$4(__spreadValues$9({}, hash), { [parser.name]: parser })), {});
15662
15689
  }
15663
15690
  }
15664
15691
  var LoaderParserPriority = /* @__PURE__ */ ((LoaderParserPriority2) => (LoaderParserPriority2[LoaderParserPriority2.Low = 0] = "Low", LoaderParserPriority2[LoaderParserPriority2.Normal = 1] = "Normal", LoaderParserPriority2[LoaderParserPriority2.High = 2] = "High", LoaderParserPriority2))(LoaderParserPriority || {});
@@ -15690,14 +15717,14 @@ ${e2}`);
15690
15717
  }
15691
15718
  };
15692
15719
  extensions$1.add(loadTxt);
15693
- var __defProp$8 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$8 = (a2, b2) => {
15720
+ var __defProp$8 = Object.defineProperty, __defProps$3 = Object.defineProperties, __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$8 = Object.getOwnPropertySymbols, __hasOwnProp$8 = Object.prototype.hasOwnProperty, __propIsEnum$8 = Object.prototype.propertyIsEnumerable, __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$8 = (a2, b2) => {
15694
15721
  for (var prop in b2 || (b2 = {}))
15695
15722
  __hasOwnProp$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15696
15723
  if (__getOwnPropSymbols$8)
15697
15724
  for (var prop of __getOwnPropSymbols$8(b2))
15698
15725
  __propIsEnum$8.call(b2, prop) && __defNormalProp$8(a2, prop, b2[prop]);
15699
15726
  return a2;
15700
- }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
15727
+ }, __spreadProps$3 = (a2, b2) => __defProps$3(a2, __getOwnPropDescs$3(b2));
15701
15728
  const validWeights = [
15702
15729
  "normal",
15703
15730
  "bold",
@@ -15746,7 +15773,7 @@ ${e2}`);
15746
15773
  if (fonts) {
15747
15774
  const fontFaces = [], name = (_b = (_a2 = options.data) == null ? void 0 : _a2.family) != null ? _b : getFontFamilyName(url2), weights = (_e = (_d = (_c = options.data) == null ? void 0 : _c.weights) == null ? void 0 : _d.filter((weight) => validWeights.includes(weight))) != null ? _e : ["normal"], data = (_f = options.data) != null ? _f : {};
15748
15775
  for (let i2 = 0; i2 < weights.length; i2++) {
15749
- const weight = weights[i2], font = new FontFace(name, `url(${encodeURIWhenNeeded(url2)})`, __spreadProps$2(__spreadValues$8({}, data), {
15776
+ const weight = weights[i2], font = new FontFace(name, `url(${encodeURIWhenNeeded(url2)})`, __spreadProps$3(__spreadValues$8({}, data), {
15750
15777
  weight
15751
15778
  }));
15752
15779
  await font.load(), fonts.add(font), fontFaces.push(font);
@@ -15760,82 +15787,78 @@ ${e2}`);
15760
15787
  }
15761
15788
  };
15762
15789
  extensions$1.add(loadWebFont);
15763
- let UUID = 0, MAX_WORKERS;
15764
- const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=", checkImageBitmapCode = {
15765
- id: "checkImageBitmap",
15766
- code: `
15767
- async function checkImageBitmap()
15768
- {
15769
- try
15770
- {
15771
- if (typeof createImageBitmap !== 'function') return false;
15772
-
15773
- const response = await fetch('${WHITE_PNG}');
15774
- const imageBlob = await response.blob();
15775
- const imageBitmap = await createImageBitmap(imageBlob);
15776
-
15777
- return imageBitmap.width === 1 && imageBitmap.height === 1;
15778
- }
15779
- catch (e)
15780
- {
15781
- return false;
15782
- }
15790
+ const WORKER_CODE$1 = `(function() {
15791
+ "use strict";
15792
+ const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
15793
+ async function checkImageBitmap() {
15794
+ try {
15795
+ if (typeof createImageBitmap != "function")
15796
+ return !1;
15797
+ const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
15798
+ return imageBitmap.width === 1 && imageBitmap.height === 1;
15799
+ } catch (e) {
15800
+ return !1;
15783
15801
  }
15784
- checkImageBitmap().then((result) => { self.postMessage(result); });
15785
- `
15786
- }, workerCode = {
15787
- id: "loadImageBitmap",
15788
- code: `
15789
- async function loadImageBitmap(url)
15790
- {
15791
- const response = await fetch(url);
15792
-
15793
- if (!response.ok)
15794
- {
15795
- throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \`
15796
- + \`\${response.status} \${response.statusText}\`);
15797
- }
15798
-
15799
- const imageBlob = await response.blob();
15800
- const imageBitmap = await createImageBitmap(imageBlob);
15801
-
15802
- return imageBitmap;
15802
+ }
15803
+ checkImageBitmap().then((result) => {
15804
+ self.postMessage(result);
15805
+ });
15806
+ })();
15807
+ `;
15808
+ let WORKER_URL$1 = null, WorkerInstance$1 = class extends Worker {
15809
+ constructor() {
15810
+ WORKER_URL$1 || (WORKER_URL$1 = URL.createObjectURL(new Blob([WORKER_CODE$1], { type: "application/javascript" }))), super(WORKER_URL$1);
15803
15811
  }
15804
- self.onmessage = async (event) =>
15805
- {
15806
- try
15807
- {
15808
- const imageBitmap = await loadImageBitmap(event.data.data[0]);
15809
-
15810
- self.postMessage({
15811
- data: imageBitmap,
15812
- uuid: event.data.uuid,
15813
- id: event.data.id,
15814
- }, [imageBitmap]);
15815
- }
15816
- catch(e)
15817
- {
15818
- self.postMessage({
15819
- error: e,
15820
- uuid: event.data.uuid,
15821
- id: event.data.id,
15822
- });
15823
- }
15824
- };`
15825
15812
  };
15826
- let workerURL;
15813
+ WorkerInstance$1.revokeObjectURL = function() {
15814
+ WORKER_URL$1 && (URL.revokeObjectURL(WORKER_URL$1), WORKER_URL$1 = null);
15815
+ };
15816
+ const WORKER_CODE = `(function() {
15817
+ "use strict";
15818
+ async function loadImageBitmap(url) {
15819
+ const response = await fetch(url);
15820
+ if (!response.ok)
15821
+ throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
15822
+ const imageBlob = await response.blob();
15823
+ return await createImageBitmap(imageBlob);
15824
+ }
15825
+ self.onmessage = async (event) => {
15826
+ try {
15827
+ const imageBitmap = await loadImageBitmap(event.data.data[0]);
15828
+ self.postMessage({
15829
+ data: imageBitmap,
15830
+ uuid: event.data.uuid,
15831
+ id: event.data.id
15832
+ }, [imageBitmap]);
15833
+ } catch (e) {
15834
+ self.postMessage({
15835
+ error: e,
15836
+ uuid: event.data.uuid,
15837
+ id: event.data.id
15838
+ });
15839
+ }
15840
+ };
15841
+ })();
15842
+ `;
15843
+ let WORKER_URL = null;
15844
+ class WorkerInstance extends Worker {
15845
+ constructor() {
15846
+ WORKER_URL || (WORKER_URL = URL.createObjectURL(new Blob([WORKER_CODE], { type: "application/javascript" }))), super(WORKER_URL);
15847
+ }
15848
+ }
15849
+ WorkerInstance.revokeObjectURL = function() {
15850
+ WORKER_URL && (URL.revokeObjectURL(WORKER_URL), WORKER_URL = null);
15851
+ };
15852
+ let UUID = 0, MAX_WORKERS;
15827
15853
  class WorkerManagerClass {
15828
15854
  constructor() {
15829
15855
  this._initialized = !1, this._createdWorkers = 0, this.workerPool = [], this.queue = [], this.resolveHash = {};
15830
15856
  }
15831
15857
  isImageBitmapSupported() {
15832
15858
  return this._isImageBitmapSupported !== void 0 ? this._isImageBitmapSupported : (this._isImageBitmapSupported = new Promise((resolve2) => {
15833
- const workerURL2 = URL.createObjectURL(new Blob(
15834
- [checkImageBitmapCode.code],
15835
- { type: "application/javascript" }
15836
- )), worker = new Worker(workerURL2);
15859
+ const worker = new WorkerInstance$1();
15837
15860
  worker.addEventListener("message", (event) => {
15838
- worker.terminate(), URL.revokeObjectURL(workerURL2), resolve2(event.data);
15861
+ worker.terminate(), WorkerInstance$1.revokeObjectURL(), resolve2(event.data);
15839
15862
  });
15840
15863
  }), this._isImageBitmapSupported);
15841
15864
  }
@@ -15848,7 +15871,7 @@ ${e2}`);
15848
15871
  getWorker() {
15849
15872
  MAX_WORKERS === void 0 && (MAX_WORKERS = navigator.hardwareConcurrency || 4);
15850
15873
  let worker = this.workerPool.pop();
15851
- return !worker && this._createdWorkers < MAX_WORKERS && (workerURL || (workerURL = URL.createObjectURL(new Blob([workerCode.code], { type: "application/javascript" }))), this._createdWorkers++, worker = new Worker(workerURL), worker.addEventListener("message", (event) => {
15874
+ return !worker && this._createdWorkers < MAX_WORKERS && (this._createdWorkers++, worker = new WorkerInstance(), worker.addEventListener("message", (event) => {
15852
15875
  this.complete(event.data), this.returnWorker(event.target), this.next();
15853
15876
  })), worker;
15854
15877
  }
@@ -15979,14 +16002,14 @@ ${e2}`);
15979
16002
  unload: loadTextures.unload
15980
16003
  };
15981
16004
  extensions$1.add(loadSVG);
15982
- var __defProp$5 = Object.defineProperty, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$5 = (a2, b2) => {
16005
+ var __defProp$5 = Object.defineProperty, __defProps$2 = Object.defineProperties, __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors, __getOwnPropSymbols$5 = Object.getOwnPropertySymbols, __hasOwnProp$5 = Object.prototype.hasOwnProperty, __propIsEnum$5 = Object.prototype.propertyIsEnumerable, __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues$5 = (a2, b2) => {
15983
16006
  for (var prop in b2 || (b2 = {}))
15984
16007
  __hasOwnProp$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15985
16008
  if (__getOwnPropSymbols$5)
15986
16009
  for (var prop of __getOwnPropSymbols$5(b2))
15987
16010
  __propIsEnum$5.call(b2, prop) && __defNormalProp$5(a2, prop, b2[prop]);
15988
16011
  return a2;
15989
- };
16012
+ }, __spreadProps$2 = (a2, b2) => __defProps$2(a2, __getOwnPropDescs$2(b2));
15990
16013
  const validVideoExtensions = [".mp4", ".m4v", ".webm", ".ogv"], validVideoMIMEs = [
15991
16014
  "video/mp4",
15992
16015
  "video/webm",
@@ -15998,7 +16021,11 @@ ${e2}`);
15998
16021
  priority: LoaderParserPriority.High
15999
16022
  },
16000
16023
  config: {
16001
- defaultAutoPlay: !0
16024
+ defaultAutoPlay: !0,
16025
+ defaultUpdateFPS: 0,
16026
+ defaultLoop: !1,
16027
+ defaultMuted: !1,
16028
+ defaultPlaysinline: !0
16002
16029
  },
16003
16030
  test(url2) {
16004
16031
  return checkDataUrl(url2, validVideoMIMEs) || checkExtension(url2, validVideoExtensions);
@@ -16008,9 +16035,15 @@ ${e2}`);
16008
16035
  let texture;
16009
16036
  const blob = await (await settings.ADAPTER.fetch(url2)).blob(), blobURL = URL.createObjectURL(blob);
16010
16037
  try {
16011
- const options = __spreadValues$5({
16012
- autoPlay: this.config.defaultAutoPlay
16013
- }, (_a2 = loadAsset == null ? void 0 : loadAsset.data) == null ? void 0 : _a2.resourceOptions), src = new VideoResource(blobURL, options);
16038
+ const options = __spreadProps$2(__spreadValues$5({
16039
+ autoPlay: this.config.defaultAutoPlay,
16040
+ updateFPS: this.config.defaultUpdateFPS,
16041
+ loop: this.config.defaultLoop,
16042
+ muted: this.config.defaultMuted,
16043
+ playsinline: this.config.defaultPlaysinline
16044
+ }, (_a2 = loadAsset == null ? void 0 : loadAsset.data) == null ? void 0 : _a2.resourceOptions), {
16045
+ autoLoad: !0
16046
+ }), src = new VideoResource(blobURL, options);
16014
16047
  await src.load();
16015
16048
  const base = new BaseTexture(src, __spreadValues$5({
16016
16049
  alphaMode: await detectVideoAlphaMode(),
@@ -16865,7 +16898,7 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16865
16898
  }
16866
16899
  };
16867
16900
  extensions$1.add(resolveTextureUrl);
16868
- var INTERNAL_FORMATS = /* @__PURE__ */ ((INTERNAL_FORMATS2) => (INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ATC_WEBGL = 35986] = "COMPRESSED_RGB_ATC_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR", INTERNAL_FORMATS2))(INTERNAL_FORMATS || {});
16901
+ var INTERNAL_FORMATS = /* @__PURE__ */ ((INTERNAL_FORMATS2) => (INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_S3TC_DXT1_EXT = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_R11_EAC = 37488] = "COMPRESSED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_R11_EAC = 37489] = "COMPRESSED_SIGNED_R11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RG11_EAC = 37490] = "COMPRESSED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SIGNED_RG11_EAC = 37491] = "COMPRESSED_SIGNED_RG11_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_ETC2 = 37492] = "COMPRESSED_RGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA8_ETC2_EAC = 37496] = "COMPRESSED_RGBA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ETC2 = 37493] = "COMPRESSED_SRGB8_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ETC1_WEBGL = 36196] = "COMPRESSED_RGB_ETC1_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_ATC_WEBGL = 35986] = "COMPRESSED_RGB_ATC_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_ASTC_4x4_KHR = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492] = "COMPRESSED_RGBA_BPTC_UNORM_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493] = "COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494] = "COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT", INTERNAL_FORMATS2[INTERNAL_FORMATS2.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495] = "COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT", INTERNAL_FORMATS2))(INTERNAL_FORMATS || {});
16869
16902
  const INTERNAL_FORMAT_TO_BYTES_PER_PIXEL = {
16870
16903
  // WEBGL_compressed_texture_s3tc
16871
16904
  33776: 0.5,
@@ -16905,7 +16938,13 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16905
16938
  // @see https://registry.khronos.org/OpenGL/extensions/KHR/KHR_texture_compression_astc_hdr.txt
16906
16939
  // WEBGL_compressed_texture_astc
16907
16940
  /* eslint-disable-next-line camelcase */
16908
- 37808: 1
16941
+ 37808: 1,
16942
+ // @see https://registry.khronos.org/OpenGL/extensions/EXT/EXT_texture_compression_bptc.txt
16943
+ // EXT_texture_compression_bptc
16944
+ 36492: 1,
16945
+ 36493: 1,
16946
+ 36494: 1,
16947
+ 36495: 1
16909
16948
  };
16910
16949
  let storedGl, extensions;
16911
16950
  function getCompressedTextureExtensions() {
@@ -16917,7 +16956,8 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
16917
16956
  etc1: storedGl.getExtension("WEBGL_compressed_texture_etc1"),
16918
16957
  pvrtc: storedGl.getExtension("WEBGL_compressed_texture_pvrtc") || storedGl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),
16919
16958
  atc: storedGl.getExtension("WEBGL_compressed_texture_atc"),
16920
- astc: storedGl.getExtension("WEBGL_compressed_texture_astc")
16959
+ astc: storedGl.getExtension("WEBGL_compressed_texture_astc"),
16960
+ bptc: storedGl.getExtension("EXT_texture_compression_bptc")
16921
16961
  };
16922
16962
  }
16923
16963
  const detectCompressedTextures = {
@@ -17023,15 +17063,21 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17023
17063
  static _formatToExtension(format2) {
17024
17064
  if (format2 >= 33776 && format2 <= 33779)
17025
17065
  return "s3tc";
17066
+ if (format2 >= 35916 && format2 <= 35919)
17067
+ return "s3tc_sRGB";
17026
17068
  if (format2 >= 37488 && format2 <= 37497)
17027
17069
  return "etc";
17028
17070
  if (format2 >= 35840 && format2 <= 35843)
17029
17071
  return "pvrtc";
17030
- if (format2 >= 36196)
17072
+ if (format2 === 36196)
17031
17073
  return "etc1";
17032
- if (format2 >= 35986 && format2 <= 34798)
17074
+ if (format2 === 35986 || format2 === 35987 || format2 === 34798)
17033
17075
  return "atc";
17034
- throw new Error("Invalid (compressed) texture format given!");
17076
+ if (format2 >= 36492 && format2 <= 36495)
17077
+ return "bptc";
17078
+ if (format2 === 37808)
17079
+ return "astc";
17080
+ throw new Error(`Invalid (compressed) texture format given: ${format2}`);
17035
17081
  }
17036
17082
  /**
17037
17083
  * Pre-creates buffer views for each mipmap level
@@ -17094,7 +17140,14 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17094
17140
  // WEBGL_compressed_texture_s3tc_srgb
17095
17141
  72: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
17096
17142
  75: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
17097
- 78: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT
17143
+ 78: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
17144
+ // EXT_texture_compression_bptc
17145
+ // BC6H
17146
+ 96: INTERNAL_FORMATS.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
17147
+ 95: INTERNAL_FORMATS.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
17148
+ // BC7
17149
+ 98: INTERNAL_FORMATS.COMPRESSED_RGBA_BPTC_UNORM_EXT,
17150
+ 99: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT
17098
17151
  };
17099
17152
  function parseDDS(arrayBuffer) {
17100
17153
  const data = new Uint32Array(arrayBuffer);
@@ -17394,7 +17447,8 @@ Please use Assets.add({ alias, src, data, format, loadParser }) instead.`), asse
17394
17447
  ".etc1.ktx",
17395
17448
  ".pvrt.ktx",
17396
17449
  ".atc.ktx",
17397
- ".astc.ktx"
17450
+ ".astc.ktx",
17451
+ ".bptc.ktx"
17398
17452
  ];
17399
17453
  if (extensions2.some((ext) => value.endsWith(ext)))
17400
17454
  return {
@@ -21878,15 +21932,11 @@ void main(void)
21878
21932
  type: ExtensionType.RendererPlugin
21879
21933
  }, extensions$1.add(TilingSpriteRenderer);
21880
21934
  const _Spritesheet = class _Spritesheet2 {
21881
- /**
21882
- * @param texture - Reference to the source BaseTexture object.
21883
- * @param {object} data - Spritesheet image data.
21884
- * @param resolutionFilename - The filename to consider when determining
21885
- * the resolution of the spritesheet. If not provided, the imageUrl will
21886
- * be used on the BaseTexture.
21887
- */
21888
- constructor(texture, data, resolutionFilename = null) {
21889
- this.linkedSheets = [], this._texture = texture instanceof Texture ? texture : null, this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture, this.textures = {}, this.animations = {}, this.data = data;
21935
+ /** @ignore */
21936
+ constructor(optionsOrTexture, arg1, arg2) {
21937
+ this.linkedSheets = [], (optionsOrTexture instanceof BaseTexture || optionsOrTexture instanceof Texture) && (optionsOrTexture = { texture: optionsOrTexture, data: arg1, resolutionFilename: arg2 });
21938
+ const { texture, data, resolutionFilename = null, cachePrefix = "" } = optionsOrTexture;
21939
+ this.cachePrefix = cachePrefix, this._texture = texture instanceof Texture ? texture : null, this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture, this.textures = {}, this.animations = {}, this.data = data;
21890
21940
  const resource = this.baseTexture.resource;
21891
21941
  this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null)), this._frames = this.data.frames, this._frameKeys = Object.keys(this._frames), this._batchIndex = 0, this._callback = null;
21892
21942
  }
@@ -21952,7 +22002,7 @@ void main(void)
21952
22002
  data.rotated ? 2 : 0,
21953
22003
  data.anchor,
21954
22004
  data.borders
21955
- ), Texture.addToCache(this.textures[i2], i2.toString());
22005
+ ), Texture.addToCache(this.textures[i2], this.cachePrefix + i2.toString());
21956
22006
  }
21957
22007
  frameIndex++;
21958
22008
  }
@@ -21998,12 +22048,15 @@ void main(void)
21998
22048
  if (keys.forEach((key) => {
21999
22049
  out[key] = asset;
22000
22050
  }), Object.keys(asset.textures).forEach((key) => {
22001
- out[key] = asset.textures[key];
22051
+ out[`${asset.cachePrefix}${key}`] = asset.textures[key];
22002
22052
  }), !ignoreMultiPack) {
22003
22053
  const basePath = path.dirname(keys[0]);
22004
22054
  asset.linkedSheets.forEach((item, i2) => {
22005
- const out2 = getCacheableAssets([`${basePath}/${asset.data.meta.related_multi_packs[i2]}`], item, !0);
22006
- Object.assign(out, out2);
22055
+ Object.assign(out, getCacheableAssets(
22056
+ [`${basePath}/${asset.data.meta.related_multi_packs[i2]}`],
22057
+ item,
22058
+ !0
22059
+ ));
22007
22060
  });
22008
22061
  }
22009
22062
  return out;
@@ -22048,25 +22101,39 @@ void main(void)
22048
22101
  return path.extname(options.src).toLowerCase() === ".json" && !!asset.frames;
22049
22102
  },
22050
22103
  async parse(asset, options, loader) {
22051
- var _a2, _b;
22104
+ var _a2, _b, _c;
22105
+ const {
22106
+ texture: imageTexture,
22107
+ // if user need to use preloaded texture
22108
+ imageFilename,
22109
+ // if user need to use custom filename (not from jsonFile.meta.image)
22110
+ cachePrefix
22111
+ // if user need to use custom cache prefix
22112
+ } = (_a2 = options == null ? void 0 : options.data) != null ? _a2 : {};
22052
22113
  let basePath = path.dirname(options.src);
22053
22114
  basePath && basePath.lastIndexOf("/") !== basePath.length - 1 && (basePath += "/");
22054
- let imagePath = basePath + asset.meta.image;
22055
- imagePath = copySearchParams(imagePath, options.src);
22056
- const texture = (await loader.load([imagePath]))[imagePath], spritesheet = new Spritesheet(
22057
- texture.baseTexture,
22058
- asset,
22059
- options.src
22060
- );
22115
+ let texture;
22116
+ if (imageTexture && imageTexture.baseTexture)
22117
+ texture = imageTexture;
22118
+ else {
22119
+ const imagePath = copySearchParams(basePath + (imageFilename != null ? imageFilename : asset.meta.image), options.src);
22120
+ texture = (await loader.load([imagePath]))[imagePath];
22121
+ }
22122
+ const spritesheet = new Spritesheet({
22123
+ texture: texture.baseTexture,
22124
+ data: asset,
22125
+ resolutionFilename: options.src,
22126
+ cachePrefix
22127
+ });
22061
22128
  await spritesheet.parse();
22062
- const multiPacks = (_a2 = asset == null ? void 0 : asset.meta) == null ? void 0 : _a2.related_multi_packs;
22129
+ const multiPacks = (_b = asset == null ? void 0 : asset.meta) == null ? void 0 : _b.related_multi_packs;
22063
22130
  if (Array.isArray(multiPacks)) {
22064
22131
  const promises = [];
22065
22132
  for (const item of multiPacks) {
22066
22133
  if (typeof item != "string")
22067
22134
  continue;
22068
22135
  let itemUrl = basePath + item;
22069
- (_b = options.data) != null && _b.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22136
+ (_c = options.data) != null && _c.ignoreMultiPack || (itemUrl = copySearchParams(itemUrl, options.src), promises.push(loader.load({
22070
22137
  src: itemUrl,
22071
22138
  data: {
22072
22139
  ignoreMultiPack: !0