Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eva/plugin-renderer

Package Overview
Dependencies
Maintainers
4
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eva/plugin-renderer - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1-type.2

dist/EVA.plugin.renderer.js

2

dist/plugin-renderer.cjs.js

@@ -11,3 +11,3 @@ 'use strict';

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }

@@ -14,0 +14,0 @@ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/renderer-adapter"),r=require("lodash-es/isEqual"),_=require("eventemitter3"),n=require("pixi.js");function o(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var E=o(r),a=o(_),S=function(e,t){return(S=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 i(e,t){function r(){this.constructor=e}S(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var R=function(){return(R=Object.assign||function(e){for(var t,r=1,_=arguments.length;r<_;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function s(e,t,r,_){var n,o=arguments.length,E=o<3?t:null===_?_=Object.getOwnPropertyDescriptor(t,r):_;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)E=Reflect.decorate(e,t,r,_);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(E=(o<3?n(E):o>3?n(t,r,E):n(t,r))||E);return o>3&&E&&Object.defineProperty(t,r,E),E}function C(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function c(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var _,n,o=r.call(e),E=[];try{for(;(void 0===t||t-- >0)&&!(_=o.next()).done;)E.push(_.value)}catch(e){n={error:e}}finally{try{_&&!_.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return E}function A(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e}var P=function(){function t(e){var t=e.game,r=e.rendererSystem;this.renderers=[],this.game=t,this.rendererSystem=r}return t.prototype.register=function(){for(var e,t,r=[],_=0;_<arguments.length;_++)r[_]=arguments[_];try{for(var n=C(r),o=n.next();!o.done;o=n.next()){var E=o.value;E.game=this.game,E.rendererManager=this.rendererSystem.rendererManager,E.containerManager=this.rendererSystem.containerManager,this.renderers.push(E)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},t.prototype.componentChanged=function(t){var r,_,n=function(t){var r,_;try{for(var n=(r=void 0,C(o.renderers)),a=n.next();!a.done;a=n.next()){var S=a.value,i=S.observerInfo[t.componentName];if(i){if([e.OBSERVER_TYPE.ADD,e.OBSERVER_TYPE.REMOVE].indexOf(t.type)>-1){try{S.componentChanged&&S.componentChanged(t)}catch(e){console.error("gameObject: "+t.gameObject.name+", "+t.componentName+" is error.",t,e)}continue}if(i.findIndex((function(e){return E(e,t.prop)}))>-1)try{S.componentChanged&&S.componentChanged(t)}catch(e){console.error("gameObject: "+(t.gameObject&&t.gameObject.name)+", "+t.componentName+" is componentChanged error.",t,e)}}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(_=n.return)&&_.call(n)}finally{if(r)throw r.error}}},o=this;try{for(var a=C(t),S=a.next();!S.done;S=a.next()){n(S.value)}}catch(e){r={error:e}}finally{try{S&&!S.done&&(_=a.return)&&_.call(a)}finally{if(r)throw r.error}}},t.prototype.update=function(e){var t,r,_,n;try{for(var o=C(e.components),E=o.next();!E.done;E=o.next()){var a=E.value;try{for(var S=(_=void 0,C(this.renderers)),i=S.next();!i.done;i=S.next()){var R=i.value,s=[];if(R.observerInfo[a.name]&&-1===s.indexOf(e)){s.push(e);try{R.rendererUpdate&&R.rendererUpdate(e)}catch(t){console.info("gameObject: "+e.name+", "+a.name+" is update error",t)}}}}catch(e){_={error:e}}finally{try{i&&!i.done&&(n=S.return)&&n.call(S)}finally{if(_)throw _.error}}}}catch(e){t={error:e}}finally{try{E&&!E.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},t}(),T=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,_=this.containerMap[t];if(_){var n=r.anchor,o=r.origin,E=r.position,a=r.rotation,S=r.scale,i=r.size,R=r.skew;_.rotation=a,_.scale=S,_.pivot.x=i.width*o.x,_.pivot.y=i.height*o.y,_.skew=R;var s=E.x,C=E.y;if(r.parent){var c=r.parent;s+=c.size.width*n.x,C+=c.size.height*n.y}_.position={x:s,y:C}}},e}(),p=function(r){function _(e){var t=e.system,_=e.containerManager,n=r.call(this)||this;return n.name="Transform",n.waitRemoveIds=[],n.waitChangeScenes=[],n.containerManager=_,n.init(t),n}return i(_,r),_.prototype.init=function(e){var t=this;this.system=e,this.on("changeScene",(function(e){var r=e.scene,_=e.mode,n=e.application;t.waitChangeScenes.push({scene:r,mode:_,application:n})}))},_.prototype.update=function(){var e,t,r,_;try{for(var n=C(this.waitRemoveIds),o=n.next();!o.done;o=n.next()){var E=o.value;this.containerManager.removeContainer(E)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.waitRemoveIds=[];try{for(var a=C(this.waitChangeScenes),S=a.next();!S.done;S=a.next()){var i=S.value,R=this.containerManager.getContainer(i.scene.id);R&&(i.application.stage.removeChildren(),i.application.stage.addChild(R))}}catch(e){r={error:e}}finally{try{S&&!S.done&&(_=a.return)&&_.call(a)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},_.prototype.componentChanged=function(t){t.type===e.OBSERVER_TYPE.ADD?this.addContainer(t):t.type===e.OBSERVER_TYPE.CHANGE?this.change(t):t.type===e.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(t.gameObject.id)},_.prototype.addContainer=function(e){var r=new t.Container;r.name=e.gameObject.name,this.containerManager.addContainer({name:e.gameObject.id,container:r}),e.component.worldTransform=r.transform.worldTransform},_.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 _=this.containerManager.getContainer(e.gameObject.id);delete t.worldTransform,_.parent&&_.parent.removeChild(_)}},_.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},_=s([e.decorators.componentObserver({Transform:["_parent"]})],_)}(a),l=void 0;function u(e){if(l)return l;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};l={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(l).filter((function(e){return l[e]})).join(", "))}catch(e){}return l}var G,B,D,d=e.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"}(D||(D={}));var M=((G={})[D.COMPRESSED_RGB_S3TC_DXT1_EXT]=[4,4],G[D.COMPRESSED_RGBA_S3TC_DXT1_EXT]=[4,4],G[D.COMPRESSED_RGBA_S3TC_DXT3_EXT]=[4,4],G[D.COMPRESSED_RGBA_S3TC_DXT5_EXT]=[4,4],G[D.COMPRESSED_SRGB_S3TC_DXT1_EXT]=[4,4],G[D.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=[4,4],G[D.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=[4,4],G[D.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=[4,4],G[D.COMPRESSED_R11_EAC]=[4,4],G[D.COMPRESSED_SIGNED_R11_EAC]=[4,4],G[D.COMPRESSED_RG11_EAC]=[4,4],G[D.COMPRESSED_SIGNED_RG11_EAC]=[4,4],G[D.COMPRESSED_RGB8_ETC2]=[4,4],G[D.COMPRESSED_RGBA8_ETC2_EAC]=[4,4],G[D.COMPRESSED_SRGB8_ETC2]=[4,4],G[D.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=[4,4],G[D.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],G[D.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],G[D.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=[4,4],G[D.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=[4,4],G[D.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=[8,4],G[D.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=[8,4],G[D.COMPRESSED_RGB_ETC1_WEBGL]=[4,4],G[D.COMPRESSED_RGB_ATC_WEBGL]=[4,4],G[D.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=[4,4],G[D.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=[4,4],G[D.COMPRESSED_RGBA_ASTC_4x4_KHR]=[4,4],G[D.COMPRESSED_RGBA_ASTC_5x5_KHR]=[5,5],G[D.COMPRESSED_RGBA_ASTC_6x6_KHR]=[6,6],G[D.COMPRESSED_RGBA_ASTC_8x8_KHR]=[8,8],G[D.COMPRESSED_RGBA_ASTC_10x10_KHR]=[10,10],G[D.COMPRESSED_RGBA_ASTC_12x12_KHR]=[12,12],G[D.COMPRESSED_RGBA_ASTC_10x5_KHR]=[10,5],G[D.COMPRESSED_RGBA_ASTC_10x6_KHR]=[10,6],G[D.COMPRESSED_RGBA_ASTC_10x8_KHR]=[10,8],G[D.COMPRESSED_RGBA_ASTC_12x10_KHR]=[12,10],G[D.COMPRESSED_RGBA_ASTC_5x4_KHR]=[5,4],G[D.COMPRESSED_RGBA_ASTC_6x5_KHR]=[6,5],G[D.COMPRESSED_RGBA_ASTC_8x5_KHR]=[8,5],G[D.COMPRESSED_RGBA_ASTC_8x6_KHR]=[8,6],G),O=((B={})[D.COMPRESSED_RGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",B[D.COMPRESSED_RGBA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",B[D.COMPRESSED_RGBA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc",B[D.COMPRESSED_RGBA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc",B[D.COMPRESSED_SRGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[D.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[D.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[D.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc_srgb",B[D.COMPRESSED_R11_EAC]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_SIGNED_R11_EAC]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_RG11_EAC]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_SIGNED_RG11_EAC]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_RGB8_ETC2]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_RGBA8_ETC2_EAC]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_SRGB8_ETC2]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",B[D.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[D.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[D.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[D.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",B[D.COMPRESSED_RGB_ETC1_WEBGL]="WEBGL_compressed_texture_etc1",B[D.COMPRESSED_RGB_ATC_WEBGL]="WEBGL_compressed_texture_atc",B[D.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",B[D.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",B[D.COMPRESSED_RGBA_ASTC_4x4_KHR]="WEBGL_compressed_texture_astc",B[D.COMPRESSED_RGBA_ASTC_5x5_KHR]="WEBGL_compressed_texture_astc",B[D.COMPRESSED_RGBA_ASTC_6x6_KHR]="WEBGL_compressed_texture_astc",B[D.COMPRESSED_RGBA_ASTC_8x8_KHR]="WEBGL_compressed_texture_astc",B[D.COMPRESSED_RGBA_ASTC_10x10_KHR]="WEBGL_compressed_texture_astc",B[D.COMPRESSED_RGBA_ASTC_12x12_KHR]="WEBGL_compressed_texture_astc",B),h=function(){function e(){this.levelBuffers=[]}return e.prototype.upload=function(e){var t=this.levels,r=O[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 _=0;_<this.levels;++_){var n=this.levelBuffers[_],o=n.levelWidth,E=n.levelHeight,a=n.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,_,this.internalFormat,o,E,0,a)}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}(),f=12,m=28,x=36,v=40,H=44,y=48,L=52,g=56,X=60,K=[171,75,84,88,32,49,49,187,13,10,26,10],I=function(t){function r(r,_){var n,o=t.call(this)||this;o.complete=!0,o.src=_.url;var E=new DataView(r);if(!function(e){for(var t=0;t<K.length;t++)if(e.getUint8(t)!==K[t])return!1;return!0}(E))throw new Error("Not a valid KTX Texture");var a=67305985===E.getUint32(f,!0);o.internalFormat=E.getUint32(m,a);var S=o.formerWidth=E.getUint32(x,a),i=o.formerHeight=E.getUint32(v,a)||1,R=M[o.internalFormat];o.width=S%R[0]==0?S:S+R[0]-S%R[0],o.height=i%R[1]==0?i:i+R[1]-i%R[1];var s=e.resource.resourcesMap[_.metadata.name].src[_.metadata.key],C=null!==(n=null==s?void 0:s.size)&&void 0!==n?n:{},c=C.width,A=C.height;c&&A&&(o.naturalWidth=c,o.naturalHeight=A);var P=E.getUint32(H,a)||1,T=E.getUint32(y,a)||1,p=E.getUint32(L,a),l=o.levels=E.getUint32(g,a),u=E.getUint32(X,a);if(0===i||1!==P)throw new Error("Only 2D textures are supported!");if(1!==p)throw new Error("CubeTextures are not supported!");if(1!==T)throw new Error("It does not support array textures!");for(var G=S,B=i,D=64+u,d=0;d<l;d++){var O=E.getUint32(D,a);D+=4;var h=M[o.internalFormat],I={levelID:d,levelWidth:G%h[0]==0?G:G+h[0]-G%h[0],levelHeight:B%h[1]==0?B:B+h[1]-B%h[1],levelBuffer:new Uint8Array(r,D,O)};o.levelBuffers.push(I),D+=O,D+=3-(D+3)%4,G=G>>1||1,B=B>>1||1}return o}return i(r,t),r}(h);var W=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._complete=function(t,r){e.prototype._complete.call(this,t,new I(r,this.config))},t}(d),w=e.resourceLoader.XhrResponseType;var b,N,U,V={isCompressed:!1,uploadNotCompressed:n.glCore.GLTexture.prototype.upload,upload:function(e){if(!(e instanceof h))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)}}},j=Symbol(),F=((b={})[j]=n.Texture.from,b.from=function(e){return e instanceof h?new n.Texture(n.BaseTexture.from(e)):this[j](e)},b),Y=Symbol(),k=((N={})[Y]=n.BaseTexture.from,N.from=function(e,t,r){if(!(e instanceof h))return this[Y](e,t,r);var _=e.src,o=n.utils.BaseTextureCache[_];return o||((o=new n.BaseTexture(e,t)).imageUrl=_,r&&(o.sourceScale=r),n.BaseTexture.addToCache(o,_)),o},N);function q(t){!function(e,t){e.addPreProcessResourceHandler((function(e){var r,_,n,o=null===(_=null===(r=e.src)||void 0===r?void 0:r.image)||void 0===_?void 0:_.texture;if(o){Array.isArray(o)||(o=[o]);var E=null!==(n=u(t))&&void 0!==n?n:{},a=o.find((function(e){return E[e.type]}));a&&Object.assign(e.src.image,a)}}))}(e.resource,t),Object.assign(e.RESOURCE_TYPE_STRATEGY,{astc:W,etc:W,pvrtc:W,s3tc:W,atc:W}),W.setExtensionXhrType("ktx",w.Buffer),Object.assign(n.glCore.GLTexture.prototype,V),Object.assign(n.Texture,F),Object.assign(n.BaseTexture,k)}exports.RENDERER_TYPE=void 0,(U=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[U.UNKNOWN=0]="UNKNOWN",U[U.WEBGL=1]="WEBGL",U[U.CANVAS=2]="CANVAS";var z=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},J=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},Q=function(r){function _(){var e=null!==r&&r.apply(this,arguments)||this;return e.multiApps=[],e}return i(_,r),_.prototype.init=function(t){var r=this;this.params=t,this.application=this.createApplication(t),this.containerManager=new T,this.rendererManager=new P({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new p({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(t){var _,n=t.scene,o=t.mode,E=t.params;switch(o){case e.LOAD_SCENE_MODE.SINGLE:_=r.application;break;case e.LOAD_SCENE_MODE.MULTI_CANVAS:_=r.createMultiApplication({params:E})}n.canvas=_.view,r.transform.emit("changeScene",{scene:n,mode:o,application:_})}));var _=this.application.renderer.gl;_&&(this.suportedCompressedTextureFormats=u(_),q(_))},_.prototype.registerObserver=function(e){var t,r=this.constructor.observerInfo;for(var _ in e)r[_]||(r[_]=[]),(t=r[_]).push.apply(t,A(e[_]))},_.prototype.createMultiApplication=function(e){var t=e.params,r=this.createApplication(t);return this.multiApps.push(r),r},_.prototype.createApplication=function(e){e.view=e.canvas,e.renderType===exports.RENDERER_TYPE.CANVAS&&(e.forceCanvas=!0),n.ticker.shared.autoStart=!1,n.ticker.shared.stop();var r=new t.Application(R({sharedTicker:!0},e));return void 0!==e.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),e.preventScroll?J(r.renderer):z(r.renderer)),void 0!==e.enableScroll&&(e.enableScroll?J(r.renderer):z(r.renderer)),void 0===e.preventScroll&&void 0===e.enableScroll&&J(r.renderer),r},_.prototype.update=function(){var e,t,r,_,n=this.componentObserver.clear();try{for(var o=C(n),E=o.next();!E.done;E=o.next()){var a=E.value;this.transform.componentChanged(a)}}catch(t){e={error:t}}finally{try{E&&!E.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}try{for(var S=C(this.game.gameObjects),i=S.next();!i.done;i=S.next()){var R=i.value;this.containerManager.updateTransform({name:R.id,transform:R.transform}),this.rendererManager.update(R)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(_=S.return)&&_.call(S)}finally{if(r)throw r.error}}},_.prototype.lateUpdate=function(e){this.transform.update(),this.application.ticker.update(e.time)},_.prototype.onDestroy=function(){var e,t;this.application.destroy();try{for(var r=C(this.multiApps),_=r.next();!_.done;_=r.next()){var n=_.value;n&&n.destroy()}}catch(t){e={error:t}}finally{try{_&&!_.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},_.prototype.resize=function(e,t){this.params.width=e,this.params.height=t,this.application.renderer.resize(e,t)},_.systemName="Renderer",_=s([e.decorators.componentObserver({Transform:["_parent"]})],_)}(e.System),Z=function(e){function t(t){var r=e.call(this,t)||this;return r.observerInfo=r.constructor.observerInfo,r}return i(t,e),t.prototype.componentChanged=function(e){},t.prototype.rendererUpdate=function(e){},t.prototype.update=function(e){var t,r,_=this.componentObserver.clear();try{for(var n=C(_),o=n.next();!o.done;o=n.next()){var E=o.value;this.componentChanged(E)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},t}(e.System);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},exports.ContainerManager=T,exports.Renderer=Z,exports.RendererManager=P,exports.RendererSystem=Q;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/renderer-adapter"),r=require("lodash-es/isEqual"),_=require("eventemitter3"),n=require("pixi.js");function o(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var E=o(r),a=o(_),S=function(e,t){return S=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])},S(e,t)};function i(e,t){function r(){this.constructor=e}S(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var R=function(){return R=Object.assign||function(e){for(var t,r=1,_=arguments.length;r<_;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},R.apply(this,arguments)};function s(e,t,r,_){var n,o=arguments.length,E=o<3?t:null===_?_=Object.getOwnPropertyDescriptor(t,r):_;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)E=Reflect.decorate(e,t,r,_);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(E=(o<3?n(E):o>3?n(t,r,E):n(t,r))||E);return o>3&&E&&Object.defineProperty(t,r,E),E}function C(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}function c(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var _,n,o=r.call(e),E=[];try{for(;(void 0===t||t-- >0)&&!(_=o.next()).done;)E.push(_.value)}catch(e){n={error:e}}finally{try{_&&!_.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return E}function A(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(c(arguments[t]));return e}var P=function(){function t(e){var t=e.game,r=e.rendererSystem;this.renderers=[],this.game=t,this.rendererSystem=r}return t.prototype.register=function(){for(var e,t,r=[],_=0;_<arguments.length;_++)r[_]=arguments[_];try{for(var n=C(r),o=n.next();!o.done;o=n.next()){var E=o.value;E.game=this.game,E.rendererManager=this.rendererSystem.rendererManager,E.containerManager=this.rendererSystem.containerManager,this.renderers.push(E)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},t.prototype.componentChanged=function(t){var r,_,n=function(t){var r,_;try{for(var n=(r=void 0,C(o.renderers)),a=n.next();!a.done;a=n.next()){var S=a.value,i=S.observerInfo[t.componentName];if(i){if([e.OBSERVER_TYPE.ADD,e.OBSERVER_TYPE.REMOVE].indexOf(t.type)>-1){try{S.componentChanged&&S.componentChanged(t)}catch(e){console.error("gameObject: "+t.gameObject.name+", "+t.componentName+" is error.",t,e)}continue}if(i.findIndex((function(e){return E(e,t.prop)}))>-1)try{S.componentChanged&&S.componentChanged(t)}catch(e){console.error("gameObject: "+(t.gameObject&&t.gameObject.name)+", "+t.componentName+" is componentChanged error.",t,e)}}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(_=n.return)&&_.call(n)}finally{if(r)throw r.error}}},o=this;try{for(var a=C(t),S=a.next();!S.done;S=a.next()){n(S.value)}}catch(e){r={error:e}}finally{try{S&&!S.done&&(_=a.return)&&_.call(a)}finally{if(r)throw r.error}}},t.prototype.update=function(e){var t,r,_,n;try{for(var o=C(e.components),E=o.next();!E.done;E=o.next()){var a=E.value;try{for(var S=(_=void 0,C(this.renderers)),i=S.next();!i.done;i=S.next()){var R=i.value,s=[];if(R.observerInfo[a.name]&&-1===s.indexOf(e)){s.push(e);try{R.rendererUpdate&&R.rendererUpdate(e)}catch(t){console.info("gameObject: "+e.name+", "+a.name+" is update error",t)}}}}catch(e){_={error:e}}finally{try{i&&!i.done&&(n=S.return)&&n.call(S)}finally{if(_)throw _.error}}}}catch(e){t={error:e}}finally{try{E&&!E.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}},t}(),T=P,p=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,_=this.containerMap[t];if(_){var n=r.anchor,o=r.origin,E=r.position,a=r.rotation,S=r.scale,i=r.size,R=r.skew;_.rotation=a,_.scale=S,_.pivot.x=i.width*o.x,_.pivot.y=i.height*o.y,_.skew=R;var s=E.x,C=E.y;if(r.parent){var c=r.parent;s+=c.size.width*n.x,C+=c.size.height*n.y}_.position={x:s,y:C}}},e}(),l=p,u=function(r){function _(e){var t=e.system,_=e.containerManager,n=r.call(this)||this;return n.name="Transform",n.waitRemoveIds=[],n.waitChangeScenes=[],n.containerManager=_,n.init(t),n}return i(_,r),_.prototype.init=function(e){var t=this;this.system=e,this.on("changeScene",(function(e){var r=e.scene,_=e.mode,n=e.application;t.waitChangeScenes.push({scene:r,mode:_,application:n})}))},_.prototype.update=function(){var e,t,r,_;try{for(var n=C(this.waitRemoveIds),o=n.next();!o.done;o=n.next()){var E=o.value;this.containerManager.removeContainer(E)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.waitRemoveIds=[];try{for(var a=C(this.waitChangeScenes),S=a.next();!S.done;S=a.next()){var i=S.value,R=this.containerManager.getContainer(i.scene.id);R&&(i.application.stage.removeChildren(),i.application.stage.addChild(R))}}catch(e){r={error:e}}finally{try{S&&!S.done&&(_=a.return)&&_.call(a)}finally{if(r)throw r.error}}this.waitChangeScenes=[]},_.prototype.componentChanged=function(t){t.type===e.OBSERVER_TYPE.ADD?this.addContainer(t):t.type===e.OBSERVER_TYPE.CHANGE?this.change(t):t.type===e.OBSERVER_TYPE.REMOVE&&this.waitRemoveIds.push(t.gameObject.id)},_.prototype.addContainer=function(e){var r=new t.Container;r.name=e.gameObject.name,this.containerManager.addContainer({name:e.gameObject.id,container:r}),e.component.worldTransform=r.transform.worldTransform},_.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 _=this.containerManager.getContainer(e.gameObject.id);delete t.worldTransform,_.parent&&_.parent.removeChild(_)}},_.prototype.destroy=function(){this.removeAllListeners(),this.waitRemoveIds=null,this.waitChangeScenes=null,this.system=null,this.containerManager=null},_=s([e.decorators.componentObserver({Transform:["_parent"]})],_)}(a),G=u,B=void 0;function D(e){if(B)return B;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};B={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(B).filter((function(e){return B[e]})).join(", "))}catch(e){}return B}var d,M,O,h=e.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"}(O||(O={}));var f=((d={})[O.COMPRESSED_RGB_S3TC_DXT1_EXT]=[4,4],d[O.COMPRESSED_RGBA_S3TC_DXT1_EXT]=[4,4],d[O.COMPRESSED_RGBA_S3TC_DXT3_EXT]=[4,4],d[O.COMPRESSED_RGBA_S3TC_DXT5_EXT]=[4,4],d[O.COMPRESSED_SRGB_S3TC_DXT1_EXT]=[4,4],d[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=[4,4],d[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=[4,4],d[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=[4,4],d[O.COMPRESSED_R11_EAC]=[4,4],d[O.COMPRESSED_SIGNED_R11_EAC]=[4,4],d[O.COMPRESSED_RG11_EAC]=[4,4],d[O.COMPRESSED_SIGNED_RG11_EAC]=[4,4],d[O.COMPRESSED_RGB8_ETC2]=[4,4],d[O.COMPRESSED_RGBA8_ETC2_EAC]=[4,4],d[O.COMPRESSED_SRGB8_ETC2]=[4,4],d[O.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=[4,4],d[O.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],d[O.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],d[O.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=[4,4],d[O.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=[4,4],d[O.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=[8,4],d[O.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=[8,4],d[O.COMPRESSED_RGB_ETC1_WEBGL]=[4,4],d[O.COMPRESSED_RGB_ATC_WEBGL]=[4,4],d[O.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=[4,4],d[O.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=[4,4],d[O.COMPRESSED_RGBA_ASTC_4x4_KHR]=[4,4],d[O.COMPRESSED_RGBA_ASTC_5x5_KHR]=[5,5],d[O.COMPRESSED_RGBA_ASTC_6x6_KHR]=[6,6],d[O.COMPRESSED_RGBA_ASTC_8x8_KHR]=[8,8],d[O.COMPRESSED_RGBA_ASTC_10x10_KHR]=[10,10],d[O.COMPRESSED_RGBA_ASTC_12x12_KHR]=[12,12],d[O.COMPRESSED_RGBA_ASTC_10x5_KHR]=[10,5],d[O.COMPRESSED_RGBA_ASTC_10x6_KHR]=[10,6],d[O.COMPRESSED_RGBA_ASTC_10x8_KHR]=[10,8],d[O.COMPRESSED_RGBA_ASTC_12x10_KHR]=[12,10],d[O.COMPRESSED_RGBA_ASTC_5x4_KHR]=[5,4],d[O.COMPRESSED_RGBA_ASTC_6x5_KHR]=[6,5],d[O.COMPRESSED_RGBA_ASTC_8x5_KHR]=[8,5],d[O.COMPRESSED_RGBA_ASTC_8x6_KHR]=[8,6],d),m=((M={})[O.COMPRESSED_RGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",M[O.COMPRESSED_RGBA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",M[O.COMPRESSED_RGBA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc",M[O.COMPRESSED_RGBA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc",M[O.COMPRESSED_SRGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",M[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",M[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc_srgb",M[O.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc_srgb",M[O.COMPRESSED_R11_EAC]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_SIGNED_R11_EAC]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_RG11_EAC]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_SIGNED_RG11_EAC]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_RGB8_ETC2]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_RGBA8_ETC2_EAC]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_SRGB8_ETC2]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",M[O.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",M[O.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",M[O.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",M[O.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",M[O.COMPRESSED_RGB_ETC1_WEBGL]="WEBGL_compressed_texture_etc1",M[O.COMPRESSED_RGB_ATC_WEBGL]="WEBGL_compressed_texture_atc",M[O.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",M[O.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",M[O.COMPRESSED_RGBA_ASTC_4x4_KHR]="WEBGL_compressed_texture_astc",M[O.COMPRESSED_RGBA_ASTC_5x5_KHR]="WEBGL_compressed_texture_astc",M[O.COMPRESSED_RGBA_ASTC_6x6_KHR]="WEBGL_compressed_texture_astc",M[O.COMPRESSED_RGBA_ASTC_8x8_KHR]="WEBGL_compressed_texture_astc",M[O.COMPRESSED_RGBA_ASTC_10x10_KHR]="WEBGL_compressed_texture_astc",M[O.COMPRESSED_RGBA_ASTC_12x12_KHR]="WEBGL_compressed_texture_astc",M),x=function(){function e(){this.levelBuffers=[]}return e.prototype.upload=function(e){var t=this.levels,r=m[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 _=0;_<this.levels;++_){var n=this.levelBuffers[_],o=n.levelWidth,E=n.levelHeight,a=n.levelBuffer;e.compressedTexImage2D(e.TEXTURE_2D,_,this.internalFormat,o,E,0,a)}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}(),v=12,H=28,y=36,L=40,g=44,X=48,K=52,I=56,W=60,w=[171,75,84,88,32,49,49,187,13,10,26,10],b=function(t){function r(r,_){var n,o=t.call(this)||this;o.complete=!0,o.src=_.url;var E=new DataView(r);if(!function(e){for(var t=0;t<w.length;t++)if(e.getUint8(t)!==w[t])return!1;return!0}(E))throw new Error("Not a valid KTX Texture");var a=67305985===E.getUint32(v,!0);o.internalFormat=E.getUint32(H,a);var S=o.formerWidth=E.getUint32(y,a),i=o.formerHeight=E.getUint32(L,a)||1,R=f[o.internalFormat];o.width=S%R[0]==0?S:S+R[0]-S%R[0],o.height=i%R[1]==0?i:i+R[1]-i%R[1];var s=e.resource.resourcesMap[_.metadata.name].src[_.metadata.key],C=null!==(n=null==s?void 0:s.size)&&void 0!==n?n:{},c=C.width,A=C.height;c&&A&&(o.naturalWidth=c,o.naturalHeight=A);var P=E.getUint32(g,a)||1,T=E.getUint32(X,a)||1,p=E.getUint32(K,a),l=o.levels=E.getUint32(I,a),u=E.getUint32(W,a);if(0===i||1!==P)throw new Error("Only 2D textures are supported!");if(1!==p)throw new Error("CubeTextures are not supported!");if(1!==T)throw new Error("It does not support array textures!");for(var G=S,B=i,D=64+u,d=0;d<l;d++){var M=E.getUint32(D,a);D+=4;var O=f[o.internalFormat],h={levelID:d,levelWidth:G%O[0]==0?G:G+O[0]-G%O[0],levelHeight:B%O[1]==0?B:B+O[1]-B%O[1],levelBuffer:new Uint8Array(r,D,M)};o.levelBuffers.push(h),D+=M,D+=3-(D+3)%4,G=G>>1||1,B=B>>1||1}return o}return i(r,t),r}(x);var N=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype._complete=function(t,r){e.prototype._complete.call(this,t,new b(r,this.config))},t}(h),U=e.resourceLoader.XhrResponseType;var V,j,F,Y={isCompressed:!1,uploadNotCompressed:n.glCore.GLTexture.prototype.upload,upload:function(e){if(!(e instanceof x))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)}}},k=Symbol(),q=((V={})[k]=n.Texture.from,V.from=function(e){return e instanceof x?new n.Texture(n.BaseTexture.from(e)):this[k](e)},V),z=Symbol(),J=((j={})[z]=n.BaseTexture.from,j.from=function(e,t,r){if(!(e instanceof x))return this[z](e,t,r);var _=e.src,o=n.utils.BaseTextureCache[_];return o||((o=new n.BaseTexture(e,t)).imageUrl=_,r&&(o.sourceScale=r),n.BaseTexture.addToCache(o,_)),o},j);function Q(t){!function(e,t){e.addPreProcessResourceHandler((function(e){var r,_,n,o=null===(_=null===(r=e.src)||void 0===r?void 0:r.image)||void 0===_?void 0:_.texture;if(o){Array.isArray(o)||(o=[o]);var E=null!==(n=D(t))&&void 0!==n?n:{},a=o.find((function(e){return E[e.type]}));a&&Object.assign(e.src.image,a)}}))}(e.resource,t),Object.assign(e.RESOURCE_TYPE_STRATEGY,{astc:N,etc:N,pvrtc:N,s3tc:N,atc:N}),N.setExtensionXhrType("ktx",U.Buffer),Object.assign(n.glCore.GLTexture.prototype,Y),Object.assign(n.Texture,q),Object.assign(n.BaseTexture,J)}exports.RENDERER_TYPE=void 0,(F=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[F.UNKNOWN=0]="UNKNOWN",F[F.WEBGL=1]="WEBGL",F[F.CANVAS=2]="CANVAS";var Z=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},$=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},ee=function(r){function _(){var e=null!==r&&r.apply(this,arguments)||this;return e.multiApps=[],e}return i(_,r),_.prototype.init=function(t){var r=this;this.params=t,this.application=this.createApplication(t),this.containerManager=new l,this.rendererManager=new T({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new G({system:this,containerManager:this.containerManager}),this.game.on("sceneChanged",(function(t){var _,n=t.scene,o=t.mode,E=t.params;switch(o){case e.LOAD_SCENE_MODE.SINGLE:_=r.application;break;case e.LOAD_SCENE_MODE.MULTI_CANVAS:_=r.createMultiApplication({params:E})}n.canvas=_.view,r.transform.emit("changeScene",{scene:n,mode:o,application:_})}));var _=this.application.renderer.gl;_&&(this.suportedCompressedTextureFormats=D(_),Q(_))},_.prototype.registerObserver=function(e){var t,r=this.constructor.observerInfo;for(var _ in e)r[_]||(r[_]=[]),(t=r[_]).push.apply(t,A(e[_]))},_.prototype.createMultiApplication=function(e){var t=e.params,r=this.createApplication(t);return this.multiApps.push(r),r},_.prototype.createApplication=function(e){e.view=e.canvas,e.renderType===exports.RENDERER_TYPE.CANVAS&&(e.forceCanvas=!0),n.ticker.shared.autoStart=!1,n.ticker.shared.stop();var r=new t.Application(R({sharedTicker:!0},e));return void 0!==e.preventScroll&&(console.warn("PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game"),e.preventScroll?$(r.renderer):Z(r.renderer)),void 0!==e.enableScroll&&(e.enableScroll?$(r.renderer):Z(r.renderer)),void 0===e.preventScroll&&void 0===e.enableScroll&&$(r.renderer),r},_.prototype.update=function(){var e,t,r,_,n=this.componentObserver.clear();try{for(var o=C(n),E=o.next();!E.done;E=o.next()){var a=E.value;this.transform.componentChanged(a)}}catch(t){e={error:t}}finally{try{E&&!E.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}try{for(var S=C(this.game.gameObjects),i=S.next();!i.done;i=S.next()){var R=i.value;this.containerManager.updateTransform({name:R.id,transform:R.transform}),this.rendererManager.update(R)}}catch(e){r={error:e}}finally{try{i&&!i.done&&(_=S.return)&&_.call(S)}finally{if(r)throw r.error}}},_.prototype.lateUpdate=function(e){this.transform.update(),this.application.ticker.update(e.time)},_.prototype.onDestroy=function(){var e,t;this.application.destroy();try{for(var r=C(this.multiApps),_=r.next();!_.done;_=r.next()){var n=_.value;n&&n.destroy()}}catch(t){e={error:t}}finally{try{_&&!_.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},_.prototype.resize=function(e,t){this.params.width=e,this.params.height=t,this.application.renderer.resize(e,t)},_.systemName="Renderer",_=s([e.decorators.componentObserver({Transform:["_parent"]})],_)}(e.System),te=ee,re=function(e){function t(t){var r=e.call(this,t)||this;return r.observerInfo=r.constructor.observerInfo,r}return i(t,e),t.prototype.componentChanged=function(e){},t.prototype.rendererUpdate=function(e){},t.prototype.update=function(e){var t,r,_=this.componentObserver.clear();try{for(var n=C(_),o=n.next();!o.done;o=n.next()){var E=o.value;this.componentChanged(E)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},t}(e.System),_e=re;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},exports.ContainerManager=l,exports.Renderer=_e,exports.RendererManager=T,exports.RendererSystem=te;
{
"name": "@eva/plugin-renderer",
"version": "1.2.0",
"version": "1.2.1-type.2",
"description": "@eva/plugin-renderer",

@@ -21,4 +21,4 @@ "main": "index.js",

"dependencies": {
"@eva/eva.js": "1.2.0",
"@eva/renderer-adapter": "1.2.0",
"@eva/eva.js": "1.2.1-type.2",
"@eva/renderer-adapter": "1.2.1-type.2",
"@types/pixi.js": "^4.8.9",

@@ -25,0 +25,0 @@ "eventemitter3": "^3.1.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc