@eva/plugin-renderer 1.1.14 → 1.2.0-alpha.4

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.
@@ -1,3 +1,5 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  this.EVA = this.EVA || {};
2
4
  this.EVA.plugin = this.EVA.plugin || {};
3
5
 
@@ -596,8 +598,8 @@ this.EVA.plugin.renderer = function (exports, eva_js, rendererAdapter, pixi_js)
596
598
  return result;
597
599
  }
598
600
 
599
- var Uint8Array = root$1.Uint8Array;
600
- var Uint8Array$1 = Uint8Array;
601
+ var Uint8Array$1 = root$1.Uint8Array;
602
+ var Uint8Array$2 = Uint8Array$1;
601
603
 
602
604
  function mapToArray(map) {
603
605
  var index = -1,
@@ -644,7 +646,7 @@ this.EVA.plugin.renderer = function (exports, eva_js, rendererAdapter, pixi_js)
644
646
  other = other.buffer;
645
647
 
646
648
  case arrayBufferTag$1:
647
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) {
649
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$2(object), new Uint8Array$2(other))) {
648
650
  return false;
649
651
  }
650
652
 
@@ -1003,8 +1005,8 @@ this.EVA.plugin.renderer = function (exports, eva_js, rendererAdapter, pixi_js)
1003
1005
  return result;
1004
1006
  }
1005
1007
 
1006
- var DataView = getNative(root$1, 'DataView');
1007
- var DataView$1 = DataView;
1008
+ var DataView$1 = getNative(root$1, 'DataView');
1009
+ var DataView$2 = DataView$1;
1008
1010
  var Promise$1 = getNative(root$1, 'Promise');
1009
1011
  var Promise$2 = Promise$1;
1010
1012
  var Set = getNative(root$1, 'Set');
@@ -1017,14 +1019,14 @@ this.EVA.plugin.renderer = function (exports, eva_js, rendererAdapter, pixi_js)
1017
1019
  setTag = '[object Set]',
1018
1020
  weakMapTag = '[object WeakMap]';
1019
1021
  var dataViewTag = '[object DataView]';
1020
- var dataViewCtorString = toSource(DataView$1),
1022
+ var dataViewCtorString = toSource(DataView$2),
1021
1023
  mapCtorString = toSource(Map$1),
1022
1024
  promiseCtorString = toSource(Promise$2),
1023
1025
  setCtorString = toSource(Set$1),
1024
1026
  weakMapCtorString = toSource(WeakMap$1);
1025
1027
  var getTag = baseGetTag;
1026
1028
 
1027
- if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag(new Map$1()) != mapTag || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
1029
+ if (DataView$2 && getTag(new DataView$2(new ArrayBuffer(1))) != dataViewTag || Map$1 && getTag(new Map$1()) != mapTag || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag) {
1028
1030
  getTag = function getTag(value) {
1029
1031
  var result = baseGetTag(value),
1030
1032
  Ctor = result == objectTag$1 ? value.constructor : undefined,
@@ -1695,6 +1697,387 @@ this.EVA.plugin.renderer = function (exports, eva_js, rendererAdapter, pixi_js)
1695
1697
  }(EventEmitter);
1696
1698
 
1697
1699
  var Transform$1 = Transform;
1700
+ var result = undefined;
1701
+
1702
+ function getSuportCompressedTextureFormats(gl) {
1703
+ if (result) return result;
1704
+
1705
+ if (!gl) {
1706
+ console.warn('WebGL not available for compressed textures. Silently failing.');
1707
+ return {
1708
+ s3tc: false,
1709
+ etc: false,
1710
+ etc1: false,
1711
+ pvrtc: false,
1712
+ atc: false,
1713
+ astc: false
1714
+ };
1715
+ }
1716
+
1717
+ result = {
1718
+ s3tc: !!gl.getExtension('WEBGL_compressed_texture_s3tc'),
1719
+ etc: !!gl.getExtension('WEBGL_compressed_texture_etc'),
1720
+ etc1: !!gl.getExtension('WEBGL_compressed_texture_etc1'),
1721
+ pvrtc: !!gl.getExtension('WEBGL_compressed_texture_pvrtc') || !!gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),
1722
+ atc: !!gl.getExtension('WEBGL_compressed_texture_atc'),
1723
+ astc: !!gl.getExtension('WEBGL_compressed_texture_astc')
1724
+ };
1725
+
1726
+ try {
1727
+ console.log('Eva.js Supported Compressed Texture Format List: ' + Object.keys(result).filter(function (type) {
1728
+ return result[type];
1729
+ }).join(', '));
1730
+ } catch (e) {}
1731
+
1732
+ return result;
1733
+ }
1734
+
1735
+ var XLS = eva_js.resourceLoader.XhrLoadStrategy;
1736
+ var XhrLoadStrategy = XLS;
1737
+
1738
+ var _a$2, _b;
1739
+
1740
+ var INTERNAL_FORMATS;
1741
+
1742
+ (function (INTERNAL_FORMATS) {
1743
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_S3TC_DXT1_EXT"] = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT";
1744
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_S3TC_DXT1_EXT"] = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT";
1745
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_S3TC_DXT3_EXT"] = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT";
1746
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_S3TC_DXT5_EXT"] = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT";
1747
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"] = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT";
1748
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"] = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT";
1749
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"] = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT";
1750
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB_S3TC_DXT1_EXT"] = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT";
1751
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_R11_EAC"] = 37488] = "COMPRESSED_R11_EAC";
1752
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SIGNED_R11_EAC"] = 37489] = "COMPRESSED_SIGNED_R11_EAC";
1753
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RG11_EAC"] = 37490] = "COMPRESSED_RG11_EAC";
1754
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SIGNED_RG11_EAC"] = 37491] = "COMPRESSED_SIGNED_RG11_EAC";
1755
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB8_ETC2"] = 37492] = "COMPRESSED_RGB8_ETC2";
1756
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA8_ETC2_EAC"] = 37496] = "COMPRESSED_RGBA8_ETC2_EAC";
1757
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ETC2"] = 37493] = "COMPRESSED_SRGB8_ETC2";
1758
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"] = 37497] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC";
1759
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37494] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2";
1760
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37495] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2";
1761
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_PVRTC_4BPPV1_IMG"] = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG";
1762
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"] = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG";
1763
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_PVRTC_2BPPV1_IMG"] = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG";
1764
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"] = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG";
1765
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_ETC1_WEBGL"] = 36196] = "COMPRESSED_RGB_ETC1_WEBGL";
1766
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_ATC_WEBGL"] = 35986] = "COMPRESSED_RGB_ATC_WEBGL";
1767
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL"] = 35986] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL";
1768
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"] = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL";
1769
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x10_KHR"] = 37819] = "COMPRESSED_RGBA_ASTC_10x10_KHR";
1770
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x5_KHR"] = 37816] = "COMPRESSED_RGBA_ASTC_10x5_KHR";
1771
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x6_KHR"] = 37817] = "COMPRESSED_RGBA_ASTC_10x6_KHR";
1772
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_10x8_KHR"] = 37818] = "COMPRESSED_RGBA_ASTC_10x8_KHR";
1773
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_12x10_KHR"] = 37820] = "COMPRESSED_RGBA_ASTC_12x10_KHR";
1774
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_12x12_KHR"] = 37821] = "COMPRESSED_RGBA_ASTC_12x12_KHR";
1775
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_4x4_KHR"] = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR";
1776
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_5x4_KHR"] = 37809] = "COMPRESSED_RGBA_ASTC_5x4_KHR";
1777
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_5x5_KHR"] = 37810] = "COMPRESSED_RGBA_ASTC_5x5_KHR";
1778
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_6x5_KHR"] = 37811] = "COMPRESSED_RGBA_ASTC_6x5_KHR";
1779
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_6x6_KHR"] = 37812] = "COMPRESSED_RGBA_ASTC_6x6_KHR";
1780
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_8x5_KHR"] = 37813] = "COMPRESSED_RGBA_ASTC_8x5_KHR";
1781
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_8x6_KHR"] = 37814] = "COMPRESSED_RGBA_ASTC_8x6_KHR";
1782
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGBA_ASTC_8x8_KHR"] = 37815] = "COMPRESSED_RGBA_ASTC_8x8_KHR";
1783
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR"] = 3781] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR";
1784
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR"] = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR";
1785
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR"] = 37849] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR";
1786
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR"] = 37850] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR";
1787
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR"] = 37852] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR";
1788
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"] = 37853] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR";
1789
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR"] = 37840] = "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR";
1790
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR"] = 37841] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR";
1791
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR"] = 37842] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR";
1792
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR"] = 37843] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR";
1793
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR"] = 37844] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR";
1794
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR"] = 37845] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR";
1795
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR"] = 37846] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR";
1796
+ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"] = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR";
1797
+ })(INTERNAL_FORMATS || (INTERNAL_FORMATS = {}));
1798
+
1799
+ var INTERNAL_FORMAT_TO_BLOCK_SIZE = (_a$2 = {}, _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_R11_EAC] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RG11_EAC] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = [8, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = [8, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR] = [4, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x5_KHR] = [5, 5], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x6_KHR] = [6, 6], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x8_KHR] = [8, 8], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x10_KHR] = [10, 10], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x12_KHR] = [12, 12], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x5_KHR] = [10, 5], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x6_KHR] = [10, 6], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x8_KHR] = [10, 8], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x10_KHR] = [12, 10], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x4_KHR] = [5, 4], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x5_KHR] = [6, 5], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x5_KHR] = [8, 5], _a$2[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x6_KHR] = [8, 6], _a$2);
1800
+ var INTERNAL_FORMATS_TO_EXTENSION_NAME = (_b = {}, _b[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT] = 'WEBGL_compressed_texture_s3tc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = 'WEBGL_compressed_texture_s3tc_srgb', _b[INTERNAL_FORMATS.COMPRESSED_R11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RG11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = 'WEBGL_compressed_texture_etc', _b[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = 'WEBGL_compressed_texture_pvrtc', _b[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL] = 'WEBGL_compressed_texture_etc1', _b[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL] = 'WEBGL_compressed_texture_atc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = 'WEBGL_compressed_texture_atc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = 'WEBGL_compressed_texture_atc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x5_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x6_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x8_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x10_KHR] = 'WEBGL_compressed_texture_astc', _b[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x12_KHR] = 'WEBGL_compressed_texture_astc', _b);
1801
+
1802
+ var CompressedTextureResource = function () {
1803
+ function CompressedTextureResource() {
1804
+ this.levelBuffers = [];
1805
+ }
1806
+
1807
+ CompressedTextureResource.prototype.upload = function (gl) {
1808
+ var levels = this.levels;
1809
+ var name = INTERNAL_FORMATS_TO_EXTENSION_NAME[this.internalFormat];
1810
+
1811
+ if (!gl[name]) {
1812
+ gl[name] = true;
1813
+
1814
+ if (name === 'WEBGL_compressed_texture_pvrtc') {
1815
+ gl.getExtension(name) || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc');
1816
+ } else {
1817
+ gl.getExtension(name);
1818
+ }
1819
+ }
1820
+
1821
+ for (var i = 0; i < this.levels; ++i) {
1822
+ var _a = this.levelBuffers[i],
1823
+ levelWidth = _a.levelWidth,
1824
+ levelHeight = _a.levelHeight,
1825
+ levelBuffer = _a.levelBuffer;
1826
+ gl.compressedTexImage2D(gl.TEXTURE_2D, i, this.internalFormat, levelWidth, levelHeight, 0, levelBuffer);
1827
+ }
1828
+
1829
+ if (levels > 1) {
1830
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
1831
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
1832
+ } else {
1833
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
1834
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
1835
+ }
1836
+ };
1837
+
1838
+ return CompressedTextureResource;
1839
+ }();
1840
+
1841
+ var FILE_HEADER_SIZE = 64;
1842
+ var KTX_FIELDS = {
1843
+ FILE_IDENTIFIER: 0,
1844
+ ENDIANNESS: 12,
1845
+ GL_TYPE: 16,
1846
+ GL_TYPE_SIZE: 20,
1847
+ GL_FORMAT: 24,
1848
+ GL_INTERNAL_FORMAT: 28,
1849
+ GL_BASE_INTERNAL_FORMAT: 32,
1850
+ PIXEL_WIDTH: 36,
1851
+ PIXEL_HEIGHT: 40,
1852
+ PIXEL_DEPTH: 44,
1853
+ NUMBER_OF_ARRAY_ELEMENTS: 48,
1854
+ NUMBER_OF_FACES: 52,
1855
+ NUMBER_OF_MIPMAP_LEVELS: 56,
1856
+ BYTES_OF_KEY_VALUE_DATA: 60
1857
+ };
1858
+ var FILE_IDENTIFIER = [0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A];
1859
+ var ENDIANNESS = 0x04030201;
1860
+
1861
+ var KTXTextureResource = function (_super) {
1862
+ __extends(KTXTextureResource, _super);
1863
+
1864
+ function KTXTextureResource(source, config) {
1865
+ var _a;
1866
+
1867
+ var _this = _super.call(this) || this;
1868
+
1869
+ _this.complete = true;
1870
+ _this.src = config.url;
1871
+ var dataView = new DataView(source);
1872
+
1873
+ if (!validateKTX(dataView)) {
1874
+ throw new Error('Not a valid KTX Texture');
1875
+ }
1876
+
1877
+ var littleEndian = dataView.getUint32(KTX_FIELDS.ENDIANNESS, true) === ENDIANNESS;
1878
+ _this.internalFormat = dataView.getUint32(KTX_FIELDS.GL_INTERNAL_FORMAT, littleEndian);
1879
+ var pixelWidth = _this.formerWidth = dataView.getUint32(KTX_FIELDS.PIXEL_WIDTH, littleEndian);
1880
+ var pixelHeight = _this.formerHeight = dataView.getUint32(KTX_FIELDS.PIXEL_HEIGHT, littleEndian) || 1;
1881
+ var size = INTERNAL_FORMAT_TO_BLOCK_SIZE[_this.internalFormat];
1882
+ _this.width = pixelWidth % size[0] === 0 ? pixelWidth : pixelWidth + size[0] - pixelWidth % size[0];
1883
+ _this.height = pixelHeight % size[1] === 0 ? pixelHeight : pixelHeight + size[1] - pixelHeight % size[1];
1884
+ var src = eva_js.resource.resourcesMap[config.metadata.name].src[config.metadata.key];
1885
+
1886
+ var _b = (_a = src === null || src === void 0 ? void 0 : src.size) !== null && _a !== void 0 ? _a : {},
1887
+ width = _b.width,
1888
+ height = _b.height;
1889
+
1890
+ if (width && height) {
1891
+ _this.naturalWidth = width;
1892
+ _this.naturalHeight = height;
1893
+ }
1894
+
1895
+ var pixelDepth = dataView.getUint32(KTX_FIELDS.PIXEL_DEPTH, littleEndian) || 1;
1896
+ var numberOfArrayElements = dataView.getUint32(KTX_FIELDS.NUMBER_OF_ARRAY_ELEMENTS, littleEndian) || 1;
1897
+ var numberOfFaces = dataView.getUint32(KTX_FIELDS.NUMBER_OF_FACES, littleEndian);
1898
+ var numberOfMipmapLevels = _this.levels = dataView.getUint32(KTX_FIELDS.NUMBER_OF_MIPMAP_LEVELS, littleEndian);
1899
+ var bytesOfKeyValueData = dataView.getUint32(KTX_FIELDS.BYTES_OF_KEY_VALUE_DATA, littleEndian);
1900
+
1901
+ if (pixelHeight === 0 || pixelDepth !== 1) {
1902
+ throw new Error('Only 2D textures are supported!');
1903
+ }
1904
+
1905
+ if (numberOfFaces !== 1) {
1906
+ throw new Error('CubeTextures are not supported!');
1907
+ }
1908
+
1909
+ if (numberOfArrayElements !== 1) {
1910
+ throw new Error('It does not support array textures!');
1911
+ }
1912
+
1913
+ var mipWidth = pixelWidth;
1914
+ var mipHeight = pixelHeight;
1915
+ var imageOffset = FILE_HEADER_SIZE + bytesOfKeyValueData;
1916
+
1917
+ for (var mipmapLevel = 0; mipmapLevel < numberOfMipmapLevels; mipmapLevel++) {
1918
+ var imageSize = dataView.getUint32(imageOffset, littleEndian);
1919
+ imageOffset += 4;
1920
+ var size_1 = INTERNAL_FORMAT_TO_BLOCK_SIZE[_this.internalFormat];
1921
+ var levelWidth = mipWidth % size_1[0] === 0 ? mipWidth : mipWidth + size_1[0] - mipWidth % size_1[0];
1922
+ var levelHeight = mipHeight % size_1[1] === 0 ? mipHeight : mipHeight + size_1[1] - mipHeight % size_1[1];
1923
+ var mip = {
1924
+ levelID: mipmapLevel,
1925
+ levelWidth: levelWidth,
1926
+ levelHeight: levelHeight,
1927
+ levelBuffer: new Uint8Array(source, imageOffset, imageSize)
1928
+ };
1929
+
1930
+ _this.levelBuffers.push(mip);
1931
+
1932
+ imageOffset += imageSize;
1933
+ imageOffset += 3 - (imageOffset + 3) % 4;
1934
+ mipWidth = mipWidth >> 1 || 1;
1935
+ mipHeight = mipHeight >> 1 || 1;
1936
+ }
1937
+
1938
+ return _this;
1939
+ }
1940
+
1941
+ return KTXTextureResource;
1942
+ }(CompressedTextureResource);
1943
+
1944
+ function validateKTX(dataView) {
1945
+ for (var i = 0; i < FILE_IDENTIFIER.length; i++) {
1946
+ if (dataView.getUint8(i) !== FILE_IDENTIFIER[i]) {
1947
+ return false;
1948
+ }
1949
+ }
1950
+
1951
+ return true;
1952
+ }
1953
+
1954
+ var KTXLoadStrategy = function (_super) {
1955
+ __extends(KTXLoadStrategy, _super);
1956
+
1957
+ function KTXLoadStrategy() {
1958
+ return _super !== null && _super.apply(this, arguments) || this;
1959
+ }
1960
+
1961
+ KTXLoadStrategy.prototype._complete = function (type, data) {
1962
+ _super.prototype._complete.call(this, type, new KTXTextureResource(data, this.config));
1963
+ };
1964
+
1965
+ return KTXLoadStrategy;
1966
+ }(XhrLoadStrategy);
1967
+
1968
+ var KTXLoadStrategy$1 = KTXLoadStrategy;
1969
+ var XhrResponseType = eva_js.resourceLoader.XhrResponseType;
1970
+
1971
+ function addPreProcessResourceHandler(resource, gl) {
1972
+ resource.addPreProcessResourceHandler(function normalizeResource(resource) {
1973
+ var _a, _b, _c;
1974
+
1975
+ var textures = (_b = (_a = resource.src) === null || _a === void 0 ? void 0 : _a.image) === null || _b === void 0 ? void 0 : _b.texture;
1976
+ if (!textures) return;
1977
+
1978
+ if (!Array.isArray(textures)) {
1979
+ textures = [textures];
1980
+ }
1981
+
1982
+ var formats = (_c = getSuportCompressedTextureFormats(gl)) !== null && _c !== void 0 ? _c : {};
1983
+ var target = textures.find(function (texture) {
1984
+ return formats[texture.type];
1985
+ });
1986
+
1987
+ if (target) {
1988
+ _extends(resource.src.image, target);
1989
+ }
1990
+ });
1991
+ }
1992
+
1993
+ function addKTXStragetyAndRegister() {
1994
+ _extends(eva_js.RESOURCE_TYPE_STRATEGY, {
1995
+ astc: KTXLoadStrategy$1,
1996
+ etc: KTXLoadStrategy$1,
1997
+ pvrtc: KTXLoadStrategy$1,
1998
+ s3tc: KTXLoadStrategy$1,
1999
+ atc: KTXLoadStrategy$1
2000
+ });
2001
+
2002
+ KTXLoadStrategy$1.setExtensionXhrType('ktx', XhrResponseType.Buffer);
2003
+ }
2004
+
2005
+ var GLTexture = pixi_js.glCore.GLTexture;
2006
+ var GLTextureMixin = {
2007
+ isCompressed: false,
2008
+ uploadNotCompressed: GLTexture.prototype.upload,
2009
+ upload: function upload(source) {
2010
+ if (!(source instanceof CompressedTextureResource)) {
2011
+ return this.uploadNotCompressed(source);
2012
+ }
2013
+
2014
+ this.bind();
2015
+ var gl = this.gl;
2016
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);
2017
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST);
2018
+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
2019
+ this.isCompressed = true;
2020
+ source.upload(gl);
2021
+ },
2022
+ enableMipmap: function enableMipmap() {
2023
+ if (this.isCompressed) {
2024
+ return;
2025
+ }
2026
+
2027
+ var gl = this.gl;
2028
+ this.bind();
2029
+ this.mipmap = true;
2030
+ gl.generateMipmap(gl.TEXTURE_2D);
2031
+ }
2032
+ };
2033
+
2034
+ var _a$1;
2035
+
2036
+ var oldFrom$1 = Symbol();
2037
+ var TextureMixin = (_a$1 = {}, _a$1[oldFrom$1] = pixi_js.Texture.from, _a$1.from = function (source) {
2038
+ if (!(source instanceof CompressedTextureResource)) {
2039
+ return this[oldFrom$1](source);
2040
+ }
2041
+
2042
+ return new pixi_js.Texture(pixi_js.BaseTexture.from(source));
2043
+ }, _a$1);
2044
+
2045
+ var _a;
2046
+
2047
+ var oldFrom = Symbol();
2048
+ var BaseTextureMixin = (_a = {}, _a[oldFrom] = pixi_js.BaseTexture.from, _a.from = function (source, scaleMode, sourceScale) {
2049
+ if (!(source instanceof CompressedTextureResource)) {
2050
+ return this[oldFrom](source, scaleMode, sourceScale);
2051
+ }
2052
+
2053
+ var imageUrl = source.src;
2054
+ var baseTexture = pixi_js.utils.BaseTextureCache[imageUrl];
2055
+
2056
+ if (!baseTexture) {
2057
+ baseTexture = new pixi_js.BaseTexture(source, scaleMode);
2058
+ baseTexture.imageUrl = imageUrl;
2059
+
2060
+ if (sourceScale) {
2061
+ baseTexture.sourceScale = sourceScale;
2062
+ }
2063
+
2064
+ pixi_js.BaseTexture.addToCache(baseTexture, imageUrl);
2065
+ }
2066
+
2067
+ return baseTexture;
2068
+ }, _a);
2069
+
2070
+ function registerCompressedTexture(gl) {
2071
+ addPreProcessResourceHandler(eva_js.resource, gl);
2072
+ addKTXStragetyAndRegister();
2073
+
2074
+ _extends(pixi_js.glCore.GLTexture.prototype, GLTextureMixin);
2075
+
2076
+ _extends(pixi_js.Texture, TextureMixin);
2077
+
2078
+ _extends(pixi_js.BaseTexture, BaseTextureMixin);
2079
+ }
2080
+
1698
2081
  exports.RENDERER_TYPE = void 0;
1699
2082
 
1700
2083
  (function (RENDERER_TYPE) {
@@ -1764,6 +2147,12 @@ this.EVA.plugin.renderer = function (exports, eva_js, rendererAdapter, pixi_js)
1764
2147
  application: application
1765
2148
  });
1766
2149
  });
2150
+ var gl = this.application.renderer.gl;
2151
+
2152
+ if (gl) {
2153
+ this.suportedCompressedTextureFormats = getSuportCompressedTextureFormats(gl);
2154
+ registerCompressedTexture(gl);
2155
+ }
1767
2156
  };
1768
2157
 
1769
2158
  Renderer.prototype.registerObserver = function (observerInfo) {
@@ -1953,6 +2342,23 @@ this.EVA.plugin.renderer = function (exports, eva_js, rendererAdapter, pixi_js)
1953
2342
  }(eva_js.System);
1954
2343
 
1955
2344
  var Renderer$1 = Renderer;
2345
+
2346
+ var mixinPIXI = function mixinPIXI() {
2347
+ pixi_js.BaseTexture.prototype.destroy = function () {
2348
+ if (this.imageUrl) {
2349
+ delete pixi_js.utils.TextureCache[this.imageUrl];
2350
+ this.imageUrl = null;
2351
+ }
2352
+
2353
+ this.source = null;
2354
+ this.dispose();
2355
+ pixi_js.BaseTexture.removeFromCache(this);
2356
+ this.textureCacheIds = null;
2357
+ this._destroyed = true;
2358
+ };
2359
+ };
2360
+
2361
+ mixinPIXI();
1956
2362
  exports.ContainerManager = ContainerManager$1;
1957
2363
  exports.Renderer = Renderer$1;
1958
2364
  exports.RendererManager = RendererManager$1;
@@ -1 +1 @@
1
- this.EVA=this.EVA||{},this.EVA.plugin=this.EVA.plugin||{},this.EVA.plugin.renderer=function(e,t,r,n){"use strict";var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function a(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function c(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function l(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(arguments[t]));return e}function f(e,t){return e===t||e!=e&&t!=t}function p(e,t){for(var r=e.length;r--;)if(f(e[r][0],t))return r;return-1}var h=Array.prototype.splice;function v(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}v.prototype.clear=function(){this.__data__=[],this.size=0},v.prototype.delete=function(e){var t=this.__data__,r=p(t,e);return!(r<0)&&(r==t.length-1?t.pop():h.call(t,r,1),--this.size,!0)},v.prototype.get=function(e){var t=this.__data__,r=p(t,e);return r<0?void 0:t[r][1]},v.prototype.has=function(e){return p(this.__data__,e)>-1},v.prototype.set=function(e,t){var r=this.__data__,n=p(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var y="object"==typeof global&&global&&global.Object===Object&&global,d="object"==typeof self&&self&&self.Object===Object&&self,_=y||d||Function("return this")(),b=_.Symbol,g=Object.prototype,m=g.hasOwnProperty,j=g.toString,w=b?b.toStringTag:void 0;var O=Object.prototype.toString;var E=b?b.toStringTag:void 0;function A(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":E&&E in Object(e)?function(e){var t=m.call(e,w),r=e[w];try{e[w]=void 0;var n=!0}catch(e){}var o=j.call(e);return n&&(t?e[w]=r:delete e[w]),o}(e):function(e){return O.call(e)}(e)}function x(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function S(e){if(!x(e))return!1;var t=A(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var C,M=_["__core-js_shared__"],R=(C=/[^.]+$/.exec(M&&M.keys&&M.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var P=Function.prototype.toString;function T(e){if(null!=e){try{return P.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var z=/^\[object .+?Constructor\]$/,N=Function.prototype,D=Object.prototype,V=N.toString,k=D.hasOwnProperty,I=RegExp("^"+V.call(k).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function L(e){return!(!x(e)||(t=e,R&&R in t))&&(S(e)?I:z).test(T(e));var t}function B(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return L(r)?r:void 0}var U=B(_,"Map"),F=B(Object,"create");var Y=Object.prototype.hasOwnProperty;var W=Object.prototype.hasOwnProperty;function $(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function G(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function q(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}$.prototype.clear=function(){this.__data__=F?F(null):{},this.size=0},$.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},$.prototype.get=function(e){var t=this.__data__;if(F){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Y.call(t,e)?t[e]:void 0},$.prototype.has=function(e){var t=this.__data__;return F?void 0!==t[e]:W.call(t,e)},$.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=F&&void 0===t?"__lodash_hash_undefined__":t,this},q.prototype.clear=function(){this.size=0,this.__data__={hash:new $,map:new(U||v),string:new $}},q.prototype.delete=function(e){var t=G(this,e).delete(e);return this.size-=t?1:0,t},q.prototype.get=function(e){return G(this,e).get(e)},q.prototype.has=function(e){return G(this,e).has(e)},q.prototype.set=function(e,t){var r=G(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function K(e){var t=this.__data__=new v(e);this.size=t.size}K.prototype.clear=function(){this.__data__=new v,this.size=0},K.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},K.prototype.get=function(e){return this.__data__.get(e)},K.prototype.has=function(e){return this.__data__.has(e)},K.prototype.set=function(e,t){var r=this.__data__;if(r instanceof v){var n=r.__data__;if(!U||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new q(n)}return r.set(e,t),this.size=r.size,this};function H(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new q;++t<r;)this.add(e[t])}function X(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}H.prototype.add=H.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},H.prototype.has=function(e){return this.__data__.has(e)};function J(e,t,r,n,o,a){var i=1&r,c=e.length,s=t.length;if(c!=s&&!(i&&s>c))return!1;var u=a.get(e),l=a.get(t);if(u&&l)return u==t&&l==e;var f=-1,p=!0,h=2&r?new H:void 0;for(a.set(e,t),a.set(t,e);++f<c;){var v=e[f],y=t[f];if(n)var d=i?n(y,v,f,t,e,a):n(v,y,f,e,t,a);if(void 0!==d){if(d)continue;p=!1;break}if(h){if(!X(t,(function(e,t){if(i=t,!h.has(i)&&(v===e||o(v,e,r,n,a)))return h.push(t);var i}))){p=!1;break}}else if(v!==y&&!o(v,y,r,n,a)){p=!1;break}}return a.delete(e),a.delete(t),p}var Q=_.Uint8Array;function Z(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function ee(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var te=b?b.prototype:void 0,re=te?te.valueOf:void 0;var ne=Array.isArray;var oe=Object.prototype.propertyIsEnumerable,ae=Object.getOwnPropertySymbols,ie=ae?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}(ae(e),(function(t){return oe.call(e,t)})))}:function(){return[]};function ce(e){return null!=e&&"object"==typeof e}function se(e){return ce(e)&&"[object Arguments]"==A(e)}var ue=Object.prototype,le=ue.hasOwnProperty,fe=ue.propertyIsEnumerable,pe=se(function(){return arguments}())?se:function(e){return ce(e)&&le.call(e,"callee")&&!fe.call(e,"callee")};var he="object"==typeof e&&e&&!e.nodeType&&e,ve=he&&"object"==typeof module&&module&&!module.nodeType&&module,ye=ve&&ve.exports===he?_.Buffer:void 0,de=(ye?ye.isBuffer:void 0)||function(){return!1},_e=/^(?:0|[1-9]\d*)$/;function be(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&_e.test(e))&&e>-1&&e%1==0&&e<t}function ge(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var me={};me["[object Float32Array]"]=me["[object Float64Array]"]=me["[object Int8Array]"]=me["[object Int16Array]"]=me["[object Int32Array]"]=me["[object Uint8Array]"]=me["[object Uint8ClampedArray]"]=me["[object Uint16Array]"]=me["[object Uint32Array]"]=!0,me["[object Arguments]"]=me["[object Array]"]=me["[object ArrayBuffer]"]=me["[object Boolean]"]=me["[object DataView]"]=me["[object Date]"]=me["[object Error]"]=me["[object Function]"]=me["[object Map]"]=me["[object Number]"]=me["[object Object]"]=me["[object RegExp]"]=me["[object Set]"]=me["[object String]"]=me["[object WeakMap]"]=!1;var je,we="object"==typeof e&&e&&!e.nodeType&&e,Oe=we&&"object"==typeof module&&module&&!module.nodeType&&module,Ee=Oe&&Oe.exports===we&&y.process,Ae=function(){try{var e=Oe&&Oe.require&&Oe.require("util").types;return e||Ee&&Ee.binding&&Ee.binding("util")}catch(e){}}(),xe=Ae&&Ae.isTypedArray,Se=xe?(je=xe,function(e){return je(e)}):function(e){return ce(e)&&ge(e.length)&&!!me[A(e)]},Ce=Object.prototype.hasOwnProperty;function Me(e,t){var r=ne(e),n=!r&&pe(e),o=!r&&!n&&de(e),a=!r&&!n&&!o&&Se(e),i=r||n||o||a,c=i?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],s=c.length;for(var u in e)!t&&!Ce.call(e,u)||i&&("length"==u||o&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||be(u,s))||c.push(u);return c}var Re=Object.prototype;var Pe=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Te=Object.prototype.hasOwnProperty;function ze(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||Re))return Pe(e);var t,r,n=[];for(var o in Object(e))Te.call(e,o)&&"constructor"!=o&&n.push(o);return n}function Ne(e){return null!=(t=e)&&ge(t.length)&&!S(t)?Me(e):ze(e);var t}function De(e){return function(e,t,r){var n=t(e);return ne(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,Ne,ie)}var Ve=Object.prototype.hasOwnProperty;var ke=B(_,"DataView"),Ie=B(_,"Promise"),Le=B(_,"Set"),Be=B(_,"WeakMap"),Ue="[object Map]",Fe="[object Promise]",Ye="[object Set]",We="[object WeakMap]",$e="[object DataView]",Ge=T(ke),qe=T(U),Ke=T(Ie),He=T(Le),Xe=T(Be),Je=A;(ke&&Je(new ke(new ArrayBuffer(1)))!=$e||U&&Je(new U)!=Ue||Ie&&Je(Ie.resolve())!=Fe||Le&&Je(new Le)!=Ye||Be&&Je(new Be)!=We)&&(Je=function(e){var t=A(e),r="[object Object]"==t?e.constructor:void 0,n=r?T(r):"";if(n)switch(n){case Ge:return $e;case qe:return Ue;case Ke:return Fe;case He:return Ye;case Xe:return We}return t});var Qe=Je,Ze="[object Arguments]",et="[object Array]",tt="[object Object]",rt=Object.prototype.hasOwnProperty;function nt(e,t,r,n,o,a){var i=ne(e),c=ne(t),s=i?et:Qe(e),u=c?et:Qe(t),l=(s=s==Ze?tt:s)==tt,p=(u=u==Ze?tt:u)==tt,h=s==u;if(h&&de(e)){if(!de(t))return!1;i=!0,l=!1}if(h&&!l)return a||(a=new K),i||Se(e)?J(e,t,r,n,o,a):function(e,t,r,n,o,a,i){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!a(new Q(e),new Q(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return f(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var c=Z;case"[object Set]":var s=1&n;if(c||(c=ee),e.size!=t.size&&!s)return!1;var u=i.get(e);if(u)return u==t;n|=2,i.set(e,t);var l=J(c(e),c(t),n,o,a,i);return i.delete(e),l;case"[object Symbol]":if(re)return re.call(e)==re.call(t)}return!1}(e,t,s,r,n,o,a);if(!(1&r)){var v=l&&rt.call(e,"__wrapped__"),y=p&&rt.call(t,"__wrapped__");if(v||y){var d=v?e.value():e,_=y?t.value():t;return a||(a=new K),o(d,_,r,n,a)}}return!!h&&(a||(a=new K),function(e,t,r,n,o,a){var i=1&r,c=De(e),s=c.length;if(s!=De(t).length&&!i)return!1;for(var u=s;u--;){var l=c[u];if(!(i?l in t:Ve.call(t,l)))return!1}var f=a.get(e),p=a.get(t);if(f&&p)return f==t&&p==e;var h=!0;a.set(e,t),a.set(t,e);for(var v=i;++u<s;){var y=e[l=c[u]],d=t[l];if(n)var _=i?n(d,y,l,t,e,a):n(y,d,l,e,t,a);if(!(void 0===_?y===d||o(y,d,r,n,a):_)){h=!1;break}v||(v="constructor"==l)}if(h&&!v){var b=e.constructor,g=t.constructor;b==g||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof g&&g instanceof g||(h=!1)}return a.delete(e),a.delete(t),h}(e,t,r,n,o,a))}function ot(e,t,r,n,o){return e===t||(null==e||null==t||!ce(e)&&!ce(t)?e!=e&&t!=t:nt(e,t,r,n,ot,o))}var at=function(){function e(e){var t=e.game,r=e.rendererSystem;this.renderers=[],this.game=t,this.rendererSystem=r}return e.prototype.register=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=s(r),a=o.next();!a.done;a=o.next()){var i=a.value;i.game=this.game,i.rendererManager=this.rendererSystem.rendererManager,i.containerManager=this.rendererSystem.containerManager,this.renderers.push(i)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}},e.prototype.componentChanged=function(e){var r,n,o=function(e){var r,n;try{for(var o=(r=void 0,s(a.renderers)),i=o.next();!i.done;i=o.next()){var c=i.value,u=c.observerInfo[e.componentName];if(u){if([t.OBSERVER_TYPE.ADD,t.OBSERVER_TYPE.REMOVE].indexOf(e.type)>-1){try{c.componentChanged&&c.componentChanged(e)}catch(t){console.error("gameObject: "+e.gameObject.name+", "+e.componentName+" is error.",e,t)}continue}if(u.findIndex((function(t){return r=t,n=e.prop,ot(r,n);var r,n}))>-1)try{c.componentChanged&&c.componentChanged(e)}catch(t){console.error("gameObject: "+(e.gameObject&&e.gameObject.name)+", "+e.componentName+" is componentChanged error.",e,t)}}}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},a=this;try{for(var i=s(e),c=i.next();!c.done;c=i.next()){o(c.value)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},e.prototype.update=function(e){var t,r,n,o;try{for(var a=s(e.components),i=a.next();!i.done;i=a.next()){var c=i.value;try{for(var u=(n=void 0,s(this.renderers)),l=u.next();!l.done;l=u.next()){var f=l.value,p=[];if(f.observerInfo[c.name]&&-1===p.indexOf(e)){p.push(e);try{f.rendererUpdate&&f.rendererUpdate(e)}catch(t){console.info("gameObject: "+e.name+", "+c.name+" is update error",t)}}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}},e}(),it=function(){function e(){this.containerMap={}}return e.prototype.addContainer=function(e){var t=e.name,r=e.container;this.containerMap[t]=r},e.prototype.getContainer=function(e){return this.containerMap[e]},e.prototype.removeContainer=function(e){var t;null===(t=this.containerMap[e])||void 0===t||t.destroy({children:!0}),delete this.containerMap[e]},e.prototype.updateTransform=function(e){var t=e.name,r=e.transform,n=this.containerMap[t];if(n){var o=r.anchor,a=r.origin,i=r.position,c=r.rotation,s=r.scale,u=r.size,l=r.skew;n.rotation=c,n.scale=s,n.pivot.x=u.width*a.x,n.pivot.y=u.height*a.y,n.skew=l;var f=i.x,p=i.y;if(r.parent){var h=r.parent;f+=h.size.width*o.x,p+=h.size.height*o.y}n.position={x:f,y:p}}},e}();var ct,st=function(e){function n(t){var r=t.system,n=t.containerManager,o=e.call(this)||this;return o.name="Transform",o.waitRemoveIds=[],o.waitChangeScenes=[],o.containerManager=n,o.init(r),o}return a(n,e),n.prototype.init=function(e){var t=this;this.system=e,this.on("changeScene",(function(e){var r=e.scene,n=e.mode,o=e.application;t.waitChangeScenes.push({scene:r,mode:n,application:o})}))},n.prototype.update=function(){var e,t,r,n;try{for(var o=s(this.waitRemoveIds),a=o.next();!a.done;a=o.next()){var i=a.value;this.containerManager.removeContainer(i)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.waitRemoveIds=[];try{for(var c=s(this.waitChangeScenes),u=c.next();!u.done;u=c.next()){var l=u.value,f=this.containerManager.getContainer(l.scene.id);f&&(l.application.stage.removeChildren(),l.application.stage.addChild(f))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},n.prototype.componentChanged=function(e){e.type===t.OBSERVER_TYPE.ADD?this.addContainer(e):e.type===t.OBSERVER_TYPE.CHANGE?this.change(e):e.type===t.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(e.gameObject.id)},n.prototype.addContainer=function(e){var t=new r.Container;t.name=e.gameObject.name,this.containerManager.addContainer({name:e.gameObject.id,container:t}),e.component.worldTransform=t.transform.worldTransform},n.prototype.change=function(e){var t=e.component;if(t.parent){this.containerManager.getContainer(t.parent.gameObject.id).addChild(this.containerManager.getContainer(e.gameObject.id));var r=e.gameObject.transform.parent&&e.gameObject.transform.parent.gameObject.getComponent("Render");r&&(r.sortDirty=!0)}else{var n=this.containerManager.getContainer(e.gameObject.id);delete t.worldTransform,n.parent&&n.parent.removeChild(n)}},n.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},n=c([t.decorators.componentObserver({Transform:["_parent"]})],n)}(function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,n,a,i){if("function"!=typeof n)throw new TypeError("The listener must be a function");var c=new o(n,a||e,i),s=r?r+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],c]:e._events[s].push(c):(e._events[s]=c,e._eventsCount++),e}function i(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,a=n.length,i=new Array(a);o<a;o++)i[o]=n[o].fn;return i},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,o,a,i){var c=r?r+e:e;if(!this._events[c])return!1;var s,u,l=this._events[c],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,o),!0;case 5:return l.fn.call(l.context,t,n,o,a),!0;case 6:return l.fn.call(l.context,t,n,o,a,i),!0}for(u=1,s=new Array(f-1);u<f;u++)s[u-1]=arguments[u];l.fn.apply(l.context,s)}else{var p,h=l.length;for(u=0;u<h;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),f){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,n);break;case 4:l[u].fn.call(l[u].context,t,n,o);break;default:if(!s)for(p=1,s=new Array(f-1);p<f;p++)s[p-1]=arguments[p];l[u].fn.apply(l[u].context,s)}}return!0},c.prototype.on=function(e,t,r){return a(this,e,t,r,!1)},c.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},c.prototype.removeListener=function(e,t,n,o){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return i(this,a),this;var c=this._events[a];if(c.fn)c.fn!==t||o&&!c.once||n&&c.context!==n||i(this,a);else{for(var s=0,u=[],l=c.length;s<l;s++)(c[s].fn!==t||o&&!c[s].once||n&&c[s].context!==n)&&u.push(c[s]);u.length?this._events[a]=1===u.length?u[0]:u:i(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&i(this,t)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,e.exports=c})));e.RENDERER_TYPE=void 0,(ct=e.RENDERER_TYPE||(e.RENDERER_TYPE={}))[ct.UNKNOWN=0]="UNKNOWN",ct[ct.WEBGL=1]="WEBGL",ct[ct.CANVAS=2]="CANVAS";var ut=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},lt=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},ft=function(o){function u(){var e=null!==o&&o.apply(this,arguments)||this;return e.multiApps=[],e}return a(u,o),u.prototype.init=function(e){var r=this;this.params=e,this.application=this.createApplication(e),this.containerManager=new it,this.rendererManager=new at({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new st({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(e){var n,o=e.scene,a=e.mode,i=e.params;switch(a){case t.LOAD_SCENE_MODE.SINGLE:n=r.application;break;case t.LOAD_SCENE_MODE.MULTI_CANVAS:n=r.createMultiApplication({params:i})}o.canvas=n.view,r.transform.emit("changeScene",{scene:o,mode:a,application:n})}))},u.prototype.registerObserver=function(e){var t,r=this.constructor.observerInfo;for(var n in e)r[n]||(r[n]=[]),(t=r[n]).push.apply(t,l(e[n]))},u.prototype.createMultiApplication=function(e){var t=e.params,r=this.createApplication(t);return this.multiApps.push(r),r},u.prototype.createApplication=function(t){t.view=t.canvas,t.renderType===e.RENDERER_TYPE.CANVAS&&(t.forceCanvas=!0),n.ticker.shared.autoStart=!1,n.ticker.shared.stop();var o=new r.Application(i({sharedTicker:!0},t));return void 0!==t.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),t.preventScroll?lt(o.renderer):ut(o.renderer)),void 0!==t.enableScroll&&(t.enableScroll?lt(o.renderer):ut(o.renderer)),void 0===t.preventScroll&&void 0===t.enableScroll&&lt(o.renderer),o},u.prototype.update=function(){var e,t,r,n,o=this.componentObserver.clear();try{for(var a=s(o),i=a.next();!i.done;i=a.next()){var c=i.value;this.transform.componentChanged(c)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}try{for(var u=s(this.game.gameObjects),l=u.next();!l.done;l=u.next()){var f=l.value;this.containerManager.updateTransform({name:f.id,transform:f.transform}),this.rendererManager.update(f)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}},u.prototype.lateUpdate=function(e){this.transform.update(),this.application.ticker.update(e.time)},u.prototype.onDestroy=function(){var e,t;this.application.destroy();try{for(var r=s(this.multiApps),n=r.next();!n.done;n=r.next()){var o=n.value;o&&o.destroy()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.transform.destroy(),this.transform=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null},u.prototype.resize=function(e,t){this.params.width=e,this.params.height=t,this.application.renderer.resize(e,t)},u.systemName="Renderer",u=c([t.decorators.componentObserver({Transform:["_parent"]})],u)}(t.System),pt=function(e){function t(t){var r=e.call(this,t)||this;return r.observerInfo=r.constructor.observerInfo,r}return a(t,e),t.prototype.componentChanged=function(e){},t.prototype.rendererUpdate=function(e){},t.prototype.update=function(e){var t,r,n=this.componentObserver.clear();try{for(var o=s(n),a=o.next();!a.done;a=o.next()){var i=a.value;this.componentChanged(i)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},t}(t.System);return e.ContainerManager=it,e.Renderer=pt,e.RendererManager=at,e.RendererSystem=ft,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.rendererAdapter,PIXI);
1
+ function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}this.EVA=this.EVA||{},this.EVA.plugin=this.EVA.plugin||{},this.EVA.plugin.renderer=function(e,t,r,n){"use strict";var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function _(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return(a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function i(e,t,r,n){var o,_=arguments.length,a=_<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(o=e[i])&&(a=(_<3?o(a):_>3?o(t,r,a):o(t,r))||a);return _>3&&a&&Object.defineProperty(t,r,a),a}function s(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,_=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=_.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=_.return)&&r.call(_)}finally{if(o)throw o.error}}return a}function E(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e}function u(e,t){return e===t||e!=e&&t!=t}function S(e,t){for(var r=e.length;r--;)if(u(e[r][0],t))return r;return-1}var l=Array.prototype.splice;function R(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}R.prototype.clear=function(){this.__data__=[],this.size=0},R.prototype.delete=function(e){var t=this.__data__,r=S(t,e);return!(r<0)&&(r==t.length-1?t.pop():l.call(t,r,1),--this.size,!0)},R.prototype.get=function(e){var t=this.__data__,r=S(t,e);return r<0?void 0:t[r][1]},R.prototype.has=function(e){return S(this.__data__,e)>-1},R.prototype.set=function(e,t){var r=this.__data__,n=S(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this};var p="object"==typeof global&&global&&global.Object===Object&&global,f="object"==typeof self&&self&&self.Object===Object&&self,C=p||f||Function("return this")(),h=C.Symbol,A=Object.prototype,P=A.hasOwnProperty,d=A.toString,v=h?h.toStringTag:void 0;var T=Object.prototype.toString;var y=h?h.toStringTag:void 0;function O(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":y&&y in Object(e)?function(e){var t=P.call(e,v),r=e[v];try{e[v]=void 0;var n=!0}catch(e){}var o=d.call(e);return n&&(t?e[v]=r:delete e[v]),o}(e):function(e){return T.call(e)}(e)}function G(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function B(e){if(!G(e))return!1;var t=O(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var m,D=C["__core-js_shared__"],M=(m=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||""))?"Symbol(src)_1."+m:"";var g=Function.prototype.toString;function x(e){if(null!=e){try{return g.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var b=/^\[object .+?Constructor\]$/,H=Function.prototype,L=Object.prototype,j=H.toString,w=L.hasOwnProperty,X=RegExp("^"+j.call(w).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function K(e){return!(!G(e)||(t=e,M&&M in t))&&(B(e)?X:b).test(x(e));var t}function I(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return K(r)?r:void 0}var W=I(C,"Map"),U=I(Object,"create");var N=Object.prototype.hasOwnProperty;var V=Object.prototype.hasOwnProperty;function z(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function k(e,t){var r,n,o=e.__data__;return("string"==(n=typeof(r=t))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.map}function F(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}z.prototype.clear=function(){this.__data__=U?U(null):{},this.size=0},z.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},z.prototype.get=function(e){var t=this.__data__;if(U){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return N.call(t,e)?t[e]:void 0},z.prototype.has=function(e){var t=this.__data__;return U?void 0!==t[e]:V.call(t,e)},z.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=U&&void 0===t?"__lodash_hash_undefined__":t,this},F.prototype.clear=function(){this.size=0,this.__data__={hash:new z,map:new(W||R),string:new z}},F.prototype.delete=function(e){var t=k(this,e).delete(e);return this.size-=t?1:0,t},F.prototype.get=function(e){return k(this,e).get(e)},F.prototype.has=function(e){return k(this,e).has(e)},F.prototype.set=function(e,t){var r=k(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this};function Y(e){var t=this.__data__=new R(e);this.size=t.size}Y.prototype.clear=function(){this.__data__=new R,this.size=0},Y.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Y.prototype.get=function(e){return this.__data__.get(e)},Y.prototype.has=function(e){return this.__data__.has(e)},Y.prototype.set=function(e,t){var r=this.__data__;if(r instanceof R){var n=r.__data__;if(!W||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new F(n)}return r.set(e,t),this.size=r.size,this};function $(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new F;++t<r;)this.add(e[t])}function q(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}$.prototype.add=$.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},$.prototype.has=function(e){return this.__data__.has(e)};function J(e,t,r,n,o,_){var a=1&r,i=e.length,s=t.length;if(i!=s&&!(a&&s>i))return!1;var c=_.get(e),E=_.get(t);if(c&&E)return c==t&&E==e;var u=-1,S=!0,l=2&r?new $:void 0;for(_.set(e,t),_.set(t,e);++u<i;){var R=e[u],p=t[u];if(n)var f=a?n(p,R,u,t,e,_):n(R,p,u,e,t,_);if(void 0!==f){if(f)continue;S=!1;break}if(l){if(!q(t,(function(e,t){if(a=t,!l.has(a)&&(R===e||o(R,e,r,n,_)))return l.push(t);var a}))){S=!1;break}}else if(R!==p&&!o(R,p,r,n,_)){S=!1;break}}return _.delete(e),_.delete(t),S}var Q=C.Uint8Array;function Z(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function ee(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var te=h?h.prototype:void 0,re=te?te.valueOf:void 0;var ne=Array.isArray;var oe=Object.prototype.propertyIsEnumerable,_e=Object.getOwnPropertySymbols,ae=_e?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,_=[];++r<n;){var a=e[r];t(a,r,e)&&(_[o++]=a)}return _}(_e(e),(function(t){return oe.call(e,t)})))}:function(){return[]};function ie(e){return null!=e&&"object"==typeof e}function se(e){return ie(e)&&"[object Arguments]"==O(e)}var ce=Object.prototype,Ee=ce.hasOwnProperty,ue=ce.propertyIsEnumerable,Se=se(function(){return arguments}())?se:function(e){return ie(e)&&Ee.call(e,"callee")&&!ue.call(e,"callee")};var le="object"==typeof e&&e&&!e.nodeType&&e,Re=le&&"object"==typeof module&&module&&!module.nodeType&&module,pe=Re&&Re.exports===le?C.Buffer:void 0,fe=(pe?pe.isBuffer:void 0)||function(){return!1},Ce=/^(?:0|[1-9]\d*)$/;function he(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Ce.test(e))&&e>-1&&e%1==0&&e<t}function Ae(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var Pe={};Pe["[object Float32Array]"]=Pe["[object Float64Array]"]=Pe["[object Int8Array]"]=Pe["[object Int16Array]"]=Pe["[object Int32Array]"]=Pe["[object Uint8Array]"]=Pe["[object Uint8ClampedArray]"]=Pe["[object Uint16Array]"]=Pe["[object Uint32Array]"]=!0,Pe["[object Arguments]"]=Pe["[object Array]"]=Pe["[object ArrayBuffer]"]=Pe["[object Boolean]"]=Pe["[object DataView]"]=Pe["[object Date]"]=Pe["[object Error]"]=Pe["[object Function]"]=Pe["[object Map]"]=Pe["[object Number]"]=Pe["[object Object]"]=Pe["[object RegExp]"]=Pe["[object Set]"]=Pe["[object String]"]=Pe["[object WeakMap]"]=!1;var de,ve="object"==typeof e&&e&&!e.nodeType&&e,Te=ve&&"object"==typeof module&&module&&!module.nodeType&&module,ye=Te&&Te.exports===ve&&p.process,Oe=function(){try{var e=Te&&Te.require&&Te.require("util").types;return e||ye&&ye.binding&&ye.binding("util")}catch(e){}}(),Ge=Oe&&Oe.isTypedArray,Be=Ge?(de=Ge,function(e){return de(e)}):function(e){return ie(e)&&Ae(e.length)&&!!Pe[O(e)]},me=Object.prototype.hasOwnProperty;function De(e,t){var r=ne(e),n=!r&&Se(e),o=!r&&!n&&fe(e),_=!r&&!n&&!o&&Be(e),a=r||n||o||_,i=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],s=i.length;for(var c in e)!t&&!me.call(e,c)||a&&("length"==c||o&&("offset"==c||"parent"==c)||_&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||he(c,s))||i.push(c);return i}var Me=Object.prototype;var ge=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),xe=Object.prototype.hasOwnProperty;function be(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||Me))return ge(e);var t,r,n=[];for(var o in Object(e))xe.call(e,o)&&"constructor"!=o&&n.push(o);return n}function He(e){return null!=(t=e)&&Ae(t.length)&&!B(t)?De(e):be(e);var t}function Le(e){return function(e,t,r){var n=t(e);return ne(e)?n:function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}(n,r(e))}(e,He,ae)}var je=Object.prototype.hasOwnProperty;var we=I(C,"DataView"),Xe=I(C,"Promise"),Ke=I(C,"Set"),Ie=I(C,"WeakMap"),We="[object Map]",Ue="[object Promise]",Ne="[object Set]",Ve="[object WeakMap]",ze="[object DataView]",ke=x(we),Fe=x(W),Ye=x(Xe),$e=x(Ke),qe=x(Ie),Je=O;(we&&Je(new we(new ArrayBuffer(1)))!=ze||W&&Je(new W)!=We||Xe&&Je(Xe.resolve())!=Ue||Ke&&Je(new Ke)!=Ne||Ie&&Je(new Ie)!=Ve)&&(Je=function(e){var t=O(e),r="[object Object]"==t?e.constructor:void 0,n=r?x(r):"";if(n)switch(n){case ke:return ze;case Fe:return We;case Ye:return Ue;case $e:return Ne;case qe:return Ve}return t});var Qe=Je,Ze="[object Arguments]",et="[object Array]",tt="[object Object]",rt=Object.prototype.hasOwnProperty;function nt(e,t,r,n,o,_){var a=ne(e),i=ne(t),s=a?et:Qe(e),c=i?et:Qe(t),E=(s=s==Ze?tt:s)==tt,S=(c=c==Ze?tt:c)==tt,l=s==c;if(l&&fe(e)){if(!fe(t))return!1;a=!0,E=!1}if(l&&!E)return _||(_=new Y),a||Be(e)?J(e,t,r,n,o,_):function(e,t,r,n,o,_,a){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!_(new Q(e),new Q(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return u(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var i=Z;case"[object Set]":var s=1&n;if(i||(i=ee),e.size!=t.size&&!s)return!1;var c=a.get(e);if(c)return c==t;n|=2,a.set(e,t);var E=J(i(e),i(t),n,o,_,a);return a.delete(e),E;case"[object Symbol]":if(re)return re.call(e)==re.call(t)}return!1}(e,t,s,r,n,o,_);if(!(1&r)){var R=E&&rt.call(e,"__wrapped__"),p=S&&rt.call(t,"__wrapped__");if(R||p){var f=R?e.value():e,C=p?t.value():t;return _||(_=new Y),o(f,C,r,n,_)}}return!!l&&(_||(_=new Y),function(e,t,r,n,o,_){var a=1&r,i=Le(e),s=i.length;if(s!=Le(t).length&&!a)return!1;for(var c=s;c--;){var E=i[c];if(!(a?E in t:je.call(t,E)))return!1}var u=_.get(e),S=_.get(t);if(u&&S)return u==t&&S==e;var l=!0;_.set(e,t),_.set(t,e);for(var R=a;++c<s;){var p=e[E=i[c]],f=t[E];if(n)var C=a?n(f,p,E,t,e,_):n(p,f,E,e,t,_);if(!(void 0===C?p===f||o(p,f,r,n,_):C)){l=!1;break}R||(R="constructor"==E)}if(l&&!R){var h=e.constructor,A=t.constructor;h==A||!("constructor"in e)||!("constructor"in t)||"function"==typeof h&&h instanceof h&&"function"==typeof A&&A instanceof A||(l=!1)}return _.delete(e),_.delete(t),l}(e,t,r,n,o,_))}function ot(e,t,r,n,o){return e===t||(null==e||null==t||!ie(e)&&!ie(t)?e!=e&&t!=t:nt(e,t,r,n,ot,o))}var _t=function(){function e(e){var t=e.game,r=e.rendererSystem;this.renderers=[],this.game=t,this.rendererSystem=r}return e.prototype.register=function(){for(var e,t,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=s(r),_=o.next();!_.done;_=o.next()){var a=_.value;a.game=this.game,a.rendererManager=this.rendererSystem.rendererManager,a.containerManager=this.rendererSystem.containerManager,this.renderers.push(a)}}catch(t){e={error:t}}finally{try{_&&!_.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}},e.prototype.componentChanged=function(e){var r,n,o=function(e){var r,n;try{for(var o=(r=void 0,s(_.renderers)),a=o.next();!a.done;a=o.next()){var i=a.value,c=i.observerInfo[e.componentName];if(c){if([t.OBSERVER_TYPE.ADD,t.OBSERVER_TYPE.REMOVE].indexOf(e.type)>-1){try{i.componentChanged&&i.componentChanged(e)}catch(t){console.error("gameObject: "+e.gameObject.name+", "+e.componentName+" is error.",e,t)}continue}if(c.findIndex((function(t){return r=t,n=e.prop,ot(r,n);var r,n}))>-1)try{i.componentChanged&&i.componentChanged(e)}catch(t){console.error("gameObject: "+(e.gameObject&&e.gameObject.name)+", "+e.componentName+" is componentChanged error.",e,t)}}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},_=this;try{for(var a=s(e),i=a.next();!i.done;i=a.next()){o(i.value)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},e.prototype.update=function(e){var t,r,n,o;try{for(var _=s(e.components),a=_.next();!a.done;a=_.next()){var i=a.value;try{for(var c=(n=void 0,s(this.renderers)),E=c.next();!E.done;E=c.next()){var u=E.value,S=[];if(u.observerInfo[i.name]&&-1===S.indexOf(e)){S.push(e);try{u.rendererUpdate&&u.rendererUpdate(e)}catch(t){console.info("gameObject: "+e.name+", "+i.name+" is update error",t)}}}}catch(e){n={error:e}}finally{try{E&&!E.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=_.return)&&r.call(_)}finally{if(t)throw t.error}}},e}(),at=function(){function e(){this.containerMap={}}return e.prototype.addContainer=function(e){var t=e.name,r=e.container;this.containerMap[t]=r},e.prototype.getContainer=function(e){return this.containerMap[e]},e.prototype.removeContainer=function(e){var t;null===(t=this.containerMap[e])||void 0===t||t.destroy({children:!0}),delete this.containerMap[e]},e.prototype.updateTransform=function(e){var t=e.name,r=e.transform,n=this.containerMap[t];if(n){var o=r.anchor,_=r.origin,a=r.position,i=r.rotation,s=r.scale,c=r.size,E=r.skew;n.rotation=i,n.scale=s,n.pivot.x=c.width*_.x,n.pivot.y=c.height*_.y,n.skew=E;var u=a.x,S=a.y;if(r.parent){var l=r.parent;u+=l.size.width*o.x,S+=l.size.height*o.y}n.position={x:u,y:S}}},e}();var it=function(e){function n(t){var r=t.system,n=t.containerManager,o=e.call(this)||this;return o.name="Transform",o.waitRemoveIds=[],o.waitChangeScenes=[],o.containerManager=n,o.init(r),o}return _(n,e),n.prototype.init=function(e){var t=this;this.system=e,this.on("changeScene",(function(e){var r=e.scene,n=e.mode,o=e.application;t.waitChangeScenes.push({scene:r,mode:n,application:o})}))},n.prototype.update=function(){var e,t,r,n;try{for(var o=s(this.waitRemoveIds),_=o.next();!_.done;_=o.next()){var a=_.value;this.containerManager.removeContainer(a)}}catch(t){e={error:t}}finally{try{_&&!_.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.waitRemoveIds=[];try{for(var i=s(this.waitChangeScenes),c=i.next();!c.done;c=i.next()){var E=c.value,u=this.containerManager.getContainer(E.scene.id);u&&(E.application.stage.removeChildren(),E.application.stage.addChild(u))}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},n.prototype.componentChanged=function(e){e.type===t.OBSERVER_TYPE.ADD?this.addContainer(e):e.type===t.OBSERVER_TYPE.CHANGE?this.change(e):e.type===t.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(e.gameObject.id)},n.prototype.addContainer=function(e){var t=new r.Container;t.name=e.gameObject.name,this.containerManager.addContainer({name:e.gameObject.id,container:t}),e.component.worldTransform=t.transform.worldTransform},n.prototype.change=function(e){var t=e.component;if(t.parent){this.containerManager.getContainer(t.parent.gameObject.id).addChild(this.containerManager.getContainer(e.gameObject.id));var r=e.gameObject.transform.parent&&e.gameObject.transform.parent.gameObject.getComponent("Render");r&&(r.sortDirty=!0)}else{var n=this.containerManager.getContainer(e.gameObject.id);delete t.worldTransform,n.parent&&n.parent.removeChild(n)}},n.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},n=i([t.decorators.componentObserver({Transform:["_parent"]})],n)}(function(e){var t={exports:{}};return e(t,t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function _(e,t,n,_,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var i=new o(n,_||e,a),s=r?r+t:t;return e._events[s]?e._events[s].fn?e._events[s]=[e._events[s],i]:e._events[s].push(i):(e._events[s]=i,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function i(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),i.prototype.eventNames=function(){var e,n,o=[];if(0===this._eventsCount)return o;for(n in e=this._events)t.call(e,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},i.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,_=n.length,a=new Array(_);o<_;o++)a[o]=n[o].fn;return a},i.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},i.prototype.emit=function(e,t,n,o,_,a){var i=r?r+e:e;if(!this._events[i])return!1;var s,c,E=this._events[i],u=arguments.length;if(E.fn){switch(E.once&&this.removeListener(e,E.fn,void 0,!0),u){case 1:return E.fn.call(E.context),!0;case 2:return E.fn.call(E.context,t),!0;case 3:return E.fn.call(E.context,t,n),!0;case 4:return E.fn.call(E.context,t,n,o),!0;case 5:return E.fn.call(E.context,t,n,o,_),!0;case 6:return E.fn.call(E.context,t,n,o,_,a),!0}for(c=1,s=new Array(u-1);c<u;c++)s[c-1]=arguments[c];E.fn.apply(E.context,s)}else{var S,l=E.length;for(c=0;c<l;c++)switch(E[c].once&&this.removeListener(e,E[c].fn,void 0,!0),u){case 1:E[c].fn.call(E[c].context);break;case 2:E[c].fn.call(E[c].context,t);break;case 3:E[c].fn.call(E[c].context,t,n);break;case 4:E[c].fn.call(E[c].context,t,n,o);break;default:if(!s)for(S=1,s=new Array(u-1);S<u;S++)s[S-1]=arguments[S];E[c].fn.apply(E[c].context,s)}}return!0},i.prototype.on=function(e,t,r){return _(this,e,t,r,!1)},i.prototype.once=function(e,t,r){return _(this,e,t,r,!0)},i.prototype.removeListener=function(e,t,n,o){var _=r?r+e:e;if(!this._events[_])return this;if(!t)return a(this,_),this;var i=this._events[_];if(i.fn)i.fn!==t||o&&!i.once||n&&i.context!==n||a(this,_);else{for(var s=0,c=[],E=i.length;s<E;s++)(i[s].fn!==t||o&&!i[s].once||n&&i[s].context!==n)&&c.push(i[s]);c.length?this._events[_]=1===c.length?c[0]:c:a(this,_)}return this},i.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prefixed=r,i.EventEmitter=i,e.exports=i}))),st=void 0;function ct(e){if(st)return st;if(!e)return console.warn("WebGL not available for compressed textures. Silently failing."),{s3tc:!1,etc:!1,etc1:!1,pvrtc:!1,atc:!1,astc:!1};st={s3tc:!!e.getExtension("WEBGL_compressed_texture_s3tc"),etc:!!e.getExtension("WEBGL_compressed_texture_etc"),etc1:!!e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:!!e.getExtension("WEBGL_compressed_texture_pvrtc")||!!e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:!!e.getExtension("WEBGL_compressed_texture_atc"),astc:!!e.getExtension("WEBGL_compressed_texture_astc")};try{console.log("Eva.js Supported Compressed Texture Format List: "+Object.keys(st).filter((function(e){return st[e]})).join(", "))}catch(e){}return st}var Et,ut,St,lt=t.resourceLoader.XhrLoadStrategy;!function(e){e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=3781]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"}(St||(St={}));var Rt=((Et={})[St.COMPRESSED_RGB_S3TC_DXT1_EXT]=[4,4],Et[St.COMPRESSED_RGBA_S3TC_DXT1_EXT]=[4,4],Et[St.COMPRESSED_RGBA_S3TC_DXT3_EXT]=[4,4],Et[St.COMPRESSED_RGBA_S3TC_DXT5_EXT]=[4,4],Et[St.COMPRESSED_SRGB_S3TC_DXT1_EXT]=[4,4],Et[St.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=[4,4],Et[St.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=[4,4],Et[St.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=[4,4],Et[St.COMPRESSED_R11_EAC]=[4,4],Et[St.COMPRESSED_SIGNED_R11_EAC]=[4,4],Et[St.COMPRESSED_RG11_EAC]=[4,4],Et[St.COMPRESSED_SIGNED_RG11_EAC]=[4,4],Et[St.COMPRESSED_RGB8_ETC2]=[4,4],Et[St.COMPRESSED_RGBA8_ETC2_EAC]=[4,4],Et[St.COMPRESSED_SRGB8_ETC2]=[4,4],Et[St.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=[4,4],Et[St.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],Et[St.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],Et[St.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=[4,4],Et[St.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=[4,4],Et[St.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=[8,4],Et[St.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=[8,4],Et[St.COMPRESSED_RGB_ETC1_WEBGL]=[4,4],Et[St.COMPRESSED_RGB_ATC_WEBGL]=[4,4],Et[St.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=[4,4],Et[St.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=[4,4],Et[St.COMPRESSED_RGBA_ASTC_4x4_KHR]=[4,4],Et[St.COMPRESSED_RGBA_ASTC_5x5_KHR]=[5,5],Et[St.COMPRESSED_RGBA_ASTC_6x6_KHR]=[6,6],Et[St.COMPRESSED_RGBA_ASTC_8x8_KHR]=[8,8],Et[St.COMPRESSED_RGBA_ASTC_10x10_KHR]=[10,10],Et[St.COMPRESSED_RGBA_ASTC_12x12_KHR]=[12,12],Et[St.COMPRESSED_RGBA_ASTC_10x5_KHR]=[10,5],Et[St.COMPRESSED_RGBA_ASTC_10x6_KHR]=[10,6],Et[St.COMPRESSED_RGBA_ASTC_10x8_KHR]=[10,8],Et[St.COMPRESSED_RGBA_ASTC_12x10_KHR]=[12,10],Et[St.COMPRESSED_RGBA_ASTC_5x4_KHR]=[5,4],Et[St.COMPRESSED_RGBA_ASTC_6x5_KHR]=[6,5],Et[St.COMPRESSED_RGBA_ASTC_8x5_KHR]=[8,5],Et[St.COMPRESSED_RGBA_ASTC_8x6_KHR]=[8,6],Et),pt=((ut={})[St.COMPRESSED_RGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",ut[St.COMPRESSED_RGBA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",ut[St.COMPRESSED_RGBA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc",ut[St.COMPRESSED_RGBA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc",ut[St.COMPRESSED_SRGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",ut[St.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",ut[St.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc_srgb",ut[St.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc_srgb",ut[St.COMPRESSED_R11_EAC]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_SIGNED_R11_EAC]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_RG11_EAC]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_SIGNED_RG11_EAC]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_RGB8_ETC2]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_RGBA8_ETC2_EAC]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_SRGB8_ETC2]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",ut[St.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ut[St.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ut[St.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ut[St.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ut[St.COMPRESSED_RGB_ETC1_WEBGL]="WEBGL_compressed_texture_etc1",ut[St.COMPRESSED_RGB_ATC_WEBGL]="WEBGL_compressed_texture_atc",ut[St.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",ut[St.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",ut[St.COMPRESSED_RGBA_ASTC_4x4_KHR]="WEBGL_compressed_texture_astc",ut[St.COMPRESSED_RGBA_ASTC_5x5_KHR]="WEBGL_compressed_texture_astc",ut[St.COMPRESSED_RGBA_ASTC_6x6_KHR]="WEBGL_compressed_texture_astc",ut[St.COMPRESSED_RGBA_ASTC_8x8_KHR]="WEBGL_compressed_texture_astc",ut[St.COMPRESSED_RGBA_ASTC_10x10_KHR]="WEBGL_compressed_texture_astc",ut[St.COMPRESSED_RGBA_ASTC_12x12_KHR]="WEBGL_compressed_texture_astc",ut),ft=function(){function e(){this.levelBuffers=[]}return e.prototype.upload=function(e){var t=this.levels,r=pt[this.internalFormat];e[r]||(e[r]=!0,"WEBGL_compressed_texture_pvrtc"===r?e.getExtension(r)||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"):e.getExtension(r));for(var n=0;n<this.levels;++n){var o=this.levelBuffers[n],_=o.levelWidth,a=o.levelHeight,i=o.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,n,this.internalFormat,_,a,0,i)}t>1?(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST)):(e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR))},e}(),Ct=12,ht=28,At=36,Pt=40,dt=44,vt=48,Tt=52,yt=56,Ot=60,Gt=[171,75,84,88,32,49,49,187,13,10,26,10],Bt=function(e){function r(r,n){var o,_=e.call(this)||this;_.complete=!0,_.src=n.url;var a=new DataView(r);if(!function(e){for(var t=0;t<Gt.length;t++)if(e.getUint8(t)!==Gt[t])return!1;return!0}(a))throw new Error("Not a valid KTX Texture");var i=67305985===a.getUint32(Ct,!0);_.internalFormat=a.getUint32(ht,i);var s=_.formerWidth=a.getUint32(At,i),c=_.formerHeight=a.getUint32(Pt,i)||1,E=Rt[_.internalFormat];_.width=s%E[0]==0?s:s+E[0]-s%E[0],_.height=c%E[1]==0?c:c+E[1]-c%E[1];var u=t.resource.resourcesMap[n.metadata.name].src[n.metadata.key],S=null!==(o=null==u?void 0:u.size)&&void 0!==o?o:{},l=S.width,R=S.height;l&&R&&(_.naturalWidth=l,_.naturalHeight=R);var p=a.getUint32(dt,i)||1,f=a.getUint32(vt,i)||1,C=a.getUint32(Tt,i),h=_.levels=a.getUint32(yt,i),A=a.getUint32(Ot,i);if(0===c||1!==p)throw new Error("Only 2D textures are supported!");if(1!==C)throw new Error("CubeTextures are not supported!");if(1!==f)throw new Error("It does not support array textures!");for(var P=s,d=c,v=64+A,T=0;T<h;T++){var y=a.getUint32(v,i);v+=4;var O=Rt[_.internalFormat],G={levelID:T,levelWidth:P%O[0]==0?P:P+O[0]-P%O[0],levelHeight:d%O[1]==0?d:d+O[1]-d%O[1],levelBuffer:new Uint8Array(r,v,y)};_.levelBuffers.push(G),v+=y,v+=3-(v+3)%4,P=P>>1||1,d=d>>1||1}return _}return _(r,e),r}(ft);var mt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return _(t,e),t.prototype._complete=function(t,r){e.prototype._complete.call(this,t,new Bt(r,this.config))},t}(lt),Dt=t.resourceLoader.XhrResponseType;var Mt,gt,xt,bt={isCompressed:!1,uploadNotCompressed:n.glCore.GLTexture.prototype.upload,upload:function(e){if(!(e instanceof ft))return this.uploadNotCompressed(e);this.bind();var t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST_MIPMAP_NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),this.isCompressed=!0,e.upload(t)},enableMipmap:function(){if(!this.isCompressed){var e=this.gl;this.bind(),this.mipmap=!0,e.generateMipmap(e.TEXTURE_2D)}}},Ht=Symbol(),Lt=((Mt={})[Ht]=n.Texture.from,Mt.from=function(e){return e instanceof ft?new n.Texture(n.BaseTexture.from(e)):this[Ht](e)},Mt),jt=Symbol(),wt=((gt={})[jt]=n.BaseTexture.from,gt.from=function(e,t,r){if(!(e instanceof ft))return this[jt](e,t,r);var o=e.src,_=n.utils.BaseTextureCache[o];return _||((_=new n.BaseTexture(e,t)).imageUrl=o,r&&(_.sourceScale=r),n.BaseTexture.addToCache(_,o)),_},gt);function Xt(e){!function(e,t){e.addPreProcessResourceHandler((function(e){var r,n,o,_=null===(n=null===(r=e.src)||void 0===r?void 0:r.image)||void 0===n?void 0:n.texture;if(_){Array.isArray(_)||(_=[_]);var a=null!==(o=ct(t))&&void 0!==o?o:{},i=_.find((function(e){return a[e.type]}));i&&_extends(e.src.image,i)}}))}(t.resource,e),_extends(t.RESOURCE_TYPE_STRATEGY,{astc:mt,etc:mt,pvrtc:mt,s3tc:mt,atc:mt}),mt.setExtensionXhrType("ktx",Dt.Buffer),_extends(n.glCore.GLTexture.prototype,bt),_extends(n.Texture,Lt),_extends(n.BaseTexture,wt)}e.RENDERER_TYPE=void 0,(xt=e.RENDERER_TYPE||(e.RENDERER_TYPE={}))[xt.UNKNOWN=0]="UNKNOWN",xt[xt.WEBGL=1]="WEBGL",xt[xt.CANVAS=2]="CANVAS";var Kt=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},It=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},Wt=function(o){function c(){var e=null!==o&&o.apply(this,arguments)||this;return e.multiApps=[],e}return _(c,o),c.prototype.init=function(e){var r=this;this.params=e,this.application=this.createApplication(e),this.containerManager=new at,this.rendererManager=new _t({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new it({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(e){var n,o=e.scene,_=e.mode,a=e.params;switch(_){case t.LOAD_SCENE_MODE.SINGLE:n=r.application;break;case t.LOAD_SCENE_MODE.MULTI_CANVAS:n=r.createMultiApplication({params:a})}o.canvas=n.view,r.transform.emit("changeScene",{scene:o,mode:_,application:n})}));var n=this.application.renderer.gl;n&&(this.suportedCompressedTextureFormats=ct(n),Xt(n))},c.prototype.registerObserver=function(e){var t,r=this.constructor.observerInfo;for(var n in e)r[n]||(r[n]=[]),(t=r[n]).push.apply(t,E(e[n]))},c.prototype.createMultiApplication=function(e){var t=e.params,r=this.createApplication(t);return this.multiApps.push(r),r},c.prototype.createApplication=function(t){t.view=t.canvas,t.renderType===e.RENDERER_TYPE.CANVAS&&(t.forceCanvas=!0),n.ticker.shared.autoStart=!1,n.ticker.shared.stop();var o=new r.Application(a({sharedTicker:!0},t));return void 0!==t.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),t.preventScroll?It(o.renderer):Kt(o.renderer)),void 0!==t.enableScroll&&(t.enableScroll?It(o.renderer):Kt(o.renderer)),void 0===t.preventScroll&&void 0===t.enableScroll&&It(o.renderer),o},c.prototype.update=function(){var e,t,r,n,o=this.componentObserver.clear();try{for(var _=s(o),a=_.next();!a.done;a=_.next()){var i=a.value;this.transform.componentChanged(i)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=_.return)&&t.call(_)}finally{if(e)throw e.error}}try{for(var c=s(this.game.gameObjects),E=c.next();!E.done;E=c.next()){var u=E.value;this.containerManager.updateTransform({name:u.id,transform:u.transform}),this.rendererManager.update(u)}}catch(e){r={error:e}}finally{try{E&&!E.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}},c.prototype.lateUpdate=function(e){this.transform.update(),this.application.ticker.update(e.time)},c.prototype.onDestroy=function(){var e,t;this.application.destroy();try{for(var r=s(this.multiApps),n=r.next();!n.done;n=r.next()){var o=n.value;o&&o.destroy()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.transform.destroy(),this.transform=null,this.params=null,this.rendererManager=null,this.containerManager=null,this.application=null,this.game=null,this.multiApps=null},c.prototype.resize=function(e,t){this.params.width=e,this.params.height=t,this.application.renderer.resize(e,t)},c.systemName="Renderer",c=i([t.decorators.componentObserver({Transform:["_parent"]})],c)}(t.System),Ut=function(e){function t(t){var r=e.call(this,t)||this;return r.observerInfo=r.constructor.observerInfo,r}return _(t,e),t.prototype.componentChanged=function(e){},t.prototype.rendererUpdate=function(e){},t.prototype.update=function(e){var t,r,n=this.componentObserver.clear();try{for(var o=s(n),_=o.next();!_.done;_=o.next()){var a=_.value;this.componentChanged(a)}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},t}(t.System);return n.BaseTexture.prototype.destroy=function(){this.imageUrl&&(delete n.utils.TextureCache[this.imageUrl],this.imageUrl=null),this.source=null,this.dispose(),n.BaseTexture.removeFromCache(this),this.textureCacheIds=null,this._destroyed=!0},e.ContainerManager=at,e.Renderer=Ut,e.RendererManager=_t,e.RendererSystem=Wt,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.rendererAdapter,PIXI);