phantasmal-world/8.b3bba6a68471f1f4a88f.js

1 line
377 KiB
JavaScript
Raw Normal View History

2020-04-26 04:20:20 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{455: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)}}},459: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={}))},463:function(e,t,i){"use strict";i.d(t,"b",(function(){return s})),i.d(t,"g",(function(){return n})),i.d(t,"c",(function(){return r})),i.d(t,"j",(function(){return a})),i.d(t,"h",(function(){return d})),i.d(t,"i",(function(){return c})),i.d(t,"d",(function(){return _})),i.d(t,"a",(function(){return u})),i.d(t,"e",(function(){return h})),i.d(t,"f",(function(){return p}));var o=i(40);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}magnitude(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}normalize(){const e=1/this.magnitude();this.x*=e,this.y*=e,this.z*=e}}function a(e,t){return new r(e.x-t.x,e.y-t.y,e.z-t.z)}function d(e,t){return new r(e.y*t.z-e.z*t.y,e.z*t.x-e.x*t.z,e.x*t.y-e.y*t.x)}function c(e,t){return e.x*t.x+e.y*t.y+e.z*t.z}class l{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,a,d){return new l(new Float32Array([e,o,r,t,s,a,i,n,d]))}static identity(){return l.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 l(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}}function _(e,t,i){const o=e.get(0,0)*t.x+e.get(0,1)*t.y+e.get(0,2)*t.z,s=e.get(1,0)*t.x+e.get(1,1)*t.y+e.get(1,2)*t.z,n=e.get(2,0)*t.x+e.get(2,1)*t.y+e.get(2,2)*t.z;i.x=o,i.y=s,i.z=n}class u{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,d,c,l,_,h,v,p,g){return new u(new Float32Array([e,s,d,h,t,n,c,v,i,r,l,p,o,a,_,g]))}static identity(){return u.of(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)}static translation(e,t,i){return u.of(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1)}static scale(e,t,i){return u.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,d=n+n,c=r+r,l=s*a,_=s*d,h=s*c,v=n*d,p=n*c,g=r*c,b=o*a,f=o*d,m=o*c,w=i.x,k=i.y,y=i.z;return u.of((1-(v+g))*w,(_-m)*k,(h+f)*y,e.x,(_+m)*w,(1-(l+g))*k,(p-b)*y,e.y,(h-f)*w,(p+b)*k,(1-(l+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}set_all(e,t,i,o,s,n,r,a,d,c,l,_,u,h,v,p){this.data[0]=e,this.data[1]=s,this.data[2]=d,this.data[3]=u,this.data[4]=t,this.data[5]=n,this.data[6]=c,this.data[7]=h,this.data[8]=i,this.data[9]=r,this.data[10]=l,this.data[11]=v,this.data[12]=o,this.data[13]=a,this.data[14]=_,this.data[15]=p}transpose(){let e;const t=this.data;e=t[1],t[1]=t[4],t[4]=e,e=t[2