var Si=(w,r,o)=>new Promise((a,v)=>{var h=U=>{try{D(o.next(U))}catch(V){v(V)}},b=U=>{try{D(o.throw(U))}catch(V){v(V)}},D=U=>U.done?a(U.value):Promise.resolve(U.value).then(h,b);D((o=o.apply(w,r)).next())});class PubSub{constructor(){this.events={}}on(r,o){let a=this;a.events||(a.events={}),a.events.hasOwnProperty(r)||(a.events[r]=[]),a.events[r].push(o)}emit(r,...o){let a=this;a.events||(a.events={}),a.events.hasOwnProperty(r)&&a.events[r].map(v=>v(...o))}off(r,o){if(this.events[r])if(o===void 0)this.events[r]=[];else{const a=this.events[r].indexOf(o);this.events[r].splice(a,1)}}}class Store{constructor(r){let o=this;o.actions={},o.mutations={},o.state=r.state,o.status="resting",o.events=new PubSub,r.hasOwnProperty("actions")&&(o.actions=r.actions),r.hasOwnProperty("mutations")&&(o.mutations=r.mutations)}dispatch(r,o){let a=this;return typeof a.actions[r]=="function"&&(console.groupCollapsed(`ACTION: ${r}`),a.status="action",a.actions[r](a,o),console.groupEnd(),!0)}commit(r,o){let a=this;if(typeof a.mutations[r]!="function")return console.log(`Mutation "${r}" doesn't exist`),!1;a.status="mutation";let v=a.mutations[r](a.state,o);return a.state=Object.assign(a.state,v),!0}}const options={state:{MxFun:null,Mxassembly:null,isCreateDrawObj:!1},actions:{},mutations:{}};for(let w in options.state){const r=w.charAt(0).toUpperCase()+w.slice(1);options.mutations["set"+r]=(o,a)=>{o[w]=a}}const store=new Store(options);function mxfun(){(function w(r,o,a){function v(D,U){if(!o[D]){if(!r[D]){var V=typeof require=="function"&&require;if(!U&&V)return V(D,!0);if(h)return h(D,!0);var I=new Error("Cannot find module '"+D+"'");throw I.code="MODULE_NOT_FOUND",I}var g=o[D]={exports:{}};r[D][0].call(g.exports,function(A){return v(r[D][1][A]||A)},g,g.exports,w,r,o,a)}return o[D].exports}for(var h=typeof require=="function"&&require,b=0;b>>6:(g<65536?I[N++]=224|g>>>12:(I[N++]=240|g>>>18,I[N++]=128|g>>>12&63),I[N++]=128|g>>>6&63),I[N++]=128|63&g);return I},o.buf2binstring=function(V){return U(V,V.length)},o.binstring2buf=function(V){for(var I=new a.Buf8(V.length),g=0,A=I.length;g>10&1023,T[A++]=56320|1023&M)}return U(T,A)},o.utf8border=function(V,I){var g;for((I=I||V.length)>V.length&&(I=V.length),g=I-1;0<=g&&(192&V[g])==128;)g--;return!(g<0)&&g!==0&&g+b[V[g]]>I?g:I}},{"./common":4}],6:[function(w,r,o){r.exports=function(a,v,h,b){for(var D=65535&a|0,U=a>>>16&65535|0,V=0;h!==0;){for(h-=V=2e3>>1:v>>>1;h[b]=v}return h}();r.exports=function(v,h,b,D){var U=a,V=D+b;v^=-1;for(var I=D;I>>8^U[255&(v^h[I])];return-1^v}},{}],9:[function(w,r,o){var a,v=w("../utils/common"),h=w("./trees"),b=w("./adler32"),D=w("./crc32"),U=w("./messages"),V=0,I=0,g=-2,A=2,M=8,N=286,F=30,T=19,_=2*N+1,Y=15,k=3,S=258,G=S+k+1,C=42,B=113;function R(q,ge){return q.msg=U[ge],ge}function u(q){return(q<<1)-(4q.avail_out&&(oe=q.avail_out),oe!==0&&(v.arraySet(q.output,ge.pending_buf,ge.pending_out,oe,q.next_out),q.next_out+=oe,ge.pending_out+=oe,q.total_out+=oe,q.avail_out-=oe,ge.pending-=oe,ge.pending===0&&(ge.pending_out=0))}function O(q,ge){h._tr_flush_block(q,0<=q.block_start?q.block_start:-1,q.strstart-q.block_start,ge),q.block_start=q.strstart,f(q.strm)}function W(q,ge){q.pending_buf[q.pending++]=ge}function X(q,ge){q.pending_buf[q.pending++]=ge>>>8&255,q.pending_buf[q.pending++]=255&ge}function J(q,ge){var oe,le,Pe=q.max_chain_length,Ye=q.strstart,ze=q.prev_length,se=q.nice_match,xe=q.strstart>q.w_size-G?q.strstart-(q.w_size-G):0,De=q.window,tt=q.w_mask,st=q.prev,mt=q.strstart+S,Rt=De[Ye+ze-1],Ot=De[Ye+ze];q.prev_length>=q.good_match&&(Pe>>=2),se>q.lookahead&&(se=q.lookahead);do if(De[(oe=ge)+ze]===Ot&&De[oe+ze-1]===Rt&&De[oe]===De[Ye]&&De[++oe]===De[Ye+1]){Ye+=2,oe++;do;while(De[++Ye]===De[++oe]&&De[++Ye]===De[++oe]&&De[++Ye]===De[++oe]&&De[++Ye]===De[++oe]&&De[++Ye]===De[++oe]&&De[++Ye]===De[++oe]&&De[++Ye]===De[++oe]&&De[++Ye]===De[++oe]&&Yexe&&--Pe!=0);return ze<=q.lookahead?ze:q.lookahead}function te(q){var ge,oe,le,Pe,Ye,ze,se,xe,De,tt,st=q.w_size;do{if(Pe=q.window_size-q.lookahead-q.strstart,q.strstart>=st+(st-G)){for(v.arraySet(q.window,q.window,st,st,0),q.match_start-=st,q.strstart-=st,q.block_start-=st,ge=oe=q.hash_size;le=q.head[--ge],q.head[ge]=st<=le?le-st:0,--oe;);for(ge=oe=st;le=q.prev[--ge],q.prev[ge]=st<=le?le-st:0,--oe;);Pe+=st}if(q.strm.avail_in===0)break;if(ze=q.strm,se=q.window,xe=q.strstart+q.lookahead,tt=void 0,(De=Pe)<(tt=ze.avail_in)&&(tt=De),oe=tt===0?0:(ze.avail_in-=tt,v.arraySet(se,ze.input,ze.next_in,tt,xe),ze.state.wrap===1?ze.adler=b(ze.adler,se,tt,xe):ze.state.wrap===2&&(ze.adler=D(ze.adler,se,tt,xe)),ze.next_in+=tt,ze.total_in+=tt,tt),q.lookahead+=oe,q.lookahead+q.insert>=k)for(Ye=q.strstart-q.insert,q.ins_h=q.window[Ye],q.ins_h=(q.ins_h<=k&&(q.ins_h=(q.ins_h<=k)if(le=h._tr_tally(q,q.strstart-q.match_start,q.match_length-k),q.lookahead-=q.match_length,q.match_length<=q.max_lazy_match&&q.lookahead>=k){for(q.match_length--;q.strstart++,q.ins_h=(q.ins_h<=k&&(q.ins_h=(q.ins_h<=k&&q.match_length<=q.prev_length){for(Pe=q.strstart+q.lookahead-k,le=h._tr_tally(q,q.strstart-1-q.prev_match,q.prev_length-k),q.lookahead-=q.prev_length-1,q.prev_length-=2;++q.strstart<=Pe&&(q.ins_h=(q.ins_h<q.pending_buf_size-5&&(oe=q.pending_buf_size-5);;){if(q.lookahead<=1){if(te(q),q.lookahead===0&&ge===V)return 1;if(q.lookahead===0)break}q.strstart+=q.lookahead,q.lookahead=0;var le=q.block_start+oe;if((q.strstart===0||q.strstart>=le)&&(q.lookahead=q.strstart-le,q.strstart=le,O(q,!1),q.strm.avail_out===0)||q.strstart-q.block_start>=q.w_size-G&&(O(q,!1),q.strm.avail_out===0))return 1}return q.insert=0,ge===4?(O(q,!0),q.strm.avail_out===0?3:4):(q.strstart>q.block_start&&(O(q,!1),q.strm.avail_out),1)}),new be(4,4,8,4,ne),new be(4,5,16,8,ne),new be(4,6,32,32,ne),new be(4,4,16,16,ue),new be(8,16,32,32,ue),new be(8,16,128,128,ue),new be(8,32,128,256,ue),new be(32,128,258,1024,ue),new be(32,258,258,4096,ue)],o.deflateInit=function(q,ge){return Be(q,ge,M,15,8,0)},o.deflateInit2=Be,o.deflateReset=ve,o.deflateResetKeep=je,o.deflateSetHeader=function(q,ge){return q&&q.state&&q.state.wrap===2?(q.state.gzhead=ge,I):g},o.deflate=function(q,ge){var oe,le,Pe,Ye;if(!q||!q.state||5>8&255),W(le,le.gzhead.time>>16&255),W(le,le.gzhead.time>>24&255),W(le,le.level===9?2:2<=le.strategy||le.level<2?4:0),W(le,255&le.gzhead.os),le.gzhead.extra&&le.gzhead.extra.length&&(W(le,255&le.gzhead.extra.length),W(le,le.gzhead.extra.length>>8&255)),le.gzhead.hcrc&&(q.adler=D(q.adler,le.pending_buf,le.pending,0)),le.gzindex=0,le.status=69):(W(le,0),W(le,0),W(le,0),W(le,0),W(le,0),W(le,le.level===9?2:2<=le.strategy||le.level<2?4:0),W(le,3),le.status=B);else{var ze=M+(le.w_bits-8<<4)<<8;ze|=(2<=le.strategy||le.level<2?0:le.level<6?1:le.level===6?2:3)<<6,le.strstart!==0&&(ze|=32),ze+=31-ze%31,le.status=B,X(le,ze),le.strstart!==0&&(X(le,q.adler>>>16),X(le,65535&q.adler)),q.adler=1}if(le.status===69)if(le.gzhead.extra){for(Pe=le.pending;le.gzindex<(65535&le.gzhead.extra.length)&&(le.pending!==le.pending_buf_size||(le.gzhead.hcrc&&le.pending>Pe&&(q.adler=D(q.adler,le.pending_buf,le.pending-Pe,Pe)),f(q),Pe=le.pending,le.pending!==le.pending_buf_size));)W(le,255&le.gzhead.extra[le.gzindex]),le.gzindex++;le.gzhead.hcrc&&le.pending>Pe&&(q.adler=D(q.adler,le.pending_buf,le.pending-Pe,Pe)),le.gzindex===le.gzhead.extra.length&&(le.gzindex=0,le.status=73)}else le.status=73;if(le.status===73)if(le.gzhead.name){Pe=le.pending;do{if(le.pending===le.pending_buf_size&&(le.gzhead.hcrc&&le.pending>Pe&&(q.adler=D(q.adler,le.pending_buf,le.pending-Pe,Pe)),f(q),Pe=le.pending,le.pending===le.pending_buf_size)){Ye=1;break}Ye=le.gzindexPe&&(q.adler=D(q.adler,le.pending_buf,le.pending-Pe,Pe)),Ye===0&&(le.gzindex=0,le.status=91)}else le.status=91;if(le.status===91)if(le.gzhead.comment){Pe=le.pending;do{if(le.pending===le.pending_buf_size&&(le.gzhead.hcrc&&le.pending>Pe&&(q.adler=D(q.adler,le.pending_buf,le.pending-Pe,Pe)),f(q),Pe=le.pending,le.pending===le.pending_buf_size)){Ye=1;break}Ye=le.gzindexPe&&(q.adler=D(q.adler,le.pending_buf,le.pending-Pe,Pe)),Ye===0&&(le.status=103)}else le.status=103;if(le.status===103&&(le.gzhead.hcrc?(le.pending+2>le.pending_buf_size&&f(q),le.pending+2<=le.pending_buf_size&&(W(le,255&q.adler),W(le,q.adler>>8&255),q.adler=0,le.status=B)):le.status=B),le.pending!==0){if(f(q),q.avail_out===0)return le.last_flush=-1,I}else if(q.avail_in===0&&u(ge)<=u(oe)&&ge!==4)return R(q,-5);if(le.status===666&&q.avail_in!==0)return R(q,-5);if(q.avail_in!==0||le.lookahead!==0||ge!==V&&le.status!==666){var se=le.strategy===2?function(xe,De){for(var tt;;){if(xe.lookahead===0&&(te(xe),xe.lookahead===0)){if(De===V)return 1;break}if(xe.match_length=0,tt=h._tr_tally(xe,0,xe.window[xe.strstart]),xe.lookahead--,xe.strstart++,tt&&(O(xe,!1),xe.strm.avail_out===0))return 1}return xe.insert=0,De===4?(O(xe,!0),xe.strm.avail_out===0?3:4):xe.last_lit&&(O(xe,!1),xe.strm.avail_out===0)?1:2}(le,ge):le.strategy===3?function(xe,De){for(var tt,st,mt,Rt,Ot=xe.window;;){if(xe.lookahead<=S){if(te(xe),xe.lookahead<=S&&De===V)return 1;if(xe.lookahead===0)break}if(xe.match_length=0,xe.lookahead>=k&&0xe.lookahead&&(xe.match_length=xe.lookahead)}if(xe.match_length>=k?(tt=h._tr_tally(xe,1,xe.match_length-k),xe.lookahead-=xe.match_length,xe.strstart+=xe.match_length,xe.match_length=0):(tt=h._tr_tally(xe,0,xe.window[xe.strstart]),xe.lookahead--,xe.strstart++),tt&&(O(xe,!1),xe.strm.avail_out===0))return 1}return xe.insert=0,De===4?(O(xe,!0),xe.strm.avail_out===0?3:4):xe.last_lit&&(O(xe,!1),xe.strm.avail_out===0)?1:2}(le,ge):a[le.level].func(le,ge);if(se!==3&&se!==4||(le.status=666),se===1||se===3)return q.avail_out===0&&(le.last_flush=-1),I;if(se===2&&(ge===1?h._tr_align(le):ge!==5&&(h._tr_stored_block(le,0,0,!1),ge===3&&(c(le.head),le.lookahead===0&&(le.strstart=0,le.block_start=0,le.insert=0))),f(q),q.avail_out===0))return le.last_flush=-1,I}return ge!==4?I:le.wrap<=0?1:(le.wrap===2?(W(le,255&q.adler),W(le,q.adler>>8&255),W(le,q.adler>>16&255),W(le,q.adler>>24&255),W(le,255&q.total_in),W(le,q.total_in>>8&255),W(le,q.total_in>>16&255),W(le,q.total_in>>24&255)):(X(le,q.adler>>>16),X(le,65535&q.adler)),f(q),0=oe.w_size&&(Ye===0&&(c(oe.head),oe.strstart=0,oe.block_start=0,oe.insert=0),De=new v.Buf8(oe.w_size),v.arraySet(De,ge,tt-oe.w_size,oe.w_size,0),ge=De,tt=oe.w_size),ze=q.avail_in,se=q.next_in,xe=q.input,q.avail_in=tt,q.next_in=0,q.input=ge,te(oe);oe.lookahead>=k;){for(le=oe.strstart,Pe=oe.lookahead-(k-1);oe.ins_h=(oe.ins_h<>>=B=C>>>24,_-=B,(B=C>>>16&255)==0)W[U++]=65535&C;else{if(!(16&B)){if(!(64&B)){C=Y[(65535&C)+(T&(1<>>=B,_-=B),_<15&&(T+=O[b++]<<_,_+=8,T+=O[b++]<<_,_+=8),C=k[T&G];n:for(;;){if(T>>>=B=C>>>24,_-=B,!(16&(B=C>>>16&255))){if(!(64&B)){C=k[(65535&C)+(T&(1<>>=B,_-=B,(B=U-V)>3,T&=(1<<(_-=R<<3))-1,a.next_in=b,a.next_out=U,a.avail_in=b>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function N(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new a.Buf16(320),this.work=new a.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function F(R){var u;return R&&R.state?(u=R.state,R.total_in=R.total_out=u.total=0,R.msg="",u.wrap&&(R.adler=1&u.wrap),u.mode=I,u.last=0,u.havedict=0,u.dmax=32768,u.head=null,u.hold=0,u.bits=0,u.lencode=u.lendyn=new a.Buf32(g),u.distcode=u.distdyn=new a.Buf32(A),u.sane=1,u.back=-1,U):V}function T(R){var u;return R&&R.state?((u=R.state).wsize=0,u.whave=0,u.wnext=0,F(R)):V}function _(R,u){var c,f;return R&&R.state?(f=R.state,u<0?(c=0,u=-u):(c=1+(u>>4),u<48&&(u&=15)),u&&(u<8||15=W.wsize?(a.arraySet(W.window,u,c-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(f<(O=W.wsize-W.wnext)&&(O=f),a.arraySet(W.window,u,c-f,O,W.wnext),(f-=O)?(a.arraySet(W.window,u,c-f,f,0),W.wnext=f,W.whave=W.wsize):(W.wnext+=O,W.wnext===W.wsize&&(W.wnext=0),W.whave>>8&255,c.check=h(c.check,mt,2,0),ue=ne=0,c.mode=2;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&ne)<<8)+(ne>>8))%31){R.msg="incorrect header check",c.mode=30;break}if((15&ne)!=8){R.msg="unknown compression method",c.mode=30;break}if(ue-=4,se=8+(15&(ne>>>=4)),c.wbits===0)c.wbits=se;else if(se>c.wbits){R.msg="invalid window size",c.mode=30;break}c.dmax=1<>8&1),512&c.flags&&(mt[0]=255&ne,mt[1]=ne>>>8&255,c.check=h(c.check,mt,2,0)),ue=ne=0,c.mode=3;case 3:for(;ue<32;){if(J===0)break e;J--,ne+=f[W++]<>>8&255,mt[2]=ne>>>16&255,mt[3]=ne>>>24&255,c.check=h(c.check,mt,4,0)),ue=ne=0,c.mode=4;case 4:for(;ue<16;){if(J===0)break e;J--,ne+=f[W++]<>8),512&c.flags&&(mt[0]=255&ne,mt[1]=ne>>>8&255,c.check=h(c.check,mt,2,0)),ue=ne=0,c.mode=5;case 5:if(1024&c.flags){for(;ue<16;){if(J===0)break e;J--,ne+=f[W++]<>>8&255,c.check=h(c.check,mt,2,0)),ue=ne=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(1024&c.flags&&(J<(ve=c.length)&&(ve=J),ve&&(c.head&&(se=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),a.arraySet(c.head.extra,f,W,ve,se)),512&c.flags&&(c.check=h(c.check,f,ve,W)),J-=ve,W+=ve,c.length-=ve),c.length))break e;c.length=0,c.mode=7;case 7:if(2048&c.flags){if(J===0)break e;for(ve=0;se=f[W+ve++],c.head&&se&&c.length<65536&&(c.head.name+=String.fromCharCode(se)),se&&ve>9&1,c.head.done=!0),R.adler=c.check=0,c.mode=12;break;case 10:for(;ue<32;){if(J===0)break e;J--,ne+=f[W++]<>>=7&ue,ue-=7&ue,c.mode=27;break}for(;ue<3;){if(J===0)break e;J--,ne+=f[W++]<>>=1)){case 0:c.mode=14;break;case 1:if(C(c),c.mode=20,u!==6)break;ne>>>=2,ue-=2;break e;case 2:c.mode=17;break;case 3:R.msg="invalid block type",c.mode=30}ne>>>=2,ue-=2;break;case 14:for(ne>>>=7&ue,ue-=7&ue;ue<32;){if(J===0)break e;J--,ne+=f[W++]<>>16^65535)){R.msg="invalid stored block lengths",c.mode=30;break}if(c.length=65535&ne,ue=ne=0,c.mode=15,u===6)break e;case 15:c.mode=16;case 16:if(ve=c.length){if(J>>=5,ue-=5,c.ndist=1+(31&ne),ne>>>=5,ue-=5,c.ncode=4+(15&ne),ne>>>=4,ue-=4,286>>=3,ue-=3}for(;c.have<19;)c.lens[Rt[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,De={bits:c.lenbits},xe=D(0,c.lens,0,19,c.lencode,0,c.work,De),c.lenbits=De.bits,xe){R.msg="invalid code lengths set",c.mode=30;break}c.have=0,c.mode=19;case 19:for(;c.have>>16&255,le=65535&st,!((ge=st>>>24)<=ue);){if(J===0)break e;J--,ne+=f[W++]<>>=ge,ue-=ge,c.lens[c.have++]=le;else{if(le===16){for(tt=ge+2;ue>>=ge,ue-=ge,c.have===0){R.msg="invalid bit length repeat",c.mode=30;break}se=c.lens[c.have-1],ve=3+(3&ne),ne>>>=2,ue-=2}else if(le===17){for(tt=ge+3;ue>>=ge)),ne>>>=3,ue-=3}else{for(tt=ge+7;ue>>=ge)),ne>>>=7,ue-=7}if(c.have+ve>c.nlen+c.ndist){R.msg="invalid bit length repeat",c.mode=30;break}for(;ve--;)c.lens[c.have++]=se}}if(c.mode===30)break;if(c.lens[256]===0){R.msg="invalid code -- missing end-of-block",c.mode=30;break}if(c.lenbits=9,De={bits:c.lenbits},xe=D(1,c.lens,0,c.nlen,c.lencode,0,c.work,De),c.lenbits=De.bits,xe){R.msg="invalid literal/lengths set",c.mode=30;break}if(c.distbits=6,c.distcode=c.distdyn,De={bits:c.distbits},xe=D(2,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,De),c.distbits=De.bits,xe){R.msg="invalid distances set",c.mode=30;break}if(c.mode=20,u===6)break e;case 20:c.mode=21;case 21:if(6<=J&&258<=te){R.next_out=X,R.avail_out=te,R.next_in=W,R.avail_in=J,c.hold=ne,c.bits=ue,b(R,je),X=R.next_out,O=R.output,te=R.avail_out,W=R.next_in,f=R.input,J=R.avail_in,ne=c.hold,ue=c.bits,c.mode===12&&(c.back=-1);break}for(c.back=0;oe=(st=c.lencode[ne&(1<>>16&255,le=65535&st,!((ge=st>>>24)<=ue);){if(J===0)break e;J--,ne+=f[W++]<>Pe)])>>>16&255,le=65535&st,!(Pe+(ge=st>>>24)<=ue);){if(J===0)break e;J--,ne+=f[W++]<>>=Pe,ue-=Pe,c.back+=Pe}if(ne>>>=ge,ue-=ge,c.back+=ge,c.length=le,oe===0){c.mode=26;break}if(32&oe){c.back=-1,c.mode=12;break}if(64&oe){R.msg="invalid literal/length code",c.mode=30;break}c.extra=15&oe,c.mode=22;case 22:if(c.extra){for(tt=c.extra;ue>>=c.extra,ue-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=23;case 23:for(;oe=(st=c.distcode[ne&(1<>>16&255,le=65535&st,!((ge=st>>>24)<=ue);){if(J===0)break e;J--,ne+=f[W++]<>Pe)])>>>16&255,le=65535&st,!(Pe+(ge=st>>>24)<=ue);){if(J===0)break e;J--,ne+=f[W++]<>>=Pe,ue-=Pe,c.back+=Pe}if(ne>>>=ge,ue-=ge,c.back+=ge,64&oe){R.msg="invalid distance code",c.mode=30;break}c.offset=le,c.extra=15&oe,c.mode=24;case 24:if(c.extra){for(tt=c.extra;ue>>=c.extra,ue-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){R.msg="invalid distance too far back",c.mode=30;break}c.mode=25;case 25:if(te===0)break e;if(ve=je-te,c.offset>ve){if((ve=c.offset-ve)>c.whave&&c.sane){R.msg="invalid distance too far back",c.mode=30;break}Be=ve>c.wnext?(ve-=c.wnext,c.wsize-ve):c.wnext-ve,ve>c.length&&(ve=c.length),q=c.window}else q=O,Be=X-c.offset,ve=c.length;for(teG?(B=ge[oe+N[f]],je[ve+N[f]]):(B=96,0),T=1<>te)+(_-=T)]=C<<24|B<<16|R|0,_!==0;);for(T=1<>=1;if(T!==0?(be&=T-1,be+=T):be=0,f++,--Be[c]==0){if(c===W)break;c=V[I+N[f]]}if(X>>7)]}function c(oe,le){oe.pending_buf[oe.pending++]=255&le,oe.pending_buf[oe.pending++]=le>>>8&255}function f(oe,le,Pe){oe.bi_valid>V-Pe?(oe.bi_buf|=le<>V-oe.bi_valid,oe.bi_valid+=Pe-V):(oe.bi_buf|=le<>>=1,Pe<<=1,0<--le;);return Pe>>>1}function X(oe,le,Pe){var Ye,ze,se=new Array(U+1),xe=0;for(Ye=1;Ye<=U;Ye++)se[Ye]=xe=xe+Pe[Ye-1]<<1;for(ze=0;ze<=le;ze++){var De=oe[2*ze+1];De!==0&&(oe[2*ze]=W(se[De]++,De))}}function J(oe){var le;for(le=0;le>1;1<=Pe;Pe--)ue(oe,se,Pe);for(ze=tt;Pe=oe.heap[1],oe.heap[1]=oe.heap[oe.heap_len--],ue(oe,se,1),Ye=oe.heap[1],oe.heap[--oe.heap_max]=Pe,oe.heap[--oe.heap_max]=Ye,se[2*ze]=se[2*Pe]+se[2*Ye],oe.depth[ze]=(oe.depth[Pe]>=oe.depth[Ye]?oe.depth[Pe]:oe.depth[Ye])+1,se[2*Pe+1]=se[2*Ye+1]=ze,oe.heap[1]=ze++,ue(oe,se,1),2<=oe.heap_len;);oe.heap[--oe.heap_max]=oe.heap[1],function(mt,Rt){var Ot,He,Vt,jt,Ln,nn,er=Rt.dyn_tree,yt=Rt.max_code,Ue=Rt.stat_desc.static_tree,Zt=Rt.stat_desc.has_stree,On=Rt.stat_desc.extra_bits,Xn=Rt.stat_desc.extra_base,dt=Rt.stat_desc.max_length,lt=0;for(jt=0;jt<=U;jt++)mt.bl_count[jt]=0;for(er[2*mt.heap[mt.heap_max]+1]=0,Ot=mt.heap_max+1;Ot<573;Ot++)dt<(jt=er[2*er[2*(He=mt.heap[Ot])+1]+1]+1)&&(jt=dt,lt++),er[2*He+1]=jt,yt>=7;ze>>=1)if(1&st&&De.dyn_ltree[2*tt]!==0)return 0;if(De.dyn_ltree[18]!==0||De.dyn_ltree[20]!==0||De.dyn_ltree[26]!==0)return 1;for(tt=32;tt>>3,(se=oe.static_len+3+7>>>3)<=ze&&(ze=se)):ze=se=Pe+5,Pe+4<=ze&&le!==-1?ge(oe,le,Pe,Ye):oe.strategy===4||se===ze?(f(oe,2+(Ye?1:0),3),be(oe,N,F)):(f(oe,4+(Ye?1:0),3),function(De,tt,st,mt){var Rt;for(f(De,tt-257,5),f(De,st-1,5),f(De,mt-4,4),Rt=0;Rt>>8&255,oe.pending_buf[oe.d_buf+2*oe.last_lit+1]=255&le,oe.pending_buf[oe.l_buf+oe.last_lit]=255&Pe,oe.last_lit++,le===0?oe.dyn_ltree[2*Pe]++:(oe.matches++,le--,oe.dyn_ltree[2*(_[Pe]+h+1)]++,oe.dyn_dtree[2*u(le)]++),oe.last_lit===oe.lit_bufsize-1},o._tr_align=function(oe){var le;f(oe,2,3),O(oe,256,N),(le=oe).bi_valid===16?(c(le,le.bi_buf),le.bi_buf=0,le.bi_valid=0):8<=le.bi_valid&&(le.pending_buf[le.pending++]=255&le.bi_buf,le.bi_buf>>=8,le.bi_valid-=8)}},{"../utils/common":4}],16:[function(w,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],17:[function(w,r,o){var a=w("three");a.OrbitControls=function(v,h){var b,D,U,V,I;h===void 0&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),h===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=v,this.domElement=h,this.enabled=!0,this.target=new a.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:a.MOUSE.ROTATE,MIDDLE:a.MOUSE.DOLLY,RIGHT:a.MOUSE.PAN},this.touches={ONE:a.TOUCH.ROTATE,TWO:a.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return Y.phi},this.getAzimuthalAngle=function(){return Y.theta},this.saveState=function(){g.target0.copy(g.target),g.position0.copy(g.object.position),g.zoom0=g.object.zoom},this.resetStatusValue=function(){T=F.NONE},this.reset=function(){g.target.copy(g.target0),g.object.position.copy(g.position0),g.object.zoom=g.zoom0,g.object.updateProjectionMatrix(),g.dispatchEvent(A),g.update(),T=F.NONE},this.update=(b=new a.Vector3,D=new a.Quaternion().setFromUnitVectors(v.up,new a.Vector3(0,1,0)),U=D.clone().inverse(),V=new a.Vector3,I=new a.Quaternion,function(){var yt=g.object.position;return b.copy(yt).sub(g.target),b.applyQuaternion(D),Y.setFromVector3(b),g.autoRotate&&T===F.NONE&&ne(2*Math.PI/60/60*g.autoRotateSpeed),g.enableDamping?(Y.theta+=k.theta*g.dampingFactor,Y.phi+=k.phi*g.dampingFactor):(Y.theta+=k.theta,Y.phi+=k.phi),Y.theta=Math.max(g.minAzimuthAngle,Math.min(g.maxAzimuthAngle,Y.theta)),Y.phi=Math.max(g.minPolarAngle,Math.min(g.maxPolarAngle,Y.phi)),Y.makeSafe(),Y.radius*=S,Y.radius=Math.max(g.minDistance,Math.min(g.maxDistance,Y.radius)),g.enableDamping===!0?g.target.addScaledVector(G,g.dampingFactor):g.target.add(G),b.setFromSpherical(Y),b.applyQuaternion(U),yt.copy(g.target).add(b),g.object.lookAt(g.target),g.enableDamping===!0?(k.theta*=1-g.dampingFactor,k.phi*=1-g.dampingFactor,G.multiplyScalar(1-g.dampingFactor)):(k.set(0,0,0),G.set(0,0,0)),S=1,!(!(C||V.distanceToSquared(g.object.position)>_||8*(1-I.dot(g.object.quaternion))>_)||(g.dispatchEvent(A),V.copy(g.object.position),I.copy(g.object.quaternion),C=!1))}),this.dispose=function(){g.domElement.removeEventListener("contextmenu",er,!1),g.domElement.removeEventListener("mousedown",st,!1),g.domElement.removeEventListener("wheel",Ot,!1),g.domElement.removeEventListener("touchstart",jt,!1),g.domElement.removeEventListener("touchend",nn,!1),g.domElement.removeEventListener("touchmove",Ln,!1),document.removeEventListener("mousemove",mt,!1),document.removeEventListener("mouseup",Rt,!1),g.domElement.removeEventListener("keydown",He,!1)};var g=this,A={type:"change"},M={type:"start"},N={type:"end"},F={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},T=F.NONE,_=1e-6,Y=new a.Spherical,k=new a.Spherical,S=1,G=new a.Vector3,C=!1,B=new a.Vector2,R=new a.Vector2,u=new a.Vector2,c=new a.Vector2,f=new a.Vector2,O=new a.Vector2,W=new a.Vector2,X=new a.Vector2,J=new a.Vector2;function te(){return Math.pow(.95,g.zoomSpeed)}function ne(yt){k.theta-=yt}function ue(yt){k.phi-=yt}var be,je,ve,Be=(be=new a.Vector3,function(yt,Ue){be.setFromMatrixColumn(Ue,0),be.multiplyScalar(-yt),G.add(be)}),q=(je=new a.Vector3,function(yt,Ue){g.screenSpacePanning===!0?je.setFromMatrixColumn(Ue,1):(je.setFromMatrixColumn(Ue,0),je.crossVectors(g.object.up,je)),je.multiplyScalar(yt),G.add(je)}),ge=(ve=new a.Vector3,function(yt,Ue){var Zt=g.domElement;if(g.object.isPerspectiveCamera){var On=g.object.position;ve.copy(On).sub(g.target);var Xn=ve.length();Xn*=Math.tan(g.object.fov/2*Math.PI/180),Be(2*yt*Xn/Zt.clientHeight,g.object.matrix),q(2*Ue*Xn/Zt.clientHeight,g.object.matrix)}else g.object.isOrthographicCamera?(Be(yt*(g.object.right-g.object.left)/g.object.zoom/Zt.clientWidth,g.object.matrix),q(Ue*(g.object.top-g.object.bottom)/g.object.zoom/Zt.clientHeight,g.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),g.enablePan=!1)});function oe(yt){g.object.isPerspectiveCamera?S/=yt:g.object.isOrthographicCamera?(g.object.zoom=Math.max(g.minZoom,Math.min(g.maxZoom,g.object.zoom*yt)),g.object.updateProjectionMatrix(),C=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),g.enableZoom=!1)}function le(yt){B.set(yt.clientX,yt.clientY)}function Pe(yt){c.set(yt.clientX,yt.clientY)}function Ye(yt){if(yt.touches.length==1)B.set(yt.touches[0].pageX,yt.touches[0].pageY);else{var Ue=.5*(yt.touches[0].pageX+yt.touches[1].pageX),Zt=.5*(yt.touches[0].pageY+yt.touches[1].pageY);B.set(Ue,Zt)}}function ze(yt){if(yt.touches.length==1)c.set(yt.touches[0].pageX,yt.touches[0].pageY);else{var Ue=.5*(yt.touches[0].pageX+yt.touches[1].pageX),Zt=.5*(yt.touches[0].pageY+yt.touches[1].pageY);c.set(Ue,Zt)}}function se(yt){var Ue=yt.touches[0].pageX-yt.touches[1].pageX,Zt=yt.touches[0].pageY-yt.touches[1].pageY,On=Math.sqrt(Ue*Ue+Zt*Zt);W.set(0,On)}function xe(yt){if(yt.touches.length==1)R.set(yt.touches[0].pageX,yt.touches[0].pageY);else{var Ue=.5*(yt.touches[0].pageX+yt.touches[1].pageX),Zt=.5*(yt.touches[0].pageY+yt.touches[1].pageY);R.set(Ue,Zt)}u.subVectors(R,B).multiplyScalar(g.rotateSpeed);var On=g.domElement;ne(2*Math.PI*u.x/On.clientHeight),ue(2*Math.PI*u.y/On.clientHeight),B.copy(R)}function De(yt){if(yt.touches.length==1)f.set(yt.touches[0].pageX,yt.touches[0].pageY);else{var Ue=.5*(yt.touches[0].pageX+yt.touches[1].pageX),Zt=.5*(yt.touches[0].pageY+yt.touches[1].pageY);f.set(Ue,Zt)}O.subVectors(f,c).multiplyScalar(g.panSpeed),ge(O.x,O.y),c.copy(f)}function tt(yt){var Ue=yt.touches[0].pageX-yt.touches[1].pageX,Zt=yt.touches[0].pageY-yt.touches[1].pageY,On=Math.sqrt(Ue*Ue+Zt*Zt);X.set(0,On),J.set(0,Math.pow(X.y/W.y,g.zoomSpeed)),oe(J.y),W.copy(X)}function st(yt){if(g.enabled!==!1){switch(yt.preventDefault(),g.domElement.focus?g.domElement.focus():window.focus(),yt.button){case 0:switch(g.mouseButtons.LEFT){case a.MOUSE.ROTATE:if(yt.ctrlKey||yt.metaKey||yt.shiftKey){if(g.enablePan===!1)return;Pe(yt),T=F.PAN}else{if(g.enableRotate===!1)return;le(yt),T=F.ROTATE}break;case a.MOUSE.PAN:if(yt.ctrlKey||yt.metaKey||yt.shiftKey){if(g.enableRotate===!1)return;le(yt),T=F.ROTATE}else{if(g.enablePan===!1)return;Pe(yt),T=F.PAN}break;default:T=F.NONE}break;case 1:switch(g.mouseButtons.MIDDLE){case a.MOUSE.DOLLY:if(g.enableZoom===!1)return;Ue=yt,W.set(Ue.clientX,Ue.clientY),T=F.DOLLY;break;case a.MOUSE.PAN:if(g.enablePan===!1)return;Pe(yt),T=F.PAN;break;default:T=F.NONE}break;case 2:switch(g.mouseButtons.RIGHT){case a.MOUSE.ROTATE:if(g.enableRotate===!1)return;le(yt),T=F.ROTATE;break;case a.MOUSE.PAN:if(g.enablePan===!1)return;Pe(yt),T=F.PAN;break;default:T=F.NONE}}var Ue;T!==F.NONE&&(document.addEventListener("mousemove",mt,!1),document.addEventListener("mouseup",Rt,!1),g.dispatchEvent(M))}}function mt(yt){var Ue;if(g.enabled!==!1)switch(yt.preventDefault(),T){case F.ROTATE:if(g.enableRotate===!1)return;(function(Zt){R.set(Zt.clientX,Zt.clientY),u.subVectors(R,B).multiplyScalar(g.rotateSpeed);var On=g.domElement;ne(2*Math.PI*u.x/On.clientHeight),ue(2*Math.PI*u.y/On.clientHeight),B.copy(R),g.update()})(yt);break;case F.DOLLY:if(g.enableZoom===!1)return;(function(Zt){var On;X.set(Zt.clientX,Zt.clientY),J.subVectors(X,W),0g.far||A.push({distance:J,point:Y.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}))}else for(u=0,c=(R=C.position.array).length/3-1;ug.far||A.push({distance:J,point:Y.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}))}else if(F instanceof D.Geometry){var W=F.vertices,X=W.length;for(u=0;ug.far||A.push({distance:J,point:Y.clone().applyMatrix4(this.matrixWorld),index:u,face:null,faceIndex:null,object:this}))}}}}),U.prototype.compareV3=function(g,A){var M=6*g,N=6*A;return this.positions[M]===this.positions[N]&&this.positions[1+M]===this.positions[1+N]&&this.positions[2+M]===this.positions[2+N]},U.prototype.copyV3=function(g){var A=6*g;return[this.positions[A],this.positions[1+A],this.positions[2+A]]},U.prototype.process=function(){var g,A,M=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];for(var N=0;N>8&255]+na[e>>16&255]+na[e>>24&255]+"-"+na[255&t]+na[t>>8&255]+"-"+na[t>>16&15|64]+na[t>>24&255]+"-"+na[63&n|128]+na[n>>8&255]+"-"+na[n>>16&255]+na[n>>24&255]+na[255&i]+na[i>>8&255]+na[i>>16&255]+na[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,l){return i+(e-t)*(l-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*yr.DEG2RAD},radToDeg:function(e){return e*yr.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)==0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,l){var d=Math.cos,m=Math.sin,x=d(n/2),L=m(n/2),j=d((t+i)/2),Z=m((t+i)/2),ee=d((t-i)/2),ie=m((t-i)/2),z=d((i-t)/2),he=m((i-t)/2);l==="XYX"?e.set(x*Z,L*ee,L*ie,x*j):l==="YZY"?e.set(L*ie,x*Z,L*ee,x*j):l==="ZXZ"?e.set(L*ee,L*ie,x*Z,x*j):l==="XZX"?e.set(x*Z,L*he,L*z,x*j):l==="YXY"?e.set(L*z,x*Z,L*he,x*j):l==="ZYZ"?e.set(L*he,L*z,x*Z,x*j):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}};function zt(e,t){this.x=e||0,this.y=t||0}function Ai(){this.elements=[1,0,0,0,1,0,0,0,1],0Number.EPSILON){var Ge=Math.sqrt(Le),et=Math.atan2(Ge,ye*Ae);me=Math.sin(me*et)/Ge,m=Math.sin(m*et)/Ge}var Fe=m*Ae;if(x=x*me+ee*Fe,L=L*me+ie*Fe,j=j*me+z*Fe,Z=Z*me+he*Fe,me===1-m){var at=1/Math.sqrt(x*x+L*L+j*j+Z*Z);x*=at,L*=at,j*=at,Z*=at}}e[t]=x,e[t+1]=L,e[t+2]=j,e[t+3]=Z}}),Object.defineProperties(Gi.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(Gi.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,l=e._z,d=e.order,m=Math.cos,x=Math.sin,L=m(n/2),j=m(i/2),Z=m(l/2),ee=x(n/2),ie=x(i/2),z=x(l/2);return d==="XYZ"?(this._x=ee*j*Z+L*ie*z,this._y=L*ie*Z-ee*j*z,this._z=L*j*z+ee*ie*Z,this._w=L*j*Z-ee*ie*z):d==="YXZ"?(this._x=ee*j*Z+L*ie*z,this._y=L*ie*Z-ee*j*z,this._z=L*j*z-ee*ie*Z,this._w=L*j*Z+ee*ie*z):d==="ZXY"?(this._x=ee*j*Z-L*ie*z,this._y=L*ie*Z+ee*j*z,this._z=L*j*z+ee*ie*Z,this._w=L*j*Z-ee*ie*z):d==="ZYX"?(this._x=ee*j*Z-L*ie*z,this._y=L*ie*Z+ee*j*z,this._z=L*j*z-ee*ie*Z,this._w=L*j*Z+ee*ie*z):d==="YZX"?(this._x=ee*j*Z+L*ie*z,this._y=L*ie*Z+ee*j*z,this._z=L*j*z-ee*ie*Z,this._w=L*j*Z-ee*ie*z):d==="XZY"&&(this._x=ee*j*Z-L*ie*z,this._y=L*ie*Z-ee*j*z,this._z=L*j*z+ee*ie*Z,this._w=L*j*Z+ee*ie*z),t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t,n=e.elements,i=n[0],l=n[4],d=n[8],m=n[1],x=n[5],L=n[9],j=n[2],Z=n[6],ee=n[10],ie=i+x+ee;return 0Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(yr.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,l=e._z,d=e._w,m=t._x,x=t._y,L=t._z,j=t._w;return this._x=n*j+d*m+i*L-l*x,this._y=i*j+d*x+l*m-n*L,this._z=l*j+d*L+n*x-i*m,this._w=d*j-n*m-i*x-l*L,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,i=this._y,l=this._z,d=this._w,m=d*e._w+n*e._x+i*e._y+l*e._z;if(m<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,m=-m):this.copy(e),1<=m)return this._w=d,this._x=n,this._y=i,this._z=l,this;var x=1-m*m;if(x<=Number.EPSILON){var L=1-t;return this._w=L*d+t*this._w,this._x=L*n+t*this._x,this._y=L*i+t*this._y,this._z=L*l+t*this._z,this.normalize(),this._onChangeCallback(),this}var j=Math.sqrt(x),Z=Math.atan2(j,m),ee=Math.sin((1-t)*Z)/j,ie=Math.sin(t*Z)/j;return this._w=d*ee+this._w*ie,this._x=n*ee+this._x*ie,this._y=i*ee+this._y*ie,this._z=l*ee+this._z*ie,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var bs=new Re,Hs=new Gi;function Re(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(Re.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Hs.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Hs.setFromAxisAngle(e,t))},applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,l=e.elements;return this.x=l[0]*t+l[3]*n+l[6]*i,this.y=l[1]*t+l[4]*n+l[7]*i,this.z=l[2]*t+l[5]*n+l[8]*i,this},applyNormalMatrix:function(e){return this.applyMatrix3(e).normalize()},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,l=e.elements,d=1/(l[3]*t+l[7]*n+l[11]*i+l[15]);return this.x=(l[0]*t+l[4]*n+l[8]*i+l[12])*d,this.y=(l[1]*t+l[5]*n+l[9]*i+l[13])*d,this.z=(l[2]*t+l[6]*n+l[10]*i+l[14])*d,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,l=e.x,d=e.y,m=e.z,x=e.w,L=x*t+d*i-m*n,j=x*n+m*t-l*i,Z=x*i+l*n-d*t,ee=-l*t-d*n-m*i;return this.x=L*x+ee*-l+j*-m-Z*-d,this.y=j*x+ee*-d+Z*-l-L*-m,this.z=Z*x+ee*-m+L*-d-j*-l,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,l=e.elements;return this.x=l[0]*t+l[4]*n+l[8]*i,this.y=l[1]*t+l[5]*n+l[9]*i,this.z=l[2]*t+l[6]*n+l[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,l=e.z,d=t.x,m=t.y,x=t.z;return this.x=i*x-l*m,this.y=l*d-n*x,this.z=n*m-i*d,this},projectOnVector:function(e){var t=e.lengthSq();if(t===0)return this.set(0,0,0);var n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)},projectOnPlane:function(e){return bs.copy(this).projectOnVector(e),this.sub(bs)},reflect:function(e){return this.sub(bs.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;var n=this.dot(e)/t;return Math.acos(yr.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,4*t)},setFromMatrix3Column:function(e,t){return this.fromArray(e.elements,3*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var Eo=new Re,ra=new fr,uu=new Re(0,0,0),Ms=new Re(1,1,1),Ao=new Re,Ws=new Re,_a=new Re;function fr(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0x)return!1}return!0}Object.assign(Ki.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,l=-1/0,d=-1/0,m=-1/0,x=0,L=e.length;xthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Re),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,zr),zr.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var t,n;return n=0=-e.constant},intersectsTriangle:function(e){if(this.isEmpty())return!1;this.getCenter(Uo),ua.subVectors(this.max,Uo),Ta.subVectors(e.a,Uo),dr.subVectors(e.b,Uo),Ca.subVectors(e.c,Uo),vr.subVectors(dr,Ta),Wn.subVectors(Ca,dr),lo.subVectors(Ta,Ca);var t=[0,-vr.z,vr.y,0,-Wn.z,Wn.y,0,-lo.z,lo.y,vr.z,0,-vr.x,Wn.z,0,-Wn.x,lo.z,0,-lo.x,-vr.y,vr.x,0,-Wn.y,Wn.x,0,-lo.y,lo.x,0];return!!co(t,Ta,dr,Ca,ua)&&!!co(t=[1,0,0,0,1,0,0,0,1],Ta,dr,Ca,ua)&&(Ho.crossVectors(vr,Wn),co(t=[Ho.x,Ho.y,Ho.z],Ta,dr,Ca,ua))},clampPoint:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Re),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return zr.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return e===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(zr).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()||(Yr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Yr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Yr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Yr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Yr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Yr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Yr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Yr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Yr)),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var zi=new Ki;function Zr(e,t){this.center=e!==void 0?e:new Re,this.radius=t!==void 0?t:0}Object.assign(Zr.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;t!==void 0?n.copy(t):zi.setFromPoints(e).getCenter(n);for(var i=0,l=0,d=e.length;lthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Ki),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Kr=new Re,Li=new Re,Ha=new Re,bi=new Re,Jn=new Re,li=new Re,ri=new Re;function Pr(e,t){this.origin=e!==void 0?e:new Re,this.direction=t!==void 0?t:new Re(0,0,-1)}Object.assign(Pr.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn("THREE.Ray: .at() target is now required"),t=new Re),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Kr)),this},closestPointToPoint:function(e,t){t===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Re),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Kr.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kr.copy(this.direction).multiplyScalar(t).add(this.origin),Kr.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){Li.copy(e).add(t).multiplyScalar(.5),Ha.copy(t).sub(e).normalize(),bi.copy(this.origin).sub(Li);var l,d,m,x,L=.5*e.distanceTo(t),j=-this.direction.dot(Ha),Z=bi.dot(this.direction),ee=-bi.dot(Ha),ie=bi.lengthSq(),z=Math.abs(1-j*j);if(0>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=yr.euclideanModulo(e,1),t=yr.clamp(t,0,1),n=yr.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,l=2*n-i;this.r=Ct(l,i,e+1/3),this.g=Ct(l,i,e),this.b=Ct(l,i,e-1/3)}return this},setStyle:function(e){function t(ee){ee!==void 0&&parseFloat(ee)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,l=n[1],d=n[2];switch(l){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(d)){var m=parseFloat(i[1])/360,x=parseInt(i[2],10)/100,L=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(m,x,L)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var j=n[1],Z=j.length;if(Z===3)return this.r=parseInt(j.charAt(0)+j.charAt(0),16)/255,this.g=parseInt(j.charAt(1)+j.charAt(1),16)/255,this.b=parseInt(j.charAt(2)+j.charAt(2),16)/255,this;if(Z===6)return this.r=parseInt(j.charAt(0)+j.charAt(1),16)/255,this.g=parseInt(j.charAt(2)+j.charAt(3),16)/255,this.b=parseInt(j.charAt(4)+j.charAt(5),16)/255,this}return e&&0t&&(t=e[n]);return t}Object.defineProperty(Qt.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}}),Object.assign(Qt.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,l=this.itemSize;in.far?null:{distance:L,point:Ol.clone(),object:e}}function Pl(e,t,n,i,l,d,m,x,L,j,Z,ee){ja.fromBufferAttribute(l,j),as.fromBufferAttribute(l,Z),uo.fromBufferAttribute(l,ee);var ie=e.morphTargetInfluences;if(t.morphTargets&&d&&ie){Cs.set(0,0,0),Po.set(0,0,0),lc.set(0,0,0);for(var z=0,he=d.length;z"," #include ","}"].join(` `),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {"," vec3 direction = normalize( vWorldDirection );"," vec2 sampleUV;"," sampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;"," sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;"," gl_FragColor = texture2D( tEquirect, sampleUV );","}"].join(` `)},l=new Ya({type:"CubemapFromEquirect",uniforms:Ss(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:M,blending:T});l.uniforms.tEquirect.value=t;var d=new Ti(new cc(5,5,5),l);n.add(d);var m=new Ys(1,10,1);return m.renderTarget=this,m.renderTarget.texture.name="CubeCameraTexture",m.update(e,n),d.geometry.dispose(),d.material.dispose(),this},((Rl.prototype=Object.create(Xr.prototype)).constructor=Rl).prototype.isDataTexture=!0;var Ks=new Zr,$s=new Re;function Qs(e,t,n,i,l,d){this.planes=[e!==void 0?e:new ia,t!==void 0?t:new ia,n!==void 0?n:new ia,i!==void 0?i:new ia,l!==void 0?l:new ia,d!==void 0?d:new ia]}Object.assign(Qs.prototype,{set:function(e,t,n,i,l,d){var m=this.planes;return m[0].copy(e),m[1].copy(t),m[2].copy(n),m[3].copy(i),m[4].copy(l),m[5].copy(d),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],l=n[1],d=n[2],m=n[3],x=n[4],L=n[5],j=n[6],Z=n[7],ee=n[8],ie=n[9],z=n[10],he=n[11],me=n[12],ye=n[13],Ae=n[14],Le=n[15];return t[0].setComponents(m-i,Z-x,he-ee,Le-me).normalize(),t[1].setComponents(m+i,Z+x,he+ee,Le+me).normalize(),t[2].setComponents(m+l,Z+L,he+ie,Le+ye).normalize(),t[3].setComponents(m-l,Z-L,he-ie,Le-ye).normalize(),t[4].setComponents(m-d,Z-j,he-z,Le-Ae).normalize(),t[5].setComponents(m+d,Z+j,he+z,Le+Ae).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Ks.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ks)},intersectsSprite:function(e){return Ks.center.set(0,0,0),Ks.radius=.7071067811865476,Ks.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ks)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,l=0;l<6;l++)if(t[l].distanceToPoint(n) 0.0 ) { distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); } return distanceFalloff; #else if( cutoffDistance > 0.0 && decayExponent > 0.0 ) { return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent ); } return 1.0; #endif } vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) { return RECIPROCAL_PI * diffuseColor; } vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) { float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH ); return ( 1.0 - specularColor ) * fresnel + specularColor; } vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) { float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV ); vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0; return Fr * fresnel + F0; } float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); return 1.0 / ( gl * gv ); } float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { float a2 = pow2( alpha ); float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); return 0.5 / max( gv + gl, EPSILON ); } float D_GGX( const in float alpha, const in float dotNH ) { float a2 = pow2( alpha ); float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; return RECIPROCAL_PI * a2 / pow2( denom ); } vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) { float alpha = pow2( roughness ); vec3 halfDir = normalize( incidentLight.direction + viewDir ); float dotNL = saturate( dot( normal, incidentLight.direction ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); vec3 F = F_Schlick( specularColor, dotLH ); float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); return F * ( G * D ); } vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { const float LUT_SIZE = 64.0; const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; const float LUT_BIAS = 0.5 / LUT_SIZE; float dotNV = saturate( dot( N, V ) ); vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); uv = uv * LUT_SCALE + LUT_BIAS; return uv; } float LTC_ClippedSphereFormFactor( const in vec3 f ) { float l = length( f ); return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); } vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { float x = dot( v1, v2 ); float y = abs( x ); float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; float b = 3.4175940 + ( 4.1616724 + y ) * y; float v = a / b; float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; return cross( v1, v2 ) * theta_sintheta; } vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; vec3 lightNormal = cross( v1, v2 ); if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); vec3 T1, T2; T1 = normalize( V - N * dot( V, N ) ); T2 = - cross( N, T1 ); mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); vec3 coords[ 4 ]; coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); coords[ 0 ] = normalize( coords[ 0 ] ); coords[ 1 ] = normalize( coords[ 1 ] ); coords[ 2 ] = normalize( coords[ 2 ] ); coords[ 3 ] = normalize( coords[ 3 ] ); vec3 vectorFormFactor = vec3( 0.0 ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); return vec3( result ); } vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); vec2 brdf = integrateSpecularBRDF( dotNV, roughness ); return specularColor * brdf.x + brdf.y; } void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness ); vec2 brdf = integrateSpecularBRDF( dotNV, roughness ); vec3 FssEss = F * brdf.x + brdf.y; float Ess = brdf.x + brdf.y; float Ems = 1.0 - Ess; vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } float G_BlinnPhong_Implicit( ) { return 0.25; } float D_BlinnPhong( const in float shininess, const in float dotNH ) { return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess ); } vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) { vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir ); float dotNH = saturate( dot( geometry.normal, halfDir ) ); float dotLH = saturate( dot( incidentLight.direction, halfDir ) ); vec3 F = F_Schlick( specularColor, dotLH ); float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); } float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) { return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 ); } float BlinnExponentToGGXRoughness( const in float blinnExponent ) { return sqrt( 2.0 / ( blinnExponent + 2.0 ) ); } #if defined( USE_SHEEN ) float D_Charlie(float roughness, float NoH) { float invAlpha = 1.0 / roughness; float cos2h = NoH * NoH; float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI); } float V_Neubelt(float NoV, float NoL) { return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV))); } vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) { vec3 N = geometry.normal; vec3 V = geometry.viewDir; vec3 H = normalize( V + L ); float dotNH = saturate( dot( N, H ) ); return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) ); } #endif`,bumpmap_pars_fragment:`#ifdef USE_BUMPMAP uniform sampler2D bumpMap; uniform float bumpScale; vec2 dHdxy_fwd() { vec2 dSTdx = dFdx( vUv ); vec2 dSTdy = dFdy( vUv ); float Hll = bumpScale * texture2D( bumpMap, vUv ).x; float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll; float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll; return vec2( dBx, dBy ); } vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) { vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) ); vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) ); vec3 vN = surf_norm; vec3 R1 = cross( vSigmaY, vN ); vec3 R2 = cross( vN, vSigmaX ); float fDet = dot( vSigmaX, R1 ); fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 ); vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } #endif`,clipping_planes_fragment:`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard; } #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped; } if ( clipped ) discard; #endif #endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 #if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) varying vec3 vViewPosition; #endif uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) varying vec3 vViewPosition; #endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP ) vViewPosition = - mvPosition.xyz; #endif`,color_fragment:`#ifdef USE_COLOR diffuseColor.rgb *= vColor; #endif`,color_pars_fragment:`#ifdef USE_COLOR varying vec3 vColor; #endif`,color_pars_vertex:`#ifdef USE_COLOR varying vec3 vColor; #endif`,color_vertex:`#ifdef USE_COLOR vColor.xyz = color.xyz; #endif`,common:`#define PI 3.14159265359 #define PI2 6.28318530718 #define PI_HALF 1.5707963267949 #define RECIPROCAL_PI 0.31830988618 #define RECIPROCAL_PI2 0.15915494 #define LOG2 1.442695 #define EPSILON 1e-6 #ifndef saturate #define saturate(a) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement(a) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } float pow3( const in float x ) { return x*x*x; } float pow4( const in float x ) { float x2 = x*x; return x2*x2; } float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); } highp float rand( const in vec2 uv ) { const highp float a = 12.9898, b = 78.233, c = 43758.5453; highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); return fract(sin(sn) * c); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); } float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif struct IncidentLight { vec3 color; vec3 direction; bool visible; }; struct ReflectedLight { vec3 directDiffuse; vec3 directSpecular; vec3 indirectDiffuse; vec3 indirectSpecular; }; struct GeometricContext { vec3 position; vec3 normal; vec3 viewDir; #ifdef CLEARCOAT vec3 clearcoatNormal; #endif }; vec3 transformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); } vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); } vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { float distance = dot( planeNormal, point - pointOnPlane ); return - distance * planeNormal + point; } float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) { return sign( dot( point - pointOnPlane, planeNormal ) ); } vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) { return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine; } mat3 transposeMat3( const in mat3 m ) { mat3 tmp; tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); return tmp; } float linearToRelativeLuminance( const in vec3 color ) { vec3 weights = vec3( 0.2126, 0.7152, 0.0722 ); return dot( weights, color.rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; }`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_maxMipLevel 8.0 #define cubeUV_minMipLevel 4.0 #define cubeUV_maxTileSize 256.0 #define cubeUV_minTileSize 16.0 float getFace(vec3 direction) { vec3 absDirection = abs(direction); float face = -1.0; if (absDirection.x > absDirection.z) { if (absDirection.x > absDirection.y) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if (absDirection.z > absDirection.y) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV(vec3 direction, float face) { vec2 uv; if (face == 0.0) { uv = vec2(-direction.z, direction.y) / abs(direction.x); } else if (face == 1.0) { uv = vec2(direction.x, -direction.z) / abs(direction.y); } else if (face == 2.0) { uv = direction.xy / abs(direction.z); } else if (face == 3.0) { uv = vec2(direction.z, direction.y) / abs(direction.x); } else if (face == 4.0) { uv = direction.xz / abs(direction.y); } else { uv = vec2(-direction.x, direction.y) / abs(direction.z); } return 0.5 * (uv + 1.0); } vec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) { float face = getFace(direction); float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0); mipInt = max(mipInt, cubeUV_minMipLevel); float faceSize = exp2(mipInt); float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize); vec2 uv = getUV(direction, face) * (faceSize - 1.0); vec2 f = fract(uv); uv += 0.5 - f; if (face > 2.0) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; if(mipInt < cubeUV_maxMipLevel){ uv.y += 2.0 * cubeUV_maxTileSize; } uv.y += filterInt * 2.0 * cubeUV_minTileSize; uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize); uv *= texelSize; vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb; uv.x += texelSize; vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb; uv.y += texelSize; vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb; uv.x -= texelSize; vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb; vec3 tm = mix(tl, tr, f.x); vec3 bm = mix(bl, br, f.x); return mix(tm, bm, f.y); } #define r0 1.0 #define v0 0.339 #define m0 -2.0 #define r1 0.8 #define v1 0.276 #define m1 -1.0 #define r4 0.4 #define v4 0.046 #define m4 2.0 #define r5 0.305 #define v5 0.016 #define m5 3.0 #define r6 0.21 #define v6 0.0038 #define m6 4.0 float roughnessToMip(float roughness) { float mip = 0.0; if (roughness >= r1) { mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0; } else if (roughness >= r4) { mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1; } else if (roughness >= r5) { mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4; } else if (roughness >= r6) { mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5; } else { mip = -2.0 * log2(1.16 * roughness); } return mip; } vec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) { float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel); float mipF = fract(mip); float mipInt = floor(mip); vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt); if (mipF == 0.0) { return vec4(color0, 1.0); } else { vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0); return vec4(mix(color0, color1, mipF), 1.0); } } #endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING transformedNormal = mat3( instanceMatrix ) * transformedNormal; #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); #endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb; totalEmissiveRadiance *= emissiveColor.rgb; #endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:` vec4 LinearToLinear( in vec4 value ) { return value; } vec4 GammaToLinear( in vec4 value, in float gammaFactor ) { return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a ); } vec4 LinearToGamma( in vec4 value, in float gammaFactor ) { return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a ); } vec4 sRGBToLinear( in vec4 value ) { return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); } vec4 LinearTosRGB( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); } vec4 RGBEToLinear( in vec4 value ) { return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 ); } vec4 LinearToRGBE( in vec4 value ) { float maxComponent = max( max( value.r, value.g ), value.b ); float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 ); return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 ); } vec4 RGBMToLinear( in vec4 value, in float maxRange ) { return vec4( value.rgb * value.a * maxRange, 1.0 ); } vec4 LinearToRGBM( in vec4 value, in float maxRange ) { float maxRGB = max( value.r, max( value.g, value.b ) ); float M = clamp( maxRGB / maxRange, 0.0, 1.0 ); M = ceil( M * 255.0 ) / 255.0; return vec4( value.rgb / ( M * maxRange ), M ); } vec4 RGBDToLinear( in vec4 value, in float maxRange ) { return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 ); } vec4 LinearToRGBD( in vec4 value, in float maxRange ) { float maxRGB = max( value.r, max( value.g, value.b ) ); float D = max( maxRange / maxRGB, 1.0 ); D = clamp( floor( D ) / 255.0, 0.0, 1.0 ); return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D ); } const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 ); vec4 LinearToLogLuv( in vec4 value ) { vec3 Xp_Y_XYZp = cLogLuvM * value.rgb; Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) ); vec4 vResult; vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z; float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0; vResult.w = fract( Le ); vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0; return vResult; } const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 ); vec4 LogLuvToLinear( in vec4 value ) { float Le = value.z * 255.0 + value.w; vec3 Xp_Y_XYZp; Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 ); Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y; Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z; vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb; return vec4( max( vRGB, 0.0 ), 1.0 ); }`,envmap_fragment:`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); #endif #else vec3 reflectVec = vReflect; #endif #ifdef ENVMAP_TYPE_CUBE vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 ); #elif defined( ENVMAP_TYPE_EQUIREC ) vec2 sampleUV; reflectVec = normalize( reflectVec ); sampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5; vec4 envColor = texture2D( envMap, sampleUV ); #elif defined( ENVMAP_TYPE_SPHERE ) reflectVec = normalize( reflectVec ); vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ); vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 ); #else vec4 envColor = vec4( 0.0 ); #endif #ifndef ENVMAP_TYPE_CUBE_UV envColor = envMapTexelToLinear( envColor ); #endif #ifdef ENVMAP_BLENDING_MULTIPLY outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_MIX ) outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif #endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform int maxMipLevel; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,envmap_physical_pars_fragment:`#if defined( USE_ENVMAP ) #ifdef ENVMAP_MODE_REFRACTION uniform float refractionRatio; #endif vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) { vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); #ifdef ENVMAP_TYPE_CUBE vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) ); #else vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); #else vec4 envMapColor = vec4( 0.0 ); #endif return PI * envMapColor.rgb * envMapIntensity; } float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) { float maxMIPLevelScalar = float( maxMIPLevel ); float sigma = PI * roughness * roughness / ( 1.0 + roughness ); float desiredMIPLevel = maxMIPLevelScalar + log2( sigma ); return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar ); } vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) { #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( -viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); #else vec3 reflectVec = refract( -viewDir, normal, refractionRatio ); #endif reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel ); #ifdef ENVMAP_TYPE_CUBE vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel ); #else vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_CUBE_UV ) vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); #elif defined( ENVMAP_TYPE_EQUIREC ) vec2 sampleUV; sampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5; #ifdef TEXTURE_LOD_EXT vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel ); #else vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #elif defined( ENVMAP_TYPE_SPHERE ) vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) ); #ifdef TEXTURE_LOD_EXT vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel ); #else vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel ); #endif envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb; #endif return envMapColor.rgb * envMapIntensity; } #endif`,envmap_vertex:`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vReflect = reflect( cameraToVertex, worldNormal ); #else vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif #endif`,fog_vertex:`#ifdef USE_FOG fogDepth = -mvPosition.z; #endif`,fog_pars_vertex:`#ifdef USE_FOG varying float fogDepth; #endif`,fog_fragment:`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, fogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,fog_pars_fragment:`#ifdef USE_FOG uniform vec3 fogColor; varying float fogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { float dotNL = dot( normal, lightDirection ); vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); #ifdef USE_GRADIENTMAP return texture2D( gradientMap, coord ).rgb; #else return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); #endif }`,lightmap_fragment:`#ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #endif`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,lights_lambert_vertex:`vec3 diffuse = vec3( 1.0 ); GeometricContext geometry; geometry.position = mvPosition.xyz; geometry.normal = normalize( transformedNormal ); geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz ); GeometricContext backGeometry; backGeometry.position = geometry.position; backGeometry.normal = -geometry.normal; backGeometry.viewDir = geometry.viewDir; vLightFront = vec3( 0.0 ); vIndirectFront = vec3( 0.0 ); #ifdef DOUBLE_SIDED vLightBack = vec3( 0.0 ); vIndirectBack = vec3( 0.0 ); #endif IncidentLight directLight; float dotNL; vec3 directLightColor_Diffuse; #if NUM_POINT_LIGHTS > 0 #pragma unroll_loop for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #endif #if NUM_SPOT_LIGHTS > 0 #pragma unroll_loop for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #endif #if NUM_DIR_LIGHTS > 0 #pragma unroll_loop for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = PI * directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( -dotNL ) * directLightColor_Diffuse; #endif } #endif #if NUM_HEMI_LIGHTS > 0 #pragma unroll_loop for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); #ifdef DOUBLE_SIDED vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry ); #endif } #endif`,lights_pars_begin:`uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { float x = normal.x, y = normal.y, z = normal.z; vec3 result = shCoefficients[ 0 ] * 0.886227; result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); return result; } vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) { vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) { directLight.color = directionalLight.color; directLight.direction = directionalLight.direction; directLight.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = pointLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); directLight.color = pointLight.color; directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay ); directLight.visible = ( directLight.color != vec3( 0.0 ) ); } #endif #if NUM_SPOT_LIGHTS > 0 struct SpotLight { vec3 position; vec3 direction; vec3 color; float distance; float decay; float coneCos; float penumbraCos; int shadow; float shadowBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) { vec3 lVector = spotLight.position - geometry.position; directLight.direction = normalize( lVector ); float lightDistance = length( lVector ); float angleCos = dot( directLight.direction, spotLight.direction ); if ( angleCos > spotLight.coneCos ) { float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos ); directLight.color = spotLight.color; directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay ); directLight.visible = true; } else { directLight.color = vec3( 0.0 ); directLight.visible = false; } } #endif #if NUM_RECT_AREA_LIGHTS > 0 struct RectAreaLight { vec3 color; vec3 position; vec3 halfWidth; vec3 halfHeight; }; uniform sampler2D ltc_1; uniform sampler2D ltc_2; uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; #endif #if NUM_HEMI_LIGHTS > 0 struct HemisphereLight { vec3 direction; vec3 skyColor; vec3 groundColor; }; uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) { float dotNL = dot( geometry.normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif return irradiance; } #endif`,lights_toon_fragment:`ToonMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif struct ToonMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon #define Material_LightProbeLOD( material ) (0)`,lights_phong_fragment:`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; float specularShininess; float specularStrength; }; void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength; } void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong #define Material_LightProbeLOD( material ) (0)`,lights_physical_fragment:`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness; material.specularRoughness = min( material.specularRoughness, 1.0 ); #ifdef REFLECTIVITY material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor ); #endif #ifdef CLEARCOAT material.clearcoat = saturate( clearcoat ); material.clearcoatRoughness = max( clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_SHEEN material.sheenColor = sheen; #endif`,lights_physical_pars_fragment:`struct PhysicalMaterial { vec3 diffuseColor; float specularRoughness; vec3 specularColor; #ifdef CLEARCOAT float clearcoat; float clearcoatRoughness; #endif #ifdef USE_SHEEN vec3 sheenColor; #endif }; #define MAXIMUM_SPECULAR_COEFFICIENT 0.16 #define DEFAULT_SPECULAR_COEFFICIENT 0.04 float clearcoatDHRApprox( const in float roughness, const in float dotNL ) { return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) ); } #if NUM_RECT_AREA_LIGHTS > 0 void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { vec3 normal = geometry.normal; vec3 viewDir = geometry.viewDir; vec3 position = geometry.position; vec3 lightPos = rectAreaLight.position; vec3 halfWidth = rectAreaLight.halfWidth; vec3 halfHeight = rectAreaLight.halfHeight; vec3 lightColor = rectAreaLight.color; float roughness = material.specularRoughness; vec3 rectCoords[ 4 ]; rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; vec2 uv = LTC_Uv( normal, viewDir, roughness ); vec4 t1 = texture2D( ltc_1, uv ); vec4 t2 = texture2D( ltc_2, uv ); mat3 mInv = mat3( vec3( t1.x, 0, t1.y ), vec3( 0, 1, 0 ), vec3( t1.z, 0, t1.w ) ); vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); } #endif void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS irradiance *= PI; #endif #ifdef CLEARCOAT float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = ccDotNL * directLight.color; #ifndef PHYSICALLY_CORRECT_LIGHTS ccIrradiance *= PI; #endif float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); #else float clearcoatDHR = 0.0; #endif #ifdef USE_SHEEN reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen( material.specularRoughness, directLight.direction, geometry, material.sheenColor ); #else reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness); #endif reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor ); } void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { #ifdef CLEARCOAT float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness ); float ccDotNL = ccDotNV; float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL ); #else float clearcoatDHR = 0.0; #endif float clearcoatInv = 1.0 - clearcoatDHR; vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering ); vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) ); reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #define RE_Direct RE_Direct_Physical #define RE_Direct_RectArea RE_Direct_RectArea_Physical #define RE_IndirectDiffuse RE_IndirectDiffuse_Physical #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); }`,lights_fragment_begin:` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); #ifdef CLEARCOAT geometry.clearcoatNormal = clearcoatNormal; #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #pragma unroll_loop for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointDirectLightIrradiance( pointLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) directLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; #pragma unroll_loop for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotDirectLightIrradiance( spotLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) directLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #pragma unroll_loop for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); } #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); irradiance += getLightProbeIrradiance( lightProbe, geometry ); #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry ); } #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #ifndef PHYSICALLY_CORRECT_LIGHTS lightMapIrradiance *= PI; #endif irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel ); #ifdef CLEARCOAT clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel ); #endif #endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif`,map_fragment:`#ifdef USE_MAP vec4 texelColor = texture2D( map, vUv ); texelColor = mapTexelToLinear( texelColor ); diffuseColor *= texelColor; #endif`,map_pars_fragment:`#ifdef USE_MAP uniform sampler2D map; #endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #ifdef USE_MAP vec4 mapTexel = texture2D( map, uv ); diffuseColor *= mapTexelToLinear( mapTexel ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,map_particle_pars_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,metalnessmap_fragment:`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; #endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif`,normal_fragment_begin:`#ifdef FLAT_SHADED vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) ); vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) ); vec3 normal = normalize( cross( fdx, fdy ) ); #else vec3 normal = normalize( vNormal ); #ifdef DOUBLE_SIDED normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 ); #endif #ifdef USE_TANGENT vec3 tangent = normalize( vTangent ); vec3 bitangent = normalize( vBitangent ); #ifdef DOUBLE_SIDED tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 ); bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 ); #endif #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) mat3 vTBN = mat3( tangent, bitangent, normal ); #endif #endif #endif vec3 geometryNormal = normal;`,normal_fragment_maps:`#ifdef OBJECTSPACE_NORMALMAP normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 ); #endif normal = normalize( normalMatrix * normal ); #elif defined( TANGENTSPACE_NORMALMAP ) vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; #ifdef USE_TANGENT normal = normalize( vTBN * mapN ); #else normal = perturbNormal2Arb( -vViewPosition, normal, mapN ); #endif #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() ); #endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef OBJECTSPACE_NORMALMAP uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) { vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) ); vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) ); vec2 st0 = dFdx( vUv.st ); vec2 st1 = dFdy( vUv.st ); float scale = sign( st1.t * st0.s - st0.t * st1.s ); vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale ); vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale ); vec3 N = normalize( surf_norm ); mat3 tsn = mat3( S, T, N ); mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 ); return normalize( tsn * mapN ); } #endif`,clearcoat_normal_fragment_begin:`#ifdef CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; #ifdef USE_TANGENT clearcoatNormal = normalize( vTBN * clearcoatMapN ); #else clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN ); #endif #endif`,clearcoat_normalmap_pars_fragment:`#ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { return 2.0 * rgb.xyz - 1.0; } const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); const float ShiftRight8 = 1. / 256.; vec4 packDepthToRGBA( const in float v ) { vec4 r = vec4( fract( v * PackFactors ), v ); r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; } float unpackRGBAToDepth( const in vec4 v ) { return dot( v, UnpackFactors ); } vec4 pack2HalfToRGBA( vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 )); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w); } vec2 unpackRGBATo2Half( vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { return ( viewZ + near ) / ( near - far ); } float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) { return linearClipZ * ( near - far ) - near; } float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { return (( near + viewZ ) * far ) / (( far - near ) * viewZ ); } float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * invClipZ - far ); }`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,dithering_pars_fragment:`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } #endif`,roughnessmap_fragment:`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; #endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,shadowmap_pars_fragment:`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { float shadow = 1.0; shadowCoord.xyz /= shadowCoord.w; shadowCoord.z += shadowBias; bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 ); bool inFrustum = all( inFrustumVec ); bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 ); bool frustumTest = all( frustumTestVec ); if ( frustumTest ) { #if defined( SHADOWMAP_TYPE_PCF ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx0 = - texelSize.x * shadowRadius; float dy0 = - texelSize.y * shadowRadius; float dx1 = + texelSize.x * shadowRadius; float dy1 = + texelSize.y * shadowRadius; float dx2 = dx0 / 2.0; float dy2 = dy0 / 2.0; float dx3 = dx1 / 2.0; float dy3 = dy1 / 2.0; shadow = ( texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) ) * ( 1.0 / 17.0 ); #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) vec2 texelSize = vec2( 1.0 ) / shadowMapSize; float dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #else shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); #endif } return shadow; } vec2 cubeToUV( vec3 v, float texelSizeY ) { vec3 absV = abs( v ); float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); absV *= scaleToCube; v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); vec2 planar = v.xy; float almostATexel = 1.5 * texelSizeY; float almostOne = 1.0 - almostATexel; if ( absV.z >= almostOne ) { if ( v.z > 0.0 ) planar.x = 4.0 - v.x; } else if ( absV.x >= almostOne ) { float signX = sign( v.x ); planar.x = v.z * signX + 2.0 * signX; } else if ( absV.y >= almostOne ) { float signY = sign( v.y ); planar.x = v.x + 2.0 * signY + 2.0; planar.y = v.z * signY - 2.0; } return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); } float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); vec3 lightToPosition = shadowCoord.xyz; float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; vec3 bd3D = normalize( lightToPosition ); #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; return ( texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) ) * ( 1.0 / 9.0 ); #else return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } #endif`,shadowmap_pars_vertex:`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,shadowmap_vertex:`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition; } #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 #pragma unroll_loop for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition; } #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition; } #endif #endif`,shadowmask_pars_fragment:`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLight directionalLight; #pragma unroll_loop for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLights[ i ]; shadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLight spotLight; #pragma unroll_loop for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLights[ i ]; shadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLight pointLight; #pragma unroll_loop for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLights[ i ]; shadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #endif #endif return shadow; }`,skinbase_vertex:`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,skinning_pars_vertex:`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; #ifdef BONE_TEXTURE uniform highp sampler2D boneTexture; uniform int boneTextureSize; mat4 getBoneMatrix( const in float i ) { float j = i * 4.0; float x = mod( j, float( boneTextureSize ) ); float y = floor( j / float( boneTextureSize ) ); float dx = 1.0 / float( boneTextureSize ); float dy = 1.0 / float( boneTextureSize ); y = dy * ( y + 0.5 ); vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } #else uniform mat4 boneMatrices[ MAX_BONES ]; mat4 getBoneMatrix( const in float i ) { mat4 bone = boneMatrices[ int(i) ]; return bone; } #endif #endif`,skinning_vertex:`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; skinned += boneMatY * skinVertex * skinWeight.y; skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; #endif`,skinnormal_vertex:`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; skinMatrix += skinWeight.z * boneMatZ; skinMatrix += skinWeight.w * boneMatW; skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif #endif`,specularmap_fragment:`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,tonemapping_pars_fragment:`#ifndef saturate #define saturate(a) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; uniform float toneMappingWhitePoint; vec3 LinearToneMapping( vec3 color ) { return toneMappingExposure * color; } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } #define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) ) vec3 Uncharted2ToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) ); } vec3 OptimizedCineonToneMapping( vec3 color ) { color *= toneMappingExposure; color = max( vec3( 0.0 ), color - 0.004 ); return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); } vec3 ACESFilmicToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) ); }`,uv_pars_fragment:`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; #endif`,uv_pars_vertex:`#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; #endif`,uv_vertex:`#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif`,uv2_pars_fragment:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`,uv2_pars_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; #endif`,uv2_vertex:`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; #endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`,background_frag:`uniform sampler2D t2D; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); gl_FragColor = mapTexelToLinear( texColor ); #include #include }`,background_vert:`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,cube_frag:`#include uniform float opacity; varying vec3 vWorldDirection; #include void main() { vec3 vReflect = vWorldDirection; #include gl_FragColor = envColor; gl_FragColor.a *= opacity; #include #include }`,cube_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,depth_frag:`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( gl_FragCoord.z ); #endif }`,depth_vert:`#include #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include }`,distanceRGBA_frag:`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,distanceRGBA_vert:`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,equirect_frag:`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV; sampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5; vec4 texColor = texture2D( tEquirect, sampleUV ); gl_FragColor = mapTexelToLinear( texColor ); #include #include }`,equirect_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,linedashed_frag:`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`,linedashed_vert:`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include void main() { #include vLineDistance = scale * lineDistance; vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); gl_Position = projectionMatrix * mvPosition; #include #include #include }`,meshbasic_frag:`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel= texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`,meshbasic_vert:`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #ifdef USE_ENVMAP #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,meshlambert_frag:`uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor ); #ifdef DOUBLE_SIDED reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; #else reflectedLight.indirectDiffuse += vIndirectFront; #endif #include reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ); #ifdef DOUBLE_SIDED reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; #else reflectedLight.directDiffuse = vLightFront; #endif reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask(); #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`,meshlambert_vert:`#define LAMBERT varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,meshmatcap_frag:`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include vec3 viewDir = normalize( vViewPosition ); vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); vec3 y = cross( viewDir, x ); vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; #ifdef USE_MATCAP vec4 matcapColor = texture2D( matcap, uv ); matcapColor = matcapTexelToLinear( matcapColor ); #else vec4 matcapColor = vec4( 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`,meshmatcap_vert:`#define MATCAP varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,meshtoon_frag:`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`,meshtoon_vert:`#define TOON varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,meshphong_frag:`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`,meshphong_vert:`#define PHONG varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,meshphysical_frag:`#define STANDARD #ifdef PHYSICAL #define REFLECTIVITY #define CLEARCOAT #define TRANSPARENCY #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef TRANSPARENCY uniform float transparency; #endif #ifdef REFLECTIVITY uniform float reflectivity; #endif #ifdef CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_SHEEN uniform vec3 sheen; #endif varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #ifdef TRANSPARENCY diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ); #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include #include }`,meshphysical_vert:`#define STANDARD varying vec3 vViewPosition; #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,normal_frag:`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #include #include #include #include #include #include void main() { #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); }`,normal_vert:`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif }`,points_frag:`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include #include }`,points_vert:`uniform float size; uniform float scale; #include #include #include #include #include #include void main() { #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,shadow_frag:`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,shadow_vert:`#include #include void main() { #include #include #include #include #include }`,sprite_frag:`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; gl_FragColor = vec4( outgoingLight, diffuseColor.a ); #include #include #include }`,sprite_vert:`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); vec2 scale; scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); #ifndef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) scale *= - mvPosition.z; #endif vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; vec2 rotatedPosition; rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; mvPosition.xy += rotatedPosition; gl_Position = projectionMatrix * mvPosition; #include #include #include }`},_o={basic:{uniforms:Qi([wn.common,wn.specularmap,wn.envmap,wn.aomap,wn.lightmap,wn.fog]),vertexShader:Er.meshbasic_vert,fragmentShader:Er.meshbasic_frag},lambert:{uniforms:Qi([wn.common,wn.specularmap,wn.envmap,wn.aomap,wn.lightmap,wn.emissivemap,wn.fog,wn.lights,{emissive:{value:new Qe(0)}}]),vertexShader:Er.meshlambert_vert,fragmentShader:Er.meshlambert_frag},phong:{uniforms:Qi([wn.common,wn.specularmap,wn.envmap,wn.aomap,wn.lightmap,wn.emissivemap,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.fog,wn.lights,{emissive:{value:new Qe(0)},specular:{value:new Qe(1118481)},shininess:{value:30}}]),vertexShader:Er.meshphong_vert,fragmentShader:Er.meshphong_frag},standard:{uniforms:Qi([wn.common,wn.envmap,wn.aomap,wn.lightmap,wn.emissivemap,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.roughnessmap,wn.metalnessmap,wn.fog,wn.lights,{emissive:{value:new Qe(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Er.meshphysical_vert,fragmentShader:Er.meshphysical_frag},toon:{uniforms:Qi([wn.common,wn.specularmap,wn.aomap,wn.lightmap,wn.emissivemap,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.gradientmap,wn.fog,wn.lights,{emissive:{value:new Qe(0)},specular:{value:new Qe(1118481)},shininess:{value:30}}]),vertexShader:Er.meshtoon_vert,fragmentShader:Er.meshtoon_frag},matcap:{uniforms:Qi([wn.common,wn.bumpmap,wn.normalmap,wn.displacementmap,wn.fog,{matcap:{value:null}}]),vertexShader:Er.meshmatcap_vert,fragmentShader:Er.meshmatcap_frag},points:{uniforms:Qi([wn.points,wn.fog]),vertexShader:Er.points_vert,fragmentShader:Er.points_frag},dashed:{uniforms:Qi([wn.common,wn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Er.linedashed_vert,fragmentShader:Er.linedashed_frag},depth:{uniforms:Qi([wn.common,wn.displacementmap]),vertexShader:Er.depth_vert,fragmentShader:Er.depth_frag},normal:{uniforms:Qi([wn.common,wn.bumpmap,wn.normalmap,wn.displacementmap,{opacity:{value:1}}]),vertexShader:Er.normal_vert,fragmentShader:Er.normal_frag},sprite:{uniforms:Qi([wn.sprite,wn.fog]),vertexShader:Er.sprite_vert,fragmentShader:Er.sprite_frag},background:{uniforms:{uvTransform:{value:new Ai},t2D:{value:null}},vertexShader:Er.background_vert,fragmentShader:Er.background_frag},cube:{uniforms:Qi([wn.envmap,{opacity:{value:1}}]),vertexShader:Er.cube_vert,fragmentShader:Er.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Er.equirect_vert,fragmentShader:Er.equirect_frag},distanceRGBA:{uniforms:Qi([wn.common,wn.displacementmap,{referencePosition:{value:new Re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Er.distanceRGBA_vert,fragmentShader:Er.distanceRGBA_frag},shadow:{uniforms:Qi([wn.lights,wn.fog,{color:{value:new Qe(0)},opacity:{value:1}}]),vertexShader:Er.shadow_vert,fragmentShader:Er.shadow_frag}};function Lr(e,t,n,i){var l,d,m=new Qe(0),x=0,L=null,j=0,Z=null;function ee(ie,z){t.buffers.color.setClear(ie.r,ie.g,ie.b,z,i)}return{getClearColor:function(){return m},setClearColor:function(ie,z){m.set(ie),ee(m,x=z!==void 0?z:1)},getClearAlpha:function(){return x},setClearAlpha:function(ie){ee(m,x=ie)},render:function(ie,z,he,me){var ye=z.background,Ae=e.xr,Le=Ae.getSession&&Ae.getSession();if(Le&&Le.environmentBlendMode==="additive"&&(ye=null),ye===null?ee(m,x):ye&&ye.isColor&&(ee(ye,1),me=!0),(e.autoClear||me)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),ye&&(ye.isCubeTexture||ye.isWebGLCubeRenderTarget||ye.mapping===yt)){d===void 0&&((d=new Ti(new cc(1,1,1),new Ya({type:"BackgroundCubeMaterial",uniforms:Ss(_o.cube.uniforms),vertexShader:_o.cube.vertexShader,fragmentShader:_o.cube.fragmentShader,side:M,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(et,Fe,at){this.matrixWorld.copyPosition(at.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(d));var Ge=ye.isWebGLCubeRenderTarget?ye.texture:ye;d.material.uniforms.envMap.value=Ge,d.material.uniforms.flipEnvMap.value=Ge.isCubeTexture?-1:1,L===ye&&j===Ge.version&&Z===e.toneMapping||(d.material.needsUpdate=!0,L=ye,j=Ge.version,Z=e.toneMapping),ie.unshift(d,d.geometry,d.material,0,0,null)}else ye&&ye.isTexture&&(l===void 0&&((l=new Ti(new el(2,2),new Ya({type:"BackgroundMaterial",uniforms:Ss(_o.background.uniforms),vertexShader:_o.background.vertexShader,fragmentShader:_o.background.fragmentShader,side:A,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(l)),(l.material.uniforms.t2D.value=ye).matrixAutoUpdate===!0&&ye.updateMatrix(),l.material.uniforms.uvTransform.value.copy(ye.matrix),L===ye&&j===ye.version&&Z===e.toneMapping||(l.material.needsUpdate=!0,j=(L=ye).version,Z=e.toneMapping),ie.unshift(l,l.geometry,l.material,0,0,null))}}}function hc(e,t){return Math.abs(t[1])-Math.abs(e[1])}function Ds(e,t,n,i,l,d,m,x,L,j){Xr.call(this,e=e!==void 0?e:[],t=t!==void 0?t:Vt,n,i,l,d,m=m!==void 0?m:ti,x,L,j),this.flipY=!1}function gu(e,t,n,i){Xr.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=dt,this.minFilter=dt,this.wrapR=On,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}function Na(e,t,n,i){Xr.call(this,null),this.image={data:e||null,width:t||1,height:n||1,depth:i||1},this.magFilter=dt,this.minFilter=dt,this.wrapR=On,this.generateMipmaps=!1,this.flipY=!1,this.needsUpdate=!0}_o.physical={uniforms:Qi([_o.standard.uniforms,{transparency:{value:0},clearcoat:{value:0},clearcoatRoughness:{value:0},sheen:{value:new Qe(0)},clearcoatNormalScale:{value:new zt(1,1)},clearcoatNormalMap:{value:null}}]),vertexShader:Er.meshphysical_vert,fragmentShader:Er.meshphysical_frag},((Ds.prototype=Object.create(Xr.prototype)).constructor=Ds).prototype.isCubeTexture=!0,Object.defineProperty(Ds.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}}),((gu.prototype=Object.create(Xr.prototype)).constructor=gu).prototype.isDataTexture2DArray=!0,((Na.prototype=Object.create(Xr.prototype)).constructor=Na).prototype.isDataTexture3D=!0;var zh=new Xr,yu=new gu,hh=new Na,dh=new Ds,ph=[],Za=[],ss=new Float32Array(16),vu=new Float32Array(9),fh=new Float32Array(4);function ls(e,t,n){var i=e[0];if(i<=0||0/gm;function nr(e){return e.replace(jl,Su)}function Su(e,t){var n=Er[t];if(n===void 0)throw new Error("Can not resolve #include <"+t+">");return nr(n)}var Ch=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function Os(e){return e.replace(Ch,Sh)}function Sh(e,t,n,i){for(var l="",d=parseInt(t);d void main() { float mean = 0.0; float squared_mean = 0.0; float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) ); for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) { #ifdef HORIZONAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean * HALF_SAMPLE_RATE; squared_mean = squared_mean * HALF_SAMPLE_RATE; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`,od=`void main() { gl_Position = vec4( position, 1.0 ); }`;function Oh(e,t,n){var i=new Qs,l=new zt,d=new zt,m=new Jr,x=[],L=[],j={},Z={0:M,1:A,2:N},ee=new Ya({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new zt},radius:{value:4}},vertexShader:od,fragmentShader:ad}),ie=ee.clone();ie.defines.HORIZONAL_PASS=1;var z=new Cn;z.setAttribute("position",new Qt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var he=new Ti(z,ee),me=this;function ye(Fe,at){var Je=t.update(he);ee.uniforms.shadow_pass.value=Fe.map.texture,ee.uniforms.resolution.value=Fe.mapSize,ee.uniforms.radius.value=Fe.radius,e.setRenderTarget(Fe.mapPass),e.clear(),e.renderBufferDirect(at,null,Je,ee,he,null),ie.uniforms.shadow_pass.value=Fe.mapPass.texture,ie.uniforms.resolution.value=Fe.mapSize,ie.uniforms.radius.value=Fe.radius,e.setRenderTarget(Fe.map),e.clear(),e.renderBufferDirect(at,null,Je,ie,he,null)}function Ae(Fe,at,Je){var xt=Fe<<0|at<<1|Je<<2,Tt=x[xt];return Tt===void 0&&(Tt=new Xo({depthPacking:Ei,morphTargets:Fe,skinning:at}),x[xt]=Tt),Tt}function Le(Fe,at,Je){var xt=Fe<<0|at<<1|Je<<2,Tt=L[xt];return Tt===void 0&&(Tt=new rl({morphTargets:Fe,skinning:at}),L[xt]=Tt),Tt}function Ge(Fe,at,Je,xt,Tt,Et){var At=Fe.geometry,Gt=null,Yt=Ae,St=Fe.customDepthMaterial;if(Je.isPointLight===!0&&(Yt=Le,St=Fe.customDistanceMaterial),St===void 0){var _t=!1;at.morphTargets===!0&&(At.isBufferGeometry===!0?_t=At.morphAttributes&&At.morphAttributes.position&&0n||l.y>n)&&(console.warn("THREE.WebGLShadowMap:",St,"has shadow exceeding max texture size, reducing"),l.x>n&&(d.x=Math.floor(n/hn.x),l.x=d.x*hn.x,_t.mapSize.x=d.x),l.y>n&&(d.y=Math.floor(n/hn.y),l.y=d.y*hn.y,_t.mapSize.y=d.y)),_t.map===null&&!_t.isPointLightShadow&&this.type===g){var bn={minFilter:xn,magFilter:xn,format:Gr};_t.map=new Zi(l.x,l.y,bn),_t.map.texture.name=St.name+".shadowMap",_t.mapPass=new Zi(l.x,l.y,bn),_t.camera.updateProjectionMatrix()}_t.map===null&&(bn={minFilter:dt,magFilter:dt,format:Gr},_t.map=new Zi(l.x,l.y,bn),_t.map.texture.name=St.name+".shadowMap",_t.camera.updateProjectionMatrix()),e.setRenderTarget(_t.map),e.clear();for(var Kn=_t.getViewportCount(),qn=0;qnHt||Ne.height>Ht)&&(rr=Ht/Math.max(Ne.width,Ne.height)),rr<1||nt===!0){if(typeof HTMLImageElement!="undefined"&&Ne instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Ne instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Ne instanceof ImageBitmap){var Dn=nt?yr.floorPowerOfTwo:Math.floor,Dt=Dn(rr*Ne.width),An=Dn(rr*Ne.height);x===void 0&&(x=me(Dt,An));var hr=qt?me(Dt,An):x;return hr.width=Dt,hr.height=An,hr.getContext("2d").drawImage(Ne,0,0,Dt,An),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Ne.width+"x"+Ne.height+") to ("+Dt+"x"+An+")."),hr}return"data"in Ne&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Ne.width+"x"+Ne.height+")."),Ne}return Ne}function Ae(Ne){return yr.isPowerOfTwo(Ne.width)&&yr.isPowerOfTwo(Ne.height)}function Le(Ne,nt){return Ne.generateMipmaps&&nt&&Ne.minFilter!==dt&&Ne.minFilter!==xn}function Ge(Ne,nt,qt,Ht){e.generateMipmap(Ne),i.get(nt).__maxMipLevel=Math.log(Math.max(qt,Ht))*Math.LOG2E}function et(Ne,nt,qt){if(L===!1)return nt;if(Ne!==null){if(e[Ne]!==void 0)return e[Ne];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Ne+"'")}var Ht=nt;return nt===6403&&(qt===5126&&(Ht=33326),qt===5131&&(Ht=33325),qt===5121&&(Ht=33321)),nt===6407&&(qt===5126&&(Ht=34837),qt===5131&&(Ht=34843),qt===5121&&(Ht=32849)),nt===6408&&(qt===5126&&(Ht=34836),qt===5131&&(Ht=34842),qt===5121&&(Ht=32856)),Ht===33325||Ht===33326||Ht===34842||Ht===34836?t.get("EXT_color_buffer_float"):Ht!==34843&&Ht!==34837||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),Ht}function Fe(Ne){return Ne===dt||Ne===lt||Ne===Xt?9728:9729}function at(Ne){var nt=Ne.target;nt.removeEventListener("dispose",at),function(qt){var Ht=i.get(qt);Ht.__webglInit!==void 0&&(e.deleteTexture(Ht.__webglTexture),i.remove(qt))}(nt),nt.isVideoTexture&&z.delete(nt),m.memory.textures--}function Je(Ne){var nt=Ne.target;nt.removeEventListener("dispose",Je),function(qt){var Ht=i.get(qt),rr=i.get(qt.texture);if(qt){if(rr.__webglTexture!==void 0&&e.deleteTexture(rr.__webglTexture),qt.depthTexture&&qt.depthTexture.dispose(),qt.isWebGLCubeRenderTarget)for(var Dn=0;Dn<6;Dn++)e.deleteFramebuffer(Ht.__webglFramebuffer[Dn]),Ht.__webglDepthbuffer&&e.deleteRenderbuffer(Ht.__webglDepthbuffer[Dn]);else e.deleteFramebuffer(Ht.__webglFramebuffer),Ht.__webglDepthbuffer&&e.deleteRenderbuffer(Ht.__webglDepthbuffer);if(qt.isWebGLMultiviewRenderTarget){e.deleteTexture(Ht.__webglColorTexture),e.deleteTexture(Ht.__webglDepthStencilTexture),m.memory.textures-=2,Dn=0;for(var Dt=Ht.__webglViewFramebuffers.length;DnFn)return!1;for(var ar=1,mr=$n.length;are.far||t.push({distance:x,point:Fl.clone(),uv:ki.getUV(Fl,Ba,xc,wc,cd,bc,ud,new zt),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Pt.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}});var Gl=new Re,Rh=new Re;function _c(){Pt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function Tc(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),Ti.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new fr,this.bindMatrixInverse=new fr}_c.prototype=Object.assign(Object.create(Pt.prototype),{constructor:_c,isLOD:!0,copy:function(e){Pt.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(;ie.far||t.push({distance:Fe,point:j.clone().applyMatrix4(this.matrixWorld),index:me,face:null,faceIndex:null,object:this}))}else for(me=0,ye=z.length/3-1;mee.far||t.push({distance:Fe,point:j.clone().applyMatrix4(this.matrixWorld),index:me,face:null,faceIndex:null,object:this}))}else if(i.isGeometry){var Ge=i.vertices,et=Ge.length;for(me=0;mee.far||t.push({distance:Fe,point:j.clone().applyMatrix4(this.matrixWorld),index:me,face:null,faceIndex:null,object:this}))}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Lu=new Re,Iu=new Re;function fi(e,t){La.call(this,e,t),this.type="LineSegments"}function Dc(e,t){La.call(this,e,t),this.type="LineLoop"}function Ko(e){It.call(this),this.type="PointsMaterial",this.color=new Qe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}fi.prototype=Object.assign(Object.create(La.prototype),{constructor:fi,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(e.index===null){for(var t=e.attributes.position,n=[],i=0,l=t.count;il.far)return;d.push({distance:j,distanceToRay:Math.sqrt(x),point:L,index:t,face:null,object:m})}}function Wl(e,t,n,i,l,d,m,x,L){Xr.call(this,e,t,n,i,l,d,m,x,L),this.format=m!==void 0?m:ti,this.minFilter=d!==void 0?d:xn,this.magFilter=l!==void 0?l:xn,this.generateMipmaps=!1}function Vu(e,t,n,i,l,d,m,x,L,j,Z,ee){Xr.call(this,null,d,m,x,L,j,i,l,Z,ee),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Ac(e,t,n,i,l,d,m,x,L){Xr.call(this,e,t,n,i,l,d,m,x,L),this.needsUpdate=!0}function Fu(e,t,n,i,l,d,m,x,L,j){if((j=j!==void 0?j:or)!==or&&j!==ni)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&j===or&&(n=We),n===void 0&&j===ni&&(n=Mr),Xr.call(this,null,i,l,d,m,x,j,n,L),this.image={width:e,height:t},this.magFilter=m!==void 0?m:dt,this.minFilter=x!==void 0?x:dt,this.flipY=!1,this.generateMipmaps=!1}function Oc(e){Cn.call(this),this.type="WireframeGeometry";var t,n,i,l,d,m,x,L,j,Z,ee=[],ie=[0,0],z={},he=["a","b","c"];if(e&&e.isGeometry){var me=e.faces;for(t=0,i=me.length;td.x?l.x>m.x?l.x:m.x:d.x>m.x?d.x:m.x,Z=l.y>d.y?l.y>m.y?l.y:m.y:d.y>m.y?d.y:m.y,ee=ko(x,L,t,n,i),ie=ko(j,Z,t,n,i),z=e.prevZ,he=e.nextZ;z&&z.z>=ee&&he&&he.z<=ie;){if(z!==e.prev&&z!==e.next&&ul(l.x,l.y,d.x,d.y,m.x,m.y,z.x,z.y)&&0<=oi(z.prev,z,z.next)||(z=z.prevZ,he!==e.prev&&he!==e.next&&ul(l.x,l.y,d.x,d.y,m.x,m.y,he.x,he.y)&&0<=oi(he.prev,he,he.next)))return;he=he.nextZ}for(;z&&z.z>=ee;){if(z!==e.prev&&z!==e.next&&ul(l.x,l.y,d.x,d.y,m.x,m.y,z.x,z.y)&&0<=oi(z.prev,z,z.next))return;z=z.prevZ}for(;he&&he.z<=ie;){if(he!==e.prev&&he!==e.next&&ul(l.x,l.y,d.x,d.y,m.x,m.y,he.x,he.y)&&0<=oi(he.prev,he,he.next))return;he=he.nextZ}return 1}}function Zl(e,t,n){var i=e;do{var l=i.prev,d=i.next.next;!Rs(l,d)&&$r(l,i,i.next,d)&&jc(l,d)&&jc(d,l)&&(t.push(l.i/n),t.push(i.i/n),t.push(d.i/n),Vc(i),Vc(i.next),i=e=d),i=i.next}while(i!==e);return i}function Zd(e,t,n,i,l,d){var m,x,L=e;do{for(var j=L.next.next;j!==L.prev;){if(L.i!==j.i&&(x=j,(m=L).next.i!==x.i&&m.prev.i!==x.i&&!function(ee,ie){var z=ee;do{if(z.i!==ee.i&&z.next.i!==ee.i&&z.i!==ie.i&&z.next.i!==ie.i&&$r(z,z.next,ee,ie))return 1;z=z.next}while(z!==ee)}(m,x)&&jc(m,x)&&jc(x,m)&&function(ee,ie){for(var z=ee,he=!1,me=(ee.x+ie.x)/2,ye=(ee.y+ie.y)/2;z.y>ye!=z.next.y>ye&&z.next.y!==z.y&&me<(z.next.x-z.x)*(ye-z.y)/(z.next.y-z.y)+z.x&&(he=!he),(z=z.next)!==ee;);return he}(m,x))){var Z=Nh(L,j);return L=cl(L,L.next),Z=cl(Z,Z.next),Yl(L,t,n,i,l,d),void Yl(Z,t,n,i,l,d)}j=j.next}L=L.next}while(L!==e)}function Kd(e,t){return e.x-t.x}function pd(e,t){if(t=function(i,l){var d,m=l,x=i.x,L=i.y,j=-1/0;do{if(L<=m.y&&L>=m.next.y&&m.next.y!==m.y){var Z=m.x+(L-m.y)*(m.next.x-m.x)/(m.next.y-m.y);if(Z<=x&&j=m.x&&m.x>=z&&x!==m.x&&ul(Ld.x)&&jc(m,i)&&(d=m,me=ee),m=m.next;return d}(e,t)){var n=Nh(t,e);cl(n,n.next)}}function ko(e,t,n,i,l){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*l)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*l)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Sr(e){for(var t=e,n=e;(t.x=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((Vu.prototype=Object.create(Xr.prototype)).constructor=Vu).prototype.isCompressedTexture=!0,((Ac.prototype=Object.create(Xr.prototype)).constructor=Ac).prototype.isCanvasTexture=!0,((Fu.prototype=Object.create(Xr.prototype)).constructor=Fu).prototype.isDepthTexture=!0,(Oc.prototype=Object.create(Cn.prototype)).constructor=Oc,($a.prototype=Object.create(lr.prototype)).constructor=$a,(Pc.prototype=Object.create(Cn.prototype)).constructor=Pc,(Bu.prototype=Object.create(lr.prototype)).constructor=Bu,(aa.prototype=Object.create(Cn.prototype)).constructor=aa,(gr.prototype=Object.create(lr.prototype)).constructor=gr,(Rc.prototype=Object.create(aa.prototype)).constructor=Rc,(Ea.prototype=Object.create(lr.prototype)).constructor=Ea,(mi.prototype=Object.create(aa.prototype)).constructor=mi,(Io.prototype=Object.create(lr.prototype)).constructor=Io,(Lc.prototype=Object.create(aa.prototype)).constructor=Lc,(Jl.prototype=Object.create(lr.prototype)).constructor=Jl,(fo.prototype=Object.create(aa.prototype)).constructor=fo,(Ic.prototype=Object.create(lr.prototype)).constructor=Ic,((Ps.prototype=Object.create(Cn.prototype)).constructor=Ps).prototype.toJSON=function(){var e=Cn.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},(gi.prototype=Object.create(lr.prototype)).constructor=gi,(yi.prototype=Object.create(Cn.prototype)).constructor=yi,(kc.prototype=Object.create(lr.prototype)).constructor=kc,(ql.prototype=Object.create(Cn.prototype)).constructor=ql;var hs={area:function(e){for(var t=e.length,n=0,i=t-1,l=0;l80*Z){ee=z=L[0],ie=he=L[1];for(var at=Z;atNumber.EPSILON){var ih=Math.sqrt(rh),ru=Math.sqrt(fs*fs+Fs*Fs),iu=si.x-yo/ih,au=si.y+to/ih,ou=((xi.x-Fs/ru-iu)*Fs-(xi.y+fs/ru-au)*fs)/(to*Fs-yo*fs),Gh=(sa=iu+to*ou-Ir.x)*sa+(Qr=au+yo*ou-Ir.y)*Qr;if(Gh<=2)return new zt(sa,Qr);ta=Math.sqrt(Gh/2)}else{var Co=!1;to>Number.EPSILON?fs>Number.EPSILON&&(Co=!0):to<-Number.EPSILON?fs<-Number.EPSILON&&(Co=!0):Math.sign(yo)===Math.sign(Fs)&&(Co=!0),ta=Co?(sa=-yo,Qr=to,Math.sqrt(rh)):(sa=to,Qr=yo,Math.sqrt(rh/2))}return new zt(sa/ta,Qr/ta)}for(var Dn=[],Dt=0,An=bn.length,hr=An-1,pt=Dt+1;Dtd.tracks[x].times[0]&&(me=d.tracks[x].times[0]);for(x=0;x>>1;et;)--d;if(++d,l!==0||d!==i){d<=l&&(l=(d=Math.max(d,1))-1);var m=this.getValueSize();this.times=Oi.arraySlice(n,l,d),this.values=Oi.arraySlice(this.values,l*m,d*m)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,l=n.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var d=null,m=0;m!==l;m++){var x=n[m];if(typeof x=="number"&&isNaN(x)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,m,x),e=!1;break}if(d!==null&&xNumber.EPSILON&&(j.normalize(),l=Math.acos(yr.clamp(m[n-1].dot(m[n]),-1,1)),x[n].applyMatrix4(Z.makeRotationAxis(j,l))),L[n].crossVectors(m[n],x[n]);if(t===!0)for(l=Math.acos(yr.clamp(x[0].dot(x[e]),-1,1)),l/=e,0i.length-2?i.length-1:d+1],Z=i[d>i.length-3?i.length-1:d+2];return n.set(vn(m,x.x,L.x,j.x,Z.x),vn(m,x.y,L.y,j.y,Z.y)),n},Hr.prototype.copy=function(e){gt.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var l=n[i]-t,d=this.curves[i],m=d.getLength(),x=m===0?0:1-l/m;return d.getPointAt(x)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;nNumber.EPSILON){if(nt<0&&(ur=hn[Bn],Ne=-Ne,Sn=hn[qn],nt=-nt),_t.ySn.y)continue;if(_t.y===ur.y){if(_t.x===ur.x)return 1}else{var qt=nt*(_t.x-ur.x)-Ne*(_t.y-ur.y);if(qt==0)return 1;if(qt<0)continue;Kn=!Kn}}else{if(_t.y!==ur.y)continue;if(Sn.x<=_t.x&&_t.x<=ur.x||ur.x<=_t.x&&_t.x<=Sn.x)return 1}}return Kn}var l=hs.isClockWise,d=this.subPaths;if(d.length===0)return[];if(t===!0)return n(d);var m,x,L,j=[];if(d.length===1)return x=d[0],(L=new Qa).curves=x.curves,j.push(L),j;var Z=!l(d[0].getPoints());Z=e?!Z:Z;var ee,ie,z=[],he=[],me=[],ye=0;he[ye]=void 0,me[ye]=[];for(var Ae=0,Le=d.length;Aen.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;n!==null&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,l=this._loopCount,d=i===2202;if(e===0)return l!==-1&&d&&(1&l)==1?n-t:t;if(i===2200){l===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n<=t)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(l===-1&&(0<=e?(l=0,this._setEndings(!0,this.repetitions===0,d)):this._setEndings(this.repetitions===0,!0,d)),n<=t||t<0){var m=Math.floor(t/n);t-=n*m,l+=Math.abs(m);var x=this.repetitions-l;if(x<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=0this.max.x||e.ythis.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new zt),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new zt),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Kp.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var $p=new Re,Ad=new Re;function bp(e,t){this.start=e!==void 0?e:new Re,this.end=t!==void 0?t:new Re}function Mp(e){Pt.call(this),this.material=e,this.render=function(){}}Object.assign(bp.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Re),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Re),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn("THREE.Line3: .at() target is now required"),t=new Re),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){$p.subVectors(e,this.start),Ad.subVectors(this.end,this.start);var n=Ad.dot(Ad),i=Ad.dot($p)/n;return t&&(i=yr.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Re),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),((Mp.prototype=Object.create(Pt.prototype)).constructor=Mp).prototype.isImmediateRenderObject=!0;var Qp=new Re;function Od(e,t){Pt.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new Cn,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],l=0,d=1;l<32;l++,d++){var m=l/32*Math.PI*2,x=d/32*Math.PI*2;i.push(Math.cos(m),Math.sin(m),1,Math.cos(x),Math.sin(x),1)}n.setAttribute("position",new an(i,3));var L=new Vi({fog:!1});this.cone=new fi(n,L),this.add(this.cone),this.update()}((Od.prototype=Object.create(Pt.prototype)).constructor=Od).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Od.prototype.update=function(){this.light.updateMatrixWorld();var e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qp.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qp),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var ic=new Re,Pd=new fr,_p=new fr;function Rd(e){for(var t=function Z(ee){var ie=[];ee&&ee.isBone&&ie.push(ee);for(var z=0;z vec4 inputTexelToLinear(vec4 value){ if(inputEncoding == 0){ return value; }else if(inputEncoding == 1){ return sRGBToLinear(value); }else if(inputEncoding == 2){ return RGBEToLinear(value); }else if(inputEncoding == 3){ return RGBMToLinear(value, 7.0); }else if(inputEncoding == 4){ return RGBMToLinear(value, 16.0); }else if(inputEncoding == 5){ return RGBDToLinear(value, 256.0); }else{ return GammaToLinear(value, 2.2); } } vec4 linearToOutputTexel(vec4 value){ if(outputEncoding == 0){ return value; }else if(outputEncoding == 1){ return LinearTosRGB(value); }else if(outputEncoding == 2){ return LinearToRGBE(value); }else if(outputEncoding == 3){ return LinearToRGBM(value, 7.0); }else if(outputEncoding == 4){ return LinearToRGBM(value, 16.0); }else if(outputEncoding == 5){ return LinearToRGBD(value, 256.0); }else{ return LinearToGamma(value, 2.2); } } vec4 envMapTexelToLinear(vec4 color) { return inputTexelToLinear(color); } #define ENVMAP_TYPE_CUBE_UV #include void main() { gl_FragColor = vec4(0.0); for (int i = 0; i < n; i++) { if (i >= samples) break; for (int dir = -1; dir < 2; dir += 2) { if (i == 0 && dir == 1) continue; vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection); if (all(equal(axis, vec3(0.0)))) axis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection); axis = normalize(axis); float theta = dTheta * float(dir * i); float cosTheta = cos(theta); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross(axis, vOutputDirection) * sin(theta) + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta); gl_FragColor.rgb += weights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt); } } gl_FragColor = linearToOutputTexel(gl_FragColor); } `,blending:T,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",uf),eu=null,tu=null,Op=function(){for(var e=[],t=[],n=[],i=ac,l=0;l vec4 inputTexelToLinear(vec4 value){ if(inputEncoding == 0){ return value; }else if(inputEncoding == 1){ return sRGBToLinear(value); }else if(inputEncoding == 2){ return RGBEToLinear(value); }else if(inputEncoding == 3){ return RGBMToLinear(value, 7.0); }else if(inputEncoding == 4){ return RGBMToLinear(value, 16.0); }else if(inputEncoding == 5){ return RGBDToLinear(value, 256.0); }else{ return GammaToLinear(value, 2.2); } } vec4 linearToOutputTexel(vec4 value){ if(outputEncoding == 0){ return value; }else if(outputEncoding == 1){ return LinearTosRGB(value); }else if(outputEncoding == 2){ return LinearToRGBE(value); }else if(outputEncoding == 3){ return LinearToRGBM(value, 7.0); }else if(outputEncoding == 4){ return LinearToRGBM(value, 16.0); }else if(outputEncoding == 5){ return LinearToRGBD(value, 256.0); }else{ return LinearToGamma(value, 2.2); } } vec4 envMapTexelToLinear(vec4 color) { return inputTexelToLinear(color); } #define RECIPROCAL_PI 0.31830988618 #define RECIPROCAL_PI2 0.15915494 void main() { gl_FragColor = vec4(0.0); vec3 outputDirection = normalize(vOutputDirection); vec2 uv; uv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5; uv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5; vec2 f = fract(uv / texelSize - 0.5); uv -= f * texelSize; vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb; uv.x += texelSize.x; vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb; uv.y += texelSize.y; vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb; uv.x -= texelSize.x; vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb; vec3 tm = mix(tl, tr, f.x); vec3 bm = mix(bl, br, f.x); gl_FragColor.rgb = mix(tm, bm, f.y); gl_FragColor = linearToOutputTexel(gl_FragColor); } `,blending:T,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function wf(){var e=new ks({uniforms:{envMap:{value:null},inputEncoding:{value:Ua[Ke]},outputEncoding:{value:Ua[Ke]}},vertexShader:` precision mediump float; precision mediump int; attribute vec3 position; attribute vec2 uv; attribute float faceIndex; varying vec3 vOutputDirection; vec3 getDirection(vec2 uv, float face) { uv = 2.0 * uv - 1.0; vec3 direction = vec3(uv, 1.0); if (face == 0.0) { direction = direction.zyx; direction.z *= -1.0; } else if (face == 1.0) { direction = direction.xzy; direction.z *= -1.0; } else if (face == 3.0) { direction = direction.zyx; direction.x *= -1.0; } else if (face == 4.0) { direction = direction.xzy; direction.y *= -1.0; } else if (face == 5.0) { direction.xz *= -1.0; } return direction; } void main() { vOutputDirection = getDirection(uv, faceIndex); gl_Position = vec4( position, 1.0 ); } `,fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform samplerCube envMap; uniform int inputEncoding; uniform int outputEncoding; #include vec4 inputTexelToLinear(vec4 value){ if(inputEncoding == 0){ return value; }else if(inputEncoding == 1){ return sRGBToLinear(value); }else if(inputEncoding == 2){ return RGBEToLinear(value); }else if(inputEncoding == 3){ return RGBMToLinear(value, 7.0); }else if(inputEncoding == 4){ return RGBMToLinear(value, 16.0); }else if(inputEncoding == 5){ return RGBDToLinear(value, 256.0); }else{ return GammaToLinear(value, 2.2); } } vec4 linearToOutputTexel(vec4 value){ if(outputEncoding == 0){ return value; }else if(outputEncoding == 1){ return LinearTosRGB(value); }else if(outputEncoding == 2){ return LinearToRGBE(value); }else if(outputEncoding == 3){ return LinearToRGBM(value, 7.0); }else if(outputEncoding == 4){ return LinearToRGBM(value, 16.0); }else if(outputEncoding == 5){ return LinearToRGBD(value, 256.0); }else{ return LinearToGamma(value, 2.2); } } vec4 envMapTexelToLinear(vec4 color) { return inputTexelToLinear(color); } void main() { gl_FragColor = vec4(0.0); gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb; gl_FragColor = linearToOutputTexel(gl_FragColor); } `,blending:T,depthTest:!1,depthWrite:!1});return e.type="CubemapToCubeUV",e}function bf(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Nn.call(this,e),this.type="catmullrom",this.closed=!0}function Mf(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Nn.call(this,e),this.type="catmullrom"}function kp(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Nn.call(this,e),this.type="catmullrom"}Rp.prototype={constructor:Rp,fromScene:function(e,t,n,i){t===void 0&&(t=0),n===void 0&&(n=.1),i===void 0&&(i=100),Pp=Ci.getRenderTarget();var l=pf();return function(d,m,x,L){var j=new Ni(90,1,m,x),Z=[1,1,1,1,-1,1],ee=[1,1,-1,-1,-1,1],ie=Ci.outputEncoding,z=Ci.toneMapping,he=Ci.toneMappingExposure,me=Ci.getClearColor(),ye=Ci.getClearAlpha();Ci.toneMapping=st,Ci.toneMappingExposure=1,Ci.outputEncoding=Ke,d.scale.z*=-1;var Ae=d.background;if(Ae&&Ae.isColor){Ae.convertSRGBToLinear();var Le=Math.max(Ae.r,Ae.g,Ae.b),Ge=Math.min(Math.max(Math.ceil(Math.log2(Le)),-128),127);Ae=Ae.multiplyScalar(Math.pow(2,-Ge));var et=(Ge+128)/255;Ci.setClearColor(Ae,et),d.background=null}for(var Fe=0;Fe<6;Fe++){var at=Fe%3;at==0?(j.up.set(0,Z[Fe],0),j.lookAt(ee[Fe],0,0)):at==1?(j.up.set(0,0,Z[Fe]),j.lookAt(0,ee[Fe],0)):(j.up.set(0,Z[Fe],0),j.lookAt(0,0,ee[Fe])),Ip(L,at*Vs,2g.x)R=I.MxThreeJS.createLines(B,16777215),u=255;else{var c=S.getMcEdJig().getMxObject().viewCoordLong2Cad(3);R=I.MxThreeJS.createDashedLines(B,16777215,2*c,c)}var f=[];f.push(g),f.push(G),f.push(k),f.push(g),f.push(k),f.push(C);var O=I.MxThreeJS.createTriangle(f,u,.27);S.drawEntity(O,30),S.drawEntity(R,31)}else R=I.MxThreeJS.createLines(B,16777215),S.drawEntity(R,31)}),_.setUserDraw(Y),_.go(function(k){N&&N({status:k,detailedResult:_.getDetailedResult()}),k!=0?T(null):(_.clearLastInputPoint(),T(_.value()))})})}},{"./MxThreeJS":37,"./Operate/MrxDbgUiPrBase":45,"./Operate/MrxDbgUiPrPoint":47,"./Operate/MxEntSelJig":50,"./Operate/MxJigCmdManager":54,"./UI/MxUiVue":65,three:19}],21:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxDrawCommands=void 0;var a=w("./MxFun"),v=w("./MxType"),h=w("./Operate/MxIntelliSelect"),b=w("./Operate/MxJigCmdManager");function D(M){M!=null&&M.grips!=null&&M.ids!=null&&a.MxFun.getCurrentMx().getMcObject().getGripManager().gripEditImp(M)}function U(M){if(M!=null&&M.pt!=null){var N=a.MxFun.getCurrentMx(),F=M.pt;if(!N.getMxDatabase().getGripManager().doPointSelect(F)){var T=!0;if(N.isValidMcObject()&&N.getMcObject().getGripManager().doPointSelect(F)&&(T=!1),a.MxFun.isPC()||(T=!1),T&&N.isMultipleSelect){var _=N.screenCoord2Current(F.x,F.y,0),Y=new h.MxIntelliSelectJig(_);Y.setDisableDynInput(!0),Y.setDisableOsnap(!0),b.MxJigCmdManager.runCmd(Y)}}}}function V(M){M!=null&&M.grips!=null&&M.ents!=null&&a.MxFun.getCurrentMx().getMxDatabase().getGripManager().gripEditImp(M)}function I(){a.MxFun.getCurrentMx().getMcObject().undo()}function g(){a.MxFun.getCurrentMx().getMcObject().redo()}function A(){a.MxFun.getCurrentMx().startPanCommand()}(o.MxDrawCommands||(o.MxDrawCommands={})).registerCommand=function(){a.MxFun.addCommand("Mx_FrontEndWebpageIntelliSel",U,v.MxType.MxCommandFlag.MCRX_CMD_TRANSPARENT|v.MxType.MxCommandFlag.MCRX_CMD_NO_UNDO_MARKER|v.MxType.MxCommandFlag.MCRX_CMD_NO_CLEAR_SELECT|v.MxType.MxCommandFlag.MCRX_CMD_NO_RECORD_PRVCMD),a.MxFun.addCommand("Mx_FrontEndWebpageGripEdit",V,v.MxType.MxCommandFlag.MCRX_CMD_TRANSPARENT|v.MxType.MxCommandFlag.MCRX_CMD_NO_UNDO_MARKER|v.MxType.MxCommandFlag.MCRX_CMD_NO_CLEAR_SELECT|v.MxType.MxCommandFlag.MCRX_CMD_NO_RECORD_PRVCMD),a.MxFun.addCommand("McDraw_GripEdit",D,v.MxType.MxCommandFlag.MCRX_CMD_TRANSPARENT|v.MxType.MxCommandFlag.MCRX_CMD_NO_CLEAR_SELECT|v.MxType.MxCommandFlag.MCRX_CMD_NO_RECORD_PRVCMD),a.MxFun.addCommand("Mx_Undo",I,v.MxType.MxCommandFlag.MCRX_CMD_NO_UNDO_MARKER),a.MxFun.addCommand("Mx_Redo",g,v.MxType.MxCommandFlag.MCRX_CMD_NO_UNDO_MARKER),a.MxFun.addCommand("Mx_Pan",A,v.MxType.MxCommandFlag.MCRX_CMD_NO_UNDO_MARKER)}},{"./MxFun":27,"./MxType":39,"./Operate/MxIntelliSelect":52,"./Operate/MxJigCmdManager":54}],22:[function(w,r,o){var a;Object.defineProperty(o,"__esModule",{value:!0}),o.MxDrawData=void 0,(a=o.MxDrawData||(o.MxDrawData={})).m_dInputRectWidth=16,a.m_isEnableIntelliSelect=!0,a.m_isEnableGripEidt=!0,a.m_isEnableCADEntityGripEidt=1,a.m_isForbiddenDynInput=!1,a.m_isMultipleSelect=!1,a.m_isAutoResetRenderer=!1,a.m_isCorrectLargeCoordinates=!0,a.m_isRequestHeaderCacheControl=!1,a.m_gripPointColor=3355443455,a.m_isMapBox=!1,a.m_isEnableDrawingViewAngle=!0,a.m_isEnableCommandRightClickMenu=!1,a.m_isMobileCommandOperationSupportsMultipoint=!0,a.getIniSet=function(){return{EnableIntelliSelect:a.m_isEnableIntelliSelect,EnableGripEidt:a.m_isEnableGripEidt,EnableCADEntityGripEidt:a.m_isEnableCADEntityGripEidt,ForbiddenDynInput:a.m_isForbiddenDynInput,EnableDrawingViewAngle:a.m_isEnableDrawingViewAngle,gripPointColor:a.m_gripPointColor,multipleSelect:a.m_isMultipleSelect,EnableCommandRightClickMenu:a.m_isEnableCommandRightClickMenu}},a.setIniset=function(v){v.EnableIntelliSelect!==void 0&&typeof v.EnableIntelliSelect=="boolean"&&(a.m_isEnableIntelliSelect=v.EnableIntelliSelect),v.EnableGripEidt!==void 0&&typeof v.EnableGripEidt=="boolean"&&(a.m_isEnableGripEidt=v.EnableGripEidt),v.EnableGripEdit!==void 0&&typeof v.EnableGripEdit=="boolean"&&(a.m_isEnableGripEidt=v.EnableGripEdit),v.EnableCADEntityGripEidt!==void 0&&typeof v.EnableCADEntityGripEidt=="number"&&(a.m_isEnableCADEntityGripEidt=v.EnableCADEntityGripEidt),v.EnableCADEntityGripEdit!==void 0&&typeof v.EnableCADEntityGripEdit=="number"&&(a.m_isEnableCADEntityGripEidt=v.EnableCADEntityGripEdit),v.ForbiddenDynInput!==void 0&&typeof v.ForbiddenDynInput=="boolean"&&(a.m_isForbiddenDynInput=v.ForbiddenDynInput),v.multipleSelect!==void 0&&typeof v.multipleSelect=="boolean"&&(a.m_isMultipleSelect=v.multipleSelect),v.autoResetRenderer!==void 0&&typeof v.autoResetRenderer=="boolean"&&(a.m_isAutoResetRenderer=v.autoResetRenderer),v.correctLargeCoordinates!==void 0&&typeof v.correctLargeCoordinates=="boolean"&&(a.m_isCorrectLargeCoordinates=v.correctLargeCoordinates),v.requestHeaderCacheControl!==void 0&&typeof v.requestHeaderCacheControl=="boolean"&&(a.m_isRequestHeaderCacheControl=v.requestHeaderCacheControl),v.MapBox!==void 0&&typeof v.MapBox=="boolean"&&(a.m_isMapBox=v.MapBox),v.inputRectWidth!==void 0&&typeof v.inputRectWidth=="number"&&(a.m_dInputRectWidth=v.inputRectWidth),v.gripPointColor!==void 0&&typeof v.gripPointColor=="number"&&(a.m_gripPointColor=v.gripPointColor),v.EnableDrawingViewAngle!==void 0&&typeof v.EnableDrawingViewAngle=="boolean"&&(a.m_isEnableDrawingViewAngle=v.EnableDrawingViewAngle),v.EnableCommandRightClickMenu!==void 0&&typeof v.EnableCommandRightClickMenu=="boolean"&&(a.m_isEnableCommandRightClickMenu=v.EnableCommandRightClickMenu),v.MobileCommandOperationSupportsMultipoint!==void 0&&typeof v.MobileCommandOperationSupportsMultipoint=="boolean"&&(a.m_isMobileCommandOperationSupportsMultipoint=v.MobileCommandOperationSupportsMultipoint)}},{}],23:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxDrawObject=o.IniSetName=o.MxRunMode=void 0;var a,v,h,b=w("three"),D=w("./MxFun"),U=w("./View/MxBrowseLayerData"),V=w("./View/MxBrowseDisplay"),I=w("./MxNetData"),g=w("./MxNetData"),A=w("./MxManager"),M=w("./MxSystemVariable"),N=w("./MxLocalFileLoad"),F=w("./Operate/MxDrawObjectOsnap"),T=w("./View/MxDbDatabase"),_=w("./View/MxDrawMapBox"),Y=w("./MxDrawObjectEvent"),k=w("./View/MxDbEntityGrip"),S=w("./cpp/McDrawObject"),G=w("./UI/MxUiVue"),C=w("./MxDrawData"),B=w("./MxTempMarkDraw");(v=a=o.MxRunMode||(o.MxRunMode={}))[v.kBrowse=1]="kBrowse",v[v.kCPPMxCAD=4]="kCPPMxCAD",(h=o.IniSetName||(o.IniSetName={})).kEnableOsnapFunction="EnableOsnapFunction";var R=(u.prototype.getCurrentMousePostion=function(){return this.curMousePostion},u.prototype.isValidCurMousePostion=function(){return this.m_isValidCurMousePostion},u.prototype.setCurrentMousePostion=function(c,f){if(f===void 0&&(f=!1),f){if(0J.x){var te=X.x;X.x=J.x,J.x=te}if(X.y>J.y){var ne=X.y;X.y=J.y,J.y=ne}this.reInit(),this._devicePixelRatio=window.devicePixelRatio,this._openFile="",this._openFileExtName="dwg",this._iniParam=[],this._initZoomwCoordPt1=null,this._initZoomWCoordPt2=null;var ue=new b.Matrix4;ue.identity(),this.intiDoc2Wold(ue),this.initCAD2Doc(ue),this.initializingObjectMatrix(),this.mxdrawThreeJS.updateCameraDisplayRange(X,J,0),this.updateDisplay(!0);var be=D.MxFun.getUiObj();be!=null&&(be.SetLayoutData(this._allLayoutName),be.UpDisplayLayout())},u.prototype.calcViewsize=function(){if(this._userCanvas==null)return{viewWidth:window.innerWidth,viewHeight:window.innerHeight};var c=this._userCanvas.clientWidth,f=this._userCanvas.clientHeight;if(this._event.onResize!=null){var O=this._event.onResize;O instanceof Array&&(O=O[0]);var W=O();W!=null&&(c=parseInt(W.width),f=parseInt(W.height))}return{viewWidth:c,viewHeight:f}},u.prototype.initMxCpp=function(c){c&&c.getImp()?(this.mcObject.init(this,c),this.secenView!=null?this.secenView.background=null:this.scene.background=null):console.log("mxerror: mcppObjectImp is null")},u.prototype.create=function(c,f,O,W){if(this._is2d?this.mxdrawThreeJS=W?new _.MxDrawMapBoxThreeJS(W,this):new _.MxDrawObject2dThreeJS(this):this.mxdrawThreeJS=new _.MxDrawObject3dThreeJS(this),this._callCreateCanvasImageData=void 0,this._devicePixelRatio=window.devicePixelRatio,this._runMode==a.kCPPMxCAD)this._openFile="";else{if(f instanceof Array?(this._openFile=f[0],this._staticLoadingOpenFiles=f):this._openFile=f,this._iniParam=D.MxFun.getUrlParams(),this._openFileExtName=this._openFile.substring(this._openFile.lastIndexOf(".")+1),this._openFile!=""){var X=new Array;X.push("file"),X.push(this._openFile),this._iniParam.push(X)}this._userIdentitySign!=""&&(this.addInitParam("userIdentitySign",this._userIdentitySign),this.addInitParam("userRandomToken",this._userRandomToken)),this.addInitParam("runMode","browse")}this._userCanvas=c;var J=window.innerWidth,te=window.innerHeight;if(c!=null&&(J=c.clientWidth,te=c.clientHeight),this._viewWidth=J,this._viewHeight=te,this.m_mxDatabase.getSelectManager().setCanvasSize(J,te),this.mxdrawThreeJS.onInitThreejs(),this.eventManager.registEvent(this),this.onCreate(),this.m_mxDatabase.init(this),this._parentDocObject=new b.Object3D,this.scene.add(this._parentDocObject),this._parentDocObject_SmallCoord=new b.Object3D,this.scene.add(this._parentDocObject_SmallCoord),this.threejsselectObjects=new b.Object3D,this.scene.add(this.threejsselectObjects),this._objectsOsnap=new F.MxDrawObjectOsnap(this),this.tempMarkDraw.init(this),A.MxManager.add(this),A.MxManager.setCurrentMx(this),this.mxdrawThreeJS.addControlsChangeEvent(),W||this.updateDisplay(),this.mxdrawThreeJS.getType()!=_.MxThreeJSType.kMapBox){var ne=this;if(c==null){var ue=function(le,Pe){Pe===void 0&&(Pe=!0),ne._viewWidth=window.innerWidth,ne._viewHeight=window.innerHeight,ne.onResizeImp()&&ne.updateDisplay(Pe)};window.addEventListener("resize",ue,!1),this._onResizeFun=ue}else{var be=function(le,Pe){Pe===void 0&&(Pe=!0),le&&le.viewWidth&&le.viewHeight||(le=ne.calcViewsize()),ne._viewWidth=le.viewWidth,ne._viewHeight=le.viewHeight,ne.onResizeImp(ne._viewWidth,ne._viewHeight)&&ne.updateDisplay(Pe)};if(this._onResizeFun=be,this._event.addResizeEvent!=null){var je=this._event.addResizeEvent;je instanceof Array&&(je=je[0]),je(be,c)}else window.addEventListener("resize",be,!1);if(window.setTimeout(function(){be(void 0,!1)},5),this._event.onResize!=null){var ve=ne.calcViewsize();be(ve,!1);var Be=0,q=0,ge=!0,oe=window.setInterval(function(){q++;var le=ne.calcViewsize();if(le.viewWidth==ve.viewWidth&&le.viewHeight==ve.viewHeight&&0>24&255;Rt==2?(le.push(ze,se),le.push(xe,De),le.push(tt,st)):Rt==1?ve!=0&&je?(Pe.push(ze,se),Pe.push(xe,De),Pe.push(tt,st)):(oe.push(ze,se),oe.push(xe,De),oe.push(tt,st)):(mt=this.automaticInversionColor(16777215&mt),q.push(ze,se),q.push(xe,De),q.push(tt,st),ge.push((255&mt)/255,(mt>>8&255)/255,(mt>>16&255)/255),ge.push((255&mt)/255,(mt>>8&255)/255,(mt>>16&255)/255),ge.push((255&mt)/255,(mt>>8&255)/255,(mt>>16&255)/255))}var Ot=this._blocks,He=this._layers;J!=0&&(Ot=this._extRefManager.getBlocks(J),He=this._extRefManager.getLayers(J));var Vt=Ot.crateBlock(ve);Vt.addGeometryMesh(q,ge,be,le,oe,Pe),Ot.createThreejsObj(Vt,this,He)}}},u.prototype.mxWebAddEntityForMemorySections=function(c,f){var O=new I.MxNetData(c),W=O.getMemorySectionsHead(),X=(W.zeroLayerIdIndex,W.databaseIndex);f!=-1&&(X=f);var J=W.nOffset,te=this._blocks,ne=this._layers;X!=0&&(te=this._extRefManager.getBlocks(X),ne=this._extRefManager.getLayers(X));for(var ue=0;ue>10),56320+(1023&ne)))}return W.join("")},u.prototype.mxWebAddEntityFor2dPointTextureBuffers=function(c,f){var O=new I.MxNetData(c),W=O.getdPointTextureBuffersHead(),X=W.ver,J=(W.zeroLayerIdIndex,W.databaseIndex);f!=-1&&(J=f);for(var te=W.datasize,ne=0;ne>24&255;nn=dt==2||dt==1?16777215:this.automaticInversionColor(16777215&nn),st.push(er,yt),st.push(Ue,Zt),st.push(On,Xn),tt.push((255&nn)/255,(nn>>8&255)/255,(nn>>16&255)/255),tt.push((255&nn)/255,(nn>>8&255)/255,(nn>>16&255)/255),tt.push((255&nn)/255,(nn>>8&255)/255,(nn>>16&255)/255)}oe.addGeometryTexture(De,st,tt,be,xe,le,Pe,Ye)}}q.createThreejsObj(oe,this,ge)}}},u.prototype.mxWebAddEntityFor2dPointCurveBuffers=function(c,f){var O=new I.MxNetData(c),W=O.getdPointCurveBuffersHead(),X=W.zeroLayerIdIndex,J=W.databaseIndex;f!=-1&&(J=f);for(var te=W.datasize,ne=0;ne>24&255;st==2?(le.push(ze,se),le.push(xe,De)):st==1?ve!=0&&je?(Pe.push(ze,se),Pe.push(xe,De)):(oe.push(ze,se),oe.push(xe,De)):(q.push(ze,se),q.push(xe,De),tt=this.automaticInversionColor(16777215&tt),ge.push((255&tt)/255,(tt>>8&255)/255,(tt>>16&255)/255),ge.push((255&tt)/255,(tt>>8&255)/255,(tt>>16&255)/255))}var mt=this._blocks,Rt=this._layers;J!=0&&(mt=this._extRefManager.getBlocks(J),Rt=this._extRefManager.getLayers(J));var Ot=mt.crateBlock(ve);Ot.addGeometryCurve(q,ge,be,le,oe,Pe),mt.createThreejsObj(Ot,this,Rt)}}},u.prototype.mxWebAddEntityFor2dPointCurveBuffer=function(c,f){var O=new I.MxNetData(c);if(!O.getIsSketchEntity()){var W,X=O.getLayerId(),J=X==O.getZeroLayerId(),te=O.getBlockId();if(!((W=c.getInt32(20,!0)/20)<1)){for(var ne=80,ue=[],be=[],je=[],ve=[],Be=[],q=0;q>24&255;ze==2?(ve.push(ge,oe),ve.push(le,Pe)):ze==1?te!=0&&J?(Be.push(ge,oe),Be.push(le,Pe)):(je.push(ge,oe),je.push(le,Pe)):(Ye=this.automaticInversionColor(16777215&Ye),ue.push(ge,oe),ue.push(le,Pe),be.push((255&Ye)/255,(Ye>>8&255)/255,(Ye>>16&255)/255),be.push((255&Ye)/255,(Ye>>8&255)/255,(Ye>>16&255)/255))}var se=O.getDatabaseIndex();f!=-1&&(se=f);var xe=this._blocks,De=this._layers;se!=0&&(xe=this._extRefManager.getBlocks(se),De=this._extRefManager.getLayers(se));var tt=xe.crateBlock(te);tt.addGeometryCurve(ue,be,X,ve,je,Be),xe.createThreejsObj(tt,this,De)}}},u.prototype.mxWebAddEntityFor2dPointMeshBuffer=function(c,f){var O=new I.MxNetData(c);if(!O.getIsSketchEntity()){var W,X=O.getLayerId(),J=O.getBlockId(),te=X==O.getZeroLayerId();if(!((W=c.getInt32(12,!0)/28)<1)){for(var ne=80,ue=[],be=[],je=[],ve=[],Be=[],q=0;q>24&255;xe==2?(ve.push(ge,oe),ve.push(le,Pe),ve.push(Ye,ze)):xe==1?J!=0&&te?(Be.push(ge,oe),Be.push(le,Pe),Be.push(Ye,ze)):(je.push(ge,oe),je.push(le,Pe),je.push(Ye,ze)):(ue.push(ge,oe),ue.push(le,Pe),ue.push(Ye,ze),se=this.automaticInversionColor(16777215&se),be.push((255&se)/255,(se>>8&255)/255,(se>>16&255)/255),be.push((255&se)/255,(se>>8&255)/255,(se>>16&255)/255),be.push((255&se)/255,(se>>8&255)/255,(se>>16&255)/255))}var De=O.getDatabaseIndex();f!=-1&&(De=f);var tt=this._blocks,st=this._layers;De!=0&&(tt=this._extRefManager.getBlocks(De),st=this._extRefManager.getLayers(De));var mt=tt.crateBlock(J);mt.addGeometryMesh(ue,be,X,ve,je,Be),tt.createThreejsObj(mt,this,st)}}},u.prototype.mxWebCreateAllBlocks=function(c,f){var O=new I.MxNetData(c).getDatabaseIndex();f!=-1&&(O=f);var W=this._blocks;O!=0&&(W=this._extRefManager.getBlocks(O)),W.createBlocks(c,this.scene)},u.prototype.mxWebEntitysData=function(c,f){f==-1&&this._objectsOsnap.mxWebEntitysData(c,f)},u.prototype.getObjectOsnap=function(){return this._objectsOsnap},u.prototype.saveMxEntityToJson=function(c){return this.m_mxDatabase.saveJson(c)},u.prototype.getDtabaseJsonString=function(){return JSON.stringify(this.m_mxDatabase.toJsonObject())},u.prototype.loadMxEntityFromJson=function(c){return this.m_mxDatabase.loadJson(c)},u);function u(c){this._is2d=!0,this._runMode=a.kBrowse,this._userCanvas=null,this._openFile="empty",this._staticLoadingOpenFiles=[],this._openFileExtName="",this._userIdentitySign="",this._rendererParam=void 0,this._userRandomToken="",this._isCreate=!1,this.m_iniSet={},this._net=null,this._staticNet=null,this._staticLoadTzNet=null,this._staticLocalNet=null,this._isStaticLocalLoad=!1,this._staticLocalLoadPath="",this._viewWidth=1,this._viewHeight=1,this.m_sysVariable=new M.MxSystemVariable,this._color="#FFFFFF",this._viewcolor=15790320,this._isAnimation=!1,this._isAnimationStarting=!1,this._isWaiteCount=0,this._callCreateCanvasImageData=void 0,this._event={},this.scene=null,this.camera=null,this.camera_recover=null,this.secenView=null,this.cameraView=null,this.renderer=null,this.controls=null,this.threejsselectObjectsView=null,this._mouseRightRotate=!1,this._isMouseMiddlePan=1,this._mapId2Entity=new Map,this._setAdyDelete=new Map,this._layers=new U.MxBrowseLayerData,this._blocks=new V.Blocks,this._extRefManager=new V.ExternalReferenceManager,this._doc2World=new b.Matrix4,this._word2doc=new b.Matrix4,this._cad2Doc=new b.Matrix4,this._doc2CAD=new b.Matrix4,this._word2Current=new b.Matrix4,this._current2word=new b.Matrix4,this._allLayoutName=new Array,this._devicePixelRatio=1,this._tzDwgStaticFile="",this._requestHeader="",this._objectsOsnap=null,this._initZoomwCoordPt1=null,this._initZoomWCoordPt2=null,this.m_mxDatabase=null,this._parentDocObject=null,this._parentDocObject_SmallCoord=null,this.threejsselectObjects=null,this.tempMarkDraw=new B.MxTempMarkDraw,this._onResizeFun=null,this._sCurrentLoadURL="",this.eventManager=new Y.MxDrawObjectEvent,this._viewangle=0,this.id=0,this.mcObject=new S.McDrawObject,this.isPointMultipleSelect=!1,this.isNewObjectMatrix=!0,this.bakControls=void 0,this.isMultipleSelect=!1,this.mxdrawThreeJS=null,this.curMousePostion=new b.Vector2(0,0),this.m_isValidCurMousePostion=!1,this._is2d=c,this._blocks.initRootBlockRef(),this.m_iniSet[h.kEnableOsnapFunction]=!1,this.m_sysVariable.init(this),this.m_mxDatabase=new T.MxDbDatabase,this.id=A.MxManager.allocId(),this.isMultipleSelect=C.MxDrawData.m_isMultipleSelect,this.mcObject.initMxObject(this)}o.MxDrawObject=R},{"./MxDrawData":22,"./MxDrawObjectEvent":26,"./MxFun":27,"./MxLocalFileLoad":28,"./MxManager":29,"./MxNetData":31,"./MxSystemVariable":35,"./MxTempMarkDraw":36,"./Operate/MxDrawObjectOsnap":49,"./UI/MxUiVue":65,"./View/MxBrowseDisplay":66,"./View/MxBrowseLayerData":67,"./View/MxDbDatabase":68,"./View/MxDbEntityGrip":70,"./View/MxDrawMapBox":75,"./cpp/McDrawObject":78,three:19}],24:[function(w,r,o){var a,v=this&&this.__extends||(a=function(T,_){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Y,k){Y.__proto__=k}||function(Y,k){for(var S in k)Object.prototype.hasOwnProperty.call(k,S)&&(Y[S]=k[S])})(T,_)},function(T,_){function Y(){this.constructor=T}a(T,_),T.prototype=_===null?Object.create(_):(Y.prototype=_.prototype,new Y)});Object.defineProperty(o,"__esModule",{value:!0}),o.MxDrawObject2d=void 0;var h,b=w("three"),D=w("./MxFun"),U=w("./MxDrawObject"),V=w("three-orbitcontrols"),I=w("./MxNetData"),g=w("./MxMaterial"),A=w("./MxDrawData"),M=w("./View/MxDrawMapBox"),N=(v(F,h=U.MxDrawObject),F.prototype.set3DDraw=function(T){this.is3DDraw=T},F.prototype.getOrthographicCamera=function(){return this.camera instanceof b.OrthographicCamera?this.camera:null},F.prototype.getFullDisplayRange=function(){return{minPt:this._initMinDisplayPoint,maxPt:this._initMaxDisplayPoint}},F.prototype.saveZoom=function(){this.camera_recover=this.camera.clone(!1),this.controls.saveState()},F.prototype.recoverZoom=function(){this.camera_recover&&(this.camera.copy(this.camera_recover,!1),this.camera_recover=null,this.getOrthographicCamera().updateProjectionMatrix(),this.controls.reset(),this.mcObject.updateDisplayMatrixData())},F.prototype.zoomW_call=function(T,_,Y,k){if(T.distanceTo(_)<1e-7)console.log("Mx:ZoomW param invalid");else{if(Y!=null&&Y||(T=this.currentCoord2World(T.x,T.y,0),_=this.currentCoord2World(_.x,_.y,0)),T.x>_.x){var S=T.x;T.x=_.x,_.x=S}T.y>_.y&&(S=T.y,T.y=_.y,_.y=S);var G=this.getViewWidth(),C=this.getViewHeight();C<5&&(C=5),G<5&&(G=5);var B=Math.abs(T.x-_.x),R=Math.abs(T.y-_.y);B<1e-5&&(B=1e-5),R<1e-5&&(R=1e-5);var u=this.getOrthographicCamera();if(B/RR.x&&(f.x=R.x),f.x>u.x&&(f.x=u.x),f.x>c.x&&(f.x=c.x),f.y>R.y&&(f.y=R.y),f.y>u.y&&(f.y=u.y),f.y>c.y&&(f.y=c.y);var O=B.clone();O.x=this._dataNum)this._isShowLoading&&a.MxFun.hideLoading();else{var I=this._dataType[this._iGet];this._iGet++;var g=this,A=this._iGet+1,M="$"+this._filename+".mxb"+A+".wgh",N=I!=0;this.getFile(this._path,M,N,function(F){g.net.onStaticMessage(F),g.getDatas()},function(){g._dataNum=0,g._iGet=0,g._isShowLoading&&a.MxFun.hideLoading(),console.log("mx get "+M+" faild")})}},V.prototype.onRenderHead=function(I){var g=JSON.parse(I);this._dataType=g.type,this._dataNum=g.count,this._iGet=0,this._isShowLoading&&a.MxFun.showLoading(),this.getDatas()},V.prototype.getFile=function(I,g,A,M,N){var F=new b;F.setPath(I),F.setBinary(A),F.load(g,M,function(){},N)},V);function V(I){this.net=null,this._dataNum=0,this._iGet=0,this._dataType=[],this._path="",this._filename="",this._isShowLoading=!0,this.net=I}o.MxLocalDwgFileLoad=U},{"./MxFun":27}],29:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxManager=o.MxCpp=o.MxData=void 0;var a,v=w("./View/MxDbEntity"),h=w("./View/MxDbTextureManager"),b=w("./SVGLoader/MxSVGLoader");(a=o.MxData||(o.MxData={})).iSelectRenderOrder=5,a.iCADMeshRenderOrder=10,a.iCADCurveRenderOrder=20,a.iMxEntityRenderOrder=30,a.iGripRenderOrder=110,a.iDynJigRenderOrder=120;var D,U,V,I,g,A,M,N,F,T,_,Y,k=(S.prototype.init=function(G){this.imp=G},S.prototype.getMxCAD_MxCpp=function(){return this.imp},S.prototype.getMxCAD_App=function(){return this.imp.App},S.prototype.newMcGePoint3d=function(G){return this.imp?this.imp.newMcGePoint3d(G):null},S.prototype.decodeFromGb2312=function(G){return this.imp.decodeFromGb2312(G)},S.prototype.encodeToGb2312=function(G){return this.imp.encodeToGb2312(G)},S.prototype.getMcDbCurve=function(G){if(this.imp.App.objectIdIsKindOf(G,"McDbCurve"))return this.imp.App.objectIdToObject(G)},S);function S(){}o.MxCpp=k,D=o.MxManager||(o.MxManager={}),U=[],V=null,g=[],A=void(I=0),M=new h.MxDbTextureManager,N=new b.MxSvgManager,F=new v.MxDbEntityClassHierarchy,T=new k,_={},Y=void 0,D.add=function(G){U.push(G)},D.setloadImageFuction=function(G){Y=G},D.getLoadImageFuction=function(){return Y},D.on=function(G,C){_[G]||(_[G]=[]),_[G].push(C)},D.callEvent=function(G,C){var B;if(_[G])return _[G].forEach(function(R){var u=R(C);B=B||u}),B},D.initMxCpp=function(G){T.init(G)},D.getMxCpp=function(){return T},D.allocId=function(){return++I},D.getMxDbEntityClassHierarchy=function(){return F},D.getMxDbTextureManager=function(){return M},D.getMxDbSvgManager=function(){return N},D.outDebugString=function(G){A==null?console.log(G):A(G)},D.setOutDebugCall=function(G){A=G},D.onLoad=function(){for(var G in U)U[G].onLoad("")},D.updateDisplay=function(){for(var G in U)U[G].updateDisplay()},D.currentMx=function(){return V},D.setCurrentMx=function(G){V=G},D.initResize=function(){for(var G in U)U[G].initResize()},D.addSelectEvent=function(G){g.push(G)},D.clearSelectEvent=function(){g=[]},D.callSelectObject=function(G){for(var C in g)if(g[C](G)==1)break},D.getMxObject=function(G){if(typeof G=="number"){for(var C in U)if(U[C].getId()===G)return U[C]}else for(var C in U)if(U[C].getCanvas()===G)return U[C];return null}},{"./SVGLoader/MxSVGLoader":59,"./View/MxDbEntity":69,"./View/MxDbTextureManager":74}],30:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxMaterial=void 0;var a=w("three");(function(v){v.shaderUniforms={crAmbient:{value:new a.Vector3(1,0,0)},crDiffuse:{value:new a.Vector3(1,0,0)},crSpecular:{value:new a.Vector3(1,0,0)}},v.m_arrSystemColors=new Array(0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10066176,10066252,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510272,8755532,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019904,7510348,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529536,6265164,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,39168,5019980,32512,4161343,19456,2509862,65343,8388511,52275,6737023,39206,5019999,32543,4161359,19475,2509871,65407,8388543,52326,6737049,39244,5020018,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39282,5020037,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39321,5020057,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29337,5014937,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19609,5010073,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9881,5005209,8063,4149119,4940,2502476,255,8355839,204,6710988,153,5000345,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490521,6245529,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980889,7490713,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471257,8735897,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,10027161,10046617,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,10027122,10046597,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,10027084,10046578,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,10027046,10046559,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215),v.m_arrDefUseMaterials=new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null),v.m_arrDefUseCurveMaterials=new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null),v.m_arrDefUseBasicMaterials=new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null),v.m_selectMaterial=new a.MeshPhongMaterial({color:255,opacity:.2,transparent:!0,side:a.DoubleSide}),v.m_mouseMoveMaterial=new a.MeshPhongMaterial({color:16776960,side:a.DoubleSide}),v.m_lockedMaterial=new a.MeshPhongMaterial({color:197379,side:a.DoubleSide}),v.m_samplePoints=new a.PointsMaterial({color:255,depthTest:!1,size:8}),v.m_samplePointsMouseMove=new a.PointsMaterial({color:16711680,depthTest:!1,size:12});var h=new a.MeshBasicMaterial({color:16777215,transparent:!0,depthTest:!1,side:a.DoubleSide,opacity:1,stencilWrite:!1,colorWrite:!1});v.getStencilMaterial=function(){return h},v.GetColorByIndex=function(b){return v.m_arrSystemColors[b]},v.GetColorMaterial=function(b){var D=v.m_arrDefUseMaterials[b];return D===null&&(D=new a.MeshLambertMaterial({color:v.m_arrSystemColors[b],side:a.DoubleSide}),v.m_arrDefUseMaterials[b]=D),D},v.GetBaseColorMaterial=function(b){var D=v.m_arrDefUseBasicMaterials[b];return D===null&&(D=new a.MeshBasicMaterial({color:v.m_arrSystemColors[b],side:a.DoubleSide}),v.m_arrDefUseMaterials[b]=D),D},v.GetCurveColorMaterial=function(b){var D=v.m_arrDefUseCurveMaterials[b];return D===null&&(D=new a.LineBasicMaterial({color:v.m_arrSystemColors[b],linewidth:1}),v.m_arrDefUseCurveMaterials[b]=D),D},v.GetSelectMaterial=function(){return v.m_selectMaterial},v.GetMouseMoveMaterial=function(){return v.m_mouseMoveMaterial},v.GetLockedMaterial=function(){return v.m_lockedMaterial},v.GetSamplePointsMaterial=function(){return v.m_samplePoints},v.GetSamplePointsMouseMoveMaterial=function(){return v.m_samplePointsMouseMove},v.createMaterial=function(b){var D=void 0;if(b==null)return D;function U(V,I){if(I.map!=null){var g=I.map,A=new a.TextureLoader().load(g);A.wrapS=A.wrapT=a.RepeatWrapping,V.map=A,V.side=a.DoubleSide}}return b.transparent!=0?b.transparent=!0:b.transparent=!1,b.name=="MeshPhongMaterial"?U(D=new a.MeshPhongMaterial(b),b):b.name=="MeshBasicMaterial"?U(D=new a.MeshBasicMaterial(b),b):b.name=="MeshDepthMaterial"?U(D=new a.MeshDepthMaterial(b),b):b.name=="MeshNormalMaterial"?U(D=new a.MeshNormalMaterial(b),b):b.name=="MeshLambertMaterial"?U(D=new a.MeshLambertMaterial(b),b):b.name=="MeshStandardMaterial"&&U(D=new a.MeshStandardMaterial(b),b),D}})(o.MxMaterial||(o.MxMaterial={}))},{three:19}],31:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxHFileLoad=o.MxNet=o.MxNetBinMessageType=o.MxNetSend=o.MxNetMessage=o.MxNetMessageType=o.MxNetData=void 0;var a,v,h=w("three"),b=w("./MxFun"),D=w("pako"),U=w("./MxManager"),V=w("./MxDrawData"),I=(g.prototype.getId=function(){return this._dataView.getInt32(4,!0)},g.prototype.getVersion_MwBlobHead=function(){return this._dataView.getInt32(60,!0)},g.prototype.getVersion_MwBlobHeadDynLen=function(){return this._dataView.getInt32(4,!0)},g.prototype.getdPointCurveBuffersHead=function(){var C={};return C.ver=this._dataView.getInt32(4,!0),C.databaseIndex=this._dataView.getInt32(8,!0),C.zeroLayerIdIndex=this._dataView.getInt32(16,!0),C.datacount=this._dataView.getInt32(20,!0),C.datasize=this._dataView.getInt32(24,!0),C},g.prototype.getdPointMeshBuffersHead=function(){var C={};return C.ver=this._dataView.getInt32(4,!0),C.databaseIndex=this._dataView.getInt32(8,!0),C.id=this._dataView.getInt32(12,!0),C.zeroLayerIdIndex=this._dataView.getInt32(16,!0),C.datacount=this._dataView.getInt32(20,!0),C.datasize=this._dataView.getInt32(24,!0),C},g.prototype.getdPointTextureBuffersHead=function(){var C={};return C.ver=this._dataView.getInt32(4,!0),C.databaseIndex=this._dataView.getInt32(8,!0),C.zeroLayerIdIndex=this._dataView.getInt32(16,!0),C.datacount=this._dataView.getInt32(20,!0),C.datasize=this._dataView.getInt32(24,!0),C},g.prototype.getBlobHeadForMemorySectionsHead=function(C){var B={};return B.type=this._dataView.getInt32(C,!0),C+=4,B.ver=this._dataView.getInt32(C,!0),C+=4,B.databaseIndex=this._dataView.getInt32(C,!0),C+=4,B.nOffset=C,B},g.prototype.getMemorySectionsHead=function(){var C=this.getBlobHeadForMemorySectionsHead(0);return C.zeroLayerIdIndex=this._dataView.getInt32(C.nOffset,!0),C.nOffset+=4,C.datacount=this._dataView.getInt32(C.nOffset,!0),C.nOffset+=4,C.datasize=this._dataView.getInt32(C.nOffset,!0),C.nOffset+=4,C.datasize!=C.nOffset&&console.log("mx: sectionshead size assert(0)"),C},g.prototype.getMemorySectionHead=function(C){var B=this.getBlobHeadForMemorySectionsHead(C);return C=B.nOffset,B.pointCount=this._dataView.getInt32(C,!0),C+=4,B.layerId=this._dataView.getInt32(C,!0),C+=4,B.blkId=this._dataView.getInt32(C,!0),C+=4,B.memColor=this._dataView.getInt32(C,!0),C+=4,B.memId=this._dataView.getInt32(C,!0),C+=4,B.memType=this._dataView.getInt32(C,!0),C+=4,B.offset=C,B},g.prototype.getdPointTextureBufferDataHead=function(C){C+=4,C+=4,C+=4;var B={};return B.dataCount=this._dataView.getInt32(C,!0),C+=4,B.layerId=this._dataView.getInt32(C,!0),C+=4,B.blkId=this._dataView.getInt32(C,!0),C+=4,B.offset=C,B},g.prototype.getdPointCurveBufferDataHead=function(C){C+=4,C+=4,C+=4;var B={};return B.pointCount=this._dataView.getInt32(C,!0),C+=4,B.layerId=this._dataView.getInt32(C,!0),C+=4,B.blkId=this._dataView.getInt32(C,!0),C+=4,B.offset=C,B},g.prototype.getdPointMeshBufferDataHead=function(C){C+=4,C+=4,C+=4;var B={};return B.pointCount=this._dataView.getInt32(C,!0),C+=4,B.layerId=this._dataView.getInt32(C,!0),C+=4,B.blkId=this._dataView.getInt32(C,!0),C+=4,B.offset=C,B},g.prototype.getDatabaseIndex=function(){return this._dataView.getInt32(8,!0)},g.prototype.getColorIndex=function(){return this._dataView.getInt32(24,!0)},g.prototype.getBufferType=function(){return this._dataView.getInt32(32,!0)},g.prototype.getIsSketchEntity=function(){return this._dataView.getInt32(40,!0)},g.prototype.getLayerId=function(){return this._dataView.getInt32(44,!0)},g.prototype.getBlockId=function(){return this._dataView.getInt32(48,!0)},g.prototype.getVertexBufferSize=function(){return this._dataView.getInt32(12,!0)},g.prototype.getIndexBufferSize=function(){return this._dataView.getInt32(16,!0)},g.prototype.getZeroLayerId=function(){return this._dataView.getInt32(52,!0)},g.prototype.getSelectMark=function(){return this._dataView.getInt32(56,!0)},g.prototype.getMateria=function(){var C=this._dataView.getInt32(36,!0);if(C==0)return"";for(var B=[],R=0;R=this._dataNum)this.hideLoading(0);else{var C=this._dataType[this._iGet];this._iGet++;var B=this,R=this._iGet+1,u="$"+this._filename+".mxb"+R+".wgh";if(1=this._staticLoadingOpenFiles.length)return console.log("Mx staticLoadingOpenFiles error!"),void this.hideLoading(7);u=this._staticLoadingOpenFiles[this._iGet]}var c=u;this._path&&(c=this._path+u);var f=c.substring(0,c.lastIndexOf("/")+1);if(this.net.getMxDrawObject().setCurrentLoadUrl(f),C==0)this.getFile(this._path,u,function(X){B._isStopLoading||(B.net.onStaticMessage(X)||(console.log(this._path),console.log(u)),B.getData())},function(){B._dataNum=0,B._iGet=0,B.hideLoading(8),console.log("mx get "+u+" faild")});else{var O=new XMLHttpRequest,W=u;this._path&&(W=this._path+u),this._urlParam.length!=0?O.open("GET",W+this._urlParam):O.open("GET",W),V.MxDrawData.m_isRequestHeaderCacheControl&&O.setRequestHeader("Cache-Control","max-age=7200"),this._requestHeader.length!=0&&O.setRequestHeader("usertoken",this._requestHeader),O.responseType="arraybuffer",O.onload=function(){B._isStopLoading||(B.net.onStaticMessage(O.response)||console.log(W),B.getData())},O.addEventListener("error",function(X){B._dataNum=0,B._iGet=0,B.hideLoading(9),console.log("mx get "+u+" faild")},!1),O.send()}}},G.prototype.onRenderHead=function(C){if(!this._isStopLoading){var B=JSON.parse(C);this._dataType=B.type,this._dataNum=B.count,this._iGet=0,this.showLoading(),this.getData()}},G.prototype.getFile=function(C,B,R,u){var c=new h.FileLoader(this.manager);c.setPath(C);var f=B;this._urlParam.length!=0&&(f=B+this._urlParam),this._requestHeader.length!=0&&(c.requestHeader={usertoken:this._requestHeader}),c.load(f,R,function(){},u)},G);function G(C,B){this.net=null,this.manager=null,this._dataNum=0,this._iGet=0,this._dataType=[],this._path="",this._filename="",this._staticLoadingOpenFiles=[],this._isShowLoading=!0,this._requestHeader="",this._isStopLoading=!1,this._urlParam="",this.net=C,this.manager=B!==void 0?B:h.DefaultLoadingManager}o.MxHFileLoad=S},{"./MxDrawData":22,"./MxFun":27,"./MxManager":29,pako:1,three:19}],32:[function(w,r,o){var a;Object.defineProperty(o,"__esModule",{value:!0}),o.MxShader=void 0,(a=o.MxShader||(o.MxShader={})).VSHADER_COLOR_POINT=` precision highp float; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; attribute vec2 position; attribute vec3 color; attribute vec4 tran1; attribute vec4 tran2; attribute vec4 tran3; attribute vec4 tran4; attribute float ishide; varying vec4 vColor; void main(){ mat4 tran; tran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; tran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; tran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; tran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; if(ishide > 0.1) vColor = vec4(color,0.0); else vColor = vec4(color,1.0); gl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); } `,a.VSHADER_COLOR_POINT_BYLAYER=` precision highp float; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform vec3 color; attribute vec2 position; attribute vec4 tran1; attribute vec4 tran2; attribute vec4 tran3; attribute vec4 tran4; attribute float ishide; varying vec4 vColor; void main(){ mat4 tran; tran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; tran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; tran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; tran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; if(ishide > 0.1) vColor = vec4(color,0.0); else vColor = vec4(color,1.0); gl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); } `,a.FSHADER_COLOR_POINT=` precision highp float; varying vec4 vColor; void main() { gl_FragColor = vColor; } `,a.VSHADER_COLOR_POINT_TEXTURE=` precision highp float; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; attribute vec2 position; attribute vec2 uv; attribute vec4 tran1; attribute vec4 tran2; attribute vec4 tran3; attribute vec4 tran4; varying vec2 vUv; void main(){ vUv = uv; mat4 tran; tran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; tran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; tran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; tran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; gl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); } `,a.FSHADER_COLOR_POINT_TEXTURE=` precision highp float; varying vec2 vUv; uniform sampler2D texture; void main() { gl_FragColor = texture2D( texture, vUv ); } `,a.VSHADER_COLOR_POINT_CLIP=` precision highp float; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform vec2 clippt1; uniform vec2 clippt2; uniform float vieww; uniform float viewh; attribute vec2 position; attribute vec3 color; attribute vec4 tran1; attribute vec4 tran2; attribute vec4 tran3; attribute vec4 tran4; attribute float ishide; varying vec4 vColor; varying vec2 vCp1; varying vec2 vCp2; void main(){ mat4 tran; tran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; tran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; tran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; tran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; vec4 pt1 = projectionMatrix * modelViewMatrix * vec4( clippt1.x,clippt1.y,0.0, 1.0 ); vec4 pt2 = projectionMatrix * modelViewMatrix * vec4( clippt2.x,clippt2.y,0.0, 1.0 ); vCp1 = vec2(pt1.x * vieww + vieww,pt1.y * viewh + viewh); vCp2 = vec2(pt2.x * vieww + vieww,pt2.y * viewh + viewh); if(ishide > 0.1) vColor = vec4(color,0.0); else vColor = vec4(color,1.0); gl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); } `,a.VSHADER_COLOR_POINT_BYLAYER_CLIP=` precision highp float; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform vec3 color; uniform vec2 clippt1; uniform vec2 clippt2; uniform float vieww; uniform float viewh; attribute vec2 position; attribute vec4 tran1; attribute vec4 tran2; attribute vec4 tran3; attribute vec4 tran4; attribute float ishide; varying vec4 vColor; varying vec2 vCp1; varying vec2 vCp2; void main(){ mat4 tran; tran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; tran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; tran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; tran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; vec4 pt1 = projectionMatrix * modelViewMatrix * vec4( clippt1.x,clippt1.y,0.0, 1.0 ); vec4 pt2 = projectionMatrix * modelViewMatrix * vec4( clippt2.x,clippt2.y,0.0, 1.0 ); vCp1 = vec2(pt1.x * vieww + vieww,pt1.y * viewh + viewh); vCp2 = vec2(pt2.x * vieww + vieww,pt2.y * viewh + viewh); if(ishide > 0.1) vColor = vec4(color,0.0); else vColor = vec4(color,1.0); gl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); } `,a.FSHADER_COLOR_POINT_CLIP=`precision highp float; varying vec4 vColor; varying vec2 vCp1; varying vec2 vCp2; void main() { if(gl_FragCoord.x > vCp1.x && gl_FragCoord.x < vCp2.x && gl_FragCoord.y > vCp1.y && gl_FragCoord.y < vCp2.y) gl_FragColor = vColor; else discard; } `,a.VSHADER_COLOR_POINT_FORMXCAD=` precision highp float; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform vec3 color; attribute vec2 position; attribute vec4 tran1; attribute vec4 tran2; attribute vec4 tran3; attribute vec4 tran4; attribute float ishide; varying vec4 vColor; void main(){ mat4 tran; tran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; tran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; tran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; tran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; gl_PointSize = 1.0; if(ishide > 0.1) vColor = vec4(color,0.0); else vColor = vec4(color,1.0); gl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); } `,a.FSHADER_COLOR_POINT_FORMXCAD=` precision highp float; varying vec4 vColor; void main() { gl_FragColor = vColor; } `,a.VSHADER_COLOR_POINT_CLIP_FORMXCAD=` precision highp float; uniform mat4 modelViewMatrix; uniform mat4 projectionMatrix; uniform vec3 color; uniform vec2 clippt1; uniform vec2 clippt2; uniform float vieww; uniform float viewh; attribute vec2 position; attribute vec4 tran1; attribute vec4 tran2; attribute vec4 tran3; attribute vec4 tran4; attribute float ishide; varying vec4 vColor; varying vec2 vCp1; varying vec2 vCp2; void main(){ mat4 tran; tran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; tran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; tran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; tran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; vec4 pt1 = projectionMatrix * modelViewMatrix * vec4( clippt1.x,clippt1.y,0.0, 1.0 ); vec4 pt2 = projectionMatrix * modelViewMatrix * vec4( clippt2.x,clippt2.y,0.0, 1.0 ); vCp1 = vec2(pt1.x * vieww + vieww,pt1.y * viewh + viewh); vCp2 = vec2(pt2.x * vieww + vieww,pt2.y * viewh + viewh); if(ishide > 0.1) vColor = vec4(color,0.0); else vColor = vec4(color,1.0); gl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); } `,a.FSHADER_COLOR_POINT_CLIP_FORMXCAD=`precision highp float; varying vec4 vColor; varying vec2 vCp1; varying vec2 vCp2; void main() { if(gl_FragCoord.x > vCp1.x && gl_FragCoord.x < vCp2.x && gl_FragCoord.y > vCp1.y && gl_FragCoord.y < vCp2.y) gl_FragColor = vColor; else discard; } `},{}],33:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxStencilObject=void 0;var a=w("three"),v=w("./MxMaterial"),h=(b.prototype.object_onAfterRender=function(D){var U=this.aryMeshStencil;if(U&&0N&&(_+=(G.fontBoundingBoxAscent+G.fontBoundingBoxDescent)*M,F.push(D.substring(Y,k)),Y=k,S++);if(Y_&&(S+=B=(R.fontBoundingBoxAscent+R.fontBoundingBoxDescent)*T,Y.push(D.substring(G,C)),k.push(B),G=C);if(G>16&255)+"",(g>>8&255)+"",(255&g)+"");F.fillStyle=O,F.textAlign="left",F.textBaseline="bottom";for(var W=0,X=0;W>24&255;return b<=0&&(b=255),b/255},a.getColor=function(h){return 16777215&h},o.MxPair=function(h,b){this.first=h,this.second=b}},{three:19}],39:[function(w,r,o){var a,v,h;Object.defineProperty(o,"__esModule",{value:!0}),o.MxType=void 0,(v=(a=o.MxType||(o.MxType={})).MxCommandFlag||(a.MxCommandFlag={}))[v.MCRX_CMD_MODAL=0]="MCRX_CMD_MODAL",v[v.MCRX_CMD_TRANSPARENT=1]="MCRX_CMD_TRANSPARENT",v[v.MCRX_CMD_NO_UNDO_MARKER=2]="MCRX_CMD_NO_UNDO_MARKER",v[v.MCRX_CMD_NOPRV=4]="MCRX_CMD_NOPRV",v[v.MCRX_CMD_NO_RECORD_PRVCMD=8]="MCRX_CMD_NO_RECORD_PRVCMD",v[v.MCRX_CMD_NO_CLEAR_SELECT=16]="MCRX_CMD_NO_CLEAR_SELECT",(h=a.MxCloneType||(a.MxCloneType={}))[h.kClone=1]="kClone",h[h.kDragClone=2]="kDragClone",h[h.kMxFileClone=3]="kMxFileClone",h[h.kSaveDwgClone=4]="kSaveDwgClone"},{}],40:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxBulid=void 0,window.MxDrawVersion="1.0(2025-02-21 21:21)",(o.MxBulid||(o.MxBulid={})).getVersion=function(){return window.MxDrawVersion?window.MxDrawVersion:"inalid version"}},{}],41:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxWindowsEvent=void 0;var a,v,h,b=w("./MxFun"),D=w("./Operate/MxJigCmdManager"),U=w("./MxDrawData"),V=w("./UI/MxUiVue");function I(T,_){for(var Y=0,k=h.length;YMath.abs(u.y-O.y)?(this.m_ptOrtho.x=u.x,this.m_ptOrtho.y=O.y):(this.m_ptOrtho.x=O.x,this.m_ptOrtho.y=u.y),this.m_isValid=!0}else this.m_isValid=!1}},S.prototype.GetCurOrthoPoint=function(){return{pt:this.m_ptOrtho,isValid:this.m_isValid}},S);function S(u){this.m_mxJig=null,this.m_ptOrtho=new M.Vector3,this.m_isValid=!1,this.m_isTrace=!0,this.m_mxJig=u}o.McEdJigOrtho=k;var G=(C.prototype.setAddDynDrawObject_call=function(u){this.m_addDynDrawObject_call=u},C.prototype.addDynDrawObject=function(u){this.m_addDynDrawObject_call?this.m_addDynDrawObject_call(u):h.addDynDrawObject(u)},C.prototype.drawLine=function(u,c,f){var O=new M.Geometry,W=new M.LineBasicMaterial({color:this.m_iColor});O.vertices.push(new M.Vector3(u.x,u.y,u.z),new M.Vector3(c.x,c.y,c.z));var X=new M.Line(O,W);f.add(X),this.addDynDrawObject(X)},C.prototype.drawPolyline=function(u,c){for(var f=new M.Geometry,O=new M.LineBasicMaterial({color:this.m_iColor}),W=u.length,X=0;Xc)&&(this.m_osmode=T.MxJigCmdManager.OsnapMode.kOsModekInValid));var f=this.m_mxJig.getMxObject().getSysVarLong("OSMODE");this.m_lSpecificOsMode!=0&&(f=this.m_lSpecificOsMode);var O=h.getPrvPoint();this.notifyOsnap(f,h.isValidPrvpoint()?O:void 0)}},R.prototype.seInValidPoint=function(){this.setPoint(void 0)},R.prototype.getCurrentOSnapPoint=function(u){var c={isSnapPoint:!1};return this.isEnable()?(c.pt=u,c.osmode=this.m_osmode,this.m_osmode!=T.MxJigCmdManager.OsnapMode.kOsModekInValid?(c.isSnapPoint=!0,c.pt.x=this.m_ptSnapPoint.x,c.pt.y=this.m_ptSnapPoint.y,c.pt.z=this.m_ptSnapPoint.z,h.isOsnapZValue()||(u.z=0)):c.pt=u):(c.pt=u,c.osmode=T.MxJigCmdManager.OsnapMode.kOsModekInValid),c},R.prototype.setLongprogressStatus=function(u){this.m_iLongprogressStatus=u},R.prototype.reComputeOffset=function(){if(this.m_isOffsetInputPostion){var u=this.m_mxJig.getMxObject(),c=_.MxTools.MillimeterToPixels(8);c=u.screenCoordLong2Doc(c),this.m_vecOffset.set(0,c,0),this.m_vecOffset.applyAxisAngle(new M.Vector3(0,0,1),20*Math.PI/180)}},R);function R(u){this.m_inPoint=new M.Vector3,this.m_vecOffset=new M.Vector3,this.m_pt=new M.Vector3,this.m_isValid=!1,this.m_ptSnapPoint=new M.Vector3,this.m_ptSnapSrcPoint=new M.Vector3,this.m_snapObjectId=0,this.m_osmode=T.MxJigCmdManager.OsnapMode.kOsModekInValid,this.m_prvInputPoint=new M.Vector3,this.m_isValidPrvInputPoint=!1,this.m_lOSmode=0,this.m_iLongprogressStatus=-1,this.m_isOffsetInputPostion=!1,this.m_mxJig=null,this.m_notifyOsnap_delayCall=void 0,this.m_isRuning=!1,this.m_isEnable=!1,this.m_lSpecificOsMode=0,this.m_mxJig=u,this.m_draw=new G}o.McEdJigOsnap=B},{"../MxDrawData":22,"../MxDrawObject":23,"../MxFun":27,"../MxTools":38,"./MxJigCmdManager":54,three:19}],44:[function(w,r,o){var a,v=this&&this.__extends||(a=function(_,Y){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(k,S){k.__proto__=S}||function(k,S){for(var G in S)Object.prototype.hasOwnProperty.call(S,G)&&(k[G]=S[G])})(_,Y)},function(_,Y){function k(){this.constructor=_}a(_,Y),_.prototype=Y===null?Object.create(Y):(k.prototype=Y.prototype,new k)});Object.defineProperty(o,"__esModule",{value:!0}),o.McGiWorldDrawSelect=o.McGiWorldDraw=o.McGiWorldDrawType=void 0;var h,b,D=w("three"),U=w("../MxThreeJS"),V=w("../MxManager"),I=w("three.meshline"),g=w("../MxFun");(b=h=o.McGiWorldDrawType||(o.McGiWorldDrawType={}))[b.kWorldDraw=1]="kWorldDraw",b[b.kDynDragDraw=2]="kDynDragDraw",b[b.kSelectDraw=3]="kSelectDraw";var A=(M.prototype.getType=function(){return this.worldDrawType},M.prototype.setXData=function(_){this.xData=_},M.prototype.setMatrix=function(_){this.matrix=_},M.prototype.getMatrix=function(){return this.matrix},M.prototype.setOpacity=function(_){this.opacity=_},M.prototype.getOpacity=function(){return this.opacity},M.prototype.setColor=function(_){_=g.MxFun.getNumberColor(_),this.iColor!=_&&(this.widthMaterial=null),this.iColor=_},M.prototype.setDash=function(_,Y){this.dDashArray=_,this.dDashRatio=Y},M.prototype.getDash=function(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}},M.prototype.setDashLineDisplay=function(_){_?(this.dDashArray=.03,this.dDashRatio=.1,this.dLineWidth==0&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0)},M.prototype.isDashLineDisplay=function(){return 0=D.MxJigCmdManager.DragStatus.kKW1&&0=D.MxJigCmdManager.DragStatus.kKW1&&(f=D.MxJigCmdManager.DragStatus.kNormal),this.m_resultDragStatus=f,D.MxJigCmdManager.DoneStatius.kExitCommand;U.MxFun.Assert(0)},B.prototype.upDisplay=function(){this.m_currSamplerPoint&&this.m_pWorldDraw&&(this._mxObject.getMcObject().onReadyJigUpdateDispla(),this.m_pWorldDraw.worldDraw(this.m_currSamplerPoint))},B);function B(){var f=G.call(this)||this;return f.m_currSamplerPoint=null,f.m_retcall=null,f.m_resultDragStatus=D.MxJigCmdManager.DragStatus.kCancel,f.m_cursorType=I.MxUiVue.CursorType.kCross,f.setUserInputControls(0),f.setDisableDynInput(!0),f}o.MrxDbgUiPrKeyWord=C;var R,u=(v(c,R=V.MrxDbgUiPrBase),c.prototype.value=function(){return this.m_value},c.prototype.basePt=function(){return new b.Vector3(this.m_basePt.x,this.m_basePt.y,0)},c.prototype.setBasePt=function(f){this.m_basePt==null?this.m_basePt=new b.Vector3(f.x,f.y,0):(this.m_basePt.x=f.x,this.m_basePt.y=f.y),this.m_useBasePt=!0},c.prototype.setUseBasePt=function(f){this.m_useBasePt=f},c.prototype.initGo=function(){this.m_keyWordPicked="",this.m_retcall=null,this.getDynImput().setGetNumber(!0),this.clearLastInputPoint(),this.m_useBasePt&&this.SetLASTPOINT(this.m_basePt)},c.prototype.go=function(f){this.initGo(),this.m_retcall=f,this.m_previousInPoint=null,this.m_currentInPoint=null,this.m_value=0,D.MxJigCmdManager.runCmd(this)},c.prototype.onExitCommand=function(){var f=this;I.MxUiVue.setCursorType(I.MxUiVue.CursorType.kNormal);var O=!1;this.m_retcall!=null&&(D.MxJigCmdManager.setRunCmdEvent(function(){R.prototype.onExitCommand.call(f,!1),O=!0}),this.m_retcall(this.getReturnStatus(this.m_resultDragStatus)),D.MxJigCmdManager.setRunCmdEvent(void 0)),!O&&D.MxJigCmdManager.isWaitCmdNull()&&I.MxUiVue.restoreCmdStatus(),O||R.prototype.onExitCommand.call(this,!0)},c.prototype.onStartCommand=function(){I.MxUiVue.setCursorType(this.m_cursorType),this.printMessage(),D.MxJigCmdManager.setKeywordList(this.keyWords()),R.prototype.onStartCommand.call(this)},c.prototype.sampler=function(){var f,O=D.MxJigCmdManager.acquirePoint(this.m_toucheType,!1);return O.status==D.MxJigCmdManager.DragStatus.kNormal&&(this.m_currSamplerPoint==null?this.m_currSamplerPoint=new b.Vector3(O.pt.x,O.pt.y,0):(this.m_currSamplerPoint.x=O.pt.x,this.m_currSamplerPoint.y=O.pt.y)),f=this.m_useBasePt?this.acquireAngle(this.m_toucheType,this.m_basePt):this.acquireAngle(this.m_toucheType,this.m_currentInPoint),this.procInKeyword(f),f.status==D.MxJigCmdManager.DragStatus.kNormal?(this.m_value=f.ang,f.status):f.status==D.MxJigCmdManager.DragStatus.kKW1?f.status:this.m_useBasePt||this.m_currentInPoint?O.status:((f=this.acquirePoint(this.m_toucheType,!1)).status==D.MxJigCmdManager.DragStatus.kNormal&&f.exit&&(this.m_previousInPoint==null?this.m_previousInPoint=new b.Vector3(f.pt.x,f.pt.y,0):(this.m_previousInPoint.x=f.pt.x,this.m_previousInPoint.y=f.pt.y)),f.status)},c.prototype.done=function(f){if(this.m_retcall!=null)return this.m_resultDragStatus=f,this.m_useBasePt||f!=D.MxJigCmdManager.DragStatus.kNormal||!this.m_previousInPoint||this.m_currentInPoint?D.MxJigCmdManager.DoneStatius.kExitCommand:(this.m_currentInPoint=this.m_previousInPoint,this.m_previousInPoint=null,D.MxJigCmdManager.DoneStatius.kContinueCommand);U.MxFun.Assert(0)},c.prototype.upDisplay=function(){this.m_currSamplerPoint&&(this.m_pWorldDraw&&(this._mxObject.getMcObject().onReadyJigUpdateDispla(),this.m_pWorldDraw.worldDraw(this.m_currSamplerPoint)),this.m_useBasePt&&this.m_basePt?this.drawEntity(g.MxThreeJS.createLine(this.m_currSamplerPoint,this.m_basePt,16777215)):this.m_currentInPoint&&this.drawEntity(g.MxThreeJS.createLine(this.m_currSamplerPoint,this.m_currentInPoint,16777215)))},c);function c(){var f=R.call(this)||this;return f.m_useBasePt=!1,f.m_basePt=null,f.m_previousInPoint=null,f.m_currentInPoint=null,f.m_value=0,f.m_currSamplerPoint=null,f.m_retcall=null,f.m_resultDragStatus=D.MxJigCmdManager.DragStatus.kCancel,f.m_cursorType=I.MxUiVue.CursorType.kCross,f}o.MrxDbgUiPrAngle=u},{"../MxFun":27,"../MxString":34,"../MxThreeJS":37,"../UI/MxUiVue":65,"./MrxDbgUiPrBase":45,"./MxJigCmdManager":54,three:19}],47:[function(w,r,o){var a,v=this&&this.__extends||(a=function(F,T){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(_,Y){_.__proto__=Y}||function(_,Y){for(var k in Y)Object.prototype.hasOwnProperty.call(Y,k)&&(_[k]=Y[k])})(F,T)},function(F,T){function _(){this.constructor=F}a(F,T),F.prototype=T===null?Object.create(T):(_.prototype=T.prototype,new _)});Object.defineProperty(o,"__esModule",{value:!0}),o.MrxDbgUiPrPoint=void 0;var h,b=w("three"),D=w("./MxJigCmdManager"),U=w("../MxFun"),V=w("./MrxDbgUiPrBase"),I=w("../UI/MxUiVue"),g=w("../MxThreeJS"),A=w("../MxManager"),M=(v(N,h=V.MrxDbgUiPrBase),N.prototype.value=function(){return new b.Vector3(this.m_value.x,this.m_value.y,0)},N.prototype.getCADValue=function(){return A.MxManager.getMxCpp().newMcGePoint3d(new b.Vector3(this.m_value.x,this.m_value.y,0))},N.prototype.basePt=function(){return new b.Vector3(this.m_basePt.x,this.m_basePt.y,0)},N.prototype.setBasePt=function(F){this.m_basePt==null?this.m_basePt=new b.Vector3(F.x,F.y,0):(this.m_basePt.x=F.x,this.m_basePt.y=F.y),this.m_useBasePt=!0},N.prototype.setUseBasePt=function(F){this.m_useBasePt=F},N.prototype.initGo=function(){this.m_keyWordPicked="",this.m_retcall=null,this.m_retWhileCall=null,this.m_exitCall=null,this.m_useBasePt&&this.SetLASTPOINT(this.m_basePt)},N.prototype.go=function(F){this.initGo(),this.m_retcall=F,D.MxJigCmdManager.runCmd(this)},N.prototype.goWhile=function(F,T){this.initGo(),this.m_retWhileCall=F,T&&(this.m_exitCall=T),D.MxJigCmdManager.runCmd(this)},N.prototype.onExitCommand=function(){var F=this;I.MxUiVue.setCursorType(I.MxUiVue.CursorType.kNormal);var T=!1;this.m_retcall!=null&&(D.MxJigCmdManager.setRunCmdEvent(function(){h.prototype.onExitCommand.call(F,!1),T=!0}),this.m_retcall(this.getReturnStatus(this.m_resultDragStatus)),D.MxJigCmdManager.setRunCmdEvent(void 0)),!T&&D.MxJigCmdManager.isWaitCmdNull()&&I.MxUiVue.restoreCmdStatus(),T||h.prototype.onExitCommand.call(this,!0)},N.prototype.onStartCommand=function(){I.MxUiVue.setCursorType(this.m_cursorType),this.printMessage(),D.MxJigCmdManager.setKeywordList(this.keyWords()),this.m_useBasePt&&this.SetLASTPOINT(this.m_basePt),h.prototype.onStartCommand.call(this)},N.prototype.sampler=function(){var F=this.acquirePoint(this.m_toucheType);return this.procInKeyword(F),F.status==D.MxJigCmdManager.DragStatus.kNormal&&(this.m_value==null?this.m_value=new b.Vector3(F.pt.x,F.pt.y,0):(this.m_value.x=F.pt.x,this.m_value.y=F.pt.y)),F.status},N.prototype.done=function(F){if(this.m_retcall!=null)return this.m_resultDragStatus=F,this.m_exitCall&&this.m_exitCall(this.getReturnStatus(this.m_resultDragStatus)),D.MxJigCmdManager.DoneStatius.kExitCommand;if(this.m_retWhileCall!=null){if((this.m_resultDragStatus=F)==D.MxJigCmdManager.DragStatus.kCancel)return this.m_exitCall&&this.m_exitCall(this.getReturnStatus(this.m_resultDragStatus)),D.MxJigCmdManager.DoneStatius.kExitCommand;var T=!1;F==D.MxJigCmdManager.DragStatus.kNull&&(T=!0);var _=this.m_retWhileCall(this.getReturnStatus(this.m_resultDragStatus));return _!=null&&_.exit!=null&&(T=_.exit),T?(this.m_exitCall&&this.m_exitCall(this.getReturnStatus(this.m_resultDragStatus)),D.MxJigCmdManager.DoneStatius.kExitCommand):(D.MxJigCmdManager.setKeywordList(this.keyWords()),this.printMessage(),D.MxJigCmdManager.DoneStatius.kContinueCommand)}U.MxFun.Assert(0)},N.prototype.upDisplay=function(){if(this.m_value&&(this.m_pWorldDraw&&(this._mxObject.getMcObject().onReadyJigUpdateDispla(0,this.m_value),this.m_pWorldDraw.worldDraw(this.m_value)),this.m_useBasePt&&this.m_basePt)){var F=16777215;this._mxObject.isWhiteViewColor()&&(F=0);var T=this._mxObject;this.drawEntity(g.MxThreeJS.createLine(T.toSmallcoord(this.m_value),T.toSmallcoord(this.m_basePt),F),void 0,!0)}},N);function N(){var F=h.call(this)||this;return F.m_useBasePt=!1,F.m_basePt=null,F.m_value=null,F.m_retcall=null,F.m_retWhileCall=null,F.m_exitCall=null,F.m_resultDragStatus=D.MxJigCmdManager.DragStatus.kCancel,F.m_cursorType=I.MxUiVue.CursorType.kCross,F}o.MrxDbgUiPrPoint=M},{"../MxFun":27,"../MxManager":29,"../MxThreeJS":37,"../UI/MxUiVue":65,"./MrxDbgUiPrBase":45,"./MxJigCmdManager":54,three:19}],48:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.MxCmdRunManager=void 0;var a,v,h,b,D,U,V,I,g=w("../MxFun"),A=w("../MxType"),M=w("./MxJigCmdManager"),N=w("../UI/MxUiVue"),F=w("../MxDrawData");a=o.MxCmdRunManager||(o.MxCmdRunManager={}),v={},h=new Array,b=0,D=!1,U="",V={},I={},a.InitQuickCommand=function(T){if(T)if(T instanceof Array)for(var _=T.length,Y=0;Y<_;Y++){var k=T[Y];if(!(k.length<2)){var S=k[0];if(S.length!=0)for(var G=k.length,C=1;C=h.length&&(b=0):D=!0,!0},a.MoveDownKey=function(){return!!D&&(--b<0&&(b=h.length-1),!0)},a.GetListCommad=function(){return b<0||b>=h.length?"":h[b]},a.ClearPrvCmd=function(){U=""},a.GetPrvCmd=function(){return U},a.SetPrvCmd=function(T){U=T},a.runCmd=function(T,_,Y){var k=_.toUpperCase(),S=v[k];if(T&&S==null){var G=V[k];if(G!=null&&(S=v[G.toUpperCase()]),S==null)return N.MxUiVue.isNull()?console.log(g.MxFun.formatString('未知命令"{0}"',_)):N.MxUiVue.acutPrintf(`未知命令"{0}"。 命令:`,_),!1}if(!S)return!1;T.endPanCommand(),T.getTempMarkDraw().clear(!1);var C=h.indexOf(S.cmd);-1N.x)C=V.MxThreeJS.createLines(G,16777215),B=255;else{var R=this.getMxObject().viewCoordLong2Cad(3);C=V.MxThreeJS.createDashedLines(G,16777215,2*R,R)}var u=[];u.push(N),u.push(T),u.push(F),u.push(N),u.push(F),u.push(_);var c=V.MxThreeJS.createTriangle(u,B,.27);this.drawEntity(c,30),this.drawEntity(C,31)},A);function A(M){var N=h.call(this)||this;return N.m_pt1=M,N.m_pt2=M,N}o.MxIntelliSelectJig=g},{"../MxThreeJS":37,"../MxTools":38,"./MxJig":53,"./MxJigCmdManager":54,three:19}],53:[function(w,r,o){Object.defineProperty(o,"__esModule",{value:!0}),o.McEdJigCommand=o.MxDynamicInput=void 0;var a=w("three"),v=w("../MxFun"),h=w("./MxJigCmdManager"),b=w("../MxManager"),D=w("../MxTools"),U=w("../UI/MxUiVue"),V=w("./McEdJigOsnap"),I=w("./McEdJigDynamicTrace"),g=w("./MxPolarAxisTrace"),A=w("./MxGridTrace"),M=w("../MxThreeJS"),N=w("../MxDrawData"),F=w("./MxOffsetArrow"),T=(_.prototype.getLockValuesMap=function(){return this.m_isShowDynInput?U.MxUiVue.DynamicInput_getLockValuesMap():new Map},_.prototype.getFocusIndex=function(){return this.m_isShowDynInput?this.m_iFocusIndex:-1},_.prototype.ClearDynDrawEntity=function(){for(var S=this.m_jig.getMxObject().getTheTempDrawContainer_SmallCoord(),G=this.m_vecDynDrawEntity.length,C=0;CNumber.EPSILON?A.loc=g.RIGHT:c*O<0||f*W<0?A.loc=g.BEHIND:Math.sqrt(c*c+f*f)=ge.t-Number.EPSILON})===void 0&&(X.push(ge),J.push(new b.Vector2(ge.x,ge.y)))},je=1;jeR&&(R=W.y),W.yc&&(c=W.x),W.x=A&&kr.push(Xt[$t]);return kr.push(Xt[Xt.length-1]),kr}(V)).length;if(ue<2)return 0;var be,je,ve,Be,q,ge,oe=V[0].equals(V[ue-1]),le=V[0],Pe=I.strokeWidth/2,Ye=1/(ue-1),ze=0,se=!1,xe=0,De=3*T,tt=2*T;yt(V[0],V[1],_).multiplyScalar(Pe),R.copy(V[0]).sub(_),u.copy(V[0]).add(_),c.copy(R),f.copy(u);for(var st=1;st"),this.isShowMainMenu&&(document.write(""),document.write(""),document.write("