function __awaiter(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{l(r.next(t))}catch(t){o(t)}}function s(t){try{l(r.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}l((r=r.apply(t,e||[])).next())})}function dynamicImport(t){return __awaiter(this,void 0,void 0,function*(){let e;switch(t){case"jquery":e=yield dynamicImportJquery();break;case"element-resize-event-polyfill":e=yield dynamicImportResize()}return e})}function dynamicImportResize(){return __awaiter(this,void 0,void 0,function*(){try{const t=yield Promise.resolve().then(function(){return elementResizeEventPolyfill_umd_min$2});return t.default?t.default:t}catch(t){console.log("import动态导入:element-resize-event-polyfill失败!",t)}})}function dynamicImportJquery(){return __awaiter(this,void 0,void 0,function*(){try{const t=yield Promise.resolve().then(function(){return jquery$1});return t.default?t.default:t}catch(t){console.log("import动态导入:jquery失败!",t)}})}let _mapDynamicCreate=null;function intiDynamicCreateMxObject(){_mapDynamicCreate||((_mapDynamicCreate={}).MxDbArea=(()=>Promise.resolve().then(function(){return index$8})),_mapDynamicCreate.MxDbLeadTag=(()=>Promise.resolve().then(function(){return index$7})),_mapDynamicCreate.MxDbCoord=(()=>Promise.resolve().then(function(){return index$c})),_mapDynamicCreate.MxDb2LineAngularDimension=(()=>Promise.resolve().then(function(){return index$e})),_mapDynamicCreate.Mx3PointArc=(()=>Promise.resolve().then(function(){return index$d})),_mapDynamicCreate.MxDbAnyLine=(()=>Promise.resolve().then(function(){return index$6})),_mapDynamicCreate.MxDbCloudLine=(()=>Promise.resolve().then(function(){return index$5})),_mapDynamicCreate.MxDbLeadComment=(()=>Promise.resolve().then(function(){return index$3})),_mapDynamicCreate.MxDbRectBoxLeadComment=(()=>Promise.resolve().then(function(){return index$2})),_mapDynamicCreate.MxDbEllipse=(()=>Promise.resolve().then(function(){return index$1})),_mapDynamicCreate.MxDbText=(()=>Promise.resolve().then(function(){return index})),_mapDynamicCreate.MxDbRegularPolygon=(()=>Promise.resolve().then(function(){return index$4})),_mapDynamicCreate.MxDbHatch=(()=>Promise.resolve().then(function(){return index$9})),_mapDynamicCreate.MxDbHatch=(()=>Promise.resolve().then(function(){return index$9})))}function dynamicCreateMxObject(t){return __awaiter(this,void 0,void 0,function*(){let e;switch(intiDynamicCreateMxObject(),t){case"MxDbSVG":try{e=yield Promise.resolve().then(function(){return index$g})}catch(e){console.log("import:"+t+"error!",e)}break;case"MxDbImage":try{e=yield Promise.resolve().then(function(){return index$i})}catch(e){console.log("import:"+t+"error!",e)}break;case"MxDbRect":try{e=yield Promise.resolve().then(function(){return index$b})}catch(e){console.log("import:"+t+"error!",e)}break;case"MxDbSVGText":try{e=yield Promise.resolve().then(function(){return index$h})}catch(e){console.log("import:"+t+"error!",e)}break;case"MxDbPolyline":try{e=yield Promise.resolve().then(function(){return index$f})}catch(e){console.log("import:"+t+"error!",e)}break;case"MxDbAlignedDimension":try{e=yield Promise.resolve().then(function(){return index$a})}catch(e){console.log("import:"+t+"error!",e)}}if(!e&&_mapDynamicCreate[t])try{e=yield _mapDynamicCreate[t]()}catch(e){console.log("import:"+t+"error!",e)}return e?e.default?e.default:e:(console.log("mx dynmac load:"+t+" failed"),null)})}class PubSub{constructor(){this.events={}}on(t,e){let n=this;return n.events.hasOwnProperty(t)||(n.events[t]=[]),n.events[t].push(e)}emit(t,...e){return this.events.hasOwnProperty(t)?this.events[t].map(t=>t(...e)):[]}off(t,e){if(this.events[t]){const n=this.events[t].indexOf(e);this.events[t].splice(n,1)}}}class Store{constructor(t){let e=this;e.actions={},e.mutations={},e.state=t.state,e.status="resting",e.events=new PubSub,t.hasOwnProperty("actions")&&(e.actions=t.actions),t.hasOwnProperty("mutations")&&(e.mutations=t.mutations)}dispatch(t,e){let n=this;return"function"!=typeof n.actions[t]?(console.error(`Action "${t} doesn't exist.`),!1):(console.groupCollapsed(`ACTION: ${t}`),n.status="action",n.actions[t](n,e),console.groupEnd(),!0)}commit(t,e){let n=this;if("function"!=typeof n.mutations[t])return console.log(`Mutation "${t}" doesn't exist`),!1;n.status="mutation";let r=n.mutations[t](n.state,e);return n.state=Object.assign(n.state,r),!0}}const options={state:{MxFun:null,Mxassembly:null,isCreateDrawObj:!1},actions:{},mutations:{}};for(let t in options.state){const e=t.charAt(0).toUpperCase()+t.slice(1);options.mutations["set"+e]=((e,n)=>{e[t]=n})}const store=new Store(options);function mxfun(){!function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){return i(e[a][1][t]||t)},u,u.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a>>6:(n<65536?e[a++]=224|n>>>12:(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63),e[a++]=128|n>>>6&63),e[a++]=128|63&n);return e},n.buf2binstring=function(t){return l(t,t.length)},n.binstring2buf=function(t){for(var e=new r.Buf8(t.length),n=0,i=e.length;n>10&1023,c[r++]=56320|1023&i)}return l(c,r)},n.utf8border=function(t,e){var n;for((e=e||t.length)>t.length&&(e=t.length),n=e-1;0<=n&&128==(192&t[n]);)n--;return!(n<0)&&0!==n&&n+a[t[n]]>e?n:e}},{"./common":4}],6:[function(t,e,n){e.exports=function(t,e,n,r){for(var i=65535&t|0,o=t>>>16&65535|0,a=0;0!==n;){for(n-=a=2e3>>1:t>>>1;e[n]=t}return e}();e.exports=function(t,e,n,i){var o=r,a=i+n;t^=-1;for(var s=i;s>>8^o[255&(t^e[s])];return-1^t}},{}],9:[function(t,e,n){var r,i=t("../utils/common"),o=t("./trees"),a=t("./adler32"),s=t("./crc32"),l=t("./messages"),c=-2,u=258,h=262,d=113;function p(t,e){return t.msg=l[e],e}function f(t){return(t<<1)-(4t.avail_out&&(n=t.avail_out),0!==n&&(i.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function y(t,e){o._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,g(t.strm)}function v(t,e){t.pending_buf[t.pending++]=e}function x(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function b(t,e){var n,r,i=t.max_chain_length,o=t.strstart,a=t.prev_length,s=t.nice_match,l=t.strstart>t.w_size-h?t.strstart-(t.w_size-h):0,c=t.window,d=t.w_mask,p=t.prev,f=t.strstart+u,m=c[o+a-1],g=c[o+a];t.prev_length>=t.good_match&&(i>>=2),s>t.lookahead&&(s=t.lookahead);do{if(c[(n=e)+a]===g&&c[n+a-1]===m&&c[n]===c[o]&&c[++n]===c[o+1]){o+=2,n++;do{}while(c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&c[++o]===c[++n]&&ol&&0!=--i);return a<=t.lookahead?a:t.lookahead}function w(t){var e,n,r,o,l,c,u,d,p,f,m=t.w_size;do{if(o=t.window_size-t.lookahead-t.strstart,t.strstart>=m+(m-h)){for(i.arraySet(t.window,t.window,m,m,0),t.match_start-=m,t.strstart-=m,t.block_start-=m,e=n=t.hash_size;r=t.head[--e],t.head[e]=m<=r?r-m:0,--n;);for(e=n=m;r=t.prev[--e],t.prev[e]=m<=r?r-m:0,--n;);o+=m}if(0===t.strm.avail_in)break;if(c=t.strm,u=t.window,d=t.strstart+t.lookahead,f=void 0,(p=o)<(f=c.avail_in)&&(f=p),n=0===f?0:(c.avail_in-=f,i.arraySet(u,c.input,c.next_in,f,d),1===c.state.wrap?c.adler=a(c.adler,u,f,d):2===c.state.wrap&&(c.adler=s(c.adler,u,f,d)),c.next_in+=f,c.total_in+=f,f),t.lookahead+=n,t.lookahead+t.insert>=3)for(l=t.strstart-t.insert,t.ins_h=t.window[l],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(r=o._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3&&t.match_length<=t.prev_length){for(i=t.strstart+t.lookahead-3,r=o._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=i&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(w(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((0===t.strstart||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,y(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-h&&(y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(y(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(y(t,!1),t.strm.avail_out),1)}),new C(4,4,8,4,M),new C(4,5,16,8,M),new C(4,6,32,32,M),new C(4,4,16,16,_),new C(8,16,32,32,_),new C(8,16,128,128,_),new C(8,32,128,256,_),new C(32,128,258,1024,_),new C(32,258,258,4096,_)],n.deflateInit=function(t,e){return E(t,e,8,15,8,0)},n.deflateInit2=E,n.deflateReset=T,n.deflateResetKeep=S,n.deflateSetHeader=function(t,e){return t&&t.state&&2===t.state.wrap?(t.state.gzhead=e,0):c},n.deflate=function(t,e){var n,i,a,l;if(!t||!t.state||5>8&255),v(i,i.gzhead.time>>16&255),v(i,i.gzhead.time>>24&255),v(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),v(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(v(i,255&i.gzhead.extra.length),v(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=s(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(v(i,0),v(i,0),v(i,0),v(i,0),v(i,0),v(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),v(i,3),i.status=d);else{var h=8+(i.w_bits-8<<4)<<8;h|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(h|=32),h+=31-h%31,i.status=d,x(i,h),0!==i.strstart&&(x(i,t.adler>>>16),x(i,65535&t.adler)),t.adler=1}if(69===i.status)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),g(t),a=i.pending,i.pending!==i.pending_buf_size));)v(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),g(t),a=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexa&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===l&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),g(t),a=i.pending,i.pending===i.pending_buf_size)){l=1;break}l=i.gzindexa&&(t.adler=s(t.adler,i.pending_buf,i.pending-a,a)),0===l&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&g(t),i.pending+2<=i.pending_buf_size&&(v(i,255&t.adler),v(i,t.adler>>8&255),t.adler=0,i.status=d)):i.status=d),0!==i.pending){if(g(t),0===t.avail_out)return i.last_flush=-1,0}else if(0===t.avail_in&&f(e)<=f(n)&&4!==e)return p(t,-5);if(666===i.status&&0!==t.avail_in)return p(t,-5);if(0!==t.avail_in||0!==i.lookahead||0!==e&&666!==i.status){var b=2===i.strategy?function(t,e){for(var n;;){if(0===t.lookahead&&(w(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(y(t,!1),0===t.strm.avail_out)?1:2}(i,e):3===i.strategy?function(t,e){for(var n,r,i,a,s=t.window;;){if(t.lookahead<=u){if(w(t),t.lookahead<=u&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(n=o._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=o._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(y(t,!1),0===t.strm.avail_out)?1:2}(i,e):r[i.level].func(i,e);if(3!==b&&4!==b||(i.status=666),1===b||3===b)return 0===t.avail_out&&(i.last_flush=-1),0;if(2===b&&(1===e?o._tr_align(i):5!==e&&(o._tr_stored_block(i,0,0,!1),3===e&&(m(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),g(t),0===t.avail_out))return i.last_flush=-1,0}return 4!==e?0:i.wrap<=0?1:(2===i.wrap?(v(i,255&t.adler),v(i,t.adler>>8&255),v(i,t.adler>>16&255),v(i,t.adler>>24&255),v(i,255&t.total_in),v(i,t.total_in>>8&255),v(i,t.total_in>>16&255),v(i,t.total_in>>24&255)):(x(i,t.adler>>>16),x(i,65535&t.adler)),g(t),0=n.w_size&&(0===s&&(m(n.head),n.strstart=0,n.block_start=0,n.insert=0),d=new i.Buf8(n.w_size),i.arraySet(d,e,p-n.w_size,n.w_size,0),e=d,p=n.w_size),l=t.avail_in,u=t.next_in,h=t.input,t.avail_in=p,t.next_in=0,t.input=e,w(n);n.lookahead>=3;){for(r=n.strstart,o=n.lookahead-2;n.ins_h=(n.ins_h<>>=b=x>>>24,f-=b,0==(b=x>>>16&255))T[o++]=65535&x;else{if(!(16&b)){if(0==(64&b)){x=m[(65535&x)+(p&(1<>>=b,f-=b),f<15&&(p+=S[r++]<>>=b=x>>>24,f-=b,!(16&(b=x>>>16&255))){if(0==(64&b)){x=g[(65535&x)+(p&(1<>>=b,f-=b,(b=o-a)>3,p&=(1<<(f-=w<<3))-1,t.next_in=r,t.next_out=o,t.avail_in=r>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function u(){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 r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function h(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new r.Buf32(852),e.distcode=e.distdyn=new r.Buf32(592),e.sane=1,e.back=-1,0):l}function d(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,h(t)):l}function p(t,e){var n,r;return t&&t.state?(r=t.state,e<0?(n=0,e=-e):(n=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=a.wsize?(r.arraySet(a.window,e,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i<(o=a.wsize-a.wnext)&&(o=i),r.arraySet(a.window,e,n-i,o,a.wnext),(i-=o)?(r.arraySet(a.window,e,n-i,i,0),a.wnext=i,a.whave=a.wsize):(a.wnext+=o,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=o(n.check,F,2,0),y=g=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&g)<<8)+(g>>8))%31){t.msg="incorrect header check",n.mode=30;break}if(8!=(15&g)){t.msg="unknown compression method",n.mode=30;break}if(y-=4,P=8+(15&(g>>>=4)),0===n.wbits)n.wbits=P;else if(P>n.wbits){t.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(F[0]=255&g,F[1]=g>>>8&255,n.check=o(n.check,F,2,0)),y=g=0,n.mode=3;case 3:for(;y<32;){if(0===f)break t;f--,g+=u[d++]<>>8&255,F[2]=g>>>16&255,F[3]=g>>>24&255,n.check=o(n.check,F,4,0)),y=g=0,n.mode=4;case 4:for(;y<16;){if(0===f)break t;f--,g+=u[d++]<>8),512&n.flags&&(F[0]=255&g,F[1]=g>>>8&255,n.check=o(n.check,F,2,0)),y=g=0,n.mode=5;case 5:if(1024&n.flags){for(;y<16;){if(0===f)break t;f--,g+=u[d++]<>>8&255,n.check=o(n.check,F,2,0)),y=g=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(f<(M=n.length)&&(M=f),M&&(n.head&&(P=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,u,d,M,P)),512&n.flags&&(n.check=o(n.check,u,M,d)),f-=M,d+=M,n.length-=M),n.length))break t;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===f)break t;for(M=0;P=u[d+M++],n.head&&P&&n.length<65536&&(n.head.name+=String.fromCharCode(P)),P&&M>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=12;break;case 10:for(;y<32;){if(0===f)break t;f--,g+=u[d++]<>>=7&y,y-=7&y,n.mode=27;break}for(;y<3;){if(0===f)break t;f--,g+=u[d++]<>>=1)){case 0:n.mode=14;break;case 1:if(v(n),n.mode=20,6!==e)break;g>>>=2,y-=2;break t;case 2:n.mode=17;break;case 3:t.msg="invalid block type",n.mode=30}g>>>=2,y-=2;break;case 14:for(g>>>=7&y,y-=7&y;y<32;){if(0===f)break t;f--,g+=u[d++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&g,y=g=0,n.mode=15,6===e)break t;case 15:n.mode=16;case 16:if(M=n.length){if(f>>=5,y-=5,n.ndist=1+(31&g),g>>>=5,y-=5,n.ncode=4+(15&g),g>>>=4,y-=4,286>>=3,y-=3}for(;n.have<19;)n.lens[B[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,R={bits:n.lenbits},L=s(0,n.lens,0,19,n.lencode,0,n.work,R),n.lenbits=R.bits,L){t.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,E=65535&k,!((S=k>>>24)<=y);){if(0===f)break t;f--,g+=u[d++]<>>=S,y-=S,n.lens[n.have++]=E;else{if(16===E){for(I=S+2;y>>=S,y-=S,0===n.have){t.msg="invalid bit length repeat",n.mode=30;break}P=n.lens[n.have-1],M=3+(3&g),g>>>=2,y-=2}else if(17===E){for(I=S+3;y>>=S)),g>>>=3,y-=3}else{for(I=S+7;y>>=S)),g>>>=7,y-=7}if(n.have+M>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=30;break}for(;M--;)n.lens[n.have++]=P}}if(30===n.mode)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,R={bits:n.lenbits},L=s(1,n.lens,0,n.nlen,n.lencode,0,n.work,R),n.lenbits=R.bits,L){t.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,R={bits:n.distbits},L=s(2,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,R),n.distbits=R.bits,L){t.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===e)break t;case 20:n.mode=21;case 21:if(6<=f&&258<=m){t.next_out=p,t.avail_out=m,t.next_in=d,t.avail_in=f,n.hold=g,n.bits=y,a(t,w),p=t.next_out,h=t.output,m=t.avail_out,d=t.next_in,u=t.input,f=t.avail_in,g=n.hold,y=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;T=(k=n.lencode[g&(1<>>16&255,E=65535&k,!((S=k>>>24)<=y);){if(0===f)break t;f--,g+=u[d++]<>D)])>>>16&255,E=65535&k,!(D+(S=k>>>24)<=y);){if(0===f)break t;f--,g+=u[d++]<>>=D,y-=D,n.back+=D}if(g>>>=S,y-=S,n.back+=S,n.length=E,0===T){n.mode=26;break}if(32&T){n.back=-1,n.mode=12;break}if(64&T){t.msg="invalid literal/length code",n.mode=30;break}n.extra=15&T,n.mode=22;case 22:if(n.extra){for(I=n.extra;y>>=n.extra,y-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;T=(k=n.distcode[g&(1<>>16&255,E=65535&k,!((S=k>>>24)<=y);){if(0===f)break t;f--,g+=u[d++]<>D)])>>>16&255,E=65535&k,!(D+(S=k>>>24)<=y);){if(0===f)break t;f--,g+=u[d++]<>>=D,y-=D,n.back+=D}if(g>>>=S,y-=S,n.back+=S,64&T){t.msg="invalid distance code",n.mode=30;break}n.offset=E,n.extra=15&T,n.mode=24;case 24:if(n.extra){for(I=n.extra;y>>=n.extra,y-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===m)break t;if(M=w-m,n.offset>M){if((M=n.offset-M)>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=30;break}_=M>n.wnext?(M-=n.wnext,n.wsize-M):n.wnext-M,M>n.length&&(M=n.length),C=n.window}else C=h,_=p-n.offset,M=n.length;for(mv?(b=B[j+h[C]],R[I+h[C]]):(b=96,0),p=1<<_-A,S=f=1<>A)+(f-=p)]=x<<24|b<<16|w|0,0!==f;);for(p=1<<_-1;L&p;)p>>=1;if(0!==p?(L&=p-1,L+=p):L=0,C++,0==--k[_]){if(_===T)break;_=e[n+h[C]]}if(E<_&&(L&g)!==m){for(0===A&&(A=E),y+=S,O=1<<(D=_-A);D+A>>7)]}function S(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function T(t,e,n){t.bi_valid>16-n?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=n-16):(t.bi_buf|=e<>>=1,n<<=1,0<--e;);return n>>>1}function A(t,e,n){var r,i,o=new Array(16),a=0;for(r=1;r<=l;r++)o[r]=a=a+n[r-1]<<1;for(i=0;i<=e;i++){var s=t[2*i+1];0!==s&&(t[2*i]=D(o[s]++,s))}}function O(t){var e;for(e=0;e>1;1<=n;n--)R(t,o,n);for(i=c;n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],R(t,o,1),r=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=r,o[2*i]=o[2*n]+o[2*r],t.depth[i]=(t.depth[n]>=t.depth[r]?t.depth[n]:t.depth[r])+1,o[2*n+1]=o[2*r+1]=i,t.heap[1]=i++,R(t,o,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var n,r,i,o,a,s,c=e.dyn_tree,u=e.max_code,h=e.stat_desc.static_tree,d=e.stat_desc.has_stree,p=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,m=e.stat_desc.max_length,g=0;for(o=0;o<=l;o++)t.bl_count[o]=0;for(c[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;n<573;n++)m<(o=c[2*c[2*(r=t.heap[n])+1]+1]+1)&&(o=m,g++),c[2*r+1]=o,u>=7;r>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e>>3,(a=t.static_len+3+7>>>3)<=i&&(i=a)):i=a=n+5,n+4<=i&&-1!==e?N(t,e,n,r):4===t.strategy||a===i?(T(t,2+(r?1:0),3),I(t,p,f)):(T(t,4+(r?1:0),3),function(t,e,n,r){var i;for(T(t,e-257,5),T(t,n-1,5),T(t,r-4,4),i=0;i>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(g[n]+o+1)]++,t.dyn_dtree[2*C(e)]++),t.last_lit===t.lit_bufsize-1},n._tr_align=function(t){var e;T(t,2,3),E(t,256,p),16===(e=t).bi_valid?(S(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":4}],16:[function(t,e,n){e.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(t,e,n){var r=t("three");r.OrbitControls=function(t,e){var n,i,o,a,s;void 0===e&&console.warn('THREE.OrbitControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.OrbitControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.enabled=!0,this.target=new r.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:r.MOUSE.ROTATE,MIDDLE:r.MOUSE.DOLLY,RIGHT:r.MOUSE.PAN},this.touches={ONE:r.TOUCH.ROTATE,TWO:r.TOUCH.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return m.phi},this.getAzimuthalAngle=function(){return m.theta},this.saveState=function(){l.target0.copy(l.target),l.position0.copy(l.object.position),l.zoom0=l.object.zoom},this.resetStatusValue=function(){p=d.NONE},this.reset=function(){l.target.copy(l.target0),l.object.position.copy(l.position0),l.object.zoom=l.zoom0,l.object.updateProjectionMatrix(),l.dispatchEvent(c),l.update(),p=d.NONE},this.update=(n=new r.Vector3,i=(new r.Quaternion).setFromUnitVectors(t.up,new r.Vector3(0,1,0)),o=i.clone().inverse(),a=new r.Vector3,s=new r.Quaternion,function(){var t=l.object.position;return n.copy(t).sub(l.target),n.applyQuaternion(i),m.setFromVector3(n),l.autoRotate&&p===d.NONE&&O(2*Math.PI/60/60*l.autoRotateSpeed),l.enableDamping?(m.theta+=g.theta*l.dampingFactor,m.phi+=g.phi*l.dampingFactor):(m.theta+=g.theta,m.phi+=g.phi),m.theta=Math.max(l.minAzimuthAngle,Math.min(l.maxAzimuthAngle,m.theta)),m.phi=Math.max(l.minPolarAngle,Math.min(l.maxPolarAngle,m.phi)),m.makeSafe(),m.radius*=y,m.radius=Math.max(l.minDistance,Math.min(l.maxDistance,m.radius)),!0===l.enableDamping?l.target.addScaledVector(v,l.dampingFactor):l.target.add(v),n.setFromSpherical(m),n.applyQuaternion(o),t.copy(l.target).add(n),l.object.lookAt(l.target),!0===l.enableDamping?(g.theta*=1-l.dampingFactor,g.phi*=1-l.dampingFactor,v.multiplyScalar(1-l.dampingFactor)):(g.set(0,0,0),v.set(0,0,0)),y=1,!(!(x||a.distanceToSquared(l.object.position)>f||8*(1-s.dot(l.object.quaternion))>f)||(l.dispatchEvent(c),a.copy(l.object.position),s.copy(l.object.quaternion),x=!1))}),this.dispose=function(){l.domElement.removeEventListener("contextmenu",nt,!1),l.domElement.removeEventListener("mousedown",X,!1),l.domElement.removeEventListener("wheel",$,!1),l.domElement.removeEventListener("touchstart",Q,!1),l.domElement.removeEventListener("touchend",et,!1),l.domElement.removeEventListener("touchmove",tt,!1),document.removeEventListener("mousemove",Y,!1),document.removeEventListener("mouseup",Z,!1),l.domElement.removeEventListener("keydown",K,!1)};var l=this,c={type:"change"},u={type:"start"},h={type:"end"},d={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},p=d.NONE,f=1e-6,m=new r.Spherical,g=new r.Spherical,y=1,v=new r.Vector3,x=!1,b=new r.Vector2,w=new r.Vector2,M=new r.Vector2,_=new r.Vector2,C=new r.Vector2,S=new r.Vector2,T=new r.Vector2,E=new r.Vector2,D=new r.Vector2;function A(){return Math.pow(.95,l.zoomSpeed)}function O(t){g.theta-=t}function P(t){g.phi-=t}var L,R,I,k=(L=new r.Vector3,function(t,e){L.setFromMatrixColumn(e,0),L.multiplyScalar(-t),v.add(L)}),F=(R=new r.Vector3,function(t,e){!0===l.screenSpacePanning?R.setFromMatrixColumn(e,1):(R.setFromMatrixColumn(e,0),R.crossVectors(l.object.up,R)),R.multiplyScalar(t),v.add(R)}),B=(I=new r.Vector3,function(t,e){var n=l.domElement;if(l.object.isPerspectiveCamera){var r=l.object.position;I.copy(r).sub(l.target);var i=I.length();i*=Math.tan(l.object.fov/2*Math.PI/180),k(2*t*i/n.clientHeight,l.object.matrix),F(2*e*i/n.clientHeight,l.object.matrix)}else l.object.isOrthographicCamera?(k(t*(l.object.right-l.object.left)/l.object.zoom/n.clientWidth,l.object.matrix),F(e*(l.object.top-l.object.bottom)/l.object.zoom/n.clientHeight,l.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),l.enablePan=!1)});function j(t){l.object.isPerspectiveCamera?y/=t:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom*t)),l.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function N(t){l.object.isPerspectiveCamera?y*=t:l.object.isOrthographicCamera?(l.object.zoom=Math.max(l.minZoom,Math.min(l.maxZoom,l.object.zoom/t)),l.object.updateProjectionMatrix(),x=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),l.enableZoom=!1)}function z(t){b.set(t.clientX,t.clientY)}function V(t){_.set(t.clientX,t.clientY)}function G(t){if(1==t.touches.length)b.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);b.set(e,n)}}function H(t){if(1==t.touches.length)_.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);_.set(e,n)}}function U(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);T.set(0,r)}function W(t){if(1==t.touches.length)w.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);w.set(e,n)}M.subVectors(w,b).multiplyScalar(l.rotateSpeed);var r=l.domElement;O(2*Math.PI*M.x/r.clientHeight),P(2*Math.PI*M.y/r.clientHeight),b.copy(w)}function J(t){if(1==t.touches.length)C.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);C.set(e,n)}S.subVectors(C,_).multiplyScalar(l.panSpeed),B(S.x,S.y),_.copy(C)}function q(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,r=Math.sqrt(e*e+n*n);E.set(0,r),D.set(0,Math.pow(E.y/T.y,l.zoomSpeed)),j(D.y),T.copy(E)}function X(t){if(!1!==l.enabled){switch(t.preventDefault(),l.domElement.focus?l.domElement.focus():window.focus(),t.button){case 0:switch(l.mouseButtons.LEFT){case r.MOUSE.ROTATE:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===l.enablePan)return;V(t),p=d.PAN}else{if(!1===l.enableRotate)return;z(t),p=d.ROTATE}break;case r.MOUSE.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===l.enableRotate)return;z(t),p=d.ROTATE}else{if(!1===l.enablePan)return;V(t),p=d.PAN}break;default:p=d.NONE}break;case 1:switch(l.mouseButtons.MIDDLE){case r.MOUSE.DOLLY:if(!1===l.enableZoom)return;e=t,T.set(e.clientX,e.clientY),p=d.DOLLY;break;case r.MOUSE.PAN:if(!1===l.enablePan)return;V(t),p=d.PAN;break;default:p=d.NONE}break;case 2:switch(l.mouseButtons.RIGHT){case r.MOUSE.ROTATE:if(!1===l.enableRotate)return;z(t),p=d.ROTATE;break;case r.MOUSE.PAN:if(!1===l.enablePan)return;V(t),p=d.PAN;break;default:p=d.NONE}}var e;p!==d.NONE&&(document.addEventListener("mousemove",Y,!1),document.addEventListener("mouseup",Z,!1),l.dispatchEvent(u))}}function Y(t){var e,n;if(!1!==l.enabled)switch(t.preventDefault(),p){case d.ROTATE:if(!1===l.enableRotate)return;!function(t){w.set(t.clientX,t.clientY),M.subVectors(w,b).multiplyScalar(l.rotateSpeed);var e=l.domElement;O(2*Math.PI*M.x/e.clientHeight),P(2*Math.PI*M.y/e.clientHeight),b.copy(w),l.update()}(t);break;case d.DOLLY:if(!1===l.enableZoom)return;n=t,E.set(n.clientX,n.clientY),D.subVectors(E,T),0t.far||e.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}))}else for(v=0,x=(y=m.position.array).length/3-1;vt.far||e.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}))}else if(l instanceof s.Geometry){var M=l.vertices,_=M.length;for(v=0;v<_-1;v+=p){var C;at.far||e.push({distance:C,point:h.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}))}}}}),l.prototype.compareV3=function(t,e){var n=6*t,r=6*e;return this.positions[n]===this.positions[r]&&this.positions[1+n]===this.positions[1+r]&&this.positions[2+n]===this.positions[2+r]},l.prototype.copyV3=function(t){var e=6*t;return[this.positions[e],this.positions[1+e],this.positions[2+e]]},l.prototype.process=function(){var t,e,n=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];for(var r=0;r>8&255]+Z[t>>16&255]+Z[t>>24&255]+"-"+Z[255&e]+Z[e>>8&255]+"-"+Z[e>>16&15|64]+Z[e>>24&255]+"-"+Z[63&n|128]+Z[n>>8&255]+"-"+Z[n>>16&255]+Z[n>>24&255]+Z[255&r]+Z[r>>8&255]+Z[r>>16&255]+Z[r>>24&255]).toUpperCase()},clamp:function(t,e,n){return Math.max(e,Math.min(n,t))},euclideanModulo:function(t,e){return(t%e+e)%e},mapLinear:function(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)},lerp:function(t,e,n){return(1-n)*t+n*e},smoothstep:function(t,e,n){return t<=e?0:n<=t?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:n<=t?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},degToRad:function(t){return t*Q.DEG2RAD},radToDeg:function(t){return t*Q.RAD2DEG},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,n,r,i){var o=Math.cos,a=Math.sin,s=o(n/2),l=a(n/2),c=o((e+r)/2),u=a((e+r)/2),h=o((e-r)/2),d=a((e-r)/2),p=o((r-e)/2),f=a((r-e)/2);"XYX"===i?t.set(s*u,l*h,l*d,s*c):"YZY"===i?t.set(l*d,s*u,l*h,s*c):"ZXZ"===i?t.set(l*h,l*d,s*u,s*c):"XZX"===i?t.set(s*u,l*f,l*p,s*c):"YXY"===i?t.set(l*p,s*u,l*f,s*c):"ZYZ"===i?t.set(l*f,l*p,s*u,s*c):console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order.")}};function tt(t,e){this.x=t||0,this.y=e||0}function et(){this.elements=[1,0,0,0,1,0,0,0,1],0Number.EPSILON){var x=Math.sqrt(v),b=Math.atan2(x,g*y);m=Math.sin(m*b)/x,a=Math.sin(a*b)/x}var w=a*y;if(s=s*m+h*w,l=l*m+d*w,c=c*m+p*w,u=u*m+f*w,m===1-a){var M=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=M,l*=M,c*=M,u*=M}}t[e]=s,t[e+1]=l,t[e+2]=c,t[e+3]=u}}),Object.defineProperties(lt.prototype,{x:{get:function(){return this._x},set:function(t){this._x=t,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(t){this._y=t,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(t){this._z=t,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(t){this._w=t,this._onChangeCallback()}}}),Object.assign(lt.prototype,{isQuaternion:!0,set:function(t,e,n,r){return this._x=t,this._y=e,this._z=n,this._w=r,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this},setFromEuler:function(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=t._x,r=t._y,i=t._z,o=t.order,a=Math.cos,s=Math.sin,l=a(n/2),c=a(r/2),u=a(i/2),h=s(n/2),d=s(r/2),p=s(i/2);return"XYZ"===o?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"YXZ"===o?(this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"ZXY"===o?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p):"ZYX"===o?(this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p):"YZX"===o?(this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p):"XZY"===o&&(this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p),!1!==e&&this._onChangeCallback(),this},setFromAxisAngle:function(t,e){var n=e/2,r=Math.sin(n);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(t){var e,n=t.elements,r=n[0],i=n[4],o=n[8],a=n[1],s=n[5],l=n[9],c=n[2],u=n[6],h=n[10],d=r+s+h;return 0Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0):(this._x=0,this._y=-t.z,this._z=t.y)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x),this._w=n,this.normalize()},angleTo:function(t){return 2*Math.acos(Math.abs(Q.clamp(this.dot(t),-1,1)))},rotateTowards:function(t,e){var n=this.angleTo(t);if(0===n)return this;var r=Math.min(1,e/n);return this.slerp(t,r),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)},premultiply:function(t){return this.multiplyQuaternions(t,this)},multiplyQuaternions:function(t,e){var n=t._x,r=t._y,i=t._z,o=t._w,a=e._x,s=e._y,l=e._z,c=e._w;return this._x=n*c+o*a+r*l-i*s,this._y=r*c+o*s+i*a-n*l,this._z=i*c+o*l+n*s-r*a,this._w=o*c-n*a-r*s-i*l,this._onChangeCallback(),this},slerp:function(t,e){if(0===e)return this;if(1===e)return this.copy(t);var n=this._x,r=this._y,i=this._z,o=this._w,a=o*t._w+n*t._x+r*t._y+i*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),1<=a)return this._w=o,this._x=n,this._y=r,this._z=i,this;var s=1-a*a;if(s<=Number.EPSILON){var l=1-e;return this._w=l*o+e*this._w,this._x=l*n+e*this._x,this._y=l*r+e*this._y,this._z=l*i+e*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),u=Math.atan2(c,a),h=Math.sin((1-e)*u)/c,d=Math.sin(e*u)/c;return this._w=o*h+this._w*d,this._x=n*h+this._x*d,this._y=r*h+this._y*d,this._z=i*h+this._z*d,this._onChangeCallback(),this},equals:function(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w},fromArray:function(t,e){return void 0===e&&(e=0),this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t},_onChange:function(t){return this._onChangeCallback=t,this},_onChangeCallback:function(){}});var ct=new ht,ut=new lt;function ht(t,e,n){this.x=t||0,this.y=e||0,this.z=n||0}Object.assign(ht.prototype,{isVector3:!0,set:function(t,e,n){return this.x=t,this.y=e,this.z=n,this},setScalar:function(t){return this.x=t,this.y=t,this.z=t,this},setX:function(t){return this.x=t,this},setY:function(t){return this.y=t,this},setZ:function(t){return this.z=t,this},setComponent:function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this},getComponent:function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},add:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},addScalar:function(t){return this.x+=t,this.y+=t,this.z+=t,this},addVectors:function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},addScaledVector:function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},sub:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)},subScalar:function(t){return this.x-=t,this.y-=t,this.z-=t,this},subVectors:function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},multiply:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)},multiplyScalar:function(t){return this.x*=t,this.y*=t,this.z*=t,this},multiplyVectors:function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},applyEuler:function(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(ut.setFromEuler(t))},applyAxisAngle:function(t,e){return this.applyQuaternion(ut.setFromAxisAngle(t,e))},applyMatrix3:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6]*r,this.y=i[1]*e+i[4]*n+i[7]*r,this.z=i[2]*e+i[5]*n+i[8]*r,this},applyNormalMatrix:function(t){return this.applyMatrix3(t).normalize()},applyMatrix4:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements,o=1/(i[3]*e+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*e+i[4]*n+i[8]*r+i[12])*o,this.y=(i[1]*e+i[5]*n+i[9]*r+i[13])*o,this.z=(i[2]*e+i[6]*n+i[10]*r+i[14])*o,this},applyQuaternion:function(t){var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=t.w,l=s*e+o*r-a*n,c=s*n+a*e-i*r,u=s*r+i*n-o*e,h=-i*e-o*n-a*r;return this.x=l*s+h*-i+c*-a-u*-o,this.y=c*s+h*-o+u*-i-l*-a,this.z=u*s+h*-a+l*-o-c*-i,this},project:function(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)},unproject:function(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)},transformDirection:function(t){var e=this.x,n=this.y,r=this.z,i=t.elements;return this.x=i[0]*e+i[4]*n+i[8]*r,this.y=i[1]*e+i[5]*n+i[9]*r,this.z=i[2]*e+i[6]*n+i[10]*r,this.normalize()},divide:function(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this},divideScalar:function(t){return this.multiplyScalar(1/t)},min:function(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this},max:function(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this},clamp:function(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this},clampScalar:function(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this},clampLength:function(t,e){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,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(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)},lerp:function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},lerpVectors:function(t,e,n){return this.subVectors(e,t).multiplyScalar(n).add(t)},cross:function(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)},crossVectors:function(t,e){var n=t.x,r=t.y,i=t.z,o=e.x,a=e.y,s=e.z;return this.x=r*s-i*a,this.y=i*o-n*s,this.z=n*a-r*o,this},projectOnVector:function(t){var e=t.lengthSq();if(0===e)return this.set(0,0,0);var n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)},projectOnPlane:function(t){return ct.copy(this).projectOnVector(t),this.sub(ct)},reflect:function(t){return this.sub(ct.copy(t).multiplyScalar(2*this.dot(t)))},angleTo:function(t){var e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;var n=this.dot(t)/e;return Math.acos(Q.clamp(n,-1,1))},distanceTo:function(t){return Math.sqrt(this.distanceToSquared(t))},distanceToSquared:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return e*e+n*n+r*r},manhattanDistanceTo:function(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)},setFromSpherical:function(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)},setFromSphericalCoords:function(t,e,n){var r=Math.sin(e)*t;return this.x=r*Math.sin(n),this.y=Math.cos(e)*t,this.z=r*Math.cos(n),this},setFromCylindrical:function(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)},setFromCylindricalCoords:function(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this},setFromMatrixPosition:function(t){var e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this},setFromMatrixScale:function(t){var e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=r,this},setFromMatrixColumn:function(t,e){return this.fromArray(t.elements,4*e)},setFromMatrix3Column:function(t,e){return this.fromArray(t.elements,3*e)},equals:function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},fromArray:function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this},toArray:function(t,e){return void 0===t&&(t=[]),void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t},fromBufferAttribute:function(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}});var dt=new ht,pt=new xt,ft=new ht(0,0,0),mt=new ht(1,1,1),gt=new ht,yt=new ht,vt=new ht;function xt(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],0s)return!1}return!0}Object.assign(Kt.prototype,{isBox3:!0,set:function(t,e){return this.min.copy(t),this.max.copy(e),this},setFromArray:function(t){for(var e=1/0,n=1/0,r=1/0,i=-1/0,o=-1/0,a=-1/0,s=0,l=t.length;sthis.max.x||t.ythis.max.y||t.zthis.max.z)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .getParameter() target is now required"),e=new ht),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)},intersectsSphere:function(t){return this.clampPoint(t.center,zt),zt.distanceToSquared(t.center)<=t.radius*t.radius},intersectsPlane:function(t){var e,n;return n=0=-t.constant},intersectsTriangle:function(t){if(this.isEmpty())return!1;this.getCenter(Xt),Yt.subVectors(this.max,Xt),Gt.subVectors(t.a,Xt),Ht.subVectors(t.b,Xt),Ut.subVectors(t.c,Xt),Wt.subVectors(Ht,Gt),Jt.subVectors(Ut,Ht),qt.subVectors(Gt,Ut);var e=[0,-Wt.z,Wt.y,0,-Jt.z,Jt.y,0,-qt.z,qt.y,Wt.z,0,-Wt.x,Jt.z,0,-Jt.x,qt.z,0,-qt.x,-Wt.y,Wt.x,0,-Jt.y,Jt.x,0,-qt.y,qt.x,0];return!!Qt(e,Gt,Ht,Ut,Yt)&&!!Qt(e=[1,0,0,0,1,0,0,0,1],Gt,Ht,Ut,Yt)&&(Zt.crossVectors(Wt,Jt),Qt(e=[Zt.x,Zt.y,Zt.z],Gt,Ht,Ut,Yt))},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box3: .clampPoint() target is now required"),e=new ht),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return zt.copy(t).clamp(this.min,this.max).sub(t).length()},getBoundingSphere:function(t){return void 0===t&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(t.center),t.radius=.5*this.getSize(zt).length(),t},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},applyMatrix4:function(t){return this.isEmpty()||(Nt[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Nt[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Nt[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Nt[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Nt[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Nt[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Nt[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Nt[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Nt)),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var te=new Kt;function ee(t,e){this.center=void 0!==t?t:new ht,this.radius=void 0!==e?e:0}Object.assign(ee.prototype,{set:function(t,e){return this.center.copy(t),this.radius=e,this},setFromPoints:function(t,e){var n=this.center;void 0!==e?n.copy(e):te.setFromPoints(t).getCenter(n);for(var r=0,i=0,o=t.length;ithis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e},getBoundingBox:function(t){return void 0===t&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),t=new Kt),t.set(this.center,this.center),t.expandByScalar(this.radius),t},applyMatrix4:function(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this},translate:function(t){return this.center.add(t),this},equals:function(t){return t.center.equals(this.center)&&t.radius===this.radius}});var ne=new ht,re=new ht,ie=new ht,oe=new ht,ae=new ht,se=new ht,le=new ht;function ce(t,e){this.origin=void 0!==t?t:new ht,this.direction=void 0!==e?e:new ht(0,0,-1)}Object.assign(ce.prototype,{set:function(t,e){return this.origin.copy(t),this.direction.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this},at:function(t,e){return void 0===e&&(console.warn("THREE.Ray: .at() target is now required"),e=new ht),e.copy(this.direction).multiplyScalar(t).add(this.origin)},lookAt:function(t){return this.direction.copy(t).sub(this.origin).normalize(),this},recast:function(t){return this.origin.copy(this.at(t,ne)),this},closestPointToPoint:function(t,e){void 0===e&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),e=new ht),e.subVectors(t,this.origin);var n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(t){return Math.sqrt(this.distanceSqToPoint(t))},distanceSqToPoint:function(t){var e=ne.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ne.copy(this.direction).multiplyScalar(e).add(this.origin),ne.distanceToSquared(t))},distanceSqToSegment:function(t,e,n,r){re.copy(t).add(e).multiplyScalar(.5),ie.copy(e).sub(t).normalize(),oe.copy(this.origin).sub(re);var i,o,a,s,l=.5*t.distanceTo(e),c=-this.direction.dot(ie),u=oe.dot(this.direction),h=-oe.dot(ie),d=oe.lengthSq(),p=Math.abs(1-c*c);if(0>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,this},setRGB:function(t,e,n){return this.r=t,this.g=e,this.b=n,this},setHSL:function(t,e,n){if(t=Q.euclideanModulo(t,1),e=Q.clamp(e,0,1),n=Q.clamp(n,0,1),0===e)this.r=this.g=this.b=n;else{var r=n<=.5?n*(1+e):n+e-n*e,i=2*n-r;this.r=Ae(i,r,t+1/3),this.g=Ae(i,r,t),this.b=Ae(i,r,t-1/3)}return this},setStyle:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var r,i=n[1],o=n[2];switch(i){case"rgb":case"rgba":if(r=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,e(r[5]),this;if(r=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,e(r[5]),this;break;case"hsl":case"hsla":if(r=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(o)){var a=parseFloat(r[1])/360,s=parseInt(r[2],10)/100,l=parseInt(r[3],10)/100;return e(r[5]),this.setHSL(a,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(t)){var c=n[1],u=c.length;if(3===u)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===u)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return t&&0e&&(e=t[n]);return e}Object.defineProperty(Be.prototype,"needsUpdate",{set:function(t){!0===t&&this.version++}}),Object.assign(Be.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(t){return this.usage=t,this},copy:function(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this},copyAt:function(t,e,n){t*=this.itemSize,n*=e.itemSize;for(var r=0,i=this.itemSize;rn.far?null:{distance:l,point:bn.clone(),object:t}}function _n(t,e,n,r,i,o,a,s,l,c,u,h){sn.fromBufferAttribute(i,c),ln.fromBufferAttribute(i,u),cn.fromBufferAttribute(i,h);var d=t.morphTargetInfluences;if(e.morphTargets&&o&&d){pn.set(0,0,0),fn.set(0,0,0),mn.set(0,0,0);for(var p=0,f=o.length;p","\t#include ","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},i=new In({type:"CubemapFromEquirect",uniforms:Pn(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=e;var o=new wn(new On(5,5,5),i);n.add(o);var a=new Bn(1,10,1);return a.renderTarget=this,a.renderTarget.texture.name="CubeCameraTexture",a.update(t,n),o.geometry.dispose(),o.material.dispose(),this},((Nn.prototype=Object.create(it.prototype)).constructor=Nn).prototype.isDataTexture=!0;var zn=new ee,Vn=new ht;function Gn(t,e,n,r,i,o){this.planes=[void 0!==t?t:new pe,void 0!==e?e:new pe,void 0!==n?n:new pe,void 0!==r?r:new pe,void 0!==i?i:new pe,void 0!==o?o:new pe]}Object.assign(Gn.prototype,{set:function(t,e,n,r,i,o){var a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(r),a[4].copy(i),a[5].copy(o),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){for(var e=this.planes,n=0;n<6;n++)e[n].copy(t.planes[n]);return this},setFromProjectionMatrix:function(t){var e=this.planes,n=t.elements,r=n[0],i=n[1],o=n[2],a=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],p=n[10],f=n[11],m=n[12],g=n[13],y=n[14],v=n[15];return e[0].setComponents(a-r,u-s,f-h,v-m).normalize(),e[1].setComponents(a+r,u+s,f+h,v+m).normalize(),e[2].setComponents(a+i,u+l,f+d,v+g).normalize(),e[3].setComponents(a-i,u-l,f-d,v-g).normalize(),e[4].setComponents(a-o,u-c,f-p,v-y).normalize(),e[5].setComponents(a+o,u+c,f+p,v+y).normalize(),this},intersectsObject:function(t){var e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),zn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(zn)},intersectsSprite:function(t){return zn.center.set(0,0,0),zn.radius=.7071067811865476,zn.applyMatrix4(t.matrixWorld),this.intersectsSphere(zn)},intersectsSphere:function(t){for(var e=this.planes,n=t.center,r=-t.radius,i=0;i<6;i++)if(e[i].distanceToPoint(n) 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_maxMipLevel 8.0\n#define cubeUV_minMipLevel 4.0\n#define cubeUV_maxTileSize 256.0\n#define cubeUV_minTileSize 16.0\nfloat getFace(vec3 direction) {\n vec3 absDirection = abs(direction);\n float face = -1.0;\n if (absDirection.x > absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n#define r0 1.0\n#define v0 0.339\n#define m0 -2.0\n#define r1 0.8\n#define v1 0.276\n#define m1 -1.0\n#define r4 0.4\n#define v4 0.046\n#define m4 2.0\n#define r5 0.305\n#define v5 0.016\n#define m5 3.0\n#define r6 0.21\n#define v6 0.0038\n#define m6 4.0\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness); }\n return mip;\n}\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn 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 );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn 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 );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = max( clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid 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) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.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;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#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 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},Xn={basic:{uniforms:Ln([Hn.common,Hn.specularmap,Hn.envmap,Hn.aomap,Hn.lightmap,Hn.fog]),vertexShader:qn.meshbasic_vert,fragmentShader:qn.meshbasic_frag},lambert:{uniforms:Ln([Hn.common,Hn.specularmap,Hn.envmap,Hn.aomap,Hn.lightmap,Hn.emissivemap,Hn.fog,Hn.lights,{emissive:{value:new De(0)}}]),vertexShader:qn.meshlambert_vert,fragmentShader:qn.meshlambert_frag},phong:{uniforms:Ln([Hn.common,Hn.specularmap,Hn.envmap,Hn.aomap,Hn.lightmap,Hn.emissivemap,Hn.bumpmap,Hn.normalmap,Hn.displacementmap,Hn.fog,Hn.lights,{emissive:{value:new De(0)},specular:{value:new De(1118481)},shininess:{value:30}}]),vertexShader:qn.meshphong_vert,fragmentShader:qn.meshphong_frag},standard:{uniforms:Ln([Hn.common,Hn.envmap,Hn.aomap,Hn.lightmap,Hn.emissivemap,Hn.bumpmap,Hn.normalmap,Hn.displacementmap,Hn.roughnessmap,Hn.metalnessmap,Hn.fog,Hn.lights,{emissive:{value:new De(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:qn.meshphysical_vert,fragmentShader:qn.meshphysical_frag},toon:{uniforms:Ln([Hn.common,Hn.specularmap,Hn.aomap,Hn.lightmap,Hn.emissivemap,Hn.bumpmap,Hn.normalmap,Hn.displacementmap,Hn.gradientmap,Hn.fog,Hn.lights,{emissive:{value:new De(0)},specular:{value:new De(1118481)},shininess:{value:30}}]),vertexShader:qn.meshtoon_vert,fragmentShader:qn.meshtoon_frag},matcap:{uniforms:Ln([Hn.common,Hn.bumpmap,Hn.normalmap,Hn.displacementmap,Hn.fog,{matcap:{value:null}}]),vertexShader:qn.meshmatcap_vert,fragmentShader:qn.meshmatcap_frag},points:{uniforms:Ln([Hn.points,Hn.fog]),vertexShader:qn.points_vert,fragmentShader:qn.points_frag},dashed:{uniforms:Ln([Hn.common,Hn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:qn.linedashed_vert,fragmentShader:qn.linedashed_frag},depth:{uniforms:Ln([Hn.common,Hn.displacementmap]),vertexShader:qn.depth_vert,fragmentShader:qn.depth_frag},normal:{uniforms:Ln([Hn.common,Hn.bumpmap,Hn.normalmap,Hn.displacementmap,{opacity:{value:1}}]),vertexShader:qn.normal_vert,fragmentShader:qn.normal_frag},sprite:{uniforms:Ln([Hn.sprite,Hn.fog]),vertexShader:qn.sprite_vert,fragmentShader:qn.sprite_frag},background:{uniforms:{uvTransform:{value:new et},t2D:{value:null}},vertexShader:qn.background_vert,fragmentShader:qn.background_frag},cube:{uniforms:Ln([Hn.envmap,{opacity:{value:1}}]),vertexShader:qn.cube_vert,fragmentShader:qn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:qn.equirect_vert,fragmentShader:qn.equirect_frag},distanceRGBA:{uniforms:Ln([Hn.common,Hn.displacementmap,{referencePosition:{value:new ht},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:qn.distanceRGBA_vert,fragmentShader:qn.distanceRGBA_frag},shadow:{uniforms:Ln([Hn.lights,Hn.fog,{color:{value:new De(0)},opacity:{value:1}}]),vertexShader:qn.shadow_vert,fragmentShader:qn.shadow_frag}};function Yn(t,e,n,r){var i,a,s=new De(0),l=0,c=null,u=0,h=null;function d(t,n){e.buffers.color.setClear(t.r,t.g,t.b,n,r)}return{getClearColor:function(){return s},setClearColor:function(t,e){s.set(t),d(s,l=void 0!==e?e:1)},getClearAlpha:function(){return l},setClearAlpha:function(t){d(s,l=t)},render:function(e,r,p,f){var m=r.background,g=t.xr,y=g.getSession&&g.getSession();if(y&&"additive"===y.environmentBlendMode&&(m=null),null===m?d(s,l):m&&m.isColor&&(d(m,1),f=!0),(t.autoClear||f)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLCubeRenderTarget||m.mapping===o)){void 0===a&&((a=new wn(new On(1,1,1),new In({type:"BackgroundCubeMaterial",uniforms:Pn(Xn.cube.uniforms),vertexShader:Xn.cube.vertexShader,fragmentShader:Xn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),a.geometry.deleteAttribute("uv"),a.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(a.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(a));var v=m.isWebGLCubeRenderTarget?m.texture:m;a.material.uniforms.envMap.value=v,a.material.uniforms.flipEnvMap.value=v.isCubeTexture?-1:1,c===m&&u===v.version&&h===t.toneMapping||(a.material.needsUpdate=!0,c=m,u=v.version,h=t.toneMapping),e.unshift(a,a.geometry,a.material,0,0,null)}else m&&m.isTexture&&(void 0===i&&((i=new wn(new Jn(2,2),new In({type:"BackgroundMaterial",uniforms:Pn(Xn.background.uniforms),vertexShader:Xn.background.vertexShader,fragmentShader:Xn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(i.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(i)),!0===(i.material.uniforms.t2D.value=m).matrixAutoUpdate&&m.updateMatrix(),i.material.uniforms.uvTransform.value.copy(m.matrix),c===m&&u===m.version&&h===t.toneMapping||(i.material.needsUpdate=!0,u=(c=m).version,h=t.toneMapping),e.unshift(i,i.geometry,i.material,0,0,null))}}}function Zn(){var t=this,e=null,n=0,r=!1,i=!1,o=new pe,a=new et,s={value:null,needsUpdate:!1};function l(){s.value!==e&&(s.value=e,s.needsUpdate=0/gm;function oi(t){return t.replace(ii,ai)}function ai(t,e){var n=qn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return oi(n)}var si=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function li(t){return t.replace(si,ci)}function ci(t,e,n,r){for(var i="",o=parseInt(e);o\nvoid main() {\n float mean = 0.0;\n float squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n #ifdef HORIZONAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean * HALF_SAMPLE_RATE;\n squared_mean = squared_mean * HALF_SAMPLE_RATE;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),f=d.clone();f.defines.HORIZONAL_PASS=1;var m=new nn;m.setAttribute("position",new Be(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var g=new wn(m,d),y=this;function v(n,r){var i=e.update(g);d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(r,null,i,d,g,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(r,null,i,f,g,null)}function x(t,e,n){var r=t<<0|e<<1|n<<2,i=s[r];return void 0===i&&(i=new bi({depthPacking:3201,morphTargets:t,skinning:e}),s[r]=i),i}function b(t,e,n){var r=t<<0|e<<1|n<<2,i=l[r];return void 0===i&&(i=new wi({morphTargets:t,skinning:e}),l[r]=i),i}function w(e,n,r,i,o,a){var s=e.geometry,l=null,u=x,d=e.customDepthMaterial;if(!0===r.isPointLight&&(u=b,d=e.customDistanceMaterial),void 0===d){var p=!1;!0===n.morphTargets&&(!0===s.isBufferGeometry?p=s.morphAttributes&&s.morphAttributes.position&&0n||i.y>n)&&(console.warn("THREE.WebGLShadowMap:",x,"has shadow exceeding max texture size, reducing"),i.x>n&&(o.x=Math.floor(n/w.x),i.x=o.x*w.x,b.mapSize.x=o.x),i.y>n&&(o.y=Math.floor(n/w.y),i.y=o.y*w.y,b.mapSize.y=o.y)),null===b.map&&!b.isPointLightShadow&&3===this.type){var C={minFilter:p,magFilter:p,format:_};b.map=new at(i.x,i.y,C),b.map.texture.name=x.name+".shadowMap",b.mapPass=new at(i.x,i.y,C),b.camera.updateProjectionMatrix()}null===b.map&&(C={minFilter:u,magFilter:u,format:_},b.map=new at(i.x,i.y,C),b.map.texture.name=x.name+".shadowMap",b.camera.updateProjectionMatrix()),t.setRenderTarget(b.map),t.clear();for(var S=b.getViewportCount(),T=0;Tr||t.height>r)&&(i=r/Math.max(t.width,t.height)),i<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){var o=e?Q.floorPowerOfTwo:Math.floor,a=o(i*t.width),l=o(i*t.height);void 0===s&&(s=P(a,l));var c=n?P(a,l):s;return c.width=a,c.height=l,c.getContext("2d").drawImage(t,0,0,a,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+a+"x"+l+")."),c}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function R(t){return Q.isPowerOfTwo(t.width)&&Q.isPowerOfTwo(t.height)}function I(t,e){return t.generateMipmaps&&e&&t.minFilter!==u&&t.minFilter!==p}function k(e,n,i,o){t.generateMipmap(e),r.get(n).__maxMipLevel=Math.log(Math.max(i,o))*Math.LOG2E}function F(n,r,i){if(!1===c)return r;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var o=r;return 6403===r&&(5126===i&&(o=33326),5131===i&&(o=33325),5121===i&&(o=33321)),6407===r&&(5126===i&&(o=34837),5131===i&&(o=34843),5121===i&&(o=32849)),6408===r&&(5126===i&&(o=34836),5131===i&&(o=34842),5121===i&&(o=32856)),33325===o||33326===o||34842===o||34836===o?e.get("EXT_color_buffer_float"):34843!==o&&34837!==o||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),o}function B(t){return t===u||t===h||t===d?9728:9729}function j(e){var n=e.target;n.removeEventListener("dispose",j),function(e){var n=r.get(e);void 0!==n.__webglInit&&(t.deleteTexture(n.__webglTexture),r.remove(e))}(n),n.isVideoTexture&&A.delete(n),a.memory.textures--}function N(e){var n=e.target;n.removeEventListener("dispose",N),function(e){var n=r.get(e),i=r.get(e.texture);if(e){if(void 0!==i.__webglTexture&&t.deleteTexture(i.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(var o=0;o<6;o++)t.deleteFramebuffer(n.__webglFramebuffer[o]),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[o]);else t.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer);if(e.isWebGLMultiviewRenderTarget){t.deleteTexture(n.__webglColorTexture),t.deleteTexture(n.__webglDepthStencilTexture),a.memory.textures-=2,o=0;for(var s=n.__webglViewFramebuffers.length;oh)return!1;for(var n=1,r=e.length;nt.far||e.push({distance:s,point:Ni.clone(),uv:Ce.getUV(Ni,Wi,Ji,qi,Xi,Yi,Zi,new tt),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(t){return Bt.prototype.copy.call(this,t),void 0!==t.center&&this.center.copy(t.center),this}});var Qi=new ht,to=new ht;function eo(){Bt.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function no(t,e){t&&t.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),wn.call(this,t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new xt,this.bindMatrixInverse=new xt}eo.prototype=Object.assign(Object.create(Bt.prototype),{constructor:eo,isLOD:!0,copy:function(t){Bt.prototype.copy.call(this,t,!1);for(var e=t.levels,n=0,r=e.length;n=e[r].distance;r++)e[r-1].object.visible=!1,e[r].object.visible=!0;for(;rt.far||e.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else for(m=0,g=p.length/3-1;mt.far||e.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}else if(r.isGeometry){var x=r.vertices,b=x.length;for(m=0;mt.far||e.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this}))}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var bo=new ht,wo=new ht;function Mo(t,e){xo.call(this,t,e),this.type="LineSegments"}function _o(t,e){xo.call(this,t,e),this.type="LineLoop"}function Co(t){Ie.call(this),this.type="PointsMaterial",this.color=new De(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}Mo.prototype=Object.assign(Object.create(xo.prototype),{constructor:Mo,isLineSegments:!0,computeLineDistances:function(){var t=this.geometry;if(t.isBufferGeometry)if(null===t.index){for(var e=t.attributes.position,n=[],r=0,i=e.count;ri.far)return;o.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:e,face:null,object:a})}}function Po(t,e,n,r,i,o,a,s,l){it.call(this,t,e,n,r,i,o,a,s,l),this.format=void 0!==a?a:M,this.minFilter=void 0!==o?o:p,this.magFilter=void 0!==i?i:p,this.generateMipmaps=!1}function Lo(t,e,n,r,i,o,a,s,l,c,u,h){it.call(this,null,o,a,s,l,c,r,i,u,h),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}function Ro(t,e,n,r,i,o,a,s,l){it.call(this,t,e,n,r,i,o,a,s,l),this.needsUpdate=!0}function Io(t,e,n,r,i,o,a,s,l,c){if((c=void 0!==c?c:C)!==C&&c!==S)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===C&&(n=y),void 0===n&&c===S&&(n=w),it.call(this,null,r,i,o,a,s,c,n,l),this.image={width:t,height:e},this.magFilter=void 0!==a?a:u,this.minFilter=void 0!==s?s:u,this.flipY=!1,this.generateMipmaps=!1}function ko(t){nn.call(this),this.type="WireframeGeometry";var e,n,r,i,o,a,s,l,c,u,h=[],d=[0,0],p={},f=["a","b","c"];if(t&&t.isGeometry){var m=t.faces;for(e=0,r=m.length;eo.x?i.x>a.x?i.x:a.x:o.x>a.x?o.x:a.x,u=i.y>o.y?i.y>a.y?i.y:a.y:o.y>a.y?o.y:a.y,h=ca(s,l,e,n,r),d=ca(c,u,e,n,r),p=t.prevZ,f=t.nextZ;p&&p.z>=h&&f&&f.z<=d;){if(p!==t.prev&&p!==t.next&&ha(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=da(p.prev,p,p.next))return;if(p=p.prevZ,f!==t.prev&&f!==t.next&&ha(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&0<=da(f.prev,f,f.next))return;f=f.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&ha(i.x,i.y,o.x,o.y,a.x,a.y,p.x,p.y)&&0<=da(p.prev,p,p.next))return;p=p.prevZ}for(;f&&f.z<=d;){if(f!==t.prev&&f!==t.next&&ha(i.x,i.y,o.x,o.y,a.x,a.y,f.x,f.y)&&0<=da(f.prev,f,f.next))return;f=f.nextZ}return 1}}function oa(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!pa(i,o)&&fa(i,r,r.next,o)&&ma(i,o)&&ma(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),va(r),va(r.next),r=t=o),r=r.next}while(r!==t);return r}function aa(t,e,n,r,i,o){var a,s,l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&(s=c,(a=l).next.i!==s.i&&a.prev.i!==s.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&fa(n,n.next,t,e))return 1;n=n.next}while(n!==t)}(a,s)&&ma(a,s)&&ma(s,a)&&function(t,e){for(var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),(n=n.next)!==t;);return r}(a,s))){var u=ga(l,c);return l=ea(l,l.next),u=ea(u,u.next),na(l,e,n,r,i,o),void na(u,e,n,r,i,o)}c=c.next}l=l.next}while(l!==t)}function sa(t,e){return t.x-e.x}function la(t,e){if(e=function(t,e){var n,r=e,i=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&a=r.x&&r.x>=u&&i!==r.x&&ha(on.x)&&ma(r,t)&&(n=r,d=l),r=r.next;return n}(t,e)){var n=ga(e,t);ea(n,n.next)}}function ca(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ua(t){for(var e=t,n=t;(e.x=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((Lo.prototype=Object.create(it.prototype)).constructor=Lo).prototype.isCompressedTexture=!0,((Ro.prototype=Object.create(it.prototype)).constructor=Ro).prototype.isCanvasTexture=!0,((Io.prototype=Object.create(it.prototype)).constructor=Io).prototype.isDepthTexture=!0,(ko.prototype=Object.create(nn.prototype)).constructor=ko,(Fo.prototype=Object.create(Dn.prototype)).constructor=Fo,(Bo.prototype=Object.create(nn.prototype)).constructor=Bo,(jo.prototype=Object.create(Dn.prototype)).constructor=jo,(No.prototype=Object.create(nn.prototype)).constructor=No,(zo.prototype=Object.create(Dn.prototype)).constructor=zo,(Vo.prototype=Object.create(No.prototype)).constructor=Vo,(Go.prototype=Object.create(Dn.prototype)).constructor=Go,(Ho.prototype=Object.create(No.prototype)).constructor=Ho,(Uo.prototype=Object.create(Dn.prototype)).constructor=Uo,(Wo.prototype=Object.create(No.prototype)).constructor=Wo,(Jo.prototype=Object.create(Dn.prototype)).constructor=Jo,(qo.prototype=Object.create(No.prototype)).constructor=qo,(Xo.prototype=Object.create(Dn.prototype)).constructor=Xo,((Yo.prototype=Object.create(nn.prototype)).constructor=Yo).prototype.toJSON=function(){var t=nn.prototype.toJSON.call(this);return t.path=this.parameters.path.toJSON(),t},(Zo.prototype=Object.create(Dn.prototype)).constructor=Zo,($o.prototype=Object.create(nn.prototype)).constructor=$o,(Ko.prototype=Object.create(Dn.prototype)).constructor=Ko,(Qo.prototype=Object.create(nn.prototype)).constructor=Qo;var ba={area:function(t){for(var e=t.length,n=0,r=e-1,i=0;i80*n){r=o=t[0],i=a=t[1];for(var f=n;fNumber.EPSILON){var d=Math.sqrt(u),p=Math.sqrt(l*l+c*c),f=e.x-s/d,m=e.y+a/d,g=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(a*c-s*l),y=(r=f+a*g-t.x)*r+(i=m+s*g-t.y)*i;if(y<=2)return new tt(r,i);o=Math.sqrt(y/2)}else{var v=!1;a>Number.EPSILON?l>Number.EPSILON&&(v=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(v=!0):Math.sign(s)===Math.sign(c)&&(v=!0),o=v?(r=-s,i=a,Math.sqrt(u)):(r=a,i=s,Math.sqrt(u/2))}return new tt(r/o,i/o)}for(var z=[],V=0,G=A.length,H=G-1,U=V+1;Vo.tracks[s].times[0]&&(m=o.tracks[s].times[0]);for(s=0;s>>1;te;)--o;if(++o,0!==i||o!==r){o<=i&&(i=(o=Math.max(o,1))-1);var a=this.getValueSize();this.times=rs.arraySlice(n,i,o),this.values=rs.arraySlice(this.values,i*a,o*a)}return this},validate:function(){var t=!0,e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);var n=this.times,r=this.values,i=n.length;0===i&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);for(var o=null,a=0;a!==i;a++){var s=n[a];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,s),t=!1;break}if(null!==o&&sNumber.EPSILON&&(c.normalize(),i=Math.acos(Q.clamp(a[n-1].dot(a[n]),-1,1)),s[n].applyMatrix4(u.makeRotationAxis(c,i))),l[n].crossVectors(a[n],s[n]);if(!0===e)for(i=Math.acos(Q.clamp(s[0].dot(s[t]),-1,1)),i/=t,0r.length-2?r.length-1:o+1],u=r[o>r.length-3?r.length-1:o+2];return n.set(Ns(a,s.x,l.x,c.x,u.x),Ns(a,s.y,l.y,c.y,u.y)),n},Xs.prototype.copy=function(t){Os.prototype.copy.call(this,t),this.points=[];for(var e=0,n=t.points.length;e=e){var i=n[r]-e,o=this.curves[r],a=o.getLength(),s=0===a?0:1-i/a;return o.getPointAt(s)}r++}return null},getLength:function(){var t=this.getCurveLengths();return t[t.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 t=[],e=0,n=0,r=this.curves.length;nNumber.EPSILON){if(c<0&&(a=e[o],l=-l,s=e[i],c=-c),t.ys.y)continue;if(t.y===a.y){if(t.x===a.x)return 1}else{var u=c*(t.x-a.x)-l*(t.y-a.y);if(0==u)return 1;if(u<0)continue;r=!r}}else{if(t.y!==a.y)continue;if(s.x<=t.x&&t.x<=a.x||a.x<=t.x&&t.x<=s.x)return 1}}return r}var i=ba.isClockWise,o=this.subPaths;if(0===o.length)return[];if(!0===e)return n(o);var a,s,l,c=[];if(1===o.length)return s=o[0],(l=new Ks).curves=s.curves,c.push(l),c;var u=!i(o[0].getPoints());u=t?!u:u;var h,d,p=[],f=[],m=[],g=0;f[g]=void 0,m[g]=[];for(var y=0,v=o.length;yn.parameterPositions[1]&&(this.stopFading(),0===r&&(this.enabled=!1))}}return this._effectiveWeight=e},_updateTimeScale:function(t){var e=0;if(!this.paused){e=this.timeScale;var n=this._timeScaleInterpolant;null!==n&&(e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e))}return this._effectiveTimeScale=e},_updateTime:function(t){var e=this.time+t,n=this._clip.duration,r=this.loop,i=this._loopCount,o=2202===r;if(0===t)return-1!==i&&o&&1==(1&i)?n-e:e;if(2200===r){-1===i&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n<=e)e=n;else{if(!(e<0)){this.time=e;break t}e=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=e,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===i&&(0<=t?(i=0,this._setEndings(!0,0===this.repetitions,o)):this._setEndings(0===this.repetitions,!0,o)),n<=e||e<0){var a=Math.floor(e/n);e-=n*a,i+=Math.abs(a);var s=this.repetitions-i;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,e=0this.max.x||t.ythis.max.y)},containsBox:function(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y},getParameter:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .getParameter() target is now required"),e=new tt),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)},clampPoint:function(t,e){return void 0===e&&(console.warn("THREE.Box2: .clampPoint() target is now required"),e=new tt),e.copy(t).clamp(this.min,this.max)},distanceToPoint:function(t){return vc.copy(t).clamp(this.min,this.max).sub(t).length()},intersect:function(t){return this.min.max(t.min),this.max.min(t.max),this},union:function(t){return this.min.min(t.min),this.max.max(t.max),this},translate:function(t){return this.min.add(t),this.max.add(t),this},equals:function(t){return t.min.equals(this.min)&&t.max.equals(this.max)}});var bc=new ht,wc=new ht;function Mc(t,e){this.start=void 0!==t?t:new ht,this.end=void 0!==e?e:new ht}function _c(t){Bt.call(this),this.material=t,this.render=function(){}}Object.assign(Mc.prototype,{set:function(t,e){return this.start.copy(t),this.end.copy(e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(t){return this.start.copy(t.start),this.end.copy(t.end),this},getCenter:function(t){return void 0===t&&(console.warn("THREE.Line3: .getCenter() target is now required"),t=new ht),t.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(t){return void 0===t&&(console.warn("THREE.Line3: .delta() target is now required"),t=new ht),t.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(t,e){return void 0===e&&(console.warn("THREE.Line3: .at() target is now required"),e=new ht),this.delta(e).multiplyScalar(t).add(this.start)},closestPointToPointParameter:function(t,e){bc.subVectors(t,this.start),wc.subVectors(this.end,this.start);var n=wc.dot(wc),r=wc.dot(bc)/n;return e&&(r=Q.clamp(r,0,1)),r},closestPointToPoint:function(t,e,n){var r=this.closestPointToPointParameter(t,e);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new ht),this.delta(n).multiplyScalar(r).add(this.start)},applyMatrix4:function(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this},equals:function(t){return t.start.equals(this.start)&&t.end.equals(this.end)}}),((_c.prototype=Object.create(Bt.prototype)).constructor=_c).prototype.isImmediateRenderObject=!0;var Cc=new ht;function Sc(t,e){Bt.call(this),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;for(var n=new nn,r=[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],i=0,o=1;i<32;i++,o++){var a=i/32*Math.PI*2,s=o/32*Math.PI*2;r.push(Math.cos(a),Math.sin(a),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new We(r,3));var l=new po({fog:!1});this.cone=new Mo(n,l),this.add(this.cone),this.update()}((Sc.prototype=Object.create(Bt.prototype)).constructor=Sc).prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()},Sc.prototype.update=function(){this.light.updateMatrixWorld();var t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Cc.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Cc),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)};var Tc=new ht,Ec=new xt,Dc=new xt;function Ac(t){for(var e=function t(e){var n=[];e&&e.isBone&&n.push(e);for(var r=0;r\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t\n\n#define ENVMAP_TYPE_CUBE_UV\n#include \n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tfor (int i = 0; i < n; i++) {\n\t\tif (i >= samples)\n\t\t\tbreak;\n\t\tfor (int dir = -1; dir < 2; dir += 2) {\n\t\t\tif (i == 0 && dir == 1)\n\t\t\t\tcontinue;\n\t\t\tvec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n\t\t\tif (all(equal(axis, vec3(0.0))))\n\t\t\t\taxis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);\n\t\t\taxis = normalize(axis);\n\t\t\tfloat theta = dTheta * float(dir * i);\n\t\t\tfloat cosTheta = cos(theta);\n\t\t\t// Rodrigues' axis-angle rotation\n\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross(axis, vOutputDirection) * sin(theta)\n\t\t\t\t\t+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n\t\t\tgl_FragColor.rgb +=\n\t\t\t\t\tweights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);\n\t\t}\n\t}\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})).type="SphericalGaussianBlur",tu),lu=null,cu=null,uu=function(){for(var t=[],e=[],n=[],r=8,i=0;i\n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t\n\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tvec3 outputDirection = normalize(vOutputDirection);\n\tvec2 uv;\n\tuv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n\tuv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;\n\tvec2 f = fract(uv / texelSize - 0.5);\n\tuv -= f * texelSize;\n\tvec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x += texelSize.x;\n\tvec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.y += texelSize.y;\n\tvec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tuv.x -= texelSize.x;\n\tvec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n\tvec3 tm = mix(tl, tr, f.x);\n\tvec3 bm = mix(bl, br, f.x);\n\tgl_FragColor.rgb = mix(tm, bm, f.y);\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return t.type="EquirectangularToCubeUV",t}function Ou(){var t=new qa({uniforms:{envMap:{value:null},inputEncoding:{value:ou[N]},outputEncoding:{value:ou[N]}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\nvec3 getDirection(vec2 uv, float face) {\n\tuv = 2.0 * uv - 1.0;\n\tvec3 direction = vec3(uv, 1.0);\n\tif (face == 0.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 1.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.z *= -1.0;\n\t} else if (face == 3.0) {\n\t\tdirection = direction.zyx;\n\t\tdirection.x *= -1.0;\n\t} else if (face == 4.0) {\n\t\tdirection = direction.xzy;\n\t\tdirection.y *= -1.0;\n\t} else if (face == 5.0) {\n\t\tdirection.xz *= -1.0;\n\t}\n\treturn direction;\n}\nvoid main() {\n\tvOutputDirection = getDirection(uv, faceIndex);\n\tgl_Position = vec4( position, 1.0 );\n}\n\t",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform samplerCube envMap;\n\n\nuniform int inputEncoding;\nuniform int outputEncoding;\n\n#include \n\nvec4 inputTexelToLinear(vec4 value){\n\tif(inputEncoding == 0){\n\t\treturn value;\n\t}else if(inputEncoding == 1){\n\t\treturn sRGBToLinear(value);\n\t}else if(inputEncoding == 2){\n\t\treturn RGBEToLinear(value);\n\t}else if(inputEncoding == 3){\n\t\treturn RGBMToLinear(value, 7.0);\n\t}else if(inputEncoding == 4){\n\t\treturn RGBMToLinear(value, 16.0);\n\t}else if(inputEncoding == 5){\n\t\treturn RGBDToLinear(value, 256.0);\n\t}else{\n\t\treturn GammaToLinear(value, 2.2);\n\t}\n}\n\nvec4 linearToOutputTexel(vec4 value){\n\tif(outputEncoding == 0){\n\t\treturn value;\n\t}else if(outputEncoding == 1){\n\t\treturn LinearTosRGB(value);\n\t}else if(outputEncoding == 2){\n\t\treturn LinearToRGBE(value);\n\t}else if(outputEncoding == 3){\n\t\treturn LinearToRGBM(value, 7.0);\n\t}else if(outputEncoding == 4){\n\t\treturn LinearToRGBM(value, 16.0);\n\t}else if(outputEncoding == 5){\n\t\treturn LinearToRGBD(value, 256.0);\n\t}else{\n\t\treturn LinearToGamma(value, 2.2);\n\t}\n}\n\nvec4 envMapTexelToLinear(vec4 color) {\n\treturn inputTexelToLinear(color);\n}\n\t\n\nvoid main() {\n\tgl_FragColor = vec4(0.0);\n\tgl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;\n\tgl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return t.type="CubemapToCubeUV",t}function Pu(t){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),js.call(this,t),this.type="catmullrom",this.closed=!0}function Lu(t){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),js.call(this,t),this.type="catmullrom"}function Ru(t){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),js.call(this,t),this.type="catmullrom"}bu.prototype={constructor:bu,fromScene:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=.1),void 0===r&&(r=100),gu=mu.getRenderTarget();var i=wu();return function(t,e,n,r){var i=new Fn(90,1,e,n),o=[1,1,1,1,-1,1],a=[1,1,-1,-1,-1,1],s=mu.outputEncoding,l=mu.toneMapping,c=mu.toneMappingExposure,u=mu.getClearColor(),h=mu.getClearAlpha();mu.toneMapping=1,mu.toneMappingExposure=1,mu.outputEncoding=N,t.scale.z*=-1;var d=t.background;if(d&&d.isColor){d.convertSRGBToLinear();var p=Math.max(d.r,d.g,d.b),f=Math.min(Math.max(Math.ceil(Math.log2(p)),-128),127);d=d.multiplyScalar(Math.pow(2,-f));var m=(f+128)/255;mu.setClearColor(d,m),t.background=null}for(var g=0;g<6;g++){var y=g%3;0==y?(i.up.set(0,o[g],0),i.lookAt(a[g],0,0)):1==y?(i.up.set(0,0,o[g]),i.lookAt(0,a[g],0)):(i.up.set(0,o[g],0),i.lookAt(0,0,a[g])),Su(r,y*eu,2>8&255)/255,(l.color>>16&255)/255),t.getDisplayBlockTable().getAllBlockRecord().forEach(function(t){var e=t.getLayerTable().getLayerRecord(a);e&&e.upColorToByLayerMaterial(n)}),o=!0},s=this,l=0;l>8,(16711680&w)>>16);var C=u.getCanvas(),S=.5*C.width,T=.5*C.height;if(e.type==c.kLinesType){var E=new r.RawShaderMaterial({uniforms:{color:{value:_},clippt1:{value:h},clippt2:{value:d},vieww:{value:S},viewh:{value:T}},vertexShader:o.MxShader.VSHADER_COLOR_POINT_CLIP_FORMXCAD,fragmentShader:o.MxShader.FSHADER_COLOR_POINT_CLIP_FORMXCAD,linewidth:1,transparent:!0,side:r.DoubleSide});n.addClipMaterial(E),(A=new r.InstancedBufferGeometry).maxInstancedCount=t.length,A.setAttribute("position",new r.Float32BufferAttribute(e.points,2)),A.setAttribute("tran1",new r.InstancedBufferAttribute(new Float32Array(f),4)),A.setAttribute("tran2",new r.InstancedBufferAttribute(new Float32Array(m),4)),A.setAttribute("tran3",new r.InstancedBufferAttribute(new Float32Array(g),4)),A.setAttribute("tran4",new r.InstancedBufferAttribute(new Float32Array(y),4)),A.setAttribute("ishide",new r.InstancedBufferAttribute(new Float32Array(v),1));var D=new r.LineSegments(A,E);D.frustumCulled=!1,D.renderOrder=s.MxData.iCADCurveRenderOrder,i.add(D),n.addEntity(e.id,D),M&&n.addColorByLayerMaterial(e.id,E)}else if(e.type==c.kTriangleType){var A;E=new r.RawShaderMaterial({uniforms:{color:{value:_},clippt1:{value:h},clippt2:{value:d},vieww:{value:S},viewh:{value:T}},vertexShader:o.MxShader.VSHADER_COLOR_POINT_CLIP_FORMXCAD,fragmentShader:o.MxShader.FSHADER_COLOR_POINT_CLIP_FORMXCAD,transparent:!0,side:r.DoubleSide}),n.addClipMaterial(E),(A=new r.InstancedBufferGeometry).maxInstancedCount=t.length,A.setAttribute("position",new r.Float32BufferAttribute(e.points,2)),A.setAttribute("tran1",new r.InstancedBufferAttribute(new Float32Array(f),4)),A.setAttribute("tran2",new r.InstancedBufferAttribute(new Float32Array(m),4)),A.setAttribute("tran3",new r.InstancedBufferAttribute(new Float32Array(g),4)),A.setAttribute("tran4",new r.InstancedBufferAttribute(new Float32Array(y),4)),A.setAttribute("ishide",new r.InstancedBufferAttribute(new Float32Array(v),1));var O=new r.Mesh(A,E);O.frustumCulled=!1,O.renderOrder=s.MxData.iCADMeshRenderOrder,i.add(O),n.addEntity(e.id,O),M&&n.addColorByLayerMaterial(e.id,E)}},E.createThreejsObjForMemData=function(t,e,n,i,a,l){if(0==t.length)return!1;for(var u=[],h=[],d=[],p=[],f=[],m=0;m>8&255)/255,(y>>16&255)/255),e.type==c.kLinesType){var b=new r.RawShaderMaterial({uniforms:{color:{value:x}},vertexShader:o.MxShader.VSHADER_COLOR_POINT_FORMXCAD,fragmentShader:o.MxShader.FSHADER_COLOR_POINT_FORMXCAD,linewidth:1,transparent:!0,side:r.DoubleSide});(M=new r.InstancedBufferGeometry).maxInstancedCount=t.length,M.setAttribute("position",new r.Float32BufferAttribute(e.points,2)),M.setAttribute("tran1",new r.InstancedBufferAttribute(new Float32Array(u),4)),M.setAttribute("tran2",new r.InstancedBufferAttribute(new Float32Array(h),4)),M.setAttribute("tran3",new r.InstancedBufferAttribute(new Float32Array(d),4)),M.setAttribute("tran4",new r.InstancedBufferAttribute(new Float32Array(p),4)),M.setAttribute("ishide",new r.InstancedBufferAttribute(new Float32Array(f),1));var w=new r.LineSegments(M,b);w.frustumCulled=!1,w.renderOrder=s.MxData.iCADCurveRenderOrder,w.visible=!l,i.add(w),n.addEntity(e.id,w),v&&n.addColorByLayerMaterial(e.id,b)}else if(e.type==c.kTriangleType){var M;b=new r.RawShaderMaterial({uniforms:{color:{value:x}},vertexShader:o.MxShader.VSHADER_COLOR_POINT_FORMXCAD,fragmentShader:o.MxShader.FSHADER_COLOR_POINT_FORMXCAD,transparent:!0,side:r.DoubleSide}),(M=new r.InstancedBufferGeometry).maxInstancedCount=t.length,M.setAttribute("position",new r.Float32BufferAttribute(e.points,2)),M.setAttribute("tran1",new r.InstancedBufferAttribute(new Float32Array(u),4)),M.setAttribute("tran2",new r.InstancedBufferAttribute(new Float32Array(h),4)),M.setAttribute("tran3",new r.InstancedBufferAttribute(new Float32Array(d),4)),M.setAttribute("tran4",new r.InstancedBufferAttribute(new Float32Array(p),4)),M.setAttribute("ishide",new r.InstancedBufferAttribute(new Float32Array(f),1));var _=new r.Mesh(M,b);_.frustumCulled=!1,_.renderOrder=s.MxData.iCADMeshRenderOrder,_.visible=!l,i.add(_),n.addEntity(e.id,_),v&&n.addColorByLayerMaterial(e.id,b)}};var O=(P.prototype.upDisplayFromChage_memData=function(t){var e=this.database.getDisplayBlockTable().getBlockRecord(t.blockId);if(null==e)return!1;var n=this.database.getLayerTable().getColor(t.layerId),r=this.database.getLayerTable().isOff(t.layerId),i=e.getLayerTable().createLayerRecord(t.layerId),o=this.mxObj.getScene(),a=e.getInstances_class();i.deleteMemorySectionEntitys(t.id,o);var s=a.aryInstanceNoClip,l=a.mapInstanceClip;0o.x){var l=i.x;i.x=o.x,o.x=l}if(i.y>o.y){var c=i.y;i.y=o.y,o.y=c}this.reInit(),this._devicePixelRatio=window.devicePixelRatio,this._openFile="",this._openFileExtName="dwg",this._iniParam=[],this._initZoomwCoordPt1=null,this._initZoomWCoordPt2=null;var u=new a.Matrix4;u.identity(),this.intiDoc2Wold(u),this.mxdrawThreeJS.updateCameraDisplayRange(i,o,0),this.updateDisplay(!0);var h=s.MxFun.getUiObj();null!=h&&(h.SetLayoutData(this._allLayoutName),h.UpDisplayLayout())},S.prototype.calcViewsize=function(){if(null==this._userCanvas)return{viewWidth:window.innerWidth,viewHeight:window.innerHeight};var t=this._userCanvas.clientWidth,e=this._userCanvas.clientHeight;if(null!=this._event.onResize){var n=this._event.onResize();null!=n&&(t=parseInt(n.width),e=parseInt(n.height))}return{viewWidth:t,viewHeight:e}},S.prototype.initMxCpp=function(t){t&&t.imp?(this.mcObject.init(this,t.imp),null!=this.secenView?this.secenView.background=null:this.scene.background=null):console.log("mxerror: mcppObjectImp is null")},S.prototype.create=function(t,e,n,i){if(this._is2d?i?(this.mxdrawThreeJS=new b.MxDrawMapBoxThreeJS(i,this),this._viewcolor=16777215):this.mxdrawThreeJS=new b.MxDrawObject2dThreeJS(this):this.mxdrawThreeJS=new b.MxDrawObject3dThreeJS(this),this._callCreateCanvasImageData=void 0,this._devicePixelRatio=window.devicePixelRatio,this._runMode==r.kCPPMxCAD)this._mxCAD=null,this._openFile="";else{if(e instanceof Array?(this._openFile=e[0],this._staticLoadingOpenFiles=e):this._openFile=e,this._iniParam=s.MxFun.getUrlParams(),this._openFileExtName=this._openFile.substring(this._openFile.lastIndexOf(".")+1),""!=this._openFile&&this._runMode!=r.kMxCAD&&this._runMode!=r.kMxCADBrowseApp){var o=new Array;o.push("file"),o.push(this._openFile),this._iniParam.push(o)}""!=this._userIdentitySign&&(this.addInitParam("userIdentitySign",this._userIdentitySign),this.addInitParam("userRandomToken",this._userRandomToken)),this.addInitParam("runMode",this._runMode==r.kMxCAD||this._runMode==r.kMxCADBrowseApp?"mxcad":"browse"),this._runMode==r.kMxCAD||this._runMode==r.kMxCADBrowseApp?("empty"==this._openFile&&(this._openFile=""),this._mxCAD=new g.MxCADObject(this)):this._mxCAD=null}this._userCanvas=t;var l=window.innerWidth,c=window.innerHeight;if(null!=t&&(l=t.clientWidth,c=t.clientHeight),this._viewWidth=l,this._viewHeight=c,this.m_mxDatabase.getSelectManager().setCanvasSize(l,c),this.mxdrawThreeJS.onInitThreejs(),this.eventManager.registEvent(this),this.onCreate(),this.m_mxDatabase.init(this),this._parentDocObject=new a.Object3D,this.scene.add(this._parentDocObject),this.threejsselectObjects=new a.Object3D,this.scene.add(this.threejsselectObjects),this._objectsOsnap=new v.MxDrawObjectOsnap(this),this._select=new p.MxSelect(this,this.getCanvas()),this._select.enabled=s.MxFun.isEnableSelect(),this._select.init(),this._is2d||(this._select.enabled=!1),this._runMode!=r.kBrowse&&(this._select.enabled=!1),f.MxManager.add(this),f.MxManager.setCurrentMx(this),this.mxdrawThreeJS.addControlsChangeEvent(),this.updateDisplay(),this.mxdrawThreeJS.getType()==b.MxThreeJSType.kMapBox)this.mxdrawThreeJS.addWindowResizeEvent();else{var u=this;if(null==t){var h=function(){u._viewWidth=window.innerWidth,u._viewHeight=window.innerHeight,u.onResizeImp(),u.updateDisplay()};window.addEventListener("resize",h,!1),this._onResizeFun=h}else{var d=function(t){t&&t.viewWidth&&t.viewHeight||(t=u.calcViewsize()),u._viewWidth=t.viewWidth,u._viewHeight=t.viewHeight,u.onResizeImp(u._viewWidth,u._viewHeight),u.updateDisplay()};if(this._onResizeFun=d,null!=this._event.addResizeEvent?this._event.addResizeEvent(d,t):window.addEventListener("resize",d,!1),window.setTimeout(function(){d()},5),null!=this._event.onResize){var m=u.calcViewsize();d(m);var y=0,x=0,w=!0,M=window.setInterval(function(){x++;var t=u.calcViewsize();if(t.viewWidth==m.viewWidth&&t.viewHeight==m.viewHeight&&0>24&255;2==E?(y.push(b,w),y.push(M,_),y.push(C,S)):1==E?0!=d&&u?(v.push(b,w),v.push(M,_),v.push(C,S)):(g.push(b,w),g.push(M,_),g.push(C,S)):(T=this.automaticInversionColor(16777215&T),f.push(b,w),f.push(M,_),f.push(C,S),m.push((255&T)/255,(T>>8&255)/255,(T>>16&255)/255),m.push((255&T)/255,(T>>8&255)/255,(T>>16&255)/255),m.push((255&T)/255,(T>>8&255)/255,(T>>16&255)/255))}var D=this._blocks,A=this._layers;0!=o&&(D=this._extRefManager.getBlocks(o),A=this._extRefManager.getLayers(o));var O=D.crateBlock(d);O.addGeometryMesh(f,m,c,y,g,v),D.createThreejsObj(O,this,A)}}},S.prototype.mxWebAddEntityForMemorySections=function(t,e){var n=new h.MxNetData(t),r=n.getMemorySectionsHead(),i=(r.zeroLayerIdIndex,r.databaseIndex);-1!=e&&(i=e);var o=r.nOffset,a=this._blocks,s=this._layers;0!=i&&(a=this._extRefManager.getBlocks(i),s=this._extRefManager.getLayers(i));for(var l=0;l>24&255;R=2==z||1==z?16777215:this.automaticInversionColor(16777215&R),S.push(I,k),S.push(F,B),S.push(j,N),C.push((255&R)/255,(R>>8&255)/255,(R>>16&255)/255),C.push((255&R)/255,(R>>8&255)/255,(R>>16&255)/255),C.push((255&R)/255,(R>>8&255)/255,(R>>16&255)/255)}g.addGeometryTexture(_,S,C,c,M,y,v,x)}}f.createThreejsObj(g,this,m)}}},S.prototype.mxWebAddEntityFor2dPointCurveBuffers=function(t,e){var n=new h.MxNetData(t),r=n.getdPointCurveBuffersHead(),i=r.zeroLayerIdIndex,o=r.databaseIndex;-1!=e&&(o=e);for(var a=r.datasize,s=0;s>24&255;2==S?(y.push(b,w),y.push(M,_)):1==S?0!=d&&u?(v.push(b,w),v.push(M,_)):(g.push(b,w),g.push(M,_)):(f.push(b,w),f.push(M,_),C=this.automaticInversionColor(16777215&C),m.push((255&C)/255,(C>>8&255)/255,(C>>16&255)/255),m.push((255&C)/255,(C>>8&255)/255,(C>>16&255)/255))}var T=this._blocks,E=this._layers;0!=o&&(T=this._extRefManager.getBlocks(o),E=this._extRefManager.getLayers(o));var D=T.crateBlock(d);D.addGeometryCurve(f,m,c,y,g,v),T.createThreejsObj(D,this,E)}}},S.prototype.mxWebAddEntityFor2dPointCurveBuffer=function(t,e){var n=new h.MxNetData(t);if(!n.getIsSketchEntity()){var r,i=n.getLayerId(),o=i==n.getZeroLayerId(),a=n.getBlockId();if(!((r=t.getInt32(20,!0)/20)<1)){for(var s=80,l=[],c=[],u=[],d=[],p=[],f=0;f>24&255;2==b?(d.push(m,g),d.push(y,v)):1==b?0!=a&&o?(p.push(m,g),p.push(y,v)):(u.push(m,g),u.push(y,v)):(x=this.automaticInversionColor(16777215&x),l.push(m,g),l.push(y,v),c.push((255&x)/255,(x>>8&255)/255,(x>>16&255)/255),c.push((255&x)/255,(x>>8&255)/255,(x>>16&255)/255))}var w=n.getDatabaseIndex();-1!=e&&(w=e);var M=this._blocks,_=this._layers;0!=w&&(M=this._extRefManager.getBlocks(w),_=this._extRefManager.getLayers(w));var C=M.crateBlock(a);C.addGeometryCurve(l,c,i,d,u,p),M.createThreejsObj(C,this,_)}}},S.prototype.mxWebAddEntityFor2dPointMeshBuffer=function(t,e){var n=new h.MxNetData(t);if(!n.getIsSketchEntity()){var r,i=n.getLayerId(),o=n.getBlockId(),a=i==n.getZeroLayerId();if(!((r=t.getInt32(12,!0)/28)<1)){for(var s=80,l=[],c=[],u=[],d=[],p=[],f=0;f>24&255;2==M?(d.push(m,g),d.push(y,v),d.push(x,b)):1==M?0!=o&&a?(p.push(m,g),p.push(y,v),p.push(x,b)):(u.push(m,g),u.push(y,v),u.push(x,b)):(l.push(m,g),l.push(y,v),l.push(x,b),w=this.automaticInversionColor(16777215&w),c.push((255&w)/255,(w>>8&255)/255,(w>>16&255)/255),c.push((255&w)/255,(w>>8&255)/255,(w>>16&255)/255),c.push((255&w)/255,(w>>8&255)/255,(w>>16&255)/255))}var _=n.getDatabaseIndex();-1!=e&&(_=e);var C=this._blocks,S=this._layers;0!=_&&(C=this._extRefManager.getBlocks(_),S=this._extRefManager.getLayers(_));var T=C.crateBlock(o);T.addGeometryMesh(l,c,i,d,u,p),C.createThreejsObj(T,this,S)}}},S.prototype.mxWebCreateAllBlocks=function(t,e){var n=new h.MxNetData(t).getDatabaseIndex();-1!=e&&(n=e);var r=this._blocks;0!=n&&(r=this._extRefManager.getBlocks(n)),r.createBlocks(t,this.scene)},S.prototype.mxWebEntitysData=function(t,e){-1==e&&this._objectsOsnap.mxWebEntitysData(t,e)},S.prototype.getObjectOsnap=function(){return this._objectsOsnap},S.prototype.saveMxEntityToJson=function(t){return this.m_mxDatabase.saveJson(t)},S.prototype.getDtabaseJsonString=function(){return JSON.stringify(this.m_mxDatabase.toJsonObject())},S.prototype.loadMxEntityFromJson=function(t){return this.m_mxDatabase.loadJson(t)},S);function S(t){this._is2d=!0,this._runMode=r.kBrowse,this._mxCAD=null,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.secenView=null,this.cameraView=null,this.renderer=null,this.controls=null,this.threejsselectObjectsView=null,this._mouseRightRotate=!0,this._isMouseMiddlePan=-1,this._mapId2Entity=new Map,this._setAdyDelete=new Map,this._sketchLayers=new l.MxCadSketchLayers(this),this._layers=new c.MxBrowseLayerData,this._blocks=new u.Blocks,this._extRefManager=new u.ExternalReferenceManager,this._doc2World=new a.Matrix4,this._word2doc=new a.Matrix4,this._cad2Doc=new a.Matrix4,this._doc2CAD=new a.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.threejsselectObjects=null,this._onResizeFun=null,this._sCurrentLoadURL="",this.mxdrawThreeJS=null,this.eventManager=new w.MxDrawObjectEvent,this._viewangle=0,this.id=0,this.mcObject=new _.McDrawObject,this._is2d=t,this._blocks.initRootBlockRef(),this.m_iniSet[o.kEnableOsnapFunction]=!1,this.m_sysVariable.init(this),this.m_mxDatabase=new x.MxDbDatabase,this.id=f.MxManager.allocId()}n.MxDrawObject=C},{"./MxCAD/MxCADObject":24,"./MxCAD/MxCadSketchLayer":27,"./MxDrawObjectEvent":33,"./MxFun":34,"./MxLocalFileLoad":35,"./MxManager":36,"./MxNetData":38,"./MxSelect":39,"./MxSystemVariable":43,"./Operate/MxDrawObjectOsnap":54,"./View/MxBrowseDisplay":68,"./View/MxBrowseLayerData":69,"./View/MxDbDatabase":70,"./View/MxDbEntityGrip":72,"./View/MxDrawMapBox":77,"./cpp/McDrawObject":79,three:19}],31:[function(t,e,n){var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),n.MxDrawObject2d=void 0;var o,a=t("three"),s=t("./MxFun"),l=t("./MxDrawObject"),c=t("three-orbitcontrols"),u=t("./MxNetData"),h=t("./MxMaterial"),d=t("./MxDrawData"),p=(i(f,o=l.MxDrawObject),f.prototype.set3DDraw=function(t){this.is3DDraw=t},f.prototype.getOrthographicCamera=function(){return this.camera instanceof a.OrthographicCamera?this.camera:null},f.prototype.getFullDisplayRange=function(){return{minPt:this._initMinDisplayPoint,maxPt:this._initMaxDisplayPoint}},f.prototype.zoomW=function(t,e,n){if(null!=n&&n||(t=this.docCoord2World(t.x,t.y,0),e=this.docCoord2World(e.x,e.y,0)),this._curMinDisplayPoint=t,this._curMaxDisplayPoint=e,t.x>e.x){var r=t.x;t.x=e.x,e.x=r}t.y>e.y&&(r=t.y,t.y=e.y,e.y=r);var i=this.getViewWidth(),o=this.getViewHeight(),s=Math.abs(t.x-e.x),l=Math.abs(t.y-e.y),c=this.getOrthographicCamera();if(s/l=this._dataNum)this._isShowLoading&&r.MxFun.hideLoading();else{var t=this._dataType[this._iGet];this._iGet++;var e=this,n=this._iGet+1,i="$"+this._filename+".mxb"+n+".wgh",o=0!=t;this.getFile(this._path,i,o,function(t){e.net.onStaticMessage(t),e.getDatas()},function(){e._dataNum=0,e._iGet=0,e._isShowLoading&&r.MxFun.hideLoading(),console.log("mx get "+i+" faild")})}},c.prototype.onRenderHead=function(t){var e=JSON.parse(t);this._dataType=e.type,this._dataNum=e.count,this._iGet=0,this._isShowLoading&&r.MxFun.showLoading(),this.getDatas()},c.prototype.getFile=function(t,e,n,r,i){var o=new a;o.setPath(t),o.setBinary(n),o.load(e,r,function(){},i)},c);function c(t){this.net=null,this._dataNum=0,this._iGet=0,this._dataType=[],this._path="",this._filename="",this._isShowLoading=!0,this.net=t}n.MxLocalDwgFileLoad=l},{"./MxFun":34}],36:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MxManager=n.MxData=void 0;var r,i,o,a,s,l,c,u,h,d,p=t("./View/MxDbEntity"),f=t("./View/MxDbTextureManager"),m=t("./SVGLoader/MxSVGLoader");(r=n.MxData||(n.MxData={})).iSelectRenderOrder=5,r.iCADMeshRenderOrder=10,r.iCADCurveRenderOrder=20,r.iMxEntityRenderOrder=30,r.iGripRenderOrder=110,r.iDynJigRenderOrder=120,i=n.MxManager||(n.MxManager={}),o=[],a=null,l=[],c=void(s=0),u=new f.MxDbTextureManager,h=new m.MxSvgManager,d=new p.MxDbEntityClassHierarchy,i.add=function(t){o.push(t)},i.allocId=function(){return++s},i.getMxDbEntityClassHierarchy=function(){return d},i.getMxDbTextureManager=function(){return u},i.getMxDbSvgManager=function(){return h},i.outDebugString=function(t){null==c?console.log(t):c(t)},i.setOutDebugCall=function(t){c=t},i.onLoad=function(){for(var t in o)o[t].onLoad("")},i.updateDisplay=function(){for(var t in o)o[t].updateDisplay()},i.currentMx=function(){return a},i.setCurrentMx=function(t){a=t},i.initResize=function(){for(var t in o)o[t].initResize()},i.addSelectEvent=function(t){l.push(t)},i.clearSelectEvent=function(){l=[]},i.callSelectObject=function(t){for(var e in l)if(1==l[e](t))break},i.init=function(){},i.getMxObject=function(t){if("number"==typeof t){for(var e in o)if(o[e].getId()===t)return o[e]}else for(var e in o)if(o[e].getCanvas()===t)return o[e];return null}},{"./SVGLoader/MxSVGLoader":61,"./View/MxDbEntity":71,"./View/MxDbTextureManager":76}],37:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MxMaterial=void 0;var r=t("three");!function(t){t.shaderUniforms={crAmbient:{value:new r.Vector3(1,0,0)},crDiffuse:{value:new r.Vector3(1,0,0)},crSpecular:{value:new r.Vector3(1,0,0)}},t.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),t.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),t.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),t.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),t.m_selectMaterial=new r.MeshPhongMaterial({color:255,opacity:.2,transparent:!0,side:r.DoubleSide}),t.m_mouseMoveMaterial=new r.MeshPhongMaterial({color:16776960,side:r.DoubleSide}),t.m_lockedMaterial=new r.MeshPhongMaterial({color:197379,side:r.DoubleSide}),t.m_samplePoints=new r.PointsMaterial({color:255,depthTest:!1,size:8}),t.m_samplePointsMouseMove=new r.PointsMaterial({color:16711680,depthTest:!1,size:12});var e=new r.MeshBasicMaterial({color:16777215,transparent:!0,depthTest:!1,side:r.DoubleSide,opacity:1,stencilWrite:!1,colorWrite:!1});t.getStencilMaterial=function(){return e},t.GetColorByIndex=function(e){return t.m_arrSystemColors[e]},t.GetColorMaterial=function(e){var n=t.m_arrDefUseMaterials[e];return null===n&&(n=new r.MeshLambertMaterial({color:t.m_arrSystemColors[e],side:r.DoubleSide}),t.m_arrDefUseMaterials[e]=n),n},t.GetBaseColorMaterial=function(e){var n=t.m_arrDefUseBasicMaterials[e];return null===n&&(n=new r.MeshBasicMaterial({color:t.m_arrSystemColors[e],side:r.DoubleSide}),t.m_arrDefUseMaterials[e]=n),n},t.GetCurveColorMaterial=function(e){var n=t.m_arrDefUseCurveMaterials[e];return null===n&&(n=new r.LineBasicMaterial({color:t.m_arrSystemColors[e],linewidth:1}),t.m_arrDefUseCurveMaterials[e]=n),n},t.GetSelectMaterial=function(){return t.m_selectMaterial},t.GetMouseMoveMaterial=function(){return t.m_mouseMoveMaterial},t.GetLockedMaterial=function(){return t.m_lockedMaterial},t.GetSamplePointsMaterial=function(){return t.m_samplePoints},t.GetSamplePointsMouseMoveMaterial=function(){return t.m_samplePointsMouseMove},t.createMaterial=function(t){var e=void 0;if(null==t)return e;function n(t,e){if(null!=e.map){var n=e.map,i=(new r.TextureLoader).load(n);i.wrapS=i.wrapT=r.RepeatWrapping,t.map=i,t.side=r.DoubleSide}}return 0!=t.transparent?t.transparent=!0:t.transparent=!1,"MeshPhongMaterial"==t.name?n(e=new r.MeshPhongMaterial(t),t):"MeshBasicMaterial"==t.name?n(e=new r.MeshBasicMaterial(t),t):"MeshDepthMaterial"==t.name?n(e=new r.MeshDepthMaterial(t),t):"MeshNormalMaterial"==t.name?n(e=new r.MeshNormalMaterial(t),t):"MeshLambertMaterial"==t.name?n(e=new r.MeshLambertMaterial(t),t):"MeshStandardMaterial"==t.name&&n(e=new r.MeshStandardMaterial(t),t),e}}(n.MxMaterial||(n.MxMaterial={}))},{three:19}],38:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MxHFileLoad=n.MxNet=n.MxNetBinMessageType=n.MxNetSend=n.MxNetMessage=n.MxNetMessageType=n.MxNetData=void 0;var r,i,o=t("three"),a=t("./MxFun"),s=t("pako"),l=t("./MxManager"),c=t("./MxDrawData"),u=(h.prototype.getId=function(){return this._dataView.getInt32(4,!0)},h.prototype.getVersion_MwBlobHead=function(){return this._dataView.getInt32(60,!0)},h.prototype.getVersion_MwBlobHeadDynLen=function(){return this._dataView.getInt32(4,!0)},h.prototype.getdPointCurveBuffersHead=function(){var t={};return t.ver=this._dataView.getInt32(4,!0),t.databaseIndex=this._dataView.getInt32(8,!0),t.zeroLayerIdIndex=this._dataView.getInt32(16,!0),t.datacount=this._dataView.getInt32(20,!0),t.datasize=this._dataView.getInt32(24,!0),t},h.prototype.getdPointMeshBuffersHead=function(){var t={};return t.ver=this._dataView.getInt32(4,!0),t.databaseIndex=this._dataView.getInt32(8,!0),t.id=this._dataView.getInt32(12,!0),t.zeroLayerIdIndex=this._dataView.getInt32(16,!0),t.datacount=this._dataView.getInt32(20,!0),t.datasize=this._dataView.getInt32(24,!0),t},h.prototype.getdPointTextureBuffersHead=function(){var t={};return t.ver=this._dataView.getInt32(4,!0),t.databaseIndex=this._dataView.getInt32(8,!0),t.zeroLayerIdIndex=this._dataView.getInt32(16,!0),t.datacount=this._dataView.getInt32(20,!0),t.datasize=this._dataView.getInt32(24,!0),t},h.prototype.getBlobHeadForMemorySectionsHead=function(t){var e={};return e.type=this._dataView.getInt32(t,!0),t+=4,e.ver=this._dataView.getInt32(t,!0),t+=4,e.databaseIndex=this._dataView.getInt32(t,!0),t+=4,e.nOffset=t,e},h.prototype.getMemorySectionsHead=function(){var t=this.getBlobHeadForMemorySectionsHead(0);return t.zeroLayerIdIndex=this._dataView.getInt32(t.nOffset,!0),t.nOffset+=4,t.datacount=this._dataView.getInt32(t.nOffset,!0),t.nOffset+=4,t.datasize=this._dataView.getInt32(t.nOffset,!0),t.nOffset+=4,t.datasize!=t.nOffset&&console.log("mx: sectionshead size assert(0)"),t},h.prototype.getMemorySectionHead=function(t){var e=this.getBlobHeadForMemorySectionsHead(t);return t=e.nOffset,e.pointCount=this._dataView.getInt32(t,!0),t+=4,e.layerId=this._dataView.getInt32(t,!0),t+=4,e.blkId=this._dataView.getInt32(t,!0),t+=4,e.memColor=this._dataView.getInt32(t,!0),t+=4,e.memId=this._dataView.getInt32(t,!0),t+=4,e.memType=this._dataView.getInt32(t,!0),t+=4,e.offset=t,e},h.prototype.getdPointTextureBufferDataHead=function(t){t+=4,t+=4,t+=4;var e={};return e.dataCount=this._dataView.getInt32(t,!0),t+=4,e.layerId=this._dataView.getInt32(t,!0),t+=4,e.blkId=this._dataView.getInt32(t,!0),t+=4,e.offset=t,e},h.prototype.getdPointCurveBufferDataHead=function(t){t+=4,t+=4,t+=4;var e={};return e.pointCount=this._dataView.getInt32(t,!0),t+=4,e.layerId=this._dataView.getInt32(t,!0),t+=4,e.blkId=this._dataView.getInt32(t,!0),t+=4,e.offset=t,e},h.prototype.getdPointMeshBufferDataHead=function(t){t+=4,t+=4,t+=4;var e={};return e.pointCount=this._dataView.getInt32(t,!0),t+=4,e.layerId=this._dataView.getInt32(t,!0),t+=4,e.blkId=this._dataView.getInt32(t,!0),t+=4,e.offset=t,e},h.prototype.getDatabaseIndex=function(){return this._dataView.getInt32(8,!0)},h.prototype.getColorIndex=function(){return this._dataView.getInt32(24,!0)},h.prototype.getBufferType=function(){return this._dataView.getInt32(32,!0)},h.prototype.getIsSketchEntity=function(){return this._dataView.getInt32(40,!0)},h.prototype.getLayerId=function(){return this._dataView.getInt32(44,!0)},h.prototype.getBlockId=function(){return this._dataView.getInt32(48,!0)},h.prototype.getVertexBufferSize=function(){return this._dataView.getInt32(12,!0)},h.prototype.getIndexBufferSize=function(){return this._dataView.getInt32(16,!0)},h.prototype.getZeroLayerId=function(){return this._dataView.getInt32(52,!0)},h.prototype.getSelectMark=function(){return this._dataView.getInt32(56,!0)},h.prototype.getMateria=function(){var t=this._dataView.getInt32(36,!0);if(0==t)return"";for(var e=[],n=0;n=this._dataNum)this.hideLoading(0);else{var t=this._dataType[this._iGet];this._iGet++;var e=this,n=this._iGet+1,r="$"+this._filename+".mxb"+n+".wgh";if(1=this._staticLoadingOpenFiles.length)return console.log("Mx staticLoadingOpenFiles error!"),void this.hideLoading(7);r=this._staticLoadingOpenFiles[this._iGet]}var i=r;this._path&&(i=this._path+r);var o=i.substring(0,i.lastIndexOf("/")+1);if(this.net.getMxDrawObject().setCurrentLoadUrl(o),0==t)this.getFile(this._path,r,function(t){e._isStopLoading||(e.net.onStaticMessage(t)||(console.log(this._path),console.log(r)),e.getData())},function(){e._dataNum=0,e._iGet=0,e.hideLoading(8),console.log("mx get "+r+" faild")});else{var a=new XMLHttpRequest,s=r;this._path&&(s=this._path+r),0!=this._urlParam.length?a.open("GET",s+this._urlParam):a.open("GET",s),c.MxDrawData.m_isRequestHeaderCacheControl&&a.setRequestHeader("Cache-Control","max-age=7200"),0!=this._requestHeader.length&&a.setRequestHeader("usertoken",this._requestHeader),a.responseType="arraybuffer",a.onload=function(){e._isStopLoading||(e.net.onStaticMessage(a.response)||console.log(s),e.getData())},a.addEventListener("error",function(t){e._dataNum=0,e._iGet=0,e.hideLoading(9),console.log("mx get "+r+" faild")},!1),a.send()}}},w.prototype.onRenderHead=function(t){if(!this._isStopLoading){var e=JSON.parse(t);this._dataType=e.type,this._dataNum=e.count,this._iGet=0,this.showLoading(),this.getData()}},w.prototype.getFile=function(t,e,n,r){var i=new o.FileLoader(this.manager);i.setPath(t);var a=e;0!=this._urlParam.length&&(a=e+this._urlParam),0!=this._requestHeader.length&&(i.requestHeader={usertoken:this._requestHeader}),i.load(a,n,function(){},r)},w);function w(t,e){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=t,this.manager=void 0!==e?e:o.DefaultLoadingManager}n.MxHFileLoad=b},{"./MxDrawData":29,"./MxFun":34,"./MxManager":36,pako:1,three:19}],39:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MxSelect=void 0;var r=t("three"),i=t("three.meshline"),o=t("./MxFun"),a=t("./MxNetData"),s=t("./MxMaterial"),l=(c.prototype.removeAll=function(){this._mapSelectMark2Entity=new Map},c.prototype.addEntity=function(t,e){var n=this._mapSelectMark2Entity.get(t);null==n&&(n=new Array,this._mapSelectMark2Entity.set(t,n)),n.push(e)},c.prototype.removeEntity=function(t){var e=new Map,n=function(t,e){var n=this.mx.getScene(),r=e;return function(e,i,a){if(null==t||i!=t)for(var s in e)o.MxFun.removeThreejsObject(e[s],n);else{var l=e.concat();r.set(t,l)}}}.call(this,t,e);this._mapSelectMark2Entity.forEach(n),this._mapSelectMark2Entity=e},c.prototype.init=function(){var t=this;t.domElement.addEventListener("mousedown",function(e){if(!1!==t.enabled&&!t.tmpDisable&&e.button==r.MOUSE.LEFT){var n=t.mx.screenCoord2Doc(e.clientX,e.clientY,0),i=t.mx.screenCoordLong2Doc(10),a=o.MxFun.formatString("[{0},{1},{2},{3}]",n.x.toString(),n.y.toString(),"0",i.toString());t.mx.callCommand("Mx_Select",a)}},!1)},c.prototype.mxWebAddEntity=function(t){var e=new a.MxNetData(t),n=e.getSelectMark();this.removeEntity(n);var r=this.mxWebAddEntity_3DChild(e);this.mxWebAddEntity_Curve(e,r)},c.prototype.mxWebAddEntity_3DChild=function(t){var e=t.getMesh();if(null==e.id)return e.size;var n=new r.Mesh(e.geometry,s.MxMaterial.GetBaseColorMaterial(1));this.mx.getScene().add(n);var i=t.getSelectMark();return this.addEntity(i,n),e.size},c.prototype.mxWebAddEntity_Curve=function(t,e){var n=t.getCurve(e);if(null!=n.id){var o=this.mx.getViewWidth(),a=this.mx.getViewHeight();this._material.resolution=new r.Vector2(o,a);for(var s=t.getSelectMark(),l=n.geometry,c=this.mx.getScene(),u=0;u+1 0.1) \n vColor = vec4(color,0.0); \nelse \n vColor = vec4(color,1.0); \ngl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); \n} \n",r.VSHADER_COLOR_POINT_BYLAYER=" precision highp float; \nuniform mat4 modelViewMatrix; \nuniform mat4 projectionMatrix; \nuniform vec3 color; \nattribute vec2 position; \nattribute vec4 tran1; \nattribute vec4 tran2; \nattribute vec4 tran3; \nattribute vec4 tran4; \nattribute float ishide; \nvarying vec4 vColor; \nvoid main(){ \n mat4 tran; \ntran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; \ntran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; \ntran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; \ntran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; \nif(ishide > 0.1) \n vColor = vec4(color,0.0); \nelse \n vColor = vec4(color,1.0); \ngl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); \n} \n",r.FSHADER_COLOR_POINT=" precision highp float; \nvarying vec4 vColor; \nvoid main() { \ngl_FragColor = vColor; \n} \n",r.VSHADER_COLOR_POINT_TEXTURE=" precision highp float; \nuniform mat4 modelViewMatrix; \nuniform mat4 projectionMatrix; \nattribute vec2 position; \nattribute vec2 uv; \nattribute vec4 tran1; \nattribute vec4 tran2; \nattribute vec4 tran3; \nattribute vec4 tran4; \nvarying vec2 vUv; \nvoid main(){ \nvUv = uv; \nmat4 tran; \ntran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; \ntran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; \ntran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; \ntran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; \ngl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); \n} \n",r.FSHADER_COLOR_POINT_TEXTURE=" precision highp float; \nvarying vec2 vUv; \nuniform sampler2D texture; \nvoid main() { \ngl_FragColor = texture2D( texture, vUv ); \n} \n",r.VSHADER_COLOR_POINT_CLIP=" precision highp float; \nuniform mat4 modelViewMatrix; \nuniform mat4 projectionMatrix; \nuniform vec2 clippt1; \nuniform vec2 clippt2; \nuniform float vieww; \nuniform float viewh; \nattribute vec2 position; \nattribute vec3 color; \nattribute vec4 tran1; \nattribute vec4 tran2; \nattribute vec4 tran3; \nattribute vec4 tran4; \nattribute float ishide; \nvarying vec4 vColor; \nvarying vec2 vCp1; \nvarying vec2 vCp2; \nvoid main(){ \n mat4 tran; \ntran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; \ntran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; \ntran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; \ntran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; \nvec4 pt1 = projectionMatrix * modelViewMatrix * vec4( clippt1.x,clippt1.y,0.0, 1.0 ); \nvec4 pt2 = projectionMatrix * modelViewMatrix * vec4( clippt2.x,clippt2.y,0.0, 1.0 ); \nvCp1 = vec2(pt1.x * vieww + vieww,pt1.y * viewh + viewh); \nvCp2 = vec2(pt2.x * vieww + vieww,pt2.y * viewh + viewh); \nif(ishide > 0.1) \n vColor = vec4(color,0.0); \nelse \n vColor = vec4(color,1.0); \ngl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); \n} \n",r.VSHADER_COLOR_POINT_BYLAYER_CLIP=" precision highp float; \nuniform mat4 modelViewMatrix; \nuniform mat4 projectionMatrix; \nuniform vec3 color; \nuniform vec2 clippt1; \nuniform vec2 clippt2; \nuniform float vieww; \nuniform float viewh; \nattribute vec2 position; \nattribute vec4 tran1; \nattribute vec4 tran2; \nattribute vec4 tran3; \nattribute vec4 tran4; \nattribute float ishide; \nvarying vec4 vColor; \nvarying vec2 vCp1; \nvarying vec2 vCp2; \nvoid main(){ \n mat4 tran; \ntran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; \ntran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; \ntran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; \ntran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; \nvec4 pt1 = projectionMatrix * modelViewMatrix * vec4( clippt1.x,clippt1.y,0.0, 1.0 ); \nvec4 pt2 = projectionMatrix * modelViewMatrix * vec4( clippt2.x,clippt2.y,0.0, 1.0 ); \nvCp1 = vec2(pt1.x * vieww + vieww,pt1.y * viewh + viewh); \nvCp2 = vec2(pt2.x * vieww + vieww,pt2.y * viewh + viewh); \nif(ishide > 0.1) \n vColor = vec4(color,0.0); \nelse \n vColor = vec4(color,1.0); \ngl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); \n} \n",r.FSHADER_COLOR_POINT_CLIP="precision highp float; \nvarying vec4 vColor; \nvarying vec2 vCp1; \nvarying vec2 vCp2; \nvoid main() { \nif(gl_FragCoord.x > vCp1.x && gl_FragCoord.x < vCp2.x && gl_FragCoord.y > vCp1.y && gl_FragCoord.y < vCp2.y) \ngl_FragColor = vColor; \nelse \ndiscard; \n} \n",r.VSHADER_COLOR_POINT_FORMXCAD=" precision highp float; \nuniform mat4 modelViewMatrix; \nuniform mat4 projectionMatrix; \nuniform vec3 color; \nattribute vec2 position; \nattribute vec4 tran1; \nattribute vec4 tran2; \nattribute vec4 tran3; \nattribute vec4 tran4; \nattribute float ishide; \nvarying vec4 vColor; \nvoid main(){ \n mat4 tran; \ntran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; \ntran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; \ntran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; \ntran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; \ngl_PointSize = 1.0;\nif(ishide > 0.1) \n vColor = vec4(color,0.0); \nelse \n vColor = vec4(color,1.0); \ngl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); \n} \n",r.FSHADER_COLOR_POINT_FORMXCAD=" precision highp float; \nvarying vec4 vColor; \nvoid main() { \ngl_FragColor = vColor; \n} \n",r.VSHADER_COLOR_POINT_CLIP_FORMXCAD=" precision highp float; \nuniform mat4 modelViewMatrix; \nuniform mat4 projectionMatrix; \nuniform vec3 color; \nuniform vec2 clippt1; \nuniform vec2 clippt2; \nuniform float vieww; \nuniform float viewh; \nattribute vec2 position; \nattribute vec4 tran1; \nattribute vec4 tran2; \nattribute vec4 tran3; \nattribute vec4 tran4; \nattribute float ishide; \nvarying vec4 vColor; \nvarying vec2 vCp1; \nvarying vec2 vCp2; \nvoid main(){ \n mat4 tran; \ntran[0][0] = tran1.x;tran[0][1] = tran1.y;tran[0][2] = tran1.z;tran[0][3] = tran1.w; \ntran[1][0] = tran2.x;tran[1][1] = tran2.y;tran[1][2] = tran2.z;tran[1][3] = tran2.w; \ntran[2][0] = tran3.x;tran[2][1] = tran3.y;tran[2][2] = tran3.z;tran[2][3] = tran3.w; \ntran[3][0] = tran4.x;tran[3][1] = tran4.y;tran[3][2] = tran4.z;tran[3][3] = tran4.w; \nvec4 pt1 = projectionMatrix * modelViewMatrix * vec4( clippt1.x,clippt1.y,0.0, 1.0 ); \nvec4 pt2 = projectionMatrix * modelViewMatrix * vec4( clippt2.x,clippt2.y,0.0, 1.0 ); \nvCp1 = vec2(pt1.x * vieww + vieww,pt1.y * viewh + viewh); \nvCp2 = vec2(pt2.x * vieww + vieww,pt2.y * viewh + viewh); \nif(ishide > 0.1) \n vColor = vec4(color,0.0); \nelse \n vColor = vec4(color,1.0); \ngl_Position = projectionMatrix * modelViewMatrix * tran * vec4( position.x,position.y,0.0, 1.0 ); \n} \n",r.FSHADER_COLOR_POINT_CLIP_FORMXCAD="precision highp float; \nvarying vec4 vColor; \nvarying vec2 vCp1; \nvarying vec2 vCp2; \nvoid main() { \nif(gl_FragCoord.x > vCp1.x && gl_FragCoord.x < vCp2.x && gl_FragCoord.y > vCp1.y && gl_FragCoord.y < vCp2.y) \ngl_FragColor = vColor; \nelse \ndiscard; \n} \n"},{}],41:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.MxStencilObject=void 0;var r=t("three"),i=t("./MxMaterial"),o=(a.prototype.object_onAfterRender=function(t){var e=this.aryMeshStencil;if(e&&0c&&(d+=(g.fontBoundingBoxAscent+g.fontBoundingBoxDescent)*l,u.push(t.substring(p,f)),p=f,m++);if(pp&&(g+=x=(b.fontBoundingBoxAscent+b.fontBoundingBoxDescent)*d,f.push(t.substring(y,v)),m.push(x),y=v);if(y>16&255)+"",(s>>8&255)+"",(255&s)+"");h.fillStyle=C,h.textAlign="left",h.textBaseline="bottom";for(var S=0,T=0;Se)&&(this.m_osmode=y.MxJigCmdManager.OsnapMode.kOsModekValid));var n=o.getOSmode(),r=o.getPrvPoint();this.notifyOsnap(n,o.isValidPrvpoint()?r:void 0)}},C.prototype.seInValidPoint=function(){this.setPoint(void 0)},C.prototype.getCurrentOSnapPoint=function(t){var e={};return this.isEnable()?(e.pt=t,e.osmode=this.m_osmode,this.m_osmode!=y.MxJigCmdManager.OsnapMode.kOsModekValid?(e.pt.x=this.m_ptSnapPoint.x,e.pt.y=this.m_ptSnapPoint.y,e.pt.z=this.m_ptSnapPoint.z,o.isOsnapZValue()||(t.z=0)):e.pt=t):(e.pt=t,e.osmode=y.MxJigCmdManager.OsnapMode.kOsModekValid),e},C.prototype.setLongprogressStatus=function(t){this.m_iLongprogressStatus=t},C.prototype.reComputeOffset=function(){},C);function C(t){this.m_inPoint=new f.Vector3,this.m_vecOffset=new f.Vector3,this.m_pt=new f.Vector3,this.m_isValid=!1,this.m_ptSnapPoint=new f.Vector3,this.m_ptSnapSrcPoint=new f.Vector3,this.m_osmode=y.MxJigCmdManager.OsnapMode.kOsModekValid,this.m_prvInputPoint=new f.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_mxJig=t,this.m_draw=new w}n.McEdJigOsnap=_},{"../MxDrawData":29,"../MxDrawObject":30,"../MxFun":34,"../MxTools":45,"../MxWindowsEvent":48,"./MxJigCmdManager":58,three:19}],50:[function(t,e,n){var r,i=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(n,"__esModule",{value:!0}),n.McGiWorldDrawSelect=n.McGiWorldDraw=n.McGiWorldDrawType=void 0;var o,a,s=t("three"),l=t("../MxThreeJS"),c=t("../MxManager"),u=t("three.meshline");(a=o=n.McGiWorldDrawType||(n.McGiWorldDrawType={}))[a.kWorldDraw=1]="kWorldDraw",a[a.kDynDragDraw=2]="kDynDragDraw",a[a.kSelectDraw=3]="kSelectDraw";var h=(d.prototype.getType=function(){return this.worldDrawType},d.prototype.setXData=function(t){this.xData=t},d.prototype.setMatrix=function(t){this.matrix=t},d.prototype.getMatrix=function(){return this.matrix},d.prototype.setOpacity=function(t){this.opacity=t},d.prototype.getOpacity=function(){return this.opacity},d.prototype.setColor=function(t){this.iColor!=t&&(this.widthMaterial=null),this.iColor=t},d.prototype.setDash=function(t,e){this.dDashArray=t,this.dDashRatio=e},d.prototype.getDash=function(){return{dDashArray:this.dDashArray,dDashRatio:this.dDashRatio}},d.prototype.setDashLineDisplay=function(t){t?(this.dDashArray=.03,this.dDashRatio=.1,0==this.dLineWidth&&(this.dLineWidth=6,this.lineWidthByPixels=!0)):(this.dDashArray=0,this.dDashRatio=0)},d.prototype.isDashLineDisplay=function(){return 0=a.MxJigCmdManager.DragStatus.kKW1&&0=o.length&&(a=0):s=!0,!0},r.MoveDownKey=function(){return!!s&&(--a<0&&(a=o.length-1),!0)},r.GetListCommad=function(){return a<0||a>=o.length?"":o[a]},r.ClearPrvCmd=function(){l=""},r.GetPrvCmd=function(){return l},r.SetPrvCmd=function(t){l=t},r.runCmd=function(t,e,n){var r=e.toUpperCase(),m=i[r];if(t&&null==m){var g=c[r];if(null!=g&&(m=i[g.toUpperCase()]),null==m)return p.MxUiVue.isNull()?console.log(u.MxFun.formatString('未知命令"{0}"',e)):p.MxUiVue.acutPrintf('未知命令"{0}"。\n命令:',e),!1}if(!m)return!1;var y=o.indexOf(m.cmd);-1this.m_pt1.x)r=c.MxThreeJS.createLines(n,16777215),i=255;else{var o=this.getMxObject().screenCoordLong2Doc(3);r=c.MxThreeJS.createDashedLines(n,16777215,2*o,o)}var s=[];s.push(this.m_pt1),s.push(t),s.push(this.m_pt2),s.push(this.m_pt1),s.push(this.m_pt2),s.push(e);var l=c.MxThreeJS.createTriangle(s,i,.27);this.drawEntity(l,30),this.drawEntity(r,31)},h);function h(t,e){var n=o.call(this)||this;return n.m_pt1=t,n.m_pt2=t,n.m_isFrontEndWebpage=e,n}n.MxIntelliSelectJig=u},{"../MxThreeJS":44,"./MxJig":57,"./MxJigCmdManager":58,three:19}],57:[function(t,e,n){Object.defineProperty(n,"__esModule",{value:!0}),n.McEdJigCommand=n.MxDynamicInput=void 0;var r=t("three"),i=t("../MxFun"),o=t("./MxJigCmdManager"),a=t("../MxManager"),s=t("../MxTools"),l=t("../UI/MxUiVue"),c=t("./McEdJigOsnap"),u=t("../MxWindowsEvent"),h=(d.prototype.onKeyDonw=function(t){if(27==t)return this.m_isInputStatus?(this.m_isInputStatus=!1,l.MxUiVue.OnMxEvent({name:"dynInputReSet"}),1):0;if(32!=t&&13!=t)return this.m_isInputStatus=!0,0;if(this.m_isInputStatus&&l.MxUiVue.DynamicInput_isShow()&&l.MxUiVue.DynamicInput_getType()==o.MxJigCmdManager.DynamicInputType.kXYCoordInput){var e,n=l.MxUiVue.DynamicInput_getValue1(),r=l.MxUiVue.DynamicInput_getValue2(),a=l.MxUiVue.DynamicInput_getFocusValue();e=s.MxTools.IsNumerical(n)&&s.MxTools.IsNumerical(r)?i.MxFun.formatString("{0},{1}",n,r):a,l.MxUiVue.setCmdText(e)}return this.m_isInputStatus=!1,0},d.prototype.isInputStatus=function(){return this.m_isInputStatus},d.prototype.initDynInput=function(t){this.m_jig=t;var e=this.m_jig.getMxObject();l.MxUiVue.DynamicInput_setType(this.m_dynType),this.m_dynType==o.MxJigCmdManager.DynamicInputType.kAutoInput&&(null!=this._dynamicInputBasePoint||e.sysVariable().getSysVarNumber("GETPOINTSTATUS")&o.MxJigCmdManager.GETPOINTSTATUS.OsModeSValidLastPoint?l.MxUiVue.DynamicInput_setType(o.MxJigCmdManager.DynamicInputType.kDistanceInput):l.MxUiVue.DynamicInput_setType(o.MxJigCmdManager.DynamicInputType.kXYCoordInput))},d.prototype.setFocus=function(t){l.MxUiVue.OnMxEvent({name:"dynInputSetFocus",param:{isFocus:t}})},d.prototype.exitDynInput=function(){this._dynamicInputBasePoint=void 0,l.MxUiVue.DynamicInput_setShow(!1),l.MxUiVue.DynamicInput_upDisplay()},d.prototype.isShow=function(){return l.MxUiVue.DynamicInput_isShow()},d.prototype.upDynInput=function(){var t,e=this.m_jig.getMxObject();if(t=!this.m_jig.isDisableDynInput()&&e.sysVariable().getSysVarBool("DYNINPUT"),l.MxUiVue.DynamicInput_setShow(t),t){if(l.MxUiVue.DynamicInput_setTip(l.MxUiVue.getCmdTip()),o.MxJigCmdManager.getAcquireStatus()==o.MxJigCmdManager.AcquireStatus.kMove){var n=o.MxJigCmdManager.getAcquirePoint();if(l.MxUiVue.DynamicInput_setPos(i.MxFun.docCoord2Screen(n.x,n.y,n.z)),l.MxUiVue.DynamicInput_getType()==o.MxJigCmdManager.DynamicInputType.kXYCoordInput){var r=n;l.MxUiVue.DynamicInput_setValue1(r.x.toFixed(3)),l.MxUiVue.DynamicInput_setValue2(r.y.toFixed(3))}else l.MxUiVue.DynamicInput_getType(),o.MxJigCmdManager.DynamicInputType.kDistanceInput}l.MxUiVue.DynamicInput_upDisplay()}},d.prototype.setDynamicInputBasePoint=function(t){this._dynamicInputBasePoint=t},d.prototype.setDynamicInputType=function(t){this.m_dynType=t},d.prototype.getDynamicInputType=function(){return this.m_dynType},d);function d(t){this.m_dynType=o.MxJigCmdManager.DynamicInputType.kAutoInput,this._dynamicInputBasePoint=void 0,this.m_isInputStatus=!1,this.m_jig=t}n.MxDynamicInput=h;var p=(f.prototype.getTypeName=function(){return""},f.prototype.getSence=function(){return this._mxObject.getTheTempDrawContainer()},f.prototype.onExitCommand=function(t){t&&this.m_dynInput.exitDynInput(),this.m_osnap.endDrag()},f.prototype.getOsnap=function(){return this.m_osnap},f.prototype.isDisableDynInput=function(){return this.m_isDisableDynInput},f.prototype.setDisableDynInput=function(t){this.m_isDisableDynInput=t},f.prototype.setDisableOsnap=function(t){this.m_isDisableOsnap=t},f.prototype.isDisableOsnap=function(){return this.m_isDisableOsnap},f.prototype.onStartCommand=function(){this._isCancle=!1,this._isExit=!1,this.m_dynInput.initDynInput(this),c.McEdImpJigGlobalData.intiStartDrag(this._mxObject),this.m_osnap.startDrag(this.m_isOffsetInputPostion,this);var t=u.MxWindowsEvent.getCurrentMousePostion(),e=this._mxObject.screenCoord2Doc(t.x,t.y,0);this.m_osnap.setPoint(e),o.MxJigCmdManager.doMouseMoveImp(),this.m_dynInput.setFocus(!0)},f.prototype.getDynImput=function(){return this.m_dynInput},f.prototype.setMxObject=function(t){this._mxObject=t},f.prototype.getMxObject=function(){return this._mxObject},f.prototype.setColor=function(t){this._iColor=t},f.prototype.getColor=function(){return this._iColor},f.prototype.setDynamicInputType=function(t){this.m_dynInput.setDynamicInputType(t)},f.prototype.getDynamicInputType=function(){return this.m_dynInput.getDynamicInputType()},f.prototype.createTriangle=function(t,e,n){var i=new r.MeshBasicMaterial({color:this._iColor,side:r.DoubleSide}),o=new r.Geometry;o.vertices.push(t),o.vertices.push(e),o.vertices.push(n);var a=new r.Vector3(1,1,1),s=new r.Color(this._iColor),l=new r.Face3(0,1,2,a,s,0);return o.faces.push(l),o.computeFaceNormals(),o.computeVertexNormals(),new r.Mesh(o,i)},f.prototype.createPoint=function(t){var e=new r.Geometry;e.vertices.push(t);var n=new r.PointsMaterial({color:this._iColor,size:3});return new r.Points(e,n)},f.prototype.createLine=function(t,e){var n=new r.Geometry,i=new r.LineBasicMaterial({color:this._iColor});return n.vertices.push(t,e),new r.Line(n,i)},f.prototype.drawReserve=function(t){this.m_isReserveDrawStatus=!0,this.m_callReserveDrawAddEntity=t,this.upDisplay(),this.m_isReserveDrawStatus=!1,this.m_callReserveDrawAddEntity=null},f.prototype.drawEntity=function(t,e){if(null!=t)if(this.m_isReserveDrawStatus)t.renderOrder=null!=e?e:a.MxData.iDynJigRenderOrder,this._mxObject.addObject(t),this.m_callReserveDrawAddEntity&&this.m_callReserveDrawAddEntity(t);else{var n="MxDynDraw_"+this._DynNameId.toString();t.name=n,t.renderOrder=null!=e?e:a.MxData.iDynJigRenderOrder,null==this._aryDynDrawObjectNamesId&&(this._aryDynDrawObjectNamesId=new Array),this._aryDynDrawObjectNamesId.push(this._DynNameId),this._DynNameId++,this.getSence().add(t)}},f.prototype.floorPowerOfTwo=function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},f.prototype.makeTextSprite=function(t,e,n,o,a){var s,l=document.createElement("canvas"),c=l.getContext("2d"),u=i.MxFun.formatString("normal {0}px Arial","256");c.font=u;var h=c.measureText(t);s=2*this.floorPowerOfTwo(h.width),l.width=s,l.height=256,c.font=u,c.textAlign="center",c.textBaseline="middle";var d=i.MxFun.formatString("#{0}",a.toString(16));c.fillStyle=d,c.fillText(t,s/2,128);var p=new r.Texture(l);p.needsUpdate=!0;var f=new r.SpriteMaterial({map:p});f.transparent=!1,f.rotation=o;var m=new r.Sprite(f);return m.scale.set(s/256*n,n,1),m.position.set(e.x,e.y,0),m},f.prototype.drawText=function(t,e,n,r){var i=this.makeTextSprite(t,r,e,n,this._iColor);this.drawEntity(i)},f.prototype.drawPoints=function(t){for(var e=0;eNumber.EPSILON?u.loc=s:d*f<0||p*m<0?u.loc=l:Math.sqrt(d*d+p*p)=c.t-Number.EPSILON})&&(n.push(c),r.push(new a.Vector2(c.x,c.y)))},c=1;cr&&(r=c.y),c.yo&&(o=c.x),c.x=r&&o.push(t[n]);return o.push(t[t.length-1]),o}(t)).length;if(T<2)return 0;var E,D,A,O,P,L,R=t[0].equals(t[T-1]),I=t[0],k=e.strokeWidth/2,F=1/(T-1),B=0,j=!1,N=0,z=3*l,V=2*l;K(t[0],t[1],c).multiplyScalar(k),g.copy(t[0]).sub(c),y.copy(t[0]).add(c),v.copy(g),x.copy(y);for(var G=1;G"),this.isShowMainMenu&&(document.write(""),document.write(""),document.write("