@eva/plugin-renderer
Advanced tools
Comparing version 1.2.7-fix.4 to 1.2.7-fix.5
@@ -1,1 +0,1 @@ | ||
function _extends(){return _extends=Object.assign?Object.assign.bind():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},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_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])},o(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},a.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,d=A.hasOwnProperty,P=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=d.call(e,v),r=e[v];try{e[v]=void 0;var n=!0}catch(e){}var o=P.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 m(e){if(!G(e))return!1;var t=O(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var B,D=C["__core-js_shared__"],M=(B=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"";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,w=H.toString,j=L.hasOwnProperty,I=RegExp("^"+w.call(j).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function X(e){return!(!G(e)||(t=e,M&&M in t))&&(m(e)?I:b).test(x(e));var t}function K(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return X(r)?r:void 0}var W=K(C,"Map"),U=K(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 F(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 k(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},k.prototype.clear=function(){this.size=0,this.__data__={hash:new z,map:new(W||R),string:new z}},k.prototype.delete=function(e){var t=F(this,e).delete(e);return this.size-=t?1:0,t},k.prototype.get=function(e){return F(this,e).get(e)},k.prototype.has=function(e){return F(this,e).has(e)},k.prototype.set=function(e,t){var r=F(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 k(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 k;++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[]},ie=ae;function se(e){return null!=e&&"object"==typeof e}function ce(e){return se(e)&&"[object Arguments]"==O(e)}var Ee=Object.prototype,ue=Ee.hasOwnProperty,Se=Ee.propertyIsEnumerable,le=ce(function(){return arguments}())?ce:function(e){return se(e)&&ue.call(e,"callee")&&!Se.call(e,"callee")},Re=le;var pe="object"==typeof e&&e&&!e.nodeType&&e,fe=pe&&"object"==typeof module&&module&&!module.nodeType&&module,Ce=fe&&fe.exports===pe?C.Buffer:void 0,he=(Ce?Ce.isBuffer:void 0)||function(){return!1},Ae=/^(?:0|[1-9]\d*)$/;function de(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Ae.test(e))&&e>-1&&e%1==0&&e<t}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}var ve={};ve["[object Float32Array]"]=ve["[object Float64Array]"]=ve["[object Int8Array]"]=ve["[object Int16Array]"]=ve["[object Int32Array]"]=ve["[object Uint8Array]"]=ve["[object Uint8ClampedArray]"]=ve["[object Uint16Array]"]=ve["[object Uint32Array]"]=!0,ve["[object Arguments]"]=ve["[object Array]"]=ve["[object ArrayBuffer]"]=ve["[object Boolean]"]=ve["[object DataView]"]=ve["[object Date]"]=ve["[object Error]"]=ve["[object Function]"]=ve["[object Map]"]=ve["[object Number]"]=ve["[object Object]"]=ve["[object RegExp]"]=ve["[object Set]"]=ve["[object String]"]=ve["[object WeakMap]"]=!1;var Te,ye="object"==typeof e&&e&&!e.nodeType&&e,Oe=ye&&"object"==typeof module&&module&&!module.nodeType&&module,Ge=Oe&&Oe.exports===ye&&p.process,me=function(){try{var e=Oe&&Oe.require&&Oe.require("util").types;return e||Ge&&Ge.binding&&Ge.binding("util")}catch(e){}}(),Be=me&&me.isTypedArray,De=Be?(Te=Be,function(e){return Te(e)}):function(e){return se(e)&&Pe(e.length)&&!!ve[O(e)]},Me=Object.prototype.hasOwnProperty;function ge(e,t){var r=ne(e),n=!r&&Re(e),o=!r&&!n&&he(e),_=!r&&!n&&!o&&De(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)||de(c,s))||i.push(c);return i}var xe=Object.prototype;var be=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),He=be,Le=Object.prototype.hasOwnProperty;function we(e){if(r=(t=e)&&t.constructor,t!==("function"==typeof r&&r.prototype||xe))return He(e);var t,r,n=[];for(var o in Object(e))Le.call(e,o)&&"constructor"!=o&&n.push(o);return n}function je(e){return null!=(t=e)&&Pe(t.length)&&!m(t)?ge(e):we(e);var t}function Ie(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,je,ie)}var Xe=Object.prototype.hasOwnProperty;var Ke=K(C,"DataView"),We=K(C,"Promise"),Ue=K(C,"Set"),Ne=K(C,"WeakMap"),Ve="[object Map]",ze="[object Promise]",Fe="[object Set]",ke="[object WeakMap]",Ye="[object DataView]",$e=x(Ke),qe=x(W),Je=x(We),Qe=x(Ue),Ze=x(Ne),et=O;(Ke&&et(new Ke(new ArrayBuffer(1)))!=Ye||W&&et(new W)!=Ve||We&&et(We.resolve())!=ze||Ue&&et(new Ue)!=Fe||Ne&&et(new Ne)!=ke)&&(et=function(e){var t=O(e),r="[object Object]"==t?e.constructor:void 0,n=r?x(r):"";if(n)switch(n){case $e:return Ye;case qe:return Ve;case Je:return ze;case Qe:return Fe;case Ze:return ke}return t});var tt=et,rt="[object Arguments]",nt="[object Array]",ot="[object Object]",_t=Object.prototype.hasOwnProperty;function at(e,t,r,n,o,_){var a=ne(e),i=ne(t),s=a?nt:tt(e),c=i?nt:tt(t),E=(s=s==rt?ot:s)==ot,S=(c=c==rt?ot:c)==ot,l=s==c;if(l&&he(e)){if(!he(t))return!1;a=!0,E=!1}if(l&&!E)return _||(_=new Y),a||De(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&&_t.call(e,"__wrapped__"),p=S&&_t.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=Ie(e),s=i.length;if(s!=Ie(t).length&&!a)return!1;for(var c=s;c--;){var E=i[c];if(!(a?E in t:Xe.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 it(e,t,r,n,o){return e===t||(null==e||null==t||!se(e)&&!se(t)?e!=e&&t!=t:at(e,t,r,n,it,o))}var st=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,it(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}(),ct=st,Et=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&&r){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}(),ut=Et;var St=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})),lt=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);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)}(St),Rt=lt,pt=void 0;function ft(e){if(pt)return pt;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};pt={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(pt).filter((function(e){return pt[e]})).join(", "))}catch(e){}return pt}var Ct,ht,At,dt=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"}(At||(At={}));var Pt=((Ct={})[At.COMPRESSED_RGB_S3TC_DXT1_EXT]=[4,4],Ct[At.COMPRESSED_RGBA_S3TC_DXT1_EXT]=[4,4],Ct[At.COMPRESSED_RGBA_S3TC_DXT3_EXT]=[4,4],Ct[At.COMPRESSED_RGBA_S3TC_DXT5_EXT]=[4,4],Ct[At.COMPRESSED_SRGB_S3TC_DXT1_EXT]=[4,4],Ct[At.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=[4,4],Ct[At.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=[4,4],Ct[At.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=[4,4],Ct[At.COMPRESSED_R11_EAC]=[4,4],Ct[At.COMPRESSED_SIGNED_R11_EAC]=[4,4],Ct[At.COMPRESSED_RG11_EAC]=[4,4],Ct[At.COMPRESSED_SIGNED_RG11_EAC]=[4,4],Ct[At.COMPRESSED_RGB8_ETC2]=[4,4],Ct[At.COMPRESSED_RGBA8_ETC2_EAC]=[4,4],Ct[At.COMPRESSED_SRGB8_ETC2]=[4,4],Ct[At.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=[4,4],Ct[At.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],Ct[At.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],Ct[At.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=[4,4],Ct[At.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=[4,4],Ct[At.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=[8,4],Ct[At.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=[8,4],Ct[At.COMPRESSED_RGB_ETC1_WEBGL]=[4,4],Ct[At.COMPRESSED_RGB_ATC_WEBGL]=[4,4],Ct[At.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=[4,4],Ct[At.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=[4,4],Ct[At.COMPRESSED_RGBA_ASTC_4x4_KHR]=[4,4],Ct[At.COMPRESSED_RGBA_ASTC_5x5_KHR]=[5,5],Ct[At.COMPRESSED_RGBA_ASTC_6x6_KHR]=[6,6],Ct[At.COMPRESSED_RGBA_ASTC_8x8_KHR]=[8,8],Ct[At.COMPRESSED_RGBA_ASTC_10x10_KHR]=[10,10],Ct[At.COMPRESSED_RGBA_ASTC_12x12_KHR]=[12,12],Ct[At.COMPRESSED_RGBA_ASTC_10x5_KHR]=[10,5],Ct[At.COMPRESSED_RGBA_ASTC_10x6_KHR]=[10,6],Ct[At.COMPRESSED_RGBA_ASTC_10x8_KHR]=[10,8],Ct[At.COMPRESSED_RGBA_ASTC_12x10_KHR]=[12,10],Ct[At.COMPRESSED_RGBA_ASTC_5x4_KHR]=[5,4],Ct[At.COMPRESSED_RGBA_ASTC_6x5_KHR]=[6,5],Ct[At.COMPRESSED_RGBA_ASTC_8x5_KHR]=[8,5],Ct[At.COMPRESSED_RGBA_ASTC_8x6_KHR]=[8,6],Ct),vt=((ht={})[At.COMPRESSED_RGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",ht[At.COMPRESSED_RGBA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",ht[At.COMPRESSED_RGBA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc",ht[At.COMPRESSED_RGBA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc",ht[At.COMPRESSED_SRGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",ht[At.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",ht[At.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc_srgb",ht[At.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc_srgb",ht[At.COMPRESSED_R11_EAC]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_SIGNED_R11_EAC]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_RG11_EAC]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_SIGNED_RG11_EAC]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_RGB8_ETC2]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_RGBA8_ETC2_EAC]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_SRGB8_ETC2]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",ht[At.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ht[At.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ht[At.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ht[At.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",ht[At.COMPRESSED_RGB_ETC1_WEBGL]="WEBGL_compressed_texture_etc1",ht[At.COMPRESSED_RGB_ATC_WEBGL]="WEBGL_compressed_texture_atc",ht[At.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",ht[At.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",ht[At.COMPRESSED_RGBA_ASTC_4x4_KHR]="WEBGL_compressed_texture_astc",ht[At.COMPRESSED_RGBA_ASTC_5x5_KHR]="WEBGL_compressed_texture_astc",ht[At.COMPRESSED_RGBA_ASTC_6x6_KHR]="WEBGL_compressed_texture_astc",ht[At.COMPRESSED_RGBA_ASTC_8x8_KHR]="WEBGL_compressed_texture_astc",ht[At.COMPRESSED_RGBA_ASTC_10x10_KHR]="WEBGL_compressed_texture_astc",ht[At.COMPRESSED_RGBA_ASTC_12x12_KHR]="WEBGL_compressed_texture_astc",ht),Tt=function(){function e(){this.levelBuffers=[]}return e.prototype.upload=function(e){var t=this.levels,r=vt[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}(),yt=12,Ot=28,Gt=36,mt=40,Bt=44,Dt=48,Mt=52,gt=56,xt=60,bt=[171,75,84,88,32,49,49,187,13,10,26,10],Ht=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<bt.length;t++)if(e.getUint8(t)!==bt[t])return!1;return!0}(a))throw new Error("Not a valid KTX Texture");var i=67305985===a.getUint32(yt,!0);_.internalFormat=a.getUint32(Ot,i);var s=_.formerWidth=a.getUint32(Gt,i),c=_.formerHeight=a.getUint32(mt,i)||1,E=Pt[_.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(Bt,i)||1,f=a.getUint32(Dt,i)||1,C=a.getUint32(Mt,i),h=_.levels=a.getUint32(gt,i),A=a.getUint32(xt,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 d=s,P=c,v=64+A,T=0;T<h;T++){var y=a.getUint32(v,i);v+=4;var O=Pt[_.internalFormat],G={levelID:T,levelWidth:d%O[0]==0?d:d+O[0]-d%O[0],levelHeight:P%O[1]==0?P:P+O[1]-P%O[1],levelBuffer:new Uint8Array(r,v,y)};_.levelBuffers.push(G),v+=y,v+=3-(v+3)%4,d=d>>1||1,P=P>>1||1}return _}return _(r,e),r}(Tt);var Lt=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 Ht(r,this.config))},t}(dt),wt=Lt,jt=t.resourceLoader.XhrResponseType;var It,Xt={isCompressed:!1,uploadNotCompressed:n.glCore.GLTexture.prototype.upload,upload:function(e){if(!(e instanceof Tt))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)}}},Kt={oldFrom:n.Texture.from,from:function(e){return e instanceof Tt?new n.Texture(n.BaseTexture.from(e)):this.oldFrom(e)}},Wt={oldFrom:n.BaseTexture.from,from:function(e,t,r){if(!(e instanceof Tt))return this.oldFrom(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)),_}};function Ut(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=ft(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:wt,etc:wt,pvrtc:wt,s3tc:wt,atc:wt}),wt.setExtensionXhrType("ktx",jt.Buffer),_extends(n.glCore.GLTexture.prototype,Xt),_extends(n.Texture,Kt),_extends(n.BaseTexture,Wt)}e.RENDERER_TYPE=void 0,(It=e.RENDERER_TYPE||(e.RENDERER_TYPE={}))[It.UNKNOWN=0]="UNKNOWN",It[It.WEBGL=1]="WEBGL",It[It.CANVAS=2]="CANVAS";var Nt=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},Vt=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},zt=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 ut,this.rendererManager=new ct({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new Rt({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=ft(n),Ut(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);var o=new r.Application(a({sharedTicker:!0},t));return n.ticker.shared.stop(),n.ticker.shared.autoStart=!1,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?Vt(o.renderer):Nt(o.renderer)),void 0!==t.enableScroll&&(t.enableScroll?Vt(o.renderer):Nt(o.renderer)),void 0===t.preventScroll&&void 0===t.enableScroll&&Vt(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),Ft=zt,kt=function(e){function t(t){var r=e.call(this,t)||this;return r.asyncIdMap={},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.prototype.increaseAsyncId=function(e){return this.asyncIdMap[e]=(this.asyncIdMap[e]||0)+1,this.asyncIdMap[e]},t.prototype.validateAsyncId=function(e,t){return this.asyncIdMap[e]===t},t}(t.System),Yt=kt;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=ut,e.Renderer=Yt,e.RendererManager=ct,e.RendererSystem=Ft,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.rendererAdapter,PIXI);window.EVA.plugin.renderer=window.EVA.plugin.renderer||_EVA_IIFE_renderer; | ||
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)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{};var _EVA_IIFE_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,d=A.hasOwnProperty,P=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=d.call(e,v),r=e[v];try{e[v]=void 0;var n=!0}catch(e){}var o=P.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 m(e){if(!G(e))return!1;var t=O(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var B,D=C["__core-js_shared__"],M=(B=/[^.]+$/.exec(D&&D.keys&&D.keys.IE_PROTO||""))?"Symbol(src)_1."+B:"";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,w=H.toString,j=L.hasOwnProperty,I=RegExp("^"+w.call(j).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function X(e){return!(!G(e)||(t=e,M&&M in t))&&(m(e)?I:b).test(x(e));var t}function K(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return X(r)?r:void 0}var W=K(C,"Map"),U=K(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 F(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 k(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},k.prototype.clear=function(){this.size=0,this.__data__={hash:new z,map:new(W||R),string:new z}},k.prototype.delete=function(e){var t=F(this,e).delete(e);return this.size-=t?1:0,t},k.prototype.get=function(e){return F(this,e).get(e)},k.prototype.has=function(e){return F(this,e).has(e)},k.prototype.set=function(e,t){var r=F(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 k(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 k;++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 de={};de["[object Float32Array]"]=de["[object Float64Array]"]=de["[object Int8Array]"]=de["[object Int16Array]"]=de["[object Int32Array]"]=de["[object Uint8Array]"]=de["[object Uint8ClampedArray]"]=de["[object Uint16Array]"]=de["[object Uint32Array]"]=!0,de["[object Arguments]"]=de["[object Array]"]=de["[object ArrayBuffer]"]=de["[object Boolean]"]=de["[object DataView]"]=de["[object Date]"]=de["[object Error]"]=de["[object Function]"]=de["[object Map]"]=de["[object Number]"]=de["[object Object]"]=de["[object RegExp]"]=de["[object Set]"]=de["[object String]"]=de["[object WeakMap]"]=!1;var Pe,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,me=Ge?(Pe=Ge,function(e){return Pe(e)}):function(e){return ie(e)&&Ae(e.length)&&!!de[O(e)]},Be=Object.prototype.hasOwnProperty;function De(e,t){var r=ne(e),n=!r&&Se(e),o=!r&&!n&&fe(e),_=!r&&!n&&!o&&me(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&&!Be.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)&&!m(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 we=Object.prototype.hasOwnProperty;var je=K(C,"DataView"),Ie=K(C,"Promise"),Xe=K(C,"Set"),Ke=K(C,"WeakMap"),We="[object Map]",Ue="[object Promise]",Ne="[object Set]",Ve="[object WeakMap]",ze="[object DataView]",Fe=x(je),ke=x(W),Ye=x(Ie),$e=x(Xe),qe=x(Ke),Je=O;(je&&Je(new je(new ArrayBuffer(1)))!=ze||W&&Je(new W)!=We||Ie&&Je(Ie.resolve())!=Ue||Xe&&Je(new Xe)!=Ne||Ke&&Je(new Ke)!=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 Fe:return ze;case ke: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||me(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:we.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&&r){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);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,dt=40,Pt=44,vt=48,Tt=52,yt=56,Ot=60,Gt=[171,75,84,88,32,49,49,187,13,10,26,10],mt=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(dt,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(Pt,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 d=s,P=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:d%O[0]==0?d:d+O[0]-d%O[0],levelHeight:P%O[1]==0?P:P+O[1]-P%O[1],levelBuffer:new Uint8Array(r,v,y)};_.levelBuffers.push(G),v+=y,v+=3-(v+3)%4,d=d>>1||1,P=P>>1||1}return _}return _(r,e),r}(ft);var Bt=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 mt(r,this.config))},t}(lt),Dt=t.resourceLoader.XhrResponseType;var Mt,gt={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)}}},xt={oldFrom:n.Texture.from,from:function(e){return e instanceof ft?new n.Texture(n.BaseTexture.from(e)):this.oldFrom(e)}},bt={oldFrom:n.BaseTexture.from,from:function(e,t,r){if(!(e instanceof ft))return this.oldFrom(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)),_}};function Ht(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:Bt,etc:Bt,pvrtc:Bt,s3tc:Bt,atc:Bt}),Bt.setExtensionXhrType("ktx",Dt.Buffer),_extends(n.glCore.GLTexture.prototype,gt),_extends(n.Texture,xt),_extends(n.BaseTexture,bt)}e.RENDERER_TYPE=void 0,(Mt=e.RENDERER_TYPE||(e.RENDERER_TYPE={}))[Mt.UNKNOWN=0]="UNKNOWN",Mt[Mt.WEBGL=1]="WEBGL",Mt[Mt.CANVAS=2]="CANVAS";var Lt=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},wt=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},jt=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),Ht(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);var o=new r.Application(a({sharedTicker:!0},t));return n.ticker.shared.stop(),n.ticker.shared.autoStart=!1,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?wt(o.renderer):Lt(o.renderer)),void 0!==t.enableScroll&&(t.enableScroll?wt(o.renderer):Lt(o.renderer)),void 0===t.preventScroll&&void 0===t.enableScroll&&wt(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),It=function(e){function t(t){var r=e.call(this,t)||this;return r.asyncIdMap={},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.prototype.increaseAsyncId=function(e){return this.asyncIdMap[e]=(this.asyncIdMap[e]||0)+1,this.asyncIdMap[e]},t.prototype.validateAsyncId=function(e,t){return this.asyncIdMap[e]===t},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=It,e.RendererManager=_t,e.RendererSystem=jt,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.rendererAdapter,PIXI);window.EVA.plugin.renderer=window.EVA.plugin.renderer||_EVA_IIFE_renderer; |
@@ -1,2 +0,3 @@ | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); } | ||
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); } | ||
import { __values, __extends, __decorate, __spread, __assign } from 'tslib'; | ||
@@ -8,6 +9,7 @@ import { OBSERVER_TYPE, decorators, resourceLoader, resource, RESOURCE_TYPE_STRATEGY, LOAD_SCENE_MODE, System } from '@eva/eva.js/dist/miniprogram'; | ||
import { glCore, Texture, BaseTexture, utils, ticker } from '@eva/miniprogram-pixi'; | ||
var RendererManager = function () { | ||
function RendererManager(_a) { | ||
var game = _a.game, | ||
rendererSystem = _a.rendererSystem; | ||
rendererSystem = _a.rendererSystem; | ||
this.renderers = []; | ||
@@ -17,8 +19,12 @@ this.game = game; | ||
} | ||
RendererManager.prototype.register = function () { | ||
var e_1, _a; | ||
var renderers = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
renderers[_i] = arguments[_i]; | ||
} | ||
try { | ||
@@ -44,6 +50,9 @@ for (var renderers_1 = __values(renderers), renderers_1_1 = renderers_1.next(); !renderers_1_1.done; renderers_1_1 = renderers_1.next()) { | ||
}; | ||
RendererManager.prototype.componentChanged = function (changes) { | ||
var e_2, _a; | ||
var _loop_1 = function _loop_1(changed) { | ||
var e_3, _a; | ||
try { | ||
@@ -53,2 +62,3 @@ for (var _b = (e_3 = void 0, __values(this_1.renderers)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var props = renderer.observerInfo[changed.componentName]; | ||
if (props) { | ||
@@ -61,7 +71,10 @@ if ([OBSERVER_TYPE.ADD, OBSERVER_TYPE.REMOVE].indexOf(changed.type) > -1) { | ||
} | ||
continue; | ||
} | ||
var index = props.findIndex(function (prop) { | ||
return isEqual(prop, changed.prop); | ||
}); | ||
if (index > -1) { | ||
@@ -88,6 +101,9 @@ try { | ||
}; | ||
var this_1 = this; | ||
try { | ||
for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) { | ||
var changed = changes_1_1.value; | ||
_loop_1(changed); | ||
@@ -107,7 +123,10 @@ } | ||
}; | ||
RendererManager.prototype.update = function (gameObject) { | ||
var e_4, _a, e_5, _b; | ||
try { | ||
for (var _c = __values(gameObject.components), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
var component = _d.value; | ||
try { | ||
@@ -118,4 +137,6 @@ for (var _e = (e_5 = void 0, __values(this.renderers)), _f = _e.next(); !_f.done; _f = _e.next()) { | ||
var props = renderer.observerInfo[component.name]; | ||
if (props && cache.indexOf(gameObject) === -1) { | ||
cache.push(gameObject); | ||
try { | ||
@@ -152,5 +173,8 @@ renderer.rendererUpdate && renderer.rendererUpdate(gameObject); | ||
}; | ||
return RendererManager; | ||
}(); | ||
var RendererManager$1 = RendererManager; | ||
var ContainerManager = function () { | ||
@@ -160,12 +184,16 @@ function ContainerManager() { | ||
} | ||
ContainerManager.prototype.addContainer = function (_a) { | ||
var name = _a.name, | ||
container = _a.container; | ||
container = _a.container; | ||
this.containerMap[name] = container; | ||
}; | ||
ContainerManager.prototype.getContainer = function (name) { | ||
return this.containerMap[name]; | ||
}; | ||
ContainerManager.prototype.removeContainer = function (name) { | ||
var _a; | ||
(_a = this.containerMap[name]) === null || _a === void 0 ? void 0 : _a.destroy({ | ||
@@ -176,14 +204,15 @@ children: true | ||
}; | ||
ContainerManager.prototype.updateTransform = function (_a) { | ||
var name = _a.name, | ||
transform = _a.transform; | ||
transform = _a.transform; | ||
var container = this.containerMap[name]; | ||
if (!container || !transform) return; | ||
var anchor = transform.anchor, | ||
origin = transform.origin, | ||
position = transform.position, | ||
rotation = transform.rotation, | ||
scale = transform.scale, | ||
size = transform.size, | ||
skew = transform.skew; | ||
origin = transform.origin, | ||
position = transform.position, | ||
rotation = transform.rotation, | ||
scale = transform.scale, | ||
size = transform.size, | ||
skew = transform.skew; | ||
container.rotation = rotation; | ||
@@ -196,2 +225,3 @@ container.scale = scale; | ||
var y = position.y; | ||
if (transform.parent) { | ||
@@ -202,2 +232,3 @@ var parent_1 = transform.parent; | ||
} | ||
container.position = { | ||
@@ -208,11 +239,17 @@ x: x, | ||
}; | ||
return ContainerManager; | ||
}(); | ||
var ContainerManager$1 = ContainerManager; | ||
var Transform = function (_super) { | ||
__extends(Transform, _super); | ||
function Transform(_a) { | ||
var system = _a.system, | ||
containerManager = _a.containerManager; | ||
containerManager = _a.containerManager; | ||
var _this = _super.call(this) || this; | ||
_this.name = 'Transform'; | ||
@@ -222,12 +259,17 @@ _this.waitRemoveIds = []; | ||
_this.containerManager = containerManager; | ||
_this.init(system); | ||
return _this; | ||
} | ||
Transform.prototype.init = function (system) { | ||
var _this = this; | ||
this.system = system; | ||
this.on('changeScene', function (_a) { | ||
var scene = _a.scene, | ||
mode = _a.mode, | ||
application = _a.application; | ||
mode = _a.mode, | ||
application = _a.application; | ||
_this.waitChangeScenes.push({ | ||
@@ -240,4 +282,6 @@ scene: scene, | ||
}; | ||
Transform.prototype.update = function () { | ||
var e_1, _a, e_2, _b; | ||
try { | ||
@@ -259,3 +303,5 @@ for (var _c = __values(this.waitRemoveIds), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
} | ||
this.waitRemoveIds = []; | ||
try { | ||
@@ -265,2 +311,3 @@ for (var _e = __values(this.waitChangeScenes), _f = _e.next(); !_f.done; _f = _e.next()) { | ||
var container = this.containerManager.getContainer(sceneInfo.scene.id); | ||
if (container) { | ||
@@ -282,4 +329,6 @@ sceneInfo.application.stage.removeChildren(); | ||
} | ||
this.waitChangeScenes = []; | ||
}; | ||
Transform.prototype.componentChanged = function (changed) { | ||
@@ -294,2 +343,3 @@ if (changed.type === OBSERVER_TYPE.ADD) { | ||
}; | ||
Transform.prototype.addContainer = function (changed) { | ||
@@ -305,4 +355,6 @@ var container = new Container(); | ||
}; | ||
Transform.prototype.change = function (changed) { | ||
var transform = changed.component; | ||
if (transform.parent) { | ||
@@ -312,2 +364,3 @@ var parentContainer = this.containerManager.getContainer(transform.parent.gameObject.id); | ||
var render = changed.gameObject.transform.parent && changed.gameObject.transform.parent.gameObject.getComponent('Render'); | ||
if (render) { | ||
@@ -321,2 +374,3 @@ render.sortDirty = true; | ||
}; | ||
Transform.prototype.destroy = function () { | ||
@@ -329,2 +383,3 @@ this.removeAllListeners(); | ||
}; | ||
Transform = __decorate([decorators.componentObserver({ | ||
@@ -335,6 +390,9 @@ Transform: ['_parent'] | ||
}(EventEmitter); | ||
var Transform$1 = Transform; | ||
var result = undefined; | ||
function getSuportCompressedTextureFormats(gl) { | ||
if (result) return result; | ||
if (!gl) { | ||
@@ -351,2 +409,3 @@ console.warn('WebGL not available for compressed textures. Silently failing.'); | ||
} | ||
result = { | ||
@@ -360,2 +419,3 @@ s3tc: !!gl.getExtension('WEBGL_compressed_texture_s3tc'), | ||
}; | ||
try { | ||
@@ -366,8 +426,13 @@ console.log('Eva.js Supported Compressed Texture Format List: ' + Object.keys(result).filter(function (type) { | ||
} catch (e) {} | ||
return result; | ||
} | ||
var XLS = resourceLoader.XhrLoadStrategy; | ||
var XhrLoadStrategy = XLS; | ||
var _a, _b; | ||
var INTERNAL_FORMATS; | ||
(function (INTERNAL_FORMATS) { | ||
@@ -429,4 +494,6 @@ INTERNAL_FORMATS[INTERNAL_FORMATS["COMPRESSED_RGB_S3TC_DXT1_EXT"] = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT"; | ||
})(INTERNAL_FORMATS || (INTERNAL_FORMATS = {})); | ||
var INTERNAL_FORMAT_TO_BLOCK_SIZE = (_a = {}, _a[INTERNAL_FORMATS.COMPRESSED_RGB_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_R11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SIGNED_R11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RG11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SIGNED_RG11_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB8_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA8_ETC2_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB8_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG] = [8, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG] = [8, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_ETC1_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGB_ATC_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_4x4_KHR] = [4, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x5_KHR] = [5, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x6_KHR] = [6, 6], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x8_KHR] = [8, 8], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x10_KHR] = [10, 10], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x12_KHR] = [12, 12], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x5_KHR] = [10, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x6_KHR] = [10, 6], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_10x8_KHR] = [10, 8], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_12x10_KHR] = [12, 10], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_5x4_KHR] = [5, 4], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_6x5_KHR] = [6, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x5_KHR] = [8, 5], _a[INTERNAL_FORMATS.COMPRESSED_RGBA_ASTC_8x6_KHR] = [8, 6], _a); | ||
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); | ||
var CompressedTextureResource = function () { | ||
@@ -436,7 +503,10 @@ function CompressedTextureResource() { | ||
} | ||
CompressedTextureResource.prototype.upload = function (gl) { | ||
var levels = this.levels; | ||
var name = INTERNAL_FORMATS_TO_EXTENSION_NAME[this.internalFormat]; | ||
if (!gl[name]) { | ||
gl[name] = true; | ||
if (name === 'WEBGL_compressed_texture_pvrtc') { | ||
@@ -448,9 +518,11 @@ gl.getExtension(name) || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'); | ||
} | ||
for (var i = 0; i < this.levels; ++i) { | ||
var _a = this.levelBuffers[i], | ||
levelWidth = _a.levelWidth, | ||
levelHeight = _a.levelHeight, | ||
levelBuffer = _a.levelBuffer; | ||
levelWidth = _a.levelWidth, | ||
levelHeight = _a.levelHeight, | ||
levelBuffer = _a.levelBuffer; | ||
gl.compressedTexImage2D(gl.TEXTURE_2D, i, this.internalFormat, levelWidth, levelHeight, 0, levelBuffer); | ||
} | ||
if (levels > 1) { | ||
@@ -464,4 +536,6 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); | ||
}; | ||
return CompressedTextureResource; | ||
}(); | ||
var FILE_HEADER_SIZE = 64; | ||
@@ -486,13 +560,19 @@ var KTX_FIELDS = { | ||
var ENDIANNESS = 0x04030201; | ||
var KTXTextureResource = function (_super) { | ||
__extends(KTXTextureResource, _super); | ||
function KTXTextureResource(source, config) { | ||
var _a; | ||
var _this = _super.call(this) || this; | ||
_this.complete = true; | ||
_this.src = config.url; | ||
var dataView = new DataView(source); | ||
if (!validateKTX(dataView)) { | ||
throw new Error('Not a valid KTX Texture'); | ||
} | ||
var littleEndian = dataView.getUint32(KTX_FIELDS.ENDIANNESS, true) === ENDIANNESS; | ||
@@ -506,5 +586,7 @@ _this.internalFormat = dataView.getUint32(KTX_FIELDS.GL_INTERNAL_FORMAT, littleEndian); | ||
var src = resource.resourcesMap[config.metadata.name].src[config.metadata.key]; | ||
var _b = (_a = src === null || src === void 0 ? void 0 : src.size) !== null && _a !== void 0 ? _a : {}, | ||
width = _b.width, | ||
height = _b.height; | ||
width = _b.width, | ||
height = _b.height; | ||
if (width && height) { | ||
@@ -514,2 +596,3 @@ _this.naturalWidth = width; | ||
} | ||
var pixelDepth = dataView.getUint32(KTX_FIELDS.PIXEL_DEPTH, littleEndian) || 1; | ||
@@ -520,14 +603,19 @@ var numberOfArrayElements = dataView.getUint32(KTX_FIELDS.NUMBER_OF_ARRAY_ELEMENTS, littleEndian) || 1; | ||
var bytesOfKeyValueData = dataView.getUint32(KTX_FIELDS.BYTES_OF_KEY_VALUE_DATA, littleEndian); | ||
if (pixelHeight === 0 || pixelDepth !== 1) { | ||
throw new Error('Only 2D textures are supported!'); | ||
} | ||
if (numberOfFaces !== 1) { | ||
throw new Error('CubeTextures are not supported!'); | ||
} | ||
if (numberOfArrayElements !== 1) { | ||
throw new Error('It does not support array textures!'); | ||
} | ||
var mipWidth = pixelWidth; | ||
var mipHeight = pixelHeight; | ||
var imageOffset = FILE_HEADER_SIZE + bytesOfKeyValueData; | ||
for (var mipmapLevel = 0; mipmapLevel < numberOfMipmapLevels; mipmapLevel++) { | ||
@@ -545,3 +633,5 @@ var imageSize = dataView.getUint32(imageOffset, littleEndian); | ||
}; | ||
_this.levelBuffers.push(mip); | ||
imageOffset += imageSize; | ||
@@ -552,6 +642,9 @@ imageOffset += 3 - (imageOffset + 3) % 4; | ||
} | ||
return _this; | ||
} | ||
return KTXTextureResource; | ||
}(CompressedTextureResource); | ||
function validateKTX(dataView) { | ||
@@ -563,24 +656,34 @@ for (var i = 0; i < FILE_IDENTIFIER.length; i++) { | ||
} | ||
return true; | ||
} | ||
var KTXLoadStrategy = function (_super) { | ||
__extends(KTXLoadStrategy, _super); | ||
function KTXLoadStrategy() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
KTXLoadStrategy.prototype._complete = function (type, data) { | ||
_super.prototype._complete.call(this, type, new KTXTextureResource(data, this.config)); | ||
}; | ||
return KTXLoadStrategy; | ||
}(XhrLoadStrategy); | ||
var KTXLoadStrategy$1 = KTXLoadStrategy; | ||
var XhrResponseType = resourceLoader.XhrResponseType; | ||
function addPreProcessResourceHandler(resource, gl) { | ||
resource.addPreProcessResourceHandler(function normalizeResource(resource) { | ||
var _a, _b, _c; | ||
var textures = (_b = (_a = resource.src) === null || _a === void 0 ? void 0 : _a.image) === null || _b === void 0 ? void 0 : _b.texture; | ||
if (!textures) return; | ||
if (!Array.isArray(textures)) { | ||
textures = [textures]; | ||
} | ||
var formats = (_c = getSuportCompressedTextureFormats(gl)) !== null && _c !== void 0 ? _c : {}; | ||
@@ -590,2 +693,3 @@ var target = textures.find(function (texture) { | ||
}); | ||
if (target) { | ||
@@ -596,2 +700,3 @@ _extends(resource.src.image, target); | ||
} | ||
function addKTXStragetyAndRegister() { | ||
@@ -605,4 +710,6 @@ _extends(RESOURCE_TYPE_STRATEGY, { | ||
}); | ||
KTXLoadStrategy$1.setExtensionXhrType('ktx', XhrResponseType.Buffer); | ||
} | ||
var GLTexture = glCore.GLTexture; | ||
@@ -616,2 +723,3 @@ var GLTextureMixin = { | ||
} | ||
this.bind(); | ||
@@ -629,2 +737,3 @@ var gl = this.gl; | ||
} | ||
var gl = this.gl; | ||
@@ -642,2 +751,3 @@ this.bind(); | ||
} | ||
return new Texture(BaseTexture.from(source)); | ||
@@ -652,23 +762,34 @@ } | ||
} | ||
var imageUrl = source.src; | ||
var baseTexture = utils.BaseTextureCache[imageUrl]; | ||
if (!baseTexture) { | ||
baseTexture = new BaseTexture(source, scaleMode); | ||
baseTexture.imageUrl = imageUrl; | ||
if (sourceScale) { | ||
baseTexture.sourceScale = sourceScale; | ||
} | ||
BaseTexture.addToCache(baseTexture, imageUrl); | ||
} | ||
return baseTexture; | ||
} | ||
}; | ||
function registerCompressedTexture(gl) { | ||
addPreProcessResourceHandler(resource, gl); | ||
addKTXStragetyAndRegister(); | ||
_extends(glCore.GLTexture.prototype, GLTextureMixin); | ||
_extends(Texture, TextureMixin); | ||
_extends(BaseTexture, BaseTextureMixin); | ||
} | ||
var RENDERER_TYPE; | ||
(function (RENDERER_TYPE) { | ||
@@ -679,2 +800,3 @@ RENDERER_TYPE[RENDERER_TYPE["UNKNOWN"] = 0] = "UNKNOWN"; | ||
})(RENDERER_TYPE || (RENDERER_TYPE = {})); | ||
var disableScroll = function disableScroll(renderer) { | ||
@@ -684,2 +806,3 @@ renderer.plugins.interaction.autoPreventDefault = true; | ||
}; | ||
var enableScroll = function enableScroll(renderer) { | ||
@@ -689,11 +812,16 @@ renderer.plugins.interaction.autoPreventDefault = false; | ||
}; | ||
var Renderer$2 = function (_super) { | ||
__extends(Renderer, _super); | ||
function Renderer() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.multiApps = []; | ||
return _this; | ||
} | ||
Renderer.prototype.init = function (params) { | ||
var _this = this; | ||
this.params = params; | ||
@@ -713,5 +841,6 @@ this.application = this.createApplication(params); | ||
var scene = _a.scene, | ||
mode = _a.mode, | ||
params = _a.params; | ||
mode = _a.mode, | ||
params = _a.params; | ||
var application; | ||
switch (mode) { | ||
@@ -721,2 +850,3 @@ case LOAD_SCENE_MODE.SINGLE: | ||
break; | ||
case LOAD_SCENE_MODE.MULTI_CANVAS: | ||
@@ -728,3 +858,5 @@ application = _this.createMultiApplication({ | ||
} | ||
scene.canvas = application.view; | ||
_this.transform.emit('changeScene', { | ||
@@ -737,2 +869,3 @@ scene: scene, | ||
var gl = this.application.renderer.gl; | ||
if (gl) { | ||
@@ -743,5 +876,8 @@ this.suportedCompressedTextureFormats = getSuportCompressedTextureFormats(gl); | ||
}; | ||
Renderer.prototype.registerObserver = function (observerInfo) { | ||
var _a; | ||
var thisObserverInfo = this.constructor.observerInfo; | ||
for (var key in observerInfo) { | ||
@@ -751,5 +887,7 @@ if (!thisObserverInfo[key]) { | ||
} | ||
(_a = thisObserverInfo[key]).push.apply(_a, __spread(observerInfo[key])); | ||
} | ||
}; | ||
Renderer.prototype.createMultiApplication = function (_a) { | ||
@@ -761,7 +899,10 @@ var params = _a.params; | ||
}; | ||
Renderer.prototype.createApplication = function (params) { | ||
params.view = params.canvas; | ||
if (params.renderType === RENDERER_TYPE.CANVAS) { | ||
params.forceCanvas = true; | ||
} | ||
var app = new Application(__assign({ | ||
@@ -772,2 +913,3 @@ sharedTicker: true | ||
ticker.shared.autoStart = false; | ||
if (params.preventScroll !== undefined) { | ||
@@ -777,13 +919,19 @@ console.warn('PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game'); | ||
} | ||
if (params.enableScroll !== undefined) { | ||
params.enableScroll ? enableScroll(app.renderer) : disableScroll(app.renderer); | ||
} | ||
if (params.preventScroll === undefined && params.enableScroll === undefined) { | ||
enableScroll(app.renderer); | ||
} | ||
return app; | ||
}; | ||
Renderer.prototype.update = function () { | ||
var e_1, _a, e_2, _b; | ||
var changes = this.componentObserver.clear(); | ||
try { | ||
@@ -805,2 +953,3 @@ for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) { | ||
} | ||
try { | ||
@@ -827,2 +976,3 @@ for (var _c = __values(this.game.gameObjects), _d = _c.next(); !_d.done; _d = _c.next()) { | ||
}; | ||
Renderer.prototype.lateUpdate = function (e) { | ||
@@ -832,5 +982,8 @@ this.transform.update(); | ||
}; | ||
Renderer.prototype.onDestroy = function () { | ||
var e_3, _a; | ||
this.application.destroy(); | ||
try { | ||
@@ -852,2 +1005,3 @@ for (var _b = __values(this.multiApps), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
} | ||
this.transform.destroy(); | ||
@@ -862,2 +1016,3 @@ this.transform = null; | ||
}; | ||
Renderer.prototype.resize = function (width, height) { | ||
@@ -868,2 +1023,3 @@ this.params.width = width; | ||
}; | ||
Renderer.systemName = 'Renderer'; | ||
@@ -875,7 +1031,11 @@ Renderer = __decorate([decorators.componentObserver({ | ||
}(System); | ||
var Renderer$3 = Renderer$2; | ||
var Renderer = function (_super) { | ||
__extends(Renderer, _super); | ||
function Renderer(params) { | ||
var _this = _super.call(this, params) || this; | ||
_this.asyncIdMap = {}; | ||
@@ -885,7 +1045,12 @@ _this.observerInfo = _this.constructor.observerInfo; | ||
} | ||
Renderer.prototype.componentChanged = function (_changed) {}; | ||
Renderer.prototype.rendererUpdate = function (_gameObject) {}; | ||
Renderer.prototype.update = function (e) { | ||
var e_1, _a; | ||
var changes = this.componentObserver.clear(); | ||
try { | ||
@@ -908,2 +1073,3 @@ for (var changes_1 = __values(changes), changes_1_1 = changes_1.next(); !changes_1_1.done; changes_1_1 = changes_1.next()) { | ||
}; | ||
Renderer.prototype.increaseAsyncId = function (id) { | ||
@@ -913,8 +1079,12 @@ this.asyncIdMap[id] = (this.asyncIdMap[id] || 0) + 1; | ||
}; | ||
Renderer.prototype.validateAsyncId = function (id, asyncId) { | ||
return this.asyncIdMap[id] === asyncId; | ||
}; | ||
return Renderer; | ||
}(System); | ||
var Renderer$1 = Renderer; | ||
var mixinPIXI = function mixinPIXI() { | ||
@@ -926,2 +1096,3 @@ BaseTexture.prototype.destroy = function () { | ||
} | ||
this.source = null; | ||
@@ -934,3 +1105,4 @@ this.dispose(); | ||
}; | ||
mixinPIXI(); | ||
export { ContainerManager$1 as ContainerManager, RENDERER_TYPE, Renderer$1 as Renderer, RendererManager$1 as RendererManager, Renderer$3 as RendererSystem }; |
@@ -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; } | ||
@@ -354,3 +354,2 @@ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual); | ||
var container = this.containerManager.getContainer(changed.gameObject.id); | ||
delete transform.worldTransform; | ||
container.parent && container.parent.removeChild(container); | ||
@@ -852,15 +851,7 @@ } | ||
} | ||
var app; | ||
try { | ||
app = new rendererAdapter.Application(__assign({ sharedTicker: true }, params)); | ||
} | ||
catch (e) { | ||
if (e.message.match(/not support webgl/i) !== undefined) { | ||
app = new rendererAdapter.Application(__assign(__assign({ sharedTicker: true }, params), { forceCanvas: true })); | ||
} | ||
} | ||
var app = new rendererAdapter.Application(__assign({ sharedTicker: true }, params)); | ||
pixi_js.ticker.shared.stop(); | ||
pixi_js.ticker.shared.autoStart = false; | ||
if (params.preventScroll !== undefined) { | ||
console.warn('PreventScroll property will deprecate at next major version, please use enableScroll instead. https://eva.js.org/#/tutorials/game'); | ||
console.warn('PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game'); | ||
params.preventScroll ? enableScroll(app.renderer) : disableScroll(app.renderer); | ||
@@ -867,0 +858,0 @@ } |
@@ -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])},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}(),P=p,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(_&&r){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=T,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);_.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,d=void 0;function B(e){if(d)return d;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};d={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(d).filter((function(e){return d[e]})).join(", "))}catch(e){}return d}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,P=E.getUint32(X,a)||1,T=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!==T)throw new Error("CubeTextures are not supported!");if(1!==P)throw new Error("It does not support array textures!");for(var G=S,d=i,B=64+u,D=0;D<l;D++){var M=E.getUint32(B,a);B+=4;var O=f[o.internalFormat],h={levelID:D,levelWidth:G%O[0]==0?G:G+O[0]-G%O[0],levelHeight:d%O[1]==0?d:d+O[1]-d%O[1],levelBuffer:new Uint8Array(r,B,M)};o.levelBuffers.push(h),B+=M,B+=3-(B+3)%4,G=G>>1||1,d=d>>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={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)}}},F={oldFrom:n.Texture.from,from:function(e){return e instanceof x?new n.Texture(n.BaseTexture.from(e)):this.oldFrom(e)}},Y={oldFrom:n.BaseTexture.from,from:function(e,t,r){if(!(e instanceof x))return this.oldFrom(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}};function k(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=B(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,j),Object.assign(n.Texture,F),Object.assign(n.BaseTexture,Y)}exports.RENDERER_TYPE=void 0,(V=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[V.UNKNOWN=0]="UNKNOWN",V[V.WEBGL=1]="WEBGL",V[V.CANVAS=2]="CANVAS";var q=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},z=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},J=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 P({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=B(_),k(_))},_.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);var r=new t.Application(R({sharedTicker:!0},e));return n.ticker.shared.stop(),n.ticker.shared.autoStart=!1,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?z(r.renderer):q(r.renderer)),void 0!==e.enableScroll&&(e.enableScroll?z(r.renderer):q(r.renderer)),void 0===e.preventScroll&&void 0===e.enableScroll&&z(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),Q=J,Z=function(e){function t(t){var r=e.call(this,t)||this;return r.asyncIdMap={},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.prototype.increaseAsyncId=function(e){return this.asyncIdMap[e]=(this.asyncIdMap[e]||0)+1,this.asyncIdMap[e]},t.prototype.validateAsyncId=function(e,t){return this.asyncIdMap[e]===t},t}(e.System),$=Z;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=$,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])})(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}(),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(_&&r){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}(),T=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);_.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,d,B,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"}(B||(B={}));var M=((G={})[B.COMPRESSED_RGB_S3TC_DXT1_EXT]=[4,4],G[B.COMPRESSED_RGBA_S3TC_DXT1_EXT]=[4,4],G[B.COMPRESSED_RGBA_S3TC_DXT3_EXT]=[4,4],G[B.COMPRESSED_RGBA_S3TC_DXT5_EXT]=[4,4],G[B.COMPRESSED_SRGB_S3TC_DXT1_EXT]=[4,4],G[B.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]=[4,4],G[B.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]=[4,4],G[B.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]=[4,4],G[B.COMPRESSED_R11_EAC]=[4,4],G[B.COMPRESSED_SIGNED_R11_EAC]=[4,4],G[B.COMPRESSED_RG11_EAC]=[4,4],G[B.COMPRESSED_SIGNED_RG11_EAC]=[4,4],G[B.COMPRESSED_RGB8_ETC2]=[4,4],G[B.COMPRESSED_RGBA8_ETC2_EAC]=[4,4],G[B.COMPRESSED_SRGB8_ETC2]=[4,4],G[B.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]=[4,4],G[B.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],G[B.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]=[4,4],G[B.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=[4,4],G[B.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=[4,4],G[B.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=[8,4],G[B.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=[8,4],G[B.COMPRESSED_RGB_ETC1_WEBGL]=[4,4],G[B.COMPRESSED_RGB_ATC_WEBGL]=[4,4],G[B.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=[4,4],G[B.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=[4,4],G[B.COMPRESSED_RGBA_ASTC_4x4_KHR]=[4,4],G[B.COMPRESSED_RGBA_ASTC_5x5_KHR]=[5,5],G[B.COMPRESSED_RGBA_ASTC_6x6_KHR]=[6,6],G[B.COMPRESSED_RGBA_ASTC_8x8_KHR]=[8,8],G[B.COMPRESSED_RGBA_ASTC_10x10_KHR]=[10,10],G[B.COMPRESSED_RGBA_ASTC_12x12_KHR]=[12,12],G[B.COMPRESSED_RGBA_ASTC_10x5_KHR]=[10,5],G[B.COMPRESSED_RGBA_ASTC_10x6_KHR]=[10,6],G[B.COMPRESSED_RGBA_ASTC_10x8_KHR]=[10,8],G[B.COMPRESSED_RGBA_ASTC_12x10_KHR]=[12,10],G[B.COMPRESSED_RGBA_ASTC_5x4_KHR]=[5,4],G[B.COMPRESSED_RGBA_ASTC_6x5_KHR]=[6,5],G[B.COMPRESSED_RGBA_ASTC_8x5_KHR]=[8,5],G[B.COMPRESSED_RGBA_ASTC_8x6_KHR]=[8,6],G),O=((d={})[B.COMPRESSED_RGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",d[B.COMPRESSED_RGBA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc",d[B.COMPRESSED_RGBA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc",d[B.COMPRESSED_RGBA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc",d[B.COMPRESSED_SRGB_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",d[B.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]="WEBGL_compressed_texture_s3tc_srgb",d[B.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]="WEBGL_compressed_texture_s3tc_srgb",d[B.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]="WEBGL_compressed_texture_s3tc_srgb",d[B.COMPRESSED_R11_EAC]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_SIGNED_R11_EAC]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_RG11_EAC]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_SIGNED_RG11_EAC]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_RGB8_ETC2]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_RGBA8_ETC2_EAC]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_SRGB8_ETC2]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]="WEBGL_compressed_texture_etc",d[B.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",d[B.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",d[B.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",d[B.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]="WEBGL_compressed_texture_pvrtc",d[B.COMPRESSED_RGB_ETC1_WEBGL]="WEBGL_compressed_texture_etc1",d[B.COMPRESSED_RGB_ATC_WEBGL]="WEBGL_compressed_texture_atc",d[B.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",d[B.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]="WEBGL_compressed_texture_atc",d[B.COMPRESSED_RGBA_ASTC_4x4_KHR]="WEBGL_compressed_texture_astc",d[B.COMPRESSED_RGBA_ASTC_5x5_KHR]="WEBGL_compressed_texture_astc",d[B.COMPRESSED_RGBA_ASTC_6x6_KHR]="WEBGL_compressed_texture_astc",d[B.COMPRESSED_RGBA_ASTC_8x8_KHR]="WEBGL_compressed_texture_astc",d[B.COMPRESSED_RGBA_ASTC_10x10_KHR]="WEBGL_compressed_texture_astc",d[B.COMPRESSED_RGBA_ASTC_12x12_KHR]="WEBGL_compressed_texture_astc",d),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,P=E.getUint32(y,a)||1,T=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!==T)throw new Error("CubeTextures are not supported!");if(1!==P)throw new Error("It does not support array textures!");for(var G=S,d=i,B=64+u,D=0;D<l;D++){var O=E.getUint32(B,a);B+=4;var h=M[o.internalFormat],I={levelID:D,levelWidth:G%h[0]==0?G:G+h[0]-G%h[0],levelHeight:d%h[1]==0?d:d+h[1]-d%h[1],levelBuffer:new Uint8Array(r,B,O)};o.levelBuffers.push(I),B+=O,B+=3-(B+3)%4,G=G>>1||1,d=d>>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={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)}}},U={oldFrom:n.Texture.from,from:function(e){return e instanceof h?new n.Texture(n.BaseTexture.from(e)):this.oldFrom(e)}},V={oldFrom:n.BaseTexture.from,from:function(e,t,r){if(!(e instanceof h))return this.oldFrom(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}};function j(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,N),Object.assign(n.Texture,U),Object.assign(n.BaseTexture,V)}exports.RENDERER_TYPE=void 0,(b=exports.RENDERER_TYPE||(exports.RENDERER_TYPE={}))[b.UNKNOWN=0]="UNKNOWN",b[b.WEBGL=1]="WEBGL",b[b.CANVAS=2]="CANVAS";var F=function(e){e.plugins.interaction.autoPreventDefault=!0,e.view.style.touchAction="none"},Y=function(e){e.plugins.interaction.autoPreventDefault=!1,e.view.style.touchAction="auto"},k=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 P,this.rendererManager=new p({game:this.game,rendererSystem:this}),this.game.canvas=this.application.view,this.transform=new T({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(_),j(_))},_.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);var r=new t.Application(R({sharedTicker:!0},e));return n.ticker.shared.stop(),n.ticker.shared.autoStart=!1,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?Y(r.renderer):F(r.renderer)),void 0!==e.enableScroll&&(e.enableScroll?Y(r.renderer):F(r.renderer)),void 0===e.preventScroll&&void 0===e.enableScroll&&Y(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),q=function(e){function t(t){var r=e.call(this,t)||this;return r.asyncIdMap={},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.prototype.increaseAsyncId=function(e){return this.asyncIdMap[e]=(this.asyncIdMap[e]||0)+1,this.asyncIdMap[e]},t.prototype.validateAsyncId=function(e,t){return this.asyncIdMap[e]===t},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=P,exports.Renderer=q,exports.RendererManager=p,exports.RendererSystem=k; |
@@ -80,4 +80,4 @@ import { Application } from '@eva/renderer-adapter'; | ||
params: RendererSystemParams; | ||
}): any; | ||
createApplication(params: RendererSystemParams): any; | ||
}): Application; | ||
createApplication(params: RendererSystemParams): Application; | ||
update(): void; | ||
@@ -84,0 +84,0 @@ lateUpdate(e: any): void; |
@@ -344,3 +344,2 @@ import { OBSERVER_TYPE, decorators, resourceLoader, resource, RESOURCE_TYPE_STRATEGY, LOAD_SCENE_MODE, System } from '@eva/eva.js'; | ||
var container = this.containerManager.getContainer(changed.gameObject.id); | ||
delete transform.worldTransform; | ||
container.parent && container.parent.removeChild(container); | ||
@@ -842,15 +841,7 @@ } | ||
} | ||
var app; | ||
try { | ||
app = new Application(__assign({ sharedTicker: true }, params)); | ||
} | ||
catch (e) { | ||
if (e.message.match(/not support webgl/i) !== undefined) { | ||
app = new Application(__assign(__assign({ sharedTicker: true }, params), { forceCanvas: true })); | ||
} | ||
} | ||
var app = new Application(__assign({ sharedTicker: true }, params)); | ||
ticker.shared.stop(); | ||
ticker.shared.autoStart = false; | ||
if (params.preventScroll !== undefined) { | ||
console.warn('PreventScroll property will deprecate at next major version, please use enableScroll instead. https://eva.js.org/#/tutorials/game'); | ||
console.warn('PreventScroll property will deprecate at next major version, please use enableEnable instead. https://eva.js.org/#/tutorials/game'); | ||
params.preventScroll ? enableScroll(app.renderer) : disableScroll(app.renderer); | ||
@@ -857,0 +848,0 @@ } |
{ | ||
"name": "@eva/plugin-renderer", | ||
"version": "1.2.7-fix.4", | ||
"version": "1.2.7-fix.5", | ||
"description": "@eva/plugin-renderer", | ||
@@ -21,4 +21,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"@eva/eva.js": "1.2.7-fix.4", | ||
"@eva/renderer-adapter": "1.2.7-fix.4", | ||
"@eva/eva.js": "1.2.7-fix.5", | ||
"@eva/renderer-adapter": "1.2.7-fix.5", | ||
"@types/pixi.js": "^4.8.9", | ||
@@ -25,0 +25,0 @@ "eventemitter3": "^3.1.2", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
496109
13
5127
+ Added@eva/eva.js@1.2.7-fix.5(transitive)
+ Added@eva/renderer-adapter@1.2.7-fix.5(transitive)
- Removed@eva/eva.js@1.2.7-fix.4(transitive)
- Removed@eva/renderer-adapter@1.2.7-fix.4(transitive)
Updated@eva/eva.js@1.2.7-fix.5