phantasmal-world/8.22493337da1c37994b30.js

1 line
374 KiB
JavaScript
Raw Normal View History

2020-01-29 20:34:43 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{456:function(e,t,i){"use strict";var o;i.d(t,"a",(function(){return o})),function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"}(o||(o={}))},457:function(e,t,i){"use strict";function o(e,t){return{success:!0,value:e,problems:null!=t?t:[]}}function s(e){return{success:!1,problems:null!=e?e:[]}}function n(e){if(e.success)return e.value;throw new Error(e.problems.join("\n"))}function r(e){return new a(e)}i.d(t,"c",(function(){return o})),i.d(t,"a",(function(){return s})),i.d(t,"d",(function(){return n})),i.d(t,"b",(function(){return r}));class a{constructor(e){this.logger=e,this.problems=[]}add_problem(e,t,i,o){return this.logger.log(e,i,o),this.problems.push({severity:e,ui_message:t}),this}add_result(e){return this.problems.push(...e.problems),this}success(e){return o(e,this.problems)}failure(){return s(this.problems)}}},458:function(e,t,i){"use strict";i.d(t,"b",(function(){return s})),i.d(t,"e",(function(){return n})),i.d(t,"c",(function(){return r})),i.d(t,"a",(function(){return d})),i.d(t,"d",(function(){return c}));var o=i(38);class s{constructor(e,t){this.x=e,this.y=t}get u(){return this.x}get v(){return this.y}}function n(e,t){return new s(e.x-t.x,e.y-t.y)}class r{constructor(e,t,i){this.x=e,this.y=t,this.z=i}}class a{constructor(e){this.data=e,Object(o.d)(9===e.length,"data should be of length 9.")}static of(e,t,i,o,s,n,r,d,c){return new a(new Float32Array([e,o,r,t,s,d,i,n,c]))}static identity(){return a.of(1,0,0,0,1,0,0,0,1)}get(e,t){return this.data[e+3*t]}set(e,t,i){this.data[e+3*t]=i}clone(){return new a(new Float32Array(this.data))}transpose(){let e;const t=this.data;e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e}inverse(){const e=this.clone();return e.invert(),e}invert(){const e=this.data[0],t=this.data[1],i=this.data[2],o=this.data[3],s=this.data[4],n=this.data[5],r=this.data[6],a=this.data[7],d=this.data[8],c=d*s-n*a,l=n*r-d*o,_=a*o-s*r,u=e*c+t*l+i*_;if(0===u)return this.data[0]=1,this.data[1]=0,this.data[2]=0,this.data[3]=0,this.data[4]=1,this.data[5]=0,this.data[6]=0,this.data[7]=0,void(this.data[8]=1);const h=1/u;this.data[0]=c*h,this.data[1]=(i*a-d*t)*h,this.data[2]=(n*t-i*s)*h,this.data[3]=l*h,this.data[4]=(d*e-i*r)*h,this.data[5]=(i*o-n*e)*h,this.data[6]=_*h,this.data[7]=(t*r-a*e)*h,this.data[8]=(s*e-t*o)*h}}class d{constructor(e){this.data=e,Object(o.d)(16===e.length,"data should be of length 16.")}static of(e,t,i,o,s,n,r,a,c,l,_,u,h,v,p,g){return new d(new Float32Array([e,s,c,h,t,n,l,v,i,r,_,p,o,a,u,g]))}static identity(){return d.of(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)}static translation(e,t,i){return d.of(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1)}static scale(e,t,i){return d.of(e,0,0,1,0,t,0,1,0,0,i,1,0,0,0,1)}static compose(e,t,i){const o=t.w,s=t.x,n=t.y,r=t.z,a=s+s,c=n+n,l=r+r,_=s*a,u=s*c,h=s*l,v=n*c,p=n*l,g=r*l,b=o*a,f=o*c,m=o*l,w=i.x,k=i.y,y=i.z;return d.of((1-(v+g))*w,(u-m)*k,(h+f)*y,e.x,(u+m)*w,(1-(_+g))*k,(p-b)*y,e.y,(h-f)*w,(p+b)*k,(1-(_+v))*y,e.z,0,0,0,1)}get(e,t){return this.data[e+4*t]}set(e,t,i){this.data[e+4*t]=i}clone(){return new d(new Float32Array(this.data))}normal_mat3(){const e=a.of(this.data[0],this.data[4],this.data[8],this.data[1],this.data[5],this.data[9],this.data[2],this.data[6],this.data[10]);return e.invert(),e.transpose(),e}}function c(e,t){const i=new d(new Float32Array(16));return l(i.data,e,t),i}function l(e,t,i){for(let o=0;o<4;o++)for(let s=0;s<4;s++)for(let n=0;n<4;n++)e[o+4*s]+=t.data[o+4*n]*i.data[n+4*s]}},466:function(e,t,i){"use strict";i.d(t,"a",(function(){return s}));var o=i(486);class s extends o.a{constructor(e,t,i=0,o=e.byteLength-i){super(t,i),this._size=o,this.backing_buffer=e,this.dv=new DataView(e,0,e.byteLength)}get size(){return this._size}set size(e){if(e>this.backing_buffer.byteLength-this.offset)throw new Error(`Size ${e} is out of bounds.`);this._size=e}take(e){const t=this.offset+this.position,i=new s(this.backing_buffer,this.endianness,t,e);return this._position+=e,i}}},480:function(e,t,i){"use strict";i.d(t,"a",(function(){return a})),i.d(t,"b",(function(){return d}));var o=i