UNPKG

polygonjs-engine

Version:

node-based webgl 3D engine https://polygonjs.com

3 lines 26.1 kB
/*! For license information please see 1.js.LICENSE.txt */ (window.webpackJsonpPOLY=window.webpackJsonpPOLY||[]).push([[1],{206:function(e,r,t){"use strict";t.d(r,"a",(function(){return s}));var n=t(0),a=t(42),i=t(25),o=t(19);function s(e){o.a.call(this,e)}s.prototype=Object.assign(Object.create(o.a.prototype),{constructor:s,load:function(e,r,t,o){const s=this,f=new i.a,h=new a.a(this.manager);return h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setPath(this.path),h.setWithCredentials(s.withCredentials),h.load(e,(function(e){const t=s.parse(e);t&&(void 0!==t.image?f.image=t.image:void 0!==t.data&&(f.image.width=t.width,f.image.height=t.height,f.image.data=t.data),f.wrapS=void 0!==t.wrapS?t.wrapS:n.n,f.wrapT=void 0!==t.wrapT?t.wrapT:n.n,f.magFilter=void 0!==t.magFilter?t.magFilter:n.V,f.minFilter=void 0!==t.minFilter?t.minFilter:n.V,f.anisotropy=void 0!==t.anisotropy?t.anisotropy:1,void 0!==t.format&&(f.format=t.format),void 0!==t.type&&(f.type=t.type),void 0!==t.mipmaps&&(f.mipmaps=t.mipmaps,f.minFilter=n.Y),1===t.mipmapCount&&(f.minFilter=n.V),f.needsUpdate=!0,r&&r(f,t))}),t,o),f}})},207:function(e,r,t){"use strict";t.d(r,"a",(function(){return V}));var n={},a=void 0,i=n;function o(e,r){var t,n=e.split("."),o=i;!(n[0]in o)&&o.execScript&&o.execScript("var "+n[0]);for(;n.length&&(t=n.shift());)n.length||r===a?o=o[t]?o[t]:o[t]={}:o[t]=r}var s="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;function f(e){var r,t,n,a,i,o,f,h,l,c,u=e.length,v=0,p=Number.POSITIVE_INFINITY;for(h=0;h<u;++h)e[h]>v&&(v=e[h]),e[h]<p&&(p=e[h]);for(r=1<<v,t=new(s?Uint32Array:Array)(r),n=1,a=0,i=2;n<=v;){for(h=0;h<u;++h)if(e[h]===n){for(o=0,f=a,l=0;l<n;++l)o=o<<1|1&f,f>>=1;for(c=n<<16|h,l=o;l<r;l+=i)t[l]=c;++a}++n,a<<=1,i<<=1}return[t,v,p]}function h(e,r){switch(this.g=[],this.h=32768,this.d=this.f=this.a=this.l=0,this.input=s?new Uint8Array(e):e,this.m=!1,this.i=c,this.r=!1,!r&&(r={})||(r.index&&(this.a=r.index),r.bufferSize&&(this.h=r.bufferSize),r.bufferType&&(this.i=r.bufferType),r.resize&&(this.r=r.resize)),this.i){case l:this.b=32768,this.c=new(s?Uint8Array:Array)(32768+this.h+258);break;case c:this.b=0,this.c=new(s?Uint8Array:Array)(this.h),this.e=this.z,this.n=this.v,this.j=this.w;break;default:throw Error("invalid inflate mode")}}var l=0,c=1,u={t:l,s:c};h.prototype.k=function(){for(;!this.m;){var e=x(this,3);switch(1&e&&(this.m=!0),e>>>=1){case 0:var r=this.input,t=this.a,n=this.c,i=this.b,o=r.length,h=a,u=n.length,v=a;if(this.d=this.f=0,t+1>=o)throw Error("invalid uncompressed block header: LEN");if(h=r[t++]|r[t++]<<8,t+1>=o)throw Error("invalid uncompressed block header: NLEN");if(h===~(r[t++]|r[t++]<<8))throw Error("invalid uncompressed block header: length verify");if(t+h>r.length)throw Error("input buffer is broken");switch(this.i){case l:for(;i+h>n.length;){if(h-=v=u-i,s)n.set(r.subarray(t,t+v),i),i+=v,t+=v;else for(;v--;)n[i++]=r[t++];this.b=i,n=this.e(),i=this.b}break;case c:for(;i+h>n.length;)n=this.e({p:2});break;default:throw Error("invalid inflate mode")}if(s)n.set(r.subarray(t,t+h),i),i+=h,t+=h;else for(;h--;)n[i++]=r[t++];this.a=t,this.b=i,this.c=n;break;case 1:this.j(O,z);break;case 2:var p,w,y,b,g=x(this,5)+257,m=x(this,5)+1,A=x(this,4)+4,U=new(s?Uint8Array:Array)(d.length),S=a,E=a,M=a,k=a,I=a;for(I=0;I<A;++I)U[d[I]]=x(this,3);if(!s)for(I=A,A=U.length;I<A;++I)U[d[I]]=0;for(p=f(U),S=new(s?Uint8Array:Array)(g+m),I=0,b=g+m;I<b;)switch(E=R(this,p),E){case 16:for(k=3+x(this,2);k--;)S[I++]=M;break;case 17:for(k=3+x(this,3);k--;)S[I++]=0;M=0;break;case 18:for(k=11+x(this,7);k--;)S[I++]=0;M=0;break;default:M=S[I++]=E}w=f(s?S.subarray(0,g):S.slice(0,g)),y=f(s?S.subarray(g):S.slice(g)),this.j(w,y);break;default:throw Error("unknown BTYPE: "+e)}}return this.n()};var v,p,w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],d=s?new Uint16Array(w):w,y=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],b=s?new Uint16Array(y):y,g=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],m=s?new Uint8Array(g):g,A=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],U=s?new Uint16Array(A):A,S=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],E=s?new Uint8Array(S):S,M=new(s?Uint8Array:Array)(288);for(v=0,p=M.length;v<p;++v)M[v]=143>=v?8:255>=v?9:279>=v?7:8;var k,I,O=f(M),C=new(s?Uint8Array:Array)(30);for(k=0,I=C.length;k<I;++k)C[k]=5;var z=f(C);function x(e,r){for(var t,n=e.f,a=e.d,i=e.input,o=e.a,s=i.length;a<r;){if(o>=s)throw Error("input buffer is broken");n|=i[o++]<<a,a+=8}return t=n&(1<<r)-1,e.f=n>>>r,e.d=a-r,e.a=o,t}function R(e,r){for(var t,n,a=e.f,i=e.d,o=e.input,s=e.a,f=o.length,h=r[0],l=r[1];i<l&&!(s>=f);)a|=o[s++]<<i,i+=8;if((n=(t=h[a&(1<<l)-1])>>>16)>i)throw Error("invalid code length: "+n);return e.f=a>>n,e.d=i-n,e.a=s,65535&t}function P(e,r){var t,n;switch(this.input=e,this.a=0,!r&&(r={})||(r.index&&(this.a=r.index),r.verify&&(this.A=r.verify)),t=e[this.a++],n=e[this.a++],15&t){case N:this.method=N;break;default:throw Error("unsupported compression method")}if(0!=((t<<8)+n)%31)throw Error("invalid fcheck flag:"+((t<<8)+n)%31);if(32&n)throw Error("fdict flag is not supported");this.q=new h(e,{index:this.a,bufferSize:r.bufferSize,bufferType:r.bufferType,resize:r.resize})}h.prototype.j=function(e,r){var t=this.c,n=this.b;this.o=e;for(var a,i,o,s,f=t.length-258;256!==(a=R(this,e));)if(256>a)n>=f&&(this.b=n,t=this.e(),n=this.b),t[n++]=a;else for(s=b[i=a-257],0<m[i]&&(s+=x(this,m[i])),a=R(this,r),o=U[a],0<E[a]&&(o+=x(this,E[a])),n>=f&&(this.b=n,t=this.e(),n=this.b);s--;)t[n]=t[n++-o];for(;8<=this.d;)this.d-=8,this.a--;this.b=n},h.prototype.w=function(e,r){var t=this.c,n=this.b;this.o=e;for(var a,i,o,s,f=t.length;256!==(a=R(this,e));)if(256>a)n>=f&&(f=(t=this.e()).length),t[n++]=a;else for(s=b[i=a-257],0<m[i]&&(s+=x(this,m[i])),a=R(this,r),o=U[a],0<E[a]&&(o+=x(this,E[a])),n+s>f&&(f=(t=this.e()).length);s--;)t[n]=t[n++-o];for(;8<=this.d;)this.d-=8,this.a--;this.b=n},h.prototype.e=function(){var e,r,t=new(s?Uint8Array:Array)(this.b-32768),n=this.b-32768,a=this.c;if(s)t.set(a.subarray(32768,t.length));else for(e=0,r=t.length;e<r;++e)t[e]=a[e+32768];if(this.g.push(t),this.l+=t.length,s)a.set(a.subarray(n,n+32768));else for(e=0;32768>e;++e)a[e]=a[n+e];return this.b=32768,a},h.prototype.z=function(e){var r,t,n,a=this.input.length/this.a+1|0,i=this.input,o=this.c;return e&&("number"==typeof e.p&&(a=e.p),"number"==typeof e.u&&(a+=e.u)),2>a?t=(n=(i.length-this.a)/this.o[2]/2*258|0)<o.length?o.length+n:o.length<<1:t=o.length*a,s?(r=new Uint8Array(t)).set(o):r=o,this.c=r},h.prototype.n=function(){var e,r,t,n,a,i=0,o=this.c,f=this.g,h=new(s?Uint8Array:Array)(this.l+(this.b-32768));if(0===f.length)return s?this.c.subarray(32768,this.b):this.c.slice(32768,this.b);for(r=0,t=f.length;r<t;++r)for(n=0,a=(e=f[r]).length;n<a;++n)h[i++]=e[n];for(r=32768,t=this.b;r<t;++r)h[i++]=o[r];return this.g=[],this.buffer=h},h.prototype.v=function(){var e,r=this.b;return s?this.r?(e=new Uint8Array(r)).set(this.c.subarray(0,r)):e=this.c.subarray(0,r):(this.c.length>r&&(this.c.length=r),e=this.c),this.buffer=e},P.prototype.k=function(){var e,r,t=this.input;if(e=this.q.k(),this.a=this.q.a,this.A){r=(t[this.a++]<<24|t[this.a++]<<16|t[this.a++]<<8|t[this.a++])>>>0;var n=e;if("string"==typeof n){var a,i,o=n.split("");for(a=0,i=o.length;a<i;a++)o[a]=(255&o[a].charCodeAt(0))>>>0;n=o}for(var s,f=1,h=0,l=n.length,c=0;0<l;){l-=s=1024<l?1024:l;do{h+=f+=n[c++]}while(--s);f%=65521,h%=65521}if(r!==(h<<16|f)>>>0)throw Error("invalid adler-32 checksum")}return e};var N=8;o("Zlib.Inflate",P),o("Zlib.Inflate.prototype.decompress",P.prototype.k);var T,D,_,F,L={ADAPTIVE:u.s,BLOCK:u.t};if(Object.keys)T=Object.keys(L);else for(D in T=[],_=0,L)T[_++]=D;for(_=0,F=T.length;_<F;++_)o("Zlib.Inflate.BufferType."+(D=T[_]),L[D]);var V=n.Zlib.Inflate},215:function(e,r,t){"use strict";t.r(r),t.d(r,"EXRLoader",(function(){return s}));var n=t(206),a=t(107),i=t(0),o=t(207),s=function(e){n.a.call(this,e),this.type=i.G};s.prototype=Object.assign(Object.create(n.a.prototype),{constructor:s,parse:function(e){const r=65536,t=14,n=65537,s=16384,f=Math.pow(2.7182818,2.2);var h=new DataView(new ArrayBuffer(8));function l(e){if(0===e)return[e,0];h.setFloat64(0,e);var r=h.getUint32(0)>>>20&2047;0===r&&(h.setFloat64(0,e*Math.pow(2,64)),r=(h.getUint32(0)>>>20&2047)-64);var t=r-1022;return[function(e,r){for(var t=Math.min(3,Math.ceil(Math.abs(r)/1023)),n=e,a=0;a<t;a++)n*=Math.pow(2,Math.floor((r+a)/t));return n}(e,-t),t]}const c={l:0,c:0,lc:0};function u(e,r,t,n,a){for(;t<e;)r=r<<8|j(n,a),t+=8;t-=e,c.l=r>>t&(1<<e)-1,c.c=r,c.lc=t}const v=new Array(59);function p(e,r,t,a,i,o,s){for(var f=t,h=0,l=0;i<=o;i++){if(f.value-t.value>a)return!1;u(6,h,l,e,f);var p=c.l;if(h=c.c,l=c.lc,s[i]=p,63==p){if(f.value-t.value>a)throw"Something wrong with hufUnpackEncTable";u(8,h,l,e,f);var w=c.l+6;if(h=c.c,l=c.lc,i+w>o+1)throw"Something wrong with hufUnpackEncTable";for(;w--;)s[i++]=0;i--}else if(p>=59){if(i+(w=p-59+2)>o+1)throw"Something wrong with hufUnpackEncTable";for(;w--;)s[i++]=0;i--}}!function(e){for(var r=0;r<=58;++r)v[r]=0;for(r=0;r<n;++r)v[e[r]]+=1;var t=0;for(r=58;r>0;--r){var a=t+v[r]>>1;v[r]=t,t=a}for(r=0;r<n;++r){var i=e[r];i>0&&(e[r]=i|v[i]++<<6)}}(s)}function w(e){return 63&e}function d(e){return e>>6}const y={c:0,lc:0};function b(e,r,t,n){e=e<<8|j(t,n),r+=8,y.c=e,y.lc=r}const g={c:0,lc:0};function m(e,r,t,n,a,i,o,s,f,h){if(e==r){n<8&&(b(t,n,a,o),t=y.c,n=y.lc);var l=t>>(n-=8);l=new Uint8Array([l])[0];if(f.value+l>h)return!1;for(var c=s[f.value-1];l-- >0;)s[f.value++]=c}else{if(!(f.value<h))return!1;s[f.value++]=e}g.c=t,g.lc=n}function A(e){return 65535&e}function U(e){var r=A(e);return r>32767?r-65536:r}const S={a:0,b:0};function E(e,r){var t=U(e),n=U(r),a=t+(1&n)+(n>>1),i=a,o=a-n;S.a=i,S.b=o}function M(e,r){var t=A(e),n=A(r),a=t-(n>>1)&65535,i=n+a-32768&65535;S.a=i,S.b=a}function k(e,r,t,n,a,i,o){for(var s,f=o<16384,h=t>a?a:t,l=1;l<=h;)l<<=1;for(s=l>>=1,l>>=1;l>=1;){for(var c,u,v,p,w=0,d=w+i*(a-s),y=i*l,b=i*s,g=n*l,m=n*s;w<=d;w+=b){for(var A=w,U=w+n*(t-s);A<=U;A+=m){var k=A+g,I=(O=A+y)+g;f?(E(e[A+r],e[O+r]),c=S.a,v=S.b,E(e[k+r],e[I+r]),u=S.a,p=S.b,E(c,u),e[A+r]=S.a,e[k+r]=S.b,E(v,p),e[O+r]=S.a,e[I+r]=S.b):(M(e[A+r],e[O+r]),c=S.a,v=S.b,M(e[k+r],e[I+r]),u=S.a,p=S.b,M(c,u),e[A+r]=S.a,e[k+r]=S.b,M(v,p),e[O+r]=S.a,e[I+r]=S.b)}if(t&l){var O=A+y;f?E(e[A+r],e[O+r]):M(e[A+r],e[O+r]),c=S.a,e[O+r]=S.b,e[A+r]=c}}if(a&l)for(A=w,U=w+n*(t-s);A<=U;A+=m){k=A+g;f?E(e[A+r],e[k+r]):M(e[A+r],e[k+r]),c=S.a,e[k+r]=S.b,e[A+r]=c}s=l,l>>=1}return w}function I(e,r,a,i,o,f){var h=a.value,l=X(r,a),c=X(r,a);a.value+=4;var u=X(r,a);if(a.value+=4,l<0||l>=n||c<0||c>=n)throw"Something wrong with HUF_ENCSIZE";var v=new Array(n),A=new Array(s);if(function(e){for(var r=0;r<s;r++)e[r]={},e[r].len=0,e[r].lit=0,e[r].p=null}(A),p(e,0,a,i-(a.value-h),l,c,v),u>8*(i-(a.value-h)))throw"Something wrong with hufUncompress";!function(e,r,n,a){for(;r<=n;r++){var i=d(e[r]),o=w(e[r]);if(i>>o)throw"Invalid table entry";if(o>t){if((l=a[i>>o-t]).len)throw"Invalid table entry";if(l.lit++,l.p){var s=l.p;l.p=new Array(l.lit);for(var f=0;f<l.lit-1;++f)l.p[f]=s[f]}else l.p=new Array(1);l.p[l.lit-1]=r}else if(o){var h=0;for(f=1<<t-o;f>0;f--){var l;if((l=a[(i<<t-o)+h]).len||l.p)throw"Invalid table entry";l.len=o,l.lit=r,h++}}}}(v,l,c,A),function(e,r,n,a,i,o,s,f,h,l){for(var c=0,u=0,v=f,p=Math.trunc(i.value+(o+7)/8);i.value<p;)for(b(c,u,n,i),c=y.c,u=y.lc;u>=t;)if((E=r[c>>u-t&16383]).len)u-=E.len,m(E.lit,s,c,u,n,0,i,h,l,v),c=g.c,u=g.lc;else{if(!E.p)throw"hufDecode issues";var A;for(A=0;A<E.lit;A++){for(var U=w(e[E.p[A]]);u<U&&i.value<p;)b(c,u,n,i),c=y.c,u=y.lc;if(u>=U&&d(e[E.p[A]])==(c>>u-U&(1<<U)-1)){u-=U,m(E.p[A],s,c,u,n,0,i,h,l,v),c=g.c,u=g.lc;break}}if(A==E.lit)throw"hufDecode issues"}var S=8-o&7;for(c>>=S,u-=S;u>0;){var E;if(!(E=r[c<<t-u&16383]).len)throw"hufDecode issues";u-=E.len,m(E.lit,s,c,u,n,0,i,h,l,v),c=g.c,u=g.lc}}(v,A,e,0,a,u,c,f,o,{value:0})}function O(e){for(var r=1;r<e.length;r++){var t=e[r-1]+e[r]-128;e[r]=t}}function C(e,r){for(var t=0,n=Math.floor((e.length+1)/2),a=0,i=e.length-1;!(a>i||(r[a++]=e[t++],a>i));)r[a++]=e[n++]}function z(e){for(var r=e.byteLength,t=new Array,n=0,a=new DataView(e);r>0;){var i=a.getInt8(n++);if(i<0){r-=(s=-i)+1;for(var o=0;o<s;o++)t.push(a.getUint8(n++))}else{var s=i;r-=2;var f=a.getUint8(n++);for(o=0;o<s+1;o++)t.push(f)}}return t}function x(e,r,t){for(var n,a=1;a<64;)65280==(n=r[e.value])?a=64:n>>8==255?a+=255&n:(t[a]=n,a++),e.value++}function R(e,r){r[0]=H(e[0]),r[1]=H(e[1]),r[2]=H(e[5]),r[3]=H(e[6]),r[4]=H(e[14]),r[5]=H(e[15]),r[6]=H(e[27]),r[7]=H(e[28]),r[8]=H(e[2]),r[9]=H(e[4]),r[10]=H(e[7]),r[11]=H(e[13]),r[12]=H(e[16]),r[13]=H(e[26]),r[14]=H(e[29]),r[15]=H(e[42]),r[16]=H(e[3]),r[17]=H(e[8]),r[18]=H(e[12]),r[19]=H(e[17]),r[20]=H(e[25]),r[21]=H(e[30]),r[22]=H(e[41]),r[23]=H(e[43]),r[24]=H(e[9]),r[25]=H(e[11]),r[26]=H(e[18]),r[27]=H(e[24]),r[28]=H(e[31]),r[29]=H(e[40]),r[30]=H(e[44]),r[31]=H(e[53]),r[32]=H(e[10]),r[33]=H(e[19]),r[34]=H(e[23]),r[35]=H(e[32]),r[36]=H(e[39]),r[37]=H(e[45]),r[38]=H(e[52]),r[39]=H(e[54]),r[40]=H(e[20]),r[41]=H(e[22]),r[42]=H(e[33]),r[43]=H(e[38]),r[44]=H(e[46]),r[45]=H(e[51]),r[46]=H(e[55]),r[47]=H(e[60]),r[48]=H(e[21]),r[49]=H(e[34]),r[50]=H(e[37]),r[51]=H(e[47]),r[52]=H(e[50]),r[53]=H(e[56]),r[54]=H(e[59]),r[55]=H(e[61]),r[56]=H(e[35]),r[57]=H(e[36]),r[58]=H(e[48]),r[59]=H(e[49]),r[60]=H(e[57]),r[61]=H(e[58]),r[62]=H(e[62]),r[63]=H(e[63])}function P(e){const r=.5*Math.cos(.7853975),t=.5*Math.cos(3.14159/16),n=.5*Math.cos(3.14159/8),a=.5*Math.cos(3*3.14159/16),i=.5*Math.cos(.981746875),o=.5*Math.cos(3*3.14159/8),s=.5*Math.cos(1.374445625);for(var f=new Array(4),h=new Array(4),l=new Array(4),c=new Array(4),u=0;u<8;++u){var v=8*u;f[0]=n*e[v+2],f[1]=o*e[v+2],f[2]=n*e[v+6],f[3]=o*e[v+6],h[0]=t*e[v+1]+a*e[v+3]+i*e[v+5]+s*e[v+7],h[1]=a*e[v+1]-s*e[v+3]-t*e[v+5]-i*e[v+7],h[2]=i*e[v+1]-t*e[v+3]+s*e[v+5]+a*e[v+7],h[3]=s*e[v+1]-i*e[v+3]+a*e[v+5]-t*e[v+7],l[0]=r*(e[v+0]+e[v+4]),l[3]=r*(e[v+0]-e[v+4]),l[1]=f[0]+f[3],l[2]=f[1]-f[2],c[0]=l[0]+l[1],c[1]=l[3]+l[2],c[2]=l[3]-l[2],c[3]=l[0]-l[1],e[v+0]=c[0]+h[0],e[v+1]=c[1]+h[1],e[v+2]=c[2]+h[2],e[v+3]=c[3]+h[3],e[v+4]=c[3]-h[3],e[v+5]=c[2]-h[2],e[v+6]=c[1]-h[1],e[v+7]=c[0]-h[0]}for(var p=0;p<8;++p)f[0]=n*e[16+p],f[1]=o*e[16+p],f[2]=n*e[48+p],f[3]=o*e[48+p],h[0]=t*e[8+p]+a*e[24+p]+i*e[40+p]+s*e[56+p],h[1]=a*e[8+p]-s*e[24+p]-t*e[40+p]-i*e[56+p],h[2]=i*e[8+p]-t*e[24+p]+s*e[40+p]+a*e[56+p],h[3]=s*e[8+p]-i*e[24+p]+a*e[40+p]-t*e[56+p],l[0]=r*(e[p]+e[32+p]),l[3]=r*(e[p]-e[32+p]),l[1]=f[0]+f[3],l[2]=f[1]-f[2],c[0]=l[0]+l[1],c[1]=l[3]+l[2],c[2]=l[3]-l[2],c[3]=l[0]-l[1],e[0+p]=c[0]+h[0],e[8+p]=c[1]+h[1],e[16+p]=c[2]+h[2],e[24+p]=c[3]+h[3],e[32+p]=c[3]-h[3],e[40+p]=c[2]-h[2],e[48+p]=c[1]-h[1],e[56+p]=c[0]-h[0]}function N(e){for(var r=0;r<64;++r){var t=e[0][r],n=e[1][r],a=e[2][r];e[0][r]=t+1.5747*a,e[1][r]=t-.1873*n-.4682*a,e[2][r]=t+1.8556*n}}function T(e,r,t){for(var n=0;n<64;++n)r[t+n]=a.a.toHalfFloat(D(e[n]))}function D(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(f,Math.abs(e)-1)}function _(e){var r=e.array.slice(e.offset.value,e.offset.value+e.size);void 0===o.a&&console.error("THREE.EXRLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");var t=new o.a(r,{resize:!0,verify:!0}),n=new Uint8Array(t.decompress().buffer),a=new Uint8Array(n.length);return O(n),C(n,a),new DataView(a.buffer)}function F(e){var r=e.viewer,t={value:e.offset.value},n=new Uint8Array(e.width*e.lines*($.channels.length*e.type*2)),a={version:B(r,t),unknownUncompressedSize:B(r,t),unknownCompressedSize:B(r,t),acCompressedSize:B(r,t),dcCompressedSize:B(r,t),rleCompressedSize:B(r,t),rleUncompressedSize:B(r,t),rleRawSize:B(r,t),totalAcUncompressedCount:B(r,t),totalDcUncompressedCount:B(r,t),acCompression:B(r,t)};if(a.version<2)throw"EXRLoader.parse: "+$.compression+" version "+a.version+" is unsupported";for(var i=new Array,s=q(r,t)-2;s>0;){var f=L(r.buffer,t),h=Y(r,t),l=h>>2&3,c=new Int8Array([(h>>4)-1])[0],u=Y(r,t);i.push({name:f,index:c,type:u,compression:l}),s-=f.length+3}for(var v=$.channels,p=new Array(e.channels),w=0;w<e.channels;++w){var d=p[w]={},y=v[w];d.name=y.name,d.compression=0,d.decoded=!1,d.type=y.pixelType,d.pLinear=y.pLinear,d.width=e.width,d.height=e.lines}for(var b={idx:new Array(3)},g=0;g<e.channels;++g)for(d=p[g],w=0;w<i.length;++w){var m=i[w];d.name==m.name&&(d.compression=m.compression,m.index>=0&&(b.idx[m.index]=g),d.offset=g)}if(a.acCompressedSize>0)switch(a.acCompression){case 0:var A=new Uint16Array(a.totalAcUncompressedCount);I(e.array,r,t,a.acCompressedSize,A,a.totalAcUncompressedCount);break;case 1:var U=e.array.slice(t.value,t.value+a.totalAcUncompressedCount),S=new o.a(U,{resize:!0,verify:!0});A=new Uint16Array(S.decompress().buffer);t.value+=a.totalAcUncompressedCount}if(a.dcCompressedSize>0){var E={array:e.array,offset:t,size:a.dcCompressedSize},M=new Uint16Array(_(E).buffer);t.value+=a.dcCompressedSize}if(a.rleRawSize>0){U=e.array.slice(t.value,t.value+a.rleCompressedSize);var k=z((S=new o.a(U,{resize:!0,verify:!0})).decompress().buffer);t.value+=a.rleCompressedSize}var O=0,C=new Array(p.length);for(w=0;w<C.length;++w)C[w]=new Array;for(var D=0;D<e.lines;++D)for(var F=0;F<p.length;++F)C[F].push(O),O+=p[F].width*e.type*2;!function(e,r,t,n,a,i){var o=new DataView(i.buffer),s=t[e.idx[0]].width,f=t[e.idx[0]].height,h=Math.floor(s/8),l=Math.ceil(s/8),c=Math.ceil(f/8),u=s-8*(l-1),v=f-8*(c-1),p={value:0},w=new Array(3),d=new Array(3),y=new Array(3),b=new Array(3),g=new Array(3);for(let t=0;t<3;++t)g[t]=r[e.idx[t]],w[t]=t<1?0:w[t-1]+l*c,d[t]=new Float32Array(64),y[t]=new Uint16Array(64),b[t]=new Uint16Array(64*l);for(let r=0;r<c;++r){var m=8;r==c-1&&(m=v);var A=8;for(let e=0;e<l;++e){e==l-1&&(A=u);for(let e=0;e<3;++e)y[e].fill(0),y[e][0]=a[w[e]++],x(p,n,y[e]),R(y[e],d[e]),P(d[e]);N(d);for(let r=0;r<3;++r)T(d[r],b[r],64*e)}let i=0;for(let n=0;n<3;++n){const a=t[e.idx[n]].type;for(let e=8*r;e<8*r+m;++e){i=g[n][e];for(let r=0;r<h;++r){const t=64*r+8*(7&e);o.setUint16(i+0*a,b[n][t+0],!0),o.setUint16(i+2*a,b[n][t+1],!0),o.setUint16(i+4*a,b[n][t+2],!0),o.setUint16(i+6*a,b[n][t+3],!0),o.setUint16(i+8*a,b[n][t+4],!0),o.setUint16(i+10*a,b[n][t+5],!0),o.setUint16(i+12*a,b[n][t+6],!0),o.setUint16(i+14*a,b[n][t+7],!0),i+=16*a}}if(h!=l)for(let e=8*r;e<8*r+m;++e){const r=g[n][e]+8*h*2*a,t=64*h+8*(7&e);for(let e=0;e<A;++e)o.setUint16(r+2*e*a,b[n][t+e],!0)}}}for(var U=new Uint16Array(s),S=(o=new DataView(i.buffer),0);S<3;++S){t[e.idx[S]].decoded=!0;var E=t[e.idx[S]].type;if(2==t[S].type)for(var M=0;M<f;++M){const e=g[S][M];for(var k=0;k<s;++k)U[k]=o.getUint16(e+2*k*E,!0);for(k=0;k<s;++k)o.setFloat32(e+2*k*E,H(U[k]),!0)}}}(b,C,p,A,M,n);for(w=0;w<p.length;++w){if(!(d=p[w]).decoded)switch(d.compression){case 2:var V=0,Z=0;for(D=0;D<e.lines;++D){for(var X=C[w][V],j=0;j<d.width;++j){for(var W=0;W<2*d.type;++W)n[X++]=k[Z+W*d.width*d.height];Z++}V++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(n.buffer)}function L(e,r){for(var t=new Uint8Array(e),n=0;0!=t[r.value+n];)n+=1;var a=(new TextDecoder).decode(t.slice(r.value,r.value+n));return r.value=r.value+n+1,a}function V(e,r){var t=e.getUint32(0,!0);return r.value=r.value+8,t}function Z(e,r){var t=e.getInt32(r.value,!0);return r.value=r.value+4,t}function X(e,r){var t=e.getUint32(r.value,!0);return r.value=r.value+4,t}function j(e,r){var t=e[r.value];return r.value=r.value+1,t}function Y(e,r){var t=e.getUint8(r.value);return r.value=r.value+1,t}function B(e,r){var t=Number(e.getBigInt64(r.value,!0));return r.value+=8,t}function W(e,r){var t=e.getFloat32(r.value,!0);return r.value+=4,t}function H(e){var r=(31744&e)>>10,t=1023&e;return(e>>15?-1:1)*(r?31===r?t?NaN:1/0:Math.pow(2,r-15)*(1+t/1024):t/1024*6103515625e-14)}function q(e,r){var t=e.getUint16(r.value,!0);return r.value+=2,t}function G(e,r,t,n,a){return"string"===n||"stringvector"===n||"iccProfile"===n?function(e,r,t){var n=(new TextDecoder).decode(new Uint8Array(e).slice(r.value,r.value+t));return r.value=r.value+t,n}(r,t,a):"chlist"===n?function(e,r,t,n){for(var a=t.value,i=[];t.value<a+n-1;){var o=L(r,t),s=Z(e,t),f=Y(e,t);t.value+=3;var h=Z(e,t),l=Z(e,t);i.push({name:o,pixelType:s,pLinear:f,xSampling:h,ySampling:l})}return t.value+=1,i}(e,r,t,a):"chromaticities"===n?function(e,r){return{redX:W(e,r),redY:W(e,r),greenX:W(e,r),greenY:W(e,r),blueX:W(e,r),blueY:W(e,r),whiteX:W(e,r),whiteY:W(e,r)}}(e,t):"compression"===n?function(e,r){return["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"][Y(e,r)]}(e,t):"box2i"===n?function(e,r){return{xMin:X(e,r),yMin:X(e,r),xMax:X(e,r),yMax:X(e,r)}}(e,t):"lineOrder"===n?function(e,r){return["INCREASING_Y"][Y(e,r)]}(e,t):"float"===n?W(e,t):"v2f"===n?function(e,r){return[W(e,r),W(e,r)]}(e,t):"v3f"===n?function(e,r){return[W(e,r),W(e,r),W(e,r)]}(e,t):"int"===n?Z(e,t):"rational"===n?function(e,r){return[Z(e,r),X(e,r)]}(e,t):"timecode"===n?function(e,r){return[X(e,r),X(e,r)]}(e,t):"preview"===n?(t.value+=a,"skipped"):void(t.value+=a)}var J=new DataView(e),K=new Uint8Array(e),$={};J.getUint32(0,!0),J.getUint8(4,!0),J.getUint8(5,!0);for(var Q={value:8},ee=!0;ee;){var re=L(e,Q);if(0==re)ee=!1;else{var te=L(e,Q),ne=G(J,e,Q,te,X(J,Q));void 0===ne?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${te}'.`):$[re]=ne}}var ae,ie,oe,se,fe=$.dataWindow.yMax+1;switch($.compression){case"NO_COMPRESSION":ie=1,ae=function(e){return new DataView(e.array.buffer,e.offset.value,e.size)};break;case"RLE_COMPRESSION":ie=1,ae=function(e){var r=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),t=new Uint8Array(z(r)),n=new Uint8Array(t.length);return O(t),C(t,n),new DataView(n.buffer)};break;case"ZIPS_COMPRESSION":ie=1,ae=_;break;case"ZIP_COMPRESSION":ie=16,ae=_;break;case"PIZ_COMPRESSION":ie=32,ae=function(e){for(var t=e.viewer,n={value:e.offset.value},a=e.width*ie*($.channels.length*e.type),i=new Uint16Array(a),o=new Uint8Array(8192),s=0,f=new Array(e.channels),h=0;h<e.channels;h++)f[h]={},f[h].start=s,f[h].end=f[h].start,f[h].nx=e.width,f[h].ny=e.lines,f[h].size=e.type,s+=f[h].nx*f[h].ny*f[h].size;var l=q(t,n),c=q(t,n);if(c>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(l<=c)for(h=0;h<c-l+1;h++)o[h+l]=Y(t,n);var u=new Uint16Array(r),v=function(e,t){for(var n=0,a=0;a<r;++a)(0==a||e[a>>3]&1<<(7&a))&&(t[n++]=a);for(var i=n-1;n<r;)t[n++]=0;return i}(o,u),p=X(t,n);for(I(e.array,t,n,p,i,s),h=0;h<e.channels;++h)for(var w=f[h],d=0;d<f[h].size;++d)k(i,w.start+d,w.nx,w.size,w.ny,w.nx*w.size,v);!function(e,r,t){for(var n=0;n<t;++n)r[n]=e[r[n]]}(u,i,s);for(var y=0,b=new Uint8Array(i.buffer.byteLength),g=0;g<e.lines;g++)for(var m=0;m<e.channels;m++){var A=(w=f[m]).nx*w.size,U=new Uint8Array(i.buffer,2*w.end,2*A);b.set(U,y),y+=2*A,w.end+=A}return new DataView(b.buffer)};break;case"PXR24_COMPRESSION":ie=16,ae=function(e){var r=e.array.slice(e.offset.value,e.offset.value+e.size);void 0===o.a&&console.error("THREE.EXRLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js");const t=new o.a(r,{resize:!0,verify:!0}),n=new Uint8Array(t.decompress().buffer),a=e.lines*e.channels*e.width,i=1==e.type?new Uint16Array(a):new Uint32Array(a);let s=0,f=0;const h=new Array(4);for(let r=0;r<e.lines;r++)for(let r=0;r<e.channels;r++){let r=0;switch(e.type){case 1:h[0]=s,h[1]=h[0]+e.width,s=h[1]+e.width;for(let t=0;t<e.width;++t)r+=n[h[0]++]<<8|n[h[1]++],i[f]=r,f++;break;case 2:h[0]=s,h[1]=h[0]+e.width,h[2]=h[1]+e.width,s=h[2]+e.width;for(let t=0;t<e.width;++t)r+=n[h[0]++]<<24|n[h[1]++]<<16|n[h[2]++]<<8,i[f]=r,f++}}return new DataView(i.buffer)};break;case"DWAA_COMPRESSION":ie=32,ae=F;break;case"DWAB_COMPRESSION":ie=256,ae=F;break;default:throw"EXRLoader.parse: "+$.compression+" is unsupported"}var he=$.channels[0].pixelType;if(1===he)switch(this.type){case i.Zc:case i.G:se=function(e,r){return H(q(e,r))},oe=2;break;case i.M:se=q,oe=2}else{if(2!==he)throw"EXRLoader.parse: unsupported pixelType "+he+" for "+$.compression+".";switch(this.type){case i.Zc:case i.G:se=W,oe=4;break;case i.M:se=function(e,r){return a.a.toHalfFloat(W(e,r))},oe=4}}for(var le=fe/ie,ce=0;ce<le;ce++)V(J,Q);var ue=$.dataWindow.xMax-$.dataWindow.xMin+1,ve=$.dataWindow.yMax-$.dataWindow.yMin+1,pe=ue*ve*4;switch(this.type){case i.Zc:case i.G:var we=new Float32Array(pe);$.channels.length<4&&we.fill(1,0,pe);break;case i.M:we=new Uint16Array(pe);$.channels.length<4&&we.fill(15360,0,pe);break;default:console.error("THREE.EXRLoader: unsupported type: ",this.type)}for(var de,ye,be={R:0,G:1,B:2,A:3},ge={size:0,width:ue,lines:ie,offset:Q,array:K,viewer:J,type:he,channels:$.channels.length},me={value:0},Ae=0;Ae<ve/ie;Ae++){de=X(J,Q),pe=X(J,Q),ge.lines=de+ie>ve?ve-de:ie,ge.offset=Q,ge.size=pe,ye=ae(ge),Q.value+=pe;for(var Ue=0;Ue<ie;Ue++){var Se=Ue+Ae*ie;if(Se>=ve)break;for(var Ee=0;Ee<$.channels.length;Ee++)for(var Me=be[$.channels[Ee].name],ke=0;ke<ue;ke++){var Ie=Ue*($.channels.length*ue)+Ee*ue+ke;me.value=Ie*oe;var Oe=se(ye,me);we[4*ue*(ve-1-Se)+4*ke+Me]=Oe}}}if(this.type===i.Zc){let e,r;const t=we.length,n=new Uint8Array(t);for(let t=0;t<ve;++t)for(let a=0;a<ue;++a){r=t*ue*4+4*a;const i=we[r],o=we[r+1],s=we[r+2];if(e=i>o?i:o,e=s>e?s:e,e<1e-32)n[r]=n[r+1]=n[r+2]=n[r+3]=0;else{const t=l(e);e=256*t[0]/e,n[r]=i*e,n[r+1]=o*e,n[r+2]=s*e,n[r+3]=t[1]+128}}we=n}const Ce=this.type===i.Zc?i.hc:i.Ib;return{header:$,width:ue,height:ve,data:we,format:Ce,type:this.type}},setDataType:function(e){return this.type=e,this},load:function(e,r,t,a){return n.a.prototype.load.call(this,e,(function(e,t){switch(e.type){case i.Zc:e.encoding=i.gc,e.minFilter=i.ob,e.magFilter=i.ob,e.generateMipmaps=!1,e.flipY=!1;break;case i.G:case i.M:e.encoding=i.U,e.minFilter=i.V,e.magFilter=i.V,e.generateMipmaps=!1,e.flipY=!1}r&&r(e,t)}),t,a)}})}}]); //# sourceMappingURL=1.js.map