You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2978 lines
1.5 MiB

4 weeks ago
import{M as Ve,a as Yf,b as Sw,c as Aw,d as xw,e as Tw,f as Kf,D as cr,g as Lt,h as yr,i as gp,j as Dw,k as kw,s as Mw,l as Iw}from"./mxdraw-CvD1WFQ5.js";const lk=""+new URL("mxdrawassembly_min-DunvvGVP.js",import.meta.url).href,ck=""+new URL("mxdrawassembly_min-DCka3zJP.wasm",import.meta.url).href,fk=""+new URL("mxdrawassembly_min.worker-B6AbC3KO.js",import.meta.url).href,hk=""+new URL("mxdrawassembly_min-DXr_9mGN.js",import.meta.url).href,pk=""+new URL("mxdrawassembly_minst-6Lgs6G89.wasm",import.meta.url).href;function oe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function qt(i){"@babel/helpers - typeof";return qt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qt(i)}function Pw(i,e){if(qt(i)!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var n=t.call(i,e||"default");if(qt(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function fy(i){var e=Pw(i,"string");return qt(e)=="symbol"?e:String(e)}function Mm(i,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,fy(n.key),n)}}function ue(i,e,t){return e&&Mm(i.prototype,e),t&&Mm(i,t),Object.defineProperty(i,"prototype",{writable:!1}),i}function ir(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Mc(i,e){return Mc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Mc(i,e)}function de(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),e&&Mc(i,e)}function Fe(i,e){if(e&&(qt(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ir(i)}function bn(i){return bn=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},bn(i)}function Fw(i){var e=i.default;if(typeof e=="function"){var t=function(){return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(n){var r=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return i[n]}})}),t}var As={},Xf={};Xf.byteLength=Bw;Xf.toByteArray=Nw;Xf.fromByteArray=Vw;var gi=[],Wr=[],Rw=typeof Uint8Array<"u"?Uint8Array:Array,bh="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Rs=0,Lw=bh.length;Rs<Lw;++Rs)gi[Rs]=bh[Rs],Wr[bh.charCodeAt(Rs)]=Rs;Wr[45]=62;Wr[95]=63;function hy(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Bw(i){var e=hy(i),t=e[0],n=e[1];return(t+n)*3/4-n}function Ow(i,e,t){return(e+t)*3/4-t}function Nw(i){var e,t=hy(i),n=t[0],r=t[1],a=new Rw(Ow(i,n,r)),s=0,o=r>0?n-4:n,u;for(u=0;u<o;u+=4)e=Wr[i.charCodeAt(u)]<<18|Wr[i.charCodeAt(u+1)]<<12|Wr[i.charCodeAt(u+2)]<<6|Wr[i.charCodeAt(u+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return r===2&&(e=Wr[i.charCodeAt(u)]<<2|Wr[i.charCodeAt(u+1)]>>4,a[s++]=e&255),r===1&&(e=Wr[i.charCodeAt(u)]<<10|Wr[i.charCodeAt(u+1)]<<4|Wr[i.charCodeAt(u+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Gw(i){return gi[i>>18&63]+gi[i>>12&63]+gi[i>>6&63]+gi[i&63]}function Uw(i,e,t){for(var n,r=[],a=e;a<t;a+=3)n=(i[a]<<16&16711680)+(i[a+1]<<8&65280)+(i[a+2]&255),r.push(Gw(n));return r.join("")}function Vw(i){for(var e,t=i.length,n=t%3,r=[],a=16383,s=0,o=t-n;s<o;s+=a)r.push(Uw(i,s,s+a>o?o:s+a));return n===1?(e=i[t-1],r.push(gi[e>>2]+gi[e<<4&63]+"==")):n===2&&(e=(i[t-2]<<8)+i[t-1],r.push(gi[e>>10]+gi
\v\f\r\x1B !"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£ØƒáíóúñѪº¿¬½¼¡«¤αßΓπΣσµτΦΘΩδφε±÷°·² "},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяЁёЄєЇїЎў°·¤ "},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"Ά·¬¦ΈΉΊΪΌΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»ΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ "},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®°±²³´µ·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"×÷ˆﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяёђґєѕіїјљњћќ§ўџ"},ibm1124:"cp1124",csibm1124:"cp1124",cp1125:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяЁёҐґЄєІіЇї·¤ "},ibm1125:"cp1125",csibm1125:"cp1125",cp1129:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüưÿ"},ibm1129:"cp1129",csibm1129:"cp1129",cp1133:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮຯະາຳິີຶືຸູຼັົຽເແໂໃໄ່້໊໋໌ໍໆໜໝ¢¬¦"},ibm1133:"cp1133",csibm1133:"cp1133",cp1161:{type:"_sbcs",chars:"กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋฿เแโใ
\v\f\rỨỰỲỶỸÝỴ\x1B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ`},georgianacademy:{type:"_sbcs",chars:"€ƒˆŠŒŽ˜šœžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},georgianps:{type:"_sbcs",chars:"€ƒˆŠŒŽ˜šœžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},pt154:{type:"_sbcs",chars:"ҖҒӮғҶҮҲүҠӢҢҚҺҸҗҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө·ёә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"},viscii:{type:"_sbcs",chars:`\0ẲẴẪ\x07\b
\v\f\r\x1B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ`},iso646cn:{type:"_sbcs",chars:`\0\x07\b
\v\f\r\x1B !"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},iso646jp:{type:"_sbcs",chars:`\0\x07\b
\v\f\r\x1B !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¾¼½ªº«»±"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü°¢£§ß®©´¨ÆØ±¥µπªºΩæø¿¡¬ƒ«» ÀÃÕŒœ÷ÿŸ¤fifl·ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:""},tis620:{type:"_sbcs",chars:"กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู฿เแโใไๅๆ็่้๊๋์ํ๎"}}),xh}var Th={},Vm;function Qw(){if(Vm)return Th;Vm=1;var i=Ua.Buffer;Th._dbcs=u;for(var e=-1,t=-2,n=-10,r=-1e3,a=new Array(256),s=-1,o=0;o<256;o++)a[o]=e;function u(h,p){if(this.encodingName=h.encodingName,!h)throw new Error("DBCS codec is called without the data.");if(!h.table)throw new Error("Encoding '"+this.encodingName+"' has no data.");var m=h.table();this.decodeTables=[],this.decodeTables[0]=a.slice(0),this.decodeTableSeq=[];for(var v=0;v<m.length;v++)this._addDecodeChunk(m[v]);if(typeof h.gb18030=="function"){this.gb18030=h.gb18030();var g=this.decodeTables.length;this.decodeTables.push(a.slice(0));var d=this.decodeTables.length;this.decodeTables.push(a.slice(0));for(var y=this.decodeTables[0],v=129;v<=254;v++)for(var b=this.decodeTables[r-y[v]],_=48;_<=57;_++){if(b[_]===e)b[_]=r-g;else if(b[_]>r)throw new Error("gb18030 decode tables conflict at byte 2");for(var w=this.decodeTables[r-b[_]],E=129;E<=254;E++){if(w[E]===e)w[E]=r-d;else{if(w[E]===r-d)continue;if(w[E]>r)throw new Error("gb18030 decode tables conflict at byte 3")}for(var x=this.decodeTables[r-w[E]],S=48;S<=57;S++)x[S]===e&&(x[S]=t)}}}this.defaultCharUnicode=p.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var T={};if(h.encodeSkipVals)for(var v=0;v<h.encodeSkipVals.length;v++){var L=h.encodeSkipVals[v];if(typeof L=="number")T[L]=!0;else for(var _=L.from;_<=L.to;_++)T[_]=!0}if(this._fillEncodeTable(0,0,T),h.encodeAdd)for(var B in h.encodeAdd)Object.prototype.hasOwnProperty.call(h.encodeAdd,B)&&this._setEncodeChar(B.charCodeAt(0),h.encodeAdd[B]);this.defCharSB=this.encodeTable[0][p.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===e&&(this.defCharSB=this.encodeTable[0]["?"]),this.defCharSB===e&&(this.defCharSB=63)}u.prototype.encoder=l,u.prototype.decoder=c,u.prototype._getDecodeTrieNode=function(h){for(var p=[];h>0;h>>>=8)p.push(h&255);p.length==0&&p.push(0);for(var m=this.decodeTables[0],v=p.length-1;v>0;v--){var g=m[p[v]];if(g==e)m[p[v]]=r-this.decodeTables.length,this.decodeTables.push(m=a.slice(0));else if(g<=r)m=this.decodeTables[r-g];else throw new Error("Overwrite byte in "+this.encodingName+", addr: "+h.t
createMxCad({
locateFile: (fileName)=> {
// 该网络路径无法访问对应fileName的文件
retrun "`.concat(s,`"
}
})
`)),console.error(u.t0);case 14:case"end":return u.stop()}},e,null,[[2,10]])}));return function(t,n,r){return i.apply(this,arguments)}}(),Km=new FinalizationRegistry(function(i){ne.App.destroyObject(i)}),Xm={},Ko=function(){function i(e){oe(this,i),ge(this,"imp",0),this.imp=e,this.imp&&(this.imp.isNull()&&console.log("Mx:error null constructor object "),Km.register(this,e,Xm))}return ue(i,[{key:"constructor_MxCADResbuf",value:function(t){this.imp=t,this.imp&&Km.register(this,t,Xm)}},{key:"getImp",value:function(){return this.imp}},{key:"initTempObject",value:function(t){this.imp=t}},{key:"objectName",get:function(){return this.imp.getObjectName()}},{key:"dxf0",get:function(){return this.imp.getDxf0()}},{key:"getJson",value:function(){var t=this.imp.getJson();return ye.decodeFromGb2312(t)}},{key:"setJson",value:function(t){var n=ye.encodeToGb2312(t);return this.imp.setJson(n)}},{key:"isKindOf",value:function(t){return this.imp.isKindOf(t)}},{key:"isNull",value:function(){return this.imp.isNull()}}]),i}();function b_(i){var e=w_();return function(){var n=bn(i),r;if(e){var a=bn(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return Fe(this,r)}}function w_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var rt=function(i){return i[i.kMxCAD=0]="kMxCAD",i[i.kMxDraw=1]="kMxDraw",i[i.kInvalid=2]="kInvalid",i}(rt||{}),Oe=function(){function i(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;oe(this,i),ge(this,"id",void 0),ge(this,"type",void 0),this.id=e,e?t==2?this.type=0:this.type=t:this.type=2}return ue(i,[{key:"isValid",value:function(){return this.type!=2&&this.id!=0}},{key:"isNull",value:function(){return this.type==2||this.id==0}},{key:"isErase",value:function(){return this.isValid()&&this.type==0&&this.id!=0?ne.App.getImp().isObjectEraseSataus(this.id):!1}},{key:"erase",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isValid()&&(this.type==1?Ve.getCurrentDraw().eraseMxEntity(this.id):this.type==0&&Tt.eraseObject(this.id,t))}},{key:"getMcDbObject",value:function(){return this.isValid()&&this.type==0?ne.App.objectIdToObject(this.id):null}},{key:"isKindOf",value:function(t){return this.isValid()&&this.type==0?ne.App.objectIdIsKindOf(this.id,t):!1}},{key:"getMcDbEntity",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbEntity")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbCurve",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbCurve")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbBlockTableRecord",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbBlockTableRecord")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbLayerTableRecord",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbLayerTableRecord")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbDimStyleTableRecord",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbDimStyleTableRecord")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbLinetypeTableRecord",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbLinetypeTableRecord")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbTextStyleTableRecord",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbTextStyleTableRecord")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbDimension",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbDimension")?ne.App.objectIdToObject(this.id):null}},{key:"getMcDbCustomEntity",value:function(){return this.isValid()&&this.type==0&&ne.App.objectIdIsKindOf(this.id,"McDbCustomEntity")?ne.App.objectIdToObject(this.id):null}}
`)},i)}function H_(i){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(i))}function j_(i){return typeof i!="function"}function Y_(i,e){var t=new Promise(function(n){var r=Date.now();$m(i.bind(null,e),function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];var o=Date.now()-r;if(!a[0])return n(function(){return{error:a[1],duration:o}});var u=a[1];if(j_(u))return n(function(){return{value:u,duration:o}});n(function(){return new Promise(function(l){var c=Date.now();$m(u,function(){for(var f=[],h=0;h<arguments.length;h++)f[h]=arguments[h];var p=o+Date.now()-c;if(!f[0])return l({error:f[1],duration:p});l({value:f[1],duration:p})})})})})});return ku(t),function(){return t.then(function(r){return r()})}}function K_(i,e,t){var n=Object.keys(i).filter(function(a){return L_(t,a)}),r=Qm(n,function(a){return Y_(i[a],e)});return ku(r),function(){return $r(this,void 0,void 0,function(){var s,o,u,l,c;return Qr(this,function(f){switch(f.label){case 0:return[4,r];case 1:return s=f.sent(),[4,Qm(s,function(h){var p=h();return ku(p),p})];case 2:return o=f.sent(),[4,Promise.all(o)];case 3:for(u=f.sent(),l={},c=0;c<n.length;++c)l[n[c]]=u[c];return[2,l]}})})}}function By(){var i=window,e=navigator;return Nr(["MSCSSMatrix"in i,"msSetImmediate"in i,"msIndexedDB"in i,"msMaxTouchPoints"in e,"msPointerEnabled"in e])>=4}function X_(){var i=window,e=navigator;return Nr(["msWriteProfilerMark"in i,"MSStream"in i,"msLaunchUri"in e,"msSaveBlob"in e])>=3&&!By()}function Wv(){var i=window,e=navigator;return Nr(["webkitPersistentStorage"in e,"webkitTemporaryStorage"in e,e.vendor.indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in i,"BatteryManager"in i,"webkitMediaStream"in i,"webkitSpeechGrammar"in i])>=5}function la(){var i=window,e=navigator;return Nr(["ApplePayError"in i,"CSSPrimitiveValue"in i,"Counter"in i,e.vendor.indexOf("Apple")===0,"getStorageUpdates"in e,"WebKitMediaKeys"in i])>=4}function zv(){var i=window,e=i.HTMLElement,t=i.Document;return Nr(["safari"in i,!("ongestureend"in i),!("TouchEvent"in i),!("orientation"in i),e&&!("autocapitalize"in e.prototype),t&&"pointerLockElement"in t.prototype])>=4}function ml(){var i=window;return H_(i.print)?Nr([String(i.browser)==="[object WebPageNamespace]","MicrodataExtractor"in i])>=1:!1}function Oy(){var i,e,t=window;return Nr(["buildID"in navigator,"MozAppearance"in((e=(i=document.documentElement)===null||i===void 0?void 0:i.style)!==null&&e!==void 0?e:{}),"onmozfullscreenchange"in t,"mozInnerScreenX"in t,"CSSMozDocumentRule"in t,"CanvasCaptureMediaStream"in t])>=4}function q_(){var i=window;return Nr([!("MediaSettingsRange"in i),"RTCEncodedAudioFrame"in i,""+i.Intl=="[object Intl]",""+i.Reflect=="[object Reflect]"])>=3}function Z_(){var i=window;return Nr(["DOMRectList"in i,"RTCPeerConnectionIceEvent"in i,"SVGGeometryElement"in i,"ontransitioncancel"in i])>=3}function gl(){var i=window,e=navigator,t=i.CSS,n=i.HTMLButtonElement;return Nr([!("getStorageUpdates"in e),n&&"popover"in n.prototype,"CSSCounterStyleRule"in i,t.supports("font-size-adjust: ex-height 0.5"),t.supports("text-transform: full-width")])>=4}function J_(){if(navigator.platform==="iPad")return!0;var i=screen,e=i.width/i.height;return Nr(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,e>.65&&e<1.53])>=2}function $_(){var i=document;return i.fullscreenElement||i.msFullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement||null}function Q_(){var i=document;return(i.exitFullscreen||i.msExitFullscreen||i.mozCancelFullScreen||i.webkitExitFullscreen).call(i)}function Ny(){var i=Wv(),e=Oy();if(!i&&!e)return!1;var t=window;return Nr(["onorientationchange"in t,"orientation"in t,i&&!("SharedWorker"in t),e&&/android/i.test(navigator.appVersion)])>=2}function eE(){return rE()?-4:tE()}function tE(){var i=window,e=i.OfflineAudioContext||i.webkitOfflineAudioContext;if(!e)return-2;if(nE())return-1;var t=4500,n=5e3,r=new e(1,n,44100),a=r.createOscillator();a.type="triangle",a.frequency.value=1e4;var s=r.createDynamicsCompressor();s.threshold.value=-50,s.knee.value=40,s.ratio.value=12,s.attack.value
`.concat(a,":");for(var s=0,o=i[a];s<o.length;s++){var u=o[s];t+=`
`.concat(e[u]?"🚫":"➡️"," ").concat(u)}}console.log("".concat(t,"\n```"))}function ZE(){for(var i=0,e=["rec2020","p3","srgb"];i<e.length;i++){var t=e[i];if(matchMedia("(color-gamut: ".concat(t,")")).matches)return t}}function JE(){if(a0("inverted"))return!0;if(a0("none"))return!1}function a0(i){return matchMedia("(inverted-colors: ".concat(i,")")).matches}function $E(){if(s0("active"))return!0;if(s0("none"))return!1}function s0(i){return matchMedia("(forced-colors: ".concat(i,")")).matches}var QE=100;function e3(){if(matchMedia("(min-monochrome: 0)").matches){for(var i=0;i<=QE;++i)if(matchMedia("(max-monochrome: ".concat(i,")")).matches)return i;throw new Error("Too high value")}}function t3(){if(Os("no-preference"))return 0;if(Os("high")||Os("more"))return 1;if(Os("low")||Os("less"))return-1;if(Os("forced"))return 10}function Os(i){return matchMedia("(prefers-contrast: ".concat(i,")")).matches}function n3(){if(o0("reduce"))return!0;if(o0("no-preference"))return!1}function o0(i){return matchMedia("(prefers-reduced-motion: ".concat(i,")")).matches}function r3(){if(u0("high"))return!0;if(u0("standard"))return!1}function u0(i){return matchMedia("(dynamic-range: ".concat(i,")")).matches}var jt=Math,ur=function(){return 0};function i3(){var i=jt.acos||ur,e=jt.acosh||ur,t=jt.asin||ur,n=jt.asinh||ur,r=jt.atanh||ur,a=jt.atan||ur,s=jt.sin||ur,o=jt.sinh||ur,u=jt.cos||ur,l=jt.cosh||ur,c=jt.tan||ur,f=jt.tanh||ur,h=jt.exp||ur,p=jt.expm1||ur,m=jt.log1p||ur,v=function(T){return jt.pow(jt.PI,T)},g=function(T){return jt.log(T+jt.sqrt(T*T-1))},d=function(T){return jt.log(T+jt.sqrt(T*T+1))},y=function(T){return jt.log((1+T)/(1-T))/2},b=function(T){return jt.exp(T)-1/jt.exp(T)/2},_=function(T){return(jt.exp(T)+1/jt.exp(T))/2},w=function(T){return jt.exp(T)-1},E=function(T){return(jt.exp(2*T)-1)/(jt.exp(2*T)+1)},x=function(T){return jt.log(1+T)};return{acos:i(.12312423423423424),acosh:e(1e308),acoshPf:g(1e154),asin:t(.12312423423423424),asinh:n(1),asinhPf:d(1),atanh:r(.5),atanhPf:y(.5),atan:a(.5),sin:s(-1e300),sinh:o(1),sinhPf:b(1),cos:u(10.000000000123),cosh:l(1),coshPf:_(1),tan:c(-1e300),tanh:f(1),tanhPf:E(1),exp:h(1),expm1:p(1),expm1Pf:w(1),log1p:m(10),log1pPf:x(10),powPI:v(-100)}}var a3="mmMwWLliI0fiflO&1",Fh={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function s3(){return o3(function(i,e){for(var t={},n={},r=0,a=Object.keys(Fh);r<a.length;r++){var s=a[r],o=Fh[s],u=o[0],l=u===void 0?{}:u,c=o[1],f=c===void 0?a3:c,h=i.createElement("span");h.textContent=f,h.style.whiteSpace="nowrap";for(var p=0,m=Object.keys(l);p<m.length;p++){var v=m[p],g=l[v];g!==void 0&&(h.style[v]=g)}t[s]=h,e.appendChild(i.createElement("br")),e.appendChild(h)}for(var d=0,y=Object.keys(Fh);d<y.length;d++){var s=y[d];n[s]=t[s].getBoundingClientRect().width}return n})}function o3(i,e){return e===void 0&&(e=4e3),Gy(function(t,n){var r=n.document,a=r.body,s=a.style;s.width="".concat(e,"px"),s.webkitTextSizeAdjust=s.textSizeAdjust="none",Wv()?a.style.zoom="".concat(1/n.devicePixelRatio):la()&&(a.style.zoom="reset");var o=r.createElement("div");return o.textContent=Py([],Array(e/20<<0)).map(function(){return"word"}).join(" "),a.appendChild(o),i(r,a)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}function u3(){return navigator.pdfViewerEnabled}function l3(){var i=new Float32Array(1),e=new Uint8Array(i.buffer);return i[0]=1/0,i[0]=i[0]-i[0],e[3]}function c3(){var i=window.ApplePaySession;if(typeof i?.canMakePayments!="function")return-1;try{return i.canMakePayments()?1:0}catch(e){return f3(e)}}function f3(i){if(i instanceof Error){if(i.name==="InvalidAccessError"){if(/\bfrom\b.*\binsecure\b/i.test(i.message))return-2;if(/\bdifferent\b.*\borigin\b.*top.level\b.*\bframe\b/i.test(i.message))return-3}if(i.name==="SecurityError"&&/\bthird.party iframes?.*\bnot.allowed\b/i.test(i.message))return-3}throw i}function h3(){var i,e=document.createElement("a"),t=(i=e.attribu
userAgent: `).concat(navigator.userAgent,`
timeBetweenLoadAndGet: `).concat(a-t,`
visitorId: `).concat(o.visitorId,`
components: `).concat(D3(s),"\n```")),[2,o]}})})}}}function F3(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{var i=new XMLHttpRequest;i.open("get","https://m1.openfpcdn.io/fingerprintjs/v".concat(Fy,"/npm-monitoring"),!0),i.send()}catch(e){console.error(e)}}function R3(i){var e;return i===void 0&&(i={}),$r(this,void 0,void 0,function(){var t,n,r;return Qr(this,function(a){switch(a.label){case 0:return(!((e=i.monitoring)!==null&&e!==void 0)||e)&&F3(),t=i.delayFallback,n=i.debug,[4,I3(t)];case 1:return a.sent(),r=E3({cache:{},debug:n}),[2,P3(r,n)]}})})}var L3=function(e){var t=null;if(typeof e=="string"&&e.length>0){if(t=document.querySelector(e),!t)return e.replace(/^#/,"")}else e instanceof HTMLCanvasElement&&(t=e);if(t)return t.id||(t.id=Math.random().toString(16).slice(2)),t.id},B3=function(e,t,n,r,a){return new Promise(function(s,o){try{Ve.createMxObject({canvasId:L3(e),isCPPMxCAD:!0,mapBox:n,callback:function(l){l.initRendererParam({webgl2:r!==!0}),l.setViewMovementMethod(t===void 0?!0:t),a&&a.callEvent("init_before_mxdraw",l),l.addEvent("initObject",function(){l.isWebgl2()?console.log("MxTip: use webgl2"):console.log("MxTip: use webgl1"),s(l)})}})}catch(u){o(u)}})},O3=function(e,t,n,r,a,s,o,u){var l=e.CreateMxDraw(t,n,r,a,s,o);return u?u.init(l):u=new vl(l),l.McObject=u,l.McObject};function Hv(){console.log(ne.App.getVersionString())}var nh=function(){var i=ut(me.mark(function e(t,n){var r,a,s,o,u,l,c,f,h,p,m,v,g,d,y,b,_,w,E,x,S,T,L,B,k,R,F,W,K,$,U,N;return me.wrap(function(D){for(;;)switch(D.prev=D.next){case 0:if(Mw.state.MxFun){D.next=3;break}return D.next=3,Iw();case 3:return r=t||{},a=r.openParameter,s=r.networkFonts,o=r.fontspath,u=r.locateFile,l=r.wasmBinary,c=r.canvas,f=r.onOpenFileComplete,h=r.fileUrl,p=r.onInit,m=r.middlePan,v=r.registdata,g=r.registfile,d=r.authorized_service,y=r.viewBackgroundColor,b=r.map,_=r.multipleSelect,w=r.enableUndo,E=r.enableIntelliSelect,x=r.browse,S=r.webgl1,D.next=6,Uv(function(){},u,l,o,s);case 6:return Ve.initMxCpp(ne),Tt.init(),Ve.setIniset({EnableIntelliSelect:E===void 0?!0:E,IntelliSelectType:1}),w!==void 0&&ne.App.IniSet({EnableUndo:w}),y&&ne.App.setDefaultViewBackgroundColor(y.red,y.green,y.blue),p&&p(),n&&n.callEvent("init"),D.next=15,B3(c,m,b,S,n);case 15:if(T=D.sent,_!==void 0&&T.setMultipleSelect(_),y&&T.setViewColor(y.red<<16|y.green<<8|y.blue),n&&n.callEvent("init_mxdraw",T),L=Ve.getMxFunTHREE(),B=new L.Vector2,T.getRenderer().getSize(B),k=O3(ne.App.getImp(),B.width,B.height,T.getCanvas().id,T.isWebgl2(),T.getId(),!!b,n),R=ne.App.getImp().getCodeVersion(),!(R!=1&&R!=2)){D.next=35;break}if(!(v&&v.length>0)){D.next=29;break}k.initRegist(v),D.next=35;break;case 29:return F=g,g&&g.length>0||(F="mxkey.json.frontpage.json"),D.next=33,qf(F);case 33:W=D.sent,W&&W.registdata?(k.initRegist(W.registdata),d?k.iniAuthorizedService(d):W.authorized_service&&W.authorized_service.length>0&&k.iniAuthorizedService(W.authorized_service)):console.log("MxTip:empty regist data");case 35:if(R!=3){D.next=48;break}if(K=localStorage.getItem("_mx_tmp_id_"),!(!K||K.length==0)){D.next=47;break}return $=window,$.__fpjs_d_m=!0,D.next=42,R3();case 42:return U=D.sent,D.next=45,U.get();case 45:K=D.sent.visitorId,localStorage.setItem("_mx_tmp_id_",K);case 47:ne.App.getImp().addFontsLoadOnInitialization(K,-121);case 48:return T.initMxCpp(k),T.addEvent("openFileComplete",function(){f&&f(k)}),k&&(x===!0||x===1?(k.setBrowse(!0),m===void 0&&(m=0)):x==2&&(m===void 0&&(m=0),Ve.setIniset({ForbiddenDynInput:!0,EnableCADEntityGripEdit:0})),m!==void 0&&k.mxdraw.setMouseMiddlePan(m),k.callEvent("init_mxcad",k)),h&&(N=0,a&&a&&(N=a),k.openWebFile(h,void 0,!0,a,N)),D.abrupt("return",k);case 53:case"end":return D.stop()}},e)}));return function(t,n){return i.apply(this,arguments)}}(),jv=function(i){return i[i.kByLayer=1]="kByLayer",i[i.kByBlock=2]="kByBlock",i[i.kByColor=3]="kByColor",i[i.kByACI=4]="kByACI",i[i.kByPen=5]="kByPen",i[i.kForeground=6]="kForeground",i[i.kLayerOff=7]="kLayerOff",i[i.kLayerFrozen=8]="kLayerFrozen",i[i.kNone=9]="kNone",i}(jv||{}),rh=function(i){return i[i.kByblock=0]="kByblock",i[i.k
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ci(i,e){return G3(i)||U3(i,e)||Xy(i,e)||V3()}function W3(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function vo(i,e,t){return W3()?vo=Reflect.construct.bind():vo=function(r,a,s){var o=[null];o.push.apply(o,a);var u=Function.bind.apply(r,o),l=new u;return s&&Mc(l,s.prototype),l},vo.apply(null,arguments)}function z3(i){if(Array.isArray(i))return xp(i)}function H3(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function j3(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xc(i){return z3(i)||H3(i)||Xy(i)||j3()}function c0(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=Y3(i))||e){t&&(i=t);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(l){throw l},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,s=!1,o;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return a=l.done,l},e:function(l){s=!0,o=l},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(s)throw o}}}}function Y3(i,e){if(i){if(typeof i=="string")return f0(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return f0(i,e)}}function f0(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}function h0(i,e){var t=i.endPoint.sub(i.startPoint).normalize(),n=new at(-t.y,t.x,0),r=n.mult(e),a=i.startPoint.clone().addvec(r),s=i.endPoint.clone().addvec(r),o=i.startPoint.clone().subvec(r),u=i.endPoint.clone().subvec(r),l=new pt(a,s),c=new pt(o,u);return[l,c]}function p0(i,e,t){var n=function(g){return[vo(Ln,xc(g.center.toVector3().toArray()).concat([Math.max(0,g.radius-e)])),vo(Ln,xc(g.center.toVector3().toArray()).concat([g.radius+e]))]};if(i instanceof st&&t){var r=Du(i,t,.1)||{},a=r.start,s=r.end,o=r.bulge;if(!a||!s)return[];if(!o||o===0){var u=new pt(a,s);return h0(u,e)}else{var l=M_(a,s,o),c=vo(Ln,xc(l.toVector3().toArray()).concat([l.distanceTo(a)]));return n(c)}}if(i instanceof pt){var f=h0(i,e),h=ci(f,2),p=h[0],m=h[1];return[p,m]}return i instanceof Ln||i instanceof $i?n(i):[]}function K3(i,e,t,n,r){var a=p0(i,t,n),s=p0(e,t,r),o=[],u=c0(a),l;try{for(u.s();!(l=u.n()).done;){var c=l.value,f=c0(s),h;try{var p=function(){var v=h.value,g=[],d=c instanceof Ln&&v instanceof Ln?yn.Intersect.kOnBothOperands:yn.Intersect.kExtendBoth,y=c.IntersectWith(v,d);y.forEach(function(b){g.push(b)}),o.push.apply(o,g)};for(f.s();!(h=f.n()).done;)p()}catch(m){f.e(m)}finally{f.f()}}}catch(m){u.e(m)}finally{u.f()}return o}var d0=function(e){var t=ci(e,3),n=t[0],r=t[1],a=t[2],s=n.x,o=n.y,u=n.z,l=r.x,c=r.y,f=r.z,h=a.x,p=a.y,m=a.z,v=o*f-c*u-o*m+p*u+c*m-p*f,g=-(s*f-l*u-s*m+h*u+l*m-h*f),d=s*c-l*o-s*p+h*o+l*p-h*c,y=-(s*c*m-s*p*f-l*o*m+l*p*u+h*o*f-h*c*u),b=2*(l-s),_=2*(c-o),w=2*(f-u),E=s*s+o*o+u*u-l*l-c*c-f*f,x=2*(h-s),S=2*(p-o),T=2*(m-u),L=s*s+o*o+u*u-h*h-p*p-m*m,B=-(g*w*L-g*T*E-_*d*L+_*T*y+S*d*E-S*w*y)/(v*_*T-v*S*w-b*g*T+b*S*d+x*g*w-x*_*d),k=(v*w*L-v*T*E-b*d*L+b*T*y+x*d*E-x*w*y)/(v*_*T-v*S*w-b*g*T+b*S*d+x*g*w-x*_*d),R=-(v*_*L-v*S*E-b*g*L+b*S*y+x*g*E-x*_*y)/(v*_*T-v*S*w-b*g*T+b*S*d+x*g*w-x*_*d);return new fe(B,k,R)};function Kv(){return Tp.apply(this,arguments)}function Tp(){return Tp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h,p,m,v;return me.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:e=new Yt,t=new Ln,n=ne.getCurrentMxCAD().getCurrentDatabaseDrawColor(),t.trueColor=new pr(n),p=new ln,p.AddMcDbEntityTypes("ARC,LINE,LWPOLYLINE,CIRCLE"),m=me.mark(function y(){var b,_,w,E,x,S,T,L,B,k,R,F,W,K,$,U,N,P,D,q,V,Q,Z,Y,ee,le;return me.wrap(function(j){for(;;)switch(j.prev=j.next){case 0:if(typeof r>"u"&&(e.setKeyWords("[三点(3P)/两点(2P)/切点、切点、半径(T)]"),r="default"),r!=="default"){j.next=47;break}if(s){j.next=19;break}return e.setMessage(`
指定圆的圆心`),j.next=6,e.go();case 6:if(b=j.sent,!e.isKeyWordPicked("3P")){j.next=10;break}return r="3P",j.abrupt("return",0);case 10:if(!e.isKeyWordPicked("2P")){j.next=13;break}return r="2P",j.abrupt("return",0);case 13:if(!e.isKeyWordPicked("T")){j.next=16;break}return r="T",j.abrupt("return",0);case 16:if(b){j.next=18;break}return j.abrupt("return",{v:void 0});case 18:s=b;case 19:if(o){j.next=44;break}return _=new tn,_.setBasePt(s),typeof a>"u"&&(_.setKeyWords("[直径(D)]"),a=!0),_.setMessage(Pt("McDbCircle_Radius","指定圆的"+(a?"半径":"直径"))),_.setUserDraw(function(ce,Ce){if(s){var Ae=new Ln(s.x,s.y,s.z,a?s.distanceTo(ce):s.distanceTo(ce)/2);Ce.drawMcDbEntity(Ae),Ce.drawLine(Ae.center.toVector3(),ce.toVector3())}}),j.next=27,_.go();case 27:if(w=j.sent,!_.isKeyWordPicked("D")){j.next=40;break}return a=!1,_.clearLastInputPoint(),_.setBasePt(s),_.setMessage(Pt("McDbCircle_Diameter","指定圆的直径")),_.setKeyWords(""),j.next=36,_.go();case 36:if(E=j.sent,E){j.next=39;break}return j.abrupt("return",{v:void 0});case 39:o=E/2;case 40:if(o){j.next=44;break}if(w){j.next=43;break}return j.abrupt("return",{v:void 0});case 43:o=w;case 44:return t.center=s,t.radius=o,j.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(t,!0)});case 47:if(r!=="3P"){j.next=77;break}if(u){j.next=56;break}return e.setMessage("指定圆上的第一个点"),e.setKeyWords(""),j.next=53,e.go();case 53:if(u=j.sent,u){j.next=56;break}return j.abrupt("return",{v:void 0});case 56:if(l){j.next=65;break}return e.setMessage("指定圆上的第二个点"),e.setKeyWords(""),e.setUserDraw(function(ce,Ce){u&&Ce.drawLine(u.toVector3(),ce.toVector3())}),j.next=62,e.go();case 62:if(l=j.sent,l){j.next=65;break}return j.abrupt("return",{v:void 0});case 65:if(c){j.next=74;break}return e.setMessage("指定圆上的第三个点"),e.setKeyWords(""),e.setUserDraw(function(ce,Ce){if(u&&l){var Ae=d0([u,l,ce]);if(Ae){var ke=new Ln(Ae.x,Ae.y,Ae.z,Ae.distanceTo(u));Ce.drawMcDbEntity(ke)}}}),j.next=71,e.go();case 71:if(c=j.sent,c){j.next=74;break}return j.abrupt("return",{v:void 0});case 74:return x=d0([u,l,c]),S=new Ln(x.x,x.y,x.z,x.distanceTo(u)),j.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(S,!0)});case 77:if(r!=="2P"){j.next=98;break}if(f){j.next=86;break}return e.setMessage("指定圆直径的第一个端点"),e.setKeyWords(""),j.next=83,e.go();case 83:if(f=j.sent,f){j.next=86;break}return j.abrupt("return",{v:void 0});case 86:if(h){j.next=95;break}return e.setMessage("指定圆直径的第二个端点"),e.setKeyWords(""),e.setUserDraw(function(ce,Ce){f&&(s=new fe((ce.x+f.x)/2,(ce.y+f.y)/2,(ce.z+f.z)/2),o=s.distanceTo(f),Ce.drawMcDbEntity(new Ln(s.x,s.y,s.z,o)))}),j.next=92,e.go();case 92:if(h=j.sent,h){j.next=95;break}return j.abrupt("return",{v:void 0});case 95:return s=new fe((h.x+f.x)/2,(h.y+f.y)/2,(h.z+f.z)/2),o=s.distanceTo(f),j.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(new Ln(s.x,s.y,s.z,o),!0)});case 98:if(r!=="T"){j.next=156;break}return e.setMessage("指定对象与圆的第一个切点"),e.setKeyWords(""),j.next=103,e.go();case 103:if(T=j.sent,T){j.next=106;break}return j.abrupt("return",{v:void 0});case 106:if(L=Tt.findEntAtPoint(T.x,T.y,T.z,-1,p),B=L.getMcDbCurve(),B){j.next=110;break}return j.abrupt("return",0);case 110:return e.setMessage("指定对象与圆的第二个切点"),e.clearLastInputPoint(),j.next=114,e.go();case 114:if(k=j.sent,k){j.next=117;break}return j.abrupt("return",{v:void 0});case 117:if(R=Tt.findEntAtPoint(k.x,k.y,k.z,-1,p),F=R.getMcDbCurve(),F){j.next=121;break}return j.abrupt("return",0);case 121:return W=new tn,W.setMessage("指定圆的半径"),j.next=125,W.go();case 125:if(K=j.sent,K){j.next=128;break}return j.abrupt("return",{v:void 0});case 128:if($=K3(B,F,K,T,k),!(!$||$.length===0)){j.next=131;break}return j.abrupt("return",{v:void 0});case 131:if($.length!==1){j.next=137;break}return U=ci($,1),N=U[0],P=new Ln(N.x,N.y,N.z,K),j.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(P)});case 137:return D=new Yt,D.clearLastInputPoint(),D.setMessage("请选择使用哪个圆心"),q=function(Ce){var
指定第一点:`),h.next=4,e.go();case 4:if(t=h.sent,n=t,t){h.next=8;break}return h.abrupt("return");case 8:e.setMessage(`
指定下一个点:`),r=0,a=[];case 11:return r>=2?e.setKeyWords("[退出(E)/闭合(C)/放弃(U)]"):r>0?e.setKeyWords("[退出(E)/放弃(U)]"):e.setKeyWords(""),e.setBasePt(t),h.next=16,e.go();case 16:if(s=h.sent,!e.isKeyWordPicked("C")){h.next=23;break}return o=new pt(n,t),ne.getCurrentMxCAD().drawEntity(o),h.abrupt("return");case 23:if(!e.isKeyWordPicked("E")){h.next=27;break}return h.abrupt("return");case 27:if(!e.isKeyWordPicked("U")){h.next=36;break}if(a.length!=0){h.next=30;break}return h.abrupt("continue",11);case 30:return u=a[a.length-1],a.pop(),r--,t=u.prvPoint,u.id.erase(),h.abrupt("continue",11);case 36:if(s){h.next=38;break}return h.abrupt("return");case 38:l=new pt(t,s),r++,c=ne.getCurrentMxCAD().drawEntity(l),a.push({id:c,prvPoint:t}),t=s,h.next=11;break;case 45:case"end":return h.stop()}},i)})),Dp.apply(this,arguments)}function X3(){return kp.apply(this,arguments)}function kp(){return kp=ut(me.mark(function i(){var e,t;return me.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e=new Yt,e.setMessage("指定点");case 2:return e.clearLastInputPoint(),r.next=6,e.go();case 6:if(t=r.sent,t!=null){r.next=9;break}return r.abrupt("break",12);case 9:ne.getCurrentMxCAD().drawEntity(new xu(t)),r.next=2;break;case 12:case"end":return r.stop()}},i)})),kp.apply(this,arguments)}function q3(){return Mp.apply(this,arguments)}function Mp(){return Mp=ut(me.mark(function i(){var e,t,n,r,a;return me.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return e=new Yt,e.setMessage(`
指定第一点:`),o.next=4,e.go();case 4:if(t=o.sent,t){o.next=7;break}return o.abrupt("return");case 7:e.setMessage(`
指定下一个点:`),n=new Pr,n.append(t);case 10:return e.setBasePt(t),n.length()==1?e.setUseBasePt(!0):(e.setUseBasePt(!1),e.setUserDraw(function(u,l){var c=new Pr;c.copy(n),c.append(u);var f=new wo;f.setFitPoints({degree:3,fitTolerance:1e-6,tangentsExist:!1,startTangent:at.kIdentity,endTangent:at.kIdentity,fitPoints:c}),l.drawMcDbEntity(f)})),o.next=15,e.go();case 15:if(r=o.sent,r){o.next=18;break}return o.abrupt("break",22);case 18:n.append(r),t=r,o.next=10;break;case 22:n.length()>2&&(a=new wo,a.setFitPoints({degree:3,fitTolerance:1e-6,tangentsExist:!1,startTangent:at.kIdentity,endTangent:at.kIdentity,fitPoints:n}),ne.getCurrentMxCAD().drawEntity(a));case 23:case"end":return o.stop()}},i)})),Mp.apply(this,arguments)}Ve.on("init",function(){Ve.addCommand("Mx_Line",Xv),Ve.addCommand("Mx_Point",X3),Ve.addCommand("Mx_About",Hv),Ve.addCommand("Mx_Spline",q3)});function qy(){return Ip.apply(this,arguments)}function Ip(){return Ip=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h,p,m,v,g;return me.wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return a=function(){var _=new Su;return _.textHeight=e||100,_.contents=t||"",_.location=n||new fe,_.trueColor=new pr(ne.getCurrentMxCAD().getCurrentDatabaseDrawColor()),_.rotation=r||0,_},s=new Qf,s.setMessage("输入文字内容"),y.next=5,s.go();case 5:if(o=y.sent,o){y.next=8;break}return y.abrupt("return");case 8:return t=o,u=new Yt,u.clearLastInputPoint(),u.setMessage("指定文字位置"),u.setUserDraw(function(b,_){n=b,_.drawMcDbEntity(a())}),y.next=15,u.go();case 15:if(l=y.sent,l){y.next=18;break}return y.abrupt("return");case 18:return n=l,c=new tn,c.setBasePt(n),c.setMessage(Pt("Mx_Text_Height","指定文字高度")),c.setUserDraw(function(b,_){n&&(e=b.distanceTo(n)),_.drawMcDbEntity(a())}),y.next=25,c.go();case 25:if(f=y.sent,f){y.next=28;break}return y.abrupt("return");case 28:return e=f,h=new Zi,h.setBasePt(n),h.clearLastInputPoint(),h.setMessage(Pt("Mx_MText_Angle","指定文字角度")),h.setUserDraw(function(b,_){n&&(r=Dn(b.x,b.y,n.x,n.y)),_.drawMcDbEntity(a())}),y.next=36,h.go();case 36:return p=y.sent,p!==null&&h.getDetailedResult()===8&&(r=p),m=a(),v=ne.getCurrentMxCAD(),g=v.drawEntity(m),v.updateDisplay(),y.abrupt("return",g);case 43:case"end":return y.stop()}},i)})),Ip.apply(this,arguments)}function ls(i,e,t){if(i.isEqualTo(e))return 0;var n=i.c().addvec(e.c().sub(i).mult(.5)),r=e.c().sub(i);r.rotateBy(Math.PI/2,at.kZAxis);var a=new pt(n,n.c().addvec(r)),s=t.c();s.rotateBy(Math.PI/2,at.kZAxis);var o=new pt(i,i.c().addvec(s)),u=a.IntersectWith(o,yn.Intersect.kExtendBoth);if(u.isEmpty())return 0;var l=u.at(0),c=l.distanceTo(i);r.normalize(),r.mult(c);var f=l.c().addvec(r),h=l.c().subvec(r),p=f.c().sub(i),m=h.c().sub(i),v=f;return p.angleTo1(t)>m.angleTo1(t)&&(v=h),Tt.calcBulge(i,v,e).val}function qv(){return Pp.apply(this,arguments)}function Pp(){return Pp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h,p,m,v,g,d,y,b,_;return me.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return e=new Yt,e.setMessage(`
指定起点:`),E.next=4,e.go();case 4:if(t=E.sent,t!==null){E.next=7;break}return E.abrupt("return");case 7:n=[],r=0,a={},a.dStartWidth=r,a.dEndWidth=r,a.pt=t,a.dBulge=0,n.push(a),s=!1,o=!0,u=!1,l=r,c=r,f=[],h=ne.getCurrentMxCAD(),Ve.acutPrintf(`
当前线宽为 {0}`,r+""),p=!1,m=function(S){S.key==="Control"&&(p=!0)},v=function(){return p=!1},window.addEventListener("keydown",m),window.addEventListener("keyup",v),g=me.mark(function x(){var S,T,L,B,k,R,F,W,K,$,U,N,P,D,q,V,Q,Z,Y,ee,le,Ee,j,ce,Ce,Ae,ke,Pe,Me,H,X,xe,_e,Le,Be,Se,We,re,Ge,M,C,A,G,I,te,ae,ve,we,Te,He,qe,ft,bt,lt,At,dt,en,et,Je,$e,dn,nn,Nt,Ut,Gn,Hn,sn,Un,Pn,Er,Rt,Gt,vr,Cr,O,z,se,be,Ie,tt,Ue,ot,ze,Ze,Mt,It,wt,je,it,on,Wt,jn,_t,ht,_n,Yn,Fn,mr,zt,Qn,Gr,Fi,za,pa,Ur,Ri,da,nu,Ds,Ha,xl,ks,Li,Sr,hi,Ar,va,ja,ma,Tl,Bi,Ya,Dl,Oi,kl,Ms,Ml,Is,Ps,Il,gh,Fs,Ka,Pl,Xa,Fl;return me.wrap(function(he){for(;;)switch(he.prev=he.next){case 0:if(!o){he.next=107;break}return S=Pt("ID_ARX_PL2","指定下一个点:"),T="[圆弧(A)/宽度(W)/长度(L)/半宽(H)]",n.length>=3?u?T="[回退(U)/圆弧(A)/宽度(W)/长度(L)/半宽(H)]":T="[回退(U)/圆弧(A)/宽度(W)/长度(L)/半宽(H)/闭合(C)]":n.length>=2&&(T="[回退(U)/圆弧(A)/宽度(W)/半宽(H)/长度(L)]"),L=new Yt,L.setMessage(S),L.setKeyWords(T),B=n[n.length-1],L.setUserDraw(function(xt,Ht){var Ct=new st;Ct.addVertexAt(B.pt,B.dBulge,B.dStartWidth,B.dEndWidth),Ct.addVertexAt(xt),Ht.drawMcDbEntity(Ct)}),he.next=11,L.go();case 11:if(k=he.sent,k===null){he.next=22;break}R={},R.dStartWidth=l,R.dEndWidth=c,R.pt=k,R.dBulge=0,n.push(R),n.length>=2&&(F=new st,F.addVertexAt(n[n.length-2].pt,0,n[n.length-2].dStartWidth,n[n.length-2].dEndWidth),F.addVertexAt(n[n.length-1].pt),f.push(h.drawEntity(F))),he.next=105;break;case 22:if(L.getStatus()!=Lt.kKeyWord){he.next=104;break}if(!L.isKeyWordPicked("A")){he.next=27;break}o=!1,he.next=102;break;case 27:if(!L.isKeyWordPicked("W")){he.next=49;break}return W=new tn,W.setMessage(Pt("ID_ARX_PLGETSTARTWIDTH","指定起点宽度")),he.next=32,W.go();case 32:if(K=he.sent,K!==null){he.next=35;break}return he.abrupt("return",0);case 35:return l=W.value(),W.setMessage(Pt("ID_ARX_PLGETVERITXWIDTH","指定端点宽度")),he.next=39,W.go();case 39:if(K=he.sent,K!==null){he.next=42;break}return he.abrupt("return",0);case 42:c=W.value(),r=c,n[n.length-1].dStartWidth=l,n[n.length-1].dEndWidth=c,l=c,he.next=102;break;case 49:if(!L.isKeyWordPicked("H")){he.next=71;break}return $=new tn,$.setMessage(Pt("ID_ARX_PLGETSTARTWIDTH","指定起点半宽")),he.next=54,$.go();case 54:if(U=he.sent,U!==null){he.next=57;break}return he.abrupt("return",0);case 57:return l=$.value()*2,$.setMessage(Pt("ID_ARX_PLGETVERITXWIDTH","指定端点半宽")),he.next=61,$.go();case 61:if(U=he.sent,U!==null){he.next=64;break}return he.abrupt("return",0);case 64:c=$.value()*2,r=c,n[n.length-1].dStartWidth=l,n[n.length-1].dEndWidth=c,l=c,he.next=102;break;case 71:if(!L.isKeyWordPicked("C")){he.next=76;break}return s=!0,he.abrupt("return",0);case 76:if(!L.isKeyWordPicked("U")){he.next=80;break}n.length>1&&(n.pop(),f[f.length-1].erase(),f.pop(),n.length>0&&L.setLastInputPoint(n[n.length-1].pt)),he.next=102;break;case 80:if(!L.isKeyWordPicked("L")){he.next=102;break}return P=at.kXAxis,L.setMessage("指定直线长度"),L.setKeyWords(""),he.next=86,L.go();case 86:if(q=he.sent,q){he.next=89;break}return he.abrupt("return",{v:void 0});case 89:V=n[n.length-1].pt,Q=q.distanceTo(V),Z=(N=n[n.length-2])===null||N===void 0?void 0:N.pt,Z&&(P=Z.sub(V)),D=V.clone().addvec(P.normalize().mult(-Q)),Y={},Y.dStartWidth=l,Y.dEndWidth=c,Y.pt=D,Y.dBulge=0,n.push(Y),L.setLastInputPoint(D),n.length>=2&&(ee=new st,ee.addVertexAt(n[n.length-2].pt,0,n[n.length-2].dStartWidth,n[n.length-2].dEndWidth),ee.addVertexAt(n[n.length-1].pt),f.push(h.drawEntity(ee)));case 102:he.next=105;break;case 104:return he.abrupt("return",0);case 105:he.next=495;break;case 107:return le=Pt("NO1_ID_ARX_PL5","指定圆弧的端点(按住 Ctrl 键以切换方向)"),Ee="[角度(A)/第二个点(S)/圆心(CE)/方向(D)/直线(L)/半径(R)/宽度(W)/半宽(H)]",n.length>=3?u?Ee="[角度(A)/第二个点(S)/圆心(CE)/方向(D)/回退(U)/直线(L)/半径(R)/宽度(W)/半宽(H)]":Ee="[角度(A)/第二个点(S)/圆心(CE)/方向(D)/回退(U)/直线(L)/半径(R)/宽度(W)/半宽(H)/闭合(C)]":n.length>=2&&(Ee="[角度(A)/第二个点(S)/圆
端点 *无效*`)),he.next=461;break;case 460:return he.abrupt("return",0);case 461:he.next=492;break;case 463:if(!j.isKeyWordPicked("W")){he.next=485;break}return Xa=new tn,Xa.setMessage(Pt("ID_ARX_PLGETSTARTWIDTH","指定起点宽度")),he.next=468,Xa.go();case 468:if(Fl=he.sent,Fl!==null){he.next=471;break}return he.abrupt("return",0);case 471:return l=Xa.value(),Xa.setMessage(Pt("ID_ARX_PLGETVERITXWIDTH","指定端点宽度")),he.next=475,Xa.go();case 475:if(Fl=he.sent,Fl!==null){he.next=478;break}return he.abrupt("return",0);case 478:c=Xa.value(),r=c,n[n.length-1].dStartWidth=l,n[n.length-1].dEndWidth=c,l=c,he.next=492;break;case 485:if(!j.isKeyWordPicked("C")){he.next=491;break}return n[n.length-1].dBulge=ls(X.pt,t,p?ce.clone().negate():ce),s=!0,he.abrupt("return",0);case 491:j.isKeyWordPicked("U")&&n.length>1&&(n.pop(),f[f.length-1].erase(),f.pop(),n.length>0&&j.setLastInputPoint(n[n.length-1].pt));case 492:he.next=495;break;case 494:return he.abrupt("return",0);case 495:case"end":return he.stop()}},x)});case 29:return E.delegateYield(g(),"t0",31);case 31:if(d=E.t0,d!==0){E.next=34;break}return E.abrupt("break",40);case 34:if(d!==1){E.next=36;break}return E.abrupt("continue",29);case 36:if(!d){E.next=38;break}return E.abrupt("return",d.v);case 38:E.next=29;break;case 40:for(u&&(s=!0),y=0;y<f.length;y++)f[y].erase();if(!(n.length>1)){E.next=47;break}for(b=new st,_=0;_<n.length;_++)b.addVertexAt(n[_].pt,n[_].dBulge,n[_].dStartWidth,n[_].dEndWidth);return b.isClosed=s,E.abrupt("return",h.drawEntity(b));case 47:window.removeEventListener("keydown",m),window.removeEventListener("keyup",v);case 49:case"end":return E.stop()}},i)})),Pp.apply(this,arguments)}Ve.on("init",function(){Ve.addCommand("Mx_Pline",qv)});function Z3(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new fe,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new fe,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:3,n=[];t=Math.max(3,t),n.push(e);for(var r=Math.PI*2/t,a=1;a<t;a++){var s=Math.cos(r*a),o=Math.sin(r*a),u=i.clone(),l=e.clone(),c=l.x-u.x,f=l.y-u.y,h=c*s-f*o+u.x,p=c*o+f*s+u.y,m=new fe(h,p);n.push(m)}return n}function J3(){for(var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:new fe,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:new fe,t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:3,n=e.x,r=e.y,a=i.x,s=i.y,o=Math.max(3,t),u=Math.sqrt(Math.pow(n-a,2)+Math.pow(r-s,2)),l=u/Math.cos(Math.PI/o),c=Math.atan2(r-s,n-a)-Math.PI/o,f=[],h=0;h<o;h++){var p=c+h*2*Math.PI/o,m=a+l*Math.cos(p),v=s+l*Math.sin(p);f.push(new fe(m,v))}return f}function $3(i,e,t){for(var n=e.x-i.x,r=e.y-i.y,a=Math.sqrt(n*n+r*r),s=Math.atan2(r,n),o=2*Math.PI/Math.max(3,t),u=[i,e],l=0;l<t;l++){var c=i.x+a*Math.cos(s+l*o),f=i.y+a*Math.sin(s+l*o);i=new fe(c,f),u.push(i)}return u}function Zv(){return Fp.apply(this,arguments)}function Fp(){return Fp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h,p,m;return me.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:if(o=new Yt,e){g.next=11;break}return u=new $f,u.setMessage(`
输入侧面数 <5>`),g.next=6,u.go();case 6:if(e=g.sent,u.getStatus()!==Lt.kCancel){g.next=9;break}return g.abrupt("return");case 9:u.getStatus()===Lt.kNone&&(e=5),u.clearLastInputPoint();case 11:l=function(){var d=ut(me.mark(function y(){var b;return me.wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(b=function(x){var S=new st,T=$3(r,x,e||5);return T.forEach(function(L){S.addVertexAt(L)}),S.isClosed=!0,S},r){w.next=10;break}return o.setMessage(`
指定边的第一个端点`),o.setKeyWords(""),w.next=6,o.go();case 6:if(r=w.sent,r){w.next=9;break}return w.abrupt("return");case 9:o.setUserDraw(function(E,x){x.drawMcDbEntity(b(E))});case 10:if(a){w.next=15;break}return o.setMessage(`
指定边的第二个端点`),w.next=14,o.go();case 14:a=w.sent;case 15:if(a){w.next=17;break}return w.abrupt("return");case 17:ne.getCurrentMxCAD().drawEntity(b(a));case 18:case"end":return w.stop()}},y)}));return function(){return d.apply(this,arguments)}}();{g.next=16;break}case 15:return g.abrupt("return",g.sent);case 16:if(o.setMessage(`
指定正多变形的中心点`),o.setKeyWords("[边(E)]"),o.setCursorType(Kf.kCross),t){g.next=23;break}return g.next=22,o.go();case 22:t=g.sent;case 23:if(t){g.next=28;break}if(!o.isKeyWordPicked("e")){g.next=27;break}return g.next=27,l();case 27:return g.abrupt("return");case 28:if(typeof n=="boolean"){g.next=38;break}return o.setMessage(`
输入选项`),o.setKeyWords("[内接于圆(I)/外切于圆(C)]"),o.clearLastInputPoint(),g.next=34,o.go();case 34:if(o.getStatus()!==Lt.kCancel){g.next=36;break}return g.abrupt("return");case 36:o.isKeyWordPicked("i")&&(n=!1),o.isKeyWordPicked("c")&&(n=!0);case 38:if(c=function(y){var b=ne.getCurrentMxCAD().getCurrentDatabaseDrawColor(),_=new st;_.trueColor=new pr(b);var w=n?J3(t,y,e):Z3(t,y,e);return w.forEach(function(E){_.addVertexAt(E)}),_.isClosed=!0,_},h=new at,s){g.next=52;break}return p=new tn,p.setBasePt(t),p.setUserDraw(function(d,y){y.drawMcDbEntity(c(d)),t&&(h=d.sub(t))}),p.setMessage(Pt("McDbPolyline_Radius",`
指定圆的半径`)),p.setKeyWords(""),g.next=48,p.go();case 48:if(m=g.sent,m){g.next=51;break}return g.abrupt("return");case 51:s=m;case 52:h=h.normalize().mult(s),f=t.clone().addvec(h),ne.getCurrentMxCAD().drawEntity(c(f),!0);case 55:case"end":return g.stop()}},i)})),Fp.apply(this,arguments)}Ve.addCommand("Mx_Polygon",Zv);function Q3(i,e,t,n,r,a){var s=t-i,o=n-e,u=r/a,l=s*Math.cos(u)-o*Math.sin(u),c=s*Math.sin(u)+o*Math.cos(u);return l+=i,c+=e,new fe(l,c)}function eC(i,e,t){var n=Math.sqrt(Math.pow(t,2)-(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2))/4),r={x:(i.x+e.x)/2,y:(i.y+e.y)/2};return new fe(r.x-n*(e.y-i.y)/Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2)),r.y-n*(i.x-e.x)/Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2)))}function tC(i,e,t,n){var r={x:e.x-i.x,y:e.y-i.y},a={x:t.x-i.x,y:t.y-i.y},s=Math.atan2(r.y,r.x),o=Math.atan2(a.y,a.x),u=o-s;u<0&&(u+=2*Math.PI);var l=n+u;return l}function nC(i,e,t,n){var r=e+t;return new fe(i.x+n*Math.cos(r),i.y+n*Math.sin(r))}function v0(i,e,t){var n=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),r={x:e.x-i.x,y:e.y-i.y},a={x:t.x-i.x,y:t.y-i.y},s=r.x*a.x+r.y*a.y,o=r.x*a.y-r.y*a.x,u=Math.atan2(o,s),l=2*n*Math.sin(u/2);return l}function Jv(){return Rp.apply(this,arguments)}function Rp(){return Rp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h,p,m,v,g,d,y,b,_,w,E,x,S,T;return me.wrap(function(B){for(;;)switch(B.prev=B.next){case 0:e=ne.getCurrentMxCAD(),t=new Yt,n=new $i,f=function(){},h=`
指定圆弧的起点:`,p="[圆心(C)]",m=!1,v=function(R){R.ctrlKey&&(m=!0)},g=function(){m=!1},d=function(){window.removeEventListener("keydown",v),window.removeEventListener("keyup",g),window.addEventListener("keydown",v),window.addEventListener("keyup",g)},y=new pt,b=new pr,b.setRGB(255,211,13),y.trueColor=b,y.linetype="ACAD_ISO02W100",_=!1,E=function(R,F){m?(n.startAngle=l,n.endAngle=u):(n.startAngle=u,n.endAngle=l),n.radius=c,n.center=o,y.endPoint=R,F.drawMcDbEntity(n),F.drawMcDbEntity(y)},x=function(R){n.computeArc(r.x,r.y,a.x,a.y,s.x,s.y),R.drawMcDbEntity(n)},S=me.mark(function k(){var R,F,W,K,$,U,N,P,D;return me.wrap(function(V){for(;;)switch(V.prev=V.next){case 0:return t.setUserDraw(f),t.setMessage(h),t.setKeyWords(p),V.next=5,t.go();case 5:if(R=V.sent,!t.isKeyWordPicked("C")){V.next=30;break}if(w="C",_=!0,!r){V.next=27;break}return t.setMessage(`
指定圆弧的圆心`),t.setKeyWords(""),V.next=14,t.go();case 14:if(F=V.sent,F){V.next=17;break}return V.abrupt("return",{v:void 0});case 17:o=F,h=`
指定圆弧的端点(按住 ctrl 键取相反方向)`,p="[角度(A)/弦长(L)/修改半径(R)]",t.setLastInputPoint(o),y.startPoint=o,c=o.distanceTo(r),f=function(Z,Y){u=Dn(o.x,o.y,r.x,r.y)-Math.PI,l=Dn(o.x,o.y,Z.x,Z.y)-Math.PI,y.endPoint=Z,E(Z,Y)},d(),V.next=29;break;case 27:h=`
指定圆弧的圆心`,p="";case 29:return V.abrupt("return",0);case 30:if(!_){V.next=124;break}if(!t.isKeyWordPicked("R")){V.next=55;break}if(w!=="E"){V.next=41;break}return W=0,K=function(){var Q=ut(me.mark(function Z(){var Y;return me.wrap(function(le){for(;;)switch(le.prev=le.next){case 0:return t.setLastInputPoint(r),t.setMessage(`
指定圆弧的半径(按住 ctrl 键取相反方向)`),t.setKeyWords(""),t.setLastInputPoint(r),y.startPoint=r,d(),f=function(j,ce){W<0?(y.endPoint=j,ce.drawMcDbEntity(y),W=0):(c=j.distanceTo(r),o=eC(r,s,c),u=Dn(o.x,o.y,r.x,r.y)-Math.PI,l=Dn(o.x,o.y,s.x,s.y)-Math.PI,E(j,ce),W=v0(o,r,s))},t.setUserDraw(f),le.next=10,t.go();case 10:if(Y=le.sent,Y){le.next=13;break}return le.abrupt("return",!0);case 13:if(W=v0(o,r,s),!(W<0)){le.next=20;break}return Ve.acutPrintf(`
半径不能小于弦长的一半弦长为`+W),W=0,le.next=19,K();case 19:return le.abrupt("return",le.sent);case 20:e.drawEntity(n);case 21:case"end":return le.stop()}},Z)}));return function(){return Q.apply(this,arguments)}}(),V.next=37,K();case 37:return V.t0=V.sent,V.abrupt("return",{v:V.t0});case 41:return t.setLastInputPoint(o),t.setMessage(Pt("draw_arc_id","指定圆弧的半径<"+n.radius+">")),t.setKeyWords(""),t.setUserDraw(function(Q,Z){y.startPoint=o,y.endPoint=Q,Z.drawMcDbEntity(y)}),V.next=47,t.go();case 47:if($=V.sent,$){V.next=50;break}return V.abrupt("return",{v:void 0});case 50:c=$.distanceTo(o),h=`
指定圆弧的端点(按住 ctrl 键取相反方向)`,p="[角度(A)/弦长(L)/修改半径(R)]",d();case 54:return V.abrupt("return",0);case 55:if(!t.isKeyWordPicked("A")){V.next=74;break}if(!(w==="C"||w==="L")){V.next=66;break}return h="指定圆弧夹角(按住 ctrl 键取相反方向)",p="[修改半径(R)]",u=Math.PI+Dn(o.x,o.y,r.x,r.y),t.setLastInputPoint(o),y.startPoint=o,c||(c=o.distanceTo(r)),f=function(Z,Y){var ee=Dn(o.x,o.y,Z.x,Z.y)-Math.PI;s=nC(o,u,ee,c),l=tC(o,r,s,u),E(Z,Y)},d(),V.abrupt("return",0);case 66:if(w!=="E"){V.next=74;break}return h="指定圆弧夹角(按住 ctrl 键取相反方向)",p="",t.setLastInputPoint(r),y.startPoint=r,f=function(Z,Y){var ee=Dn(r.x,r.y,Z.x,Z.y)-Math.PI;o=k_(r,s,ee),c=o.distanceTo(r),u=Dn(o.x,o.y,r.x,r.y)-Math.PI,l=Dn(o.x,o.y,s.x,s.y)-Math.PI,E(Z,Y)},d(),V.abrupt("return",0);case 74:if(!t.isKeyWordPicked("L")){V.next=83;break}return w="L",h=`
指定弦长(按住 ctrl 键取相反方向)`,p="[修改半径(R)]",t.setLastInputPoint(r),y.startPoint=r,f=function(Z,Y){var ee=Z.distanceTo(r);if(ee>c*2){y.endPoint=Z,Y.drawMcDbEntity(y);return}s=Q3(o.x,o.y,r.x,r.y,ee,n.radius),l=Dn(o.x,o.y,s.x,s.y)-Math.PI,E(Z,Y)},d(),V.abrupt("return",0);case 83:if(!t.isKeyWordPicked("D")){V.next=98;break}return t.setMessage(`
指定圆弧起点的切向(按住 ctrl 键取相反方向`),t.setKeyWords(""),t.setLastInputPoint(r),y.startPoint=r,U=new st,d(),t.setUserDraw(function(Q,Z){r=r,s=s;var Y=Q.sub(r),ee=ls(m?r:s,m?s:r,Y);U=new st,U.addVertexAt(r,ee),U.addVertexAt(s),y.endPoint=Q,Z.drawMcDbEntity(U),Z.drawMcDbEntity(y)}),V.next=93,t.go();case 93:if(N=V.sent,N){V.next=96;break}return V.abrupt("return",{v:void 0});case 96:return e.drawEntity(U),V.abrupt("return",{v:void 0});case 98:if(R){V.next=100;break}return V.abrupt("return",{v:void 0});case 100:if(w!=="L"){V.next=106;break}if(P=R.distanceTo(r),!(P>c*2)){V.next=106;break}return t.clearLastInputPoint(),Ve.acutPrintf(`
弦长不能超出半径的两倍半径为`+c),V.abrupt("return",0);case 106:if(o){V.next=111;break}return o=R,h=`
指定圆弧的起点`,f=function(Z,Y){Y.drawLine(Z.toVector3(),o.toVector3())},V.abrupt("return",0);case 111:if(r){V.next=122;break}return r=R,u=Dn(o.x,o.y,r.x,r.y)-Math.PI,c=r.distanceTo(o),h=`
指定圆弧的端点(按住 ctrl 键取相反方向)`,p="[角度(A)/弦长(L)/修改半径(R)]",t.setLastInputPoint(o),y.startPoint=o,f=function(Z,Y){l=Dn(o.x,o.y,Z.x,Z.y)-Math.PI,E(Z,Y)},d(),V.abrupt("return",0);case 122:return e.drawEntity(n),V.abrupt("return",{v:void 0});case 124:if(!t.isKeyWordPicked("E")){V.next=146;break}return w="E",t.clearLastInputPoint(),t.setMessage(`
指定圆弧的端点`),t.setKeyWords(""),y.startPoint=r,r=r,t.setUserDraw(function(Q,Z){y.endPoint=Q,Z.drawMcDbEntity(y)}),V.next=134,t.go();case 134:if(D=V.sent,D){V.next=137;break}return V.abrupt("return",{v:void 0});case 137:return s=D,_=!0,h=`
指定圆弧的圆心(按住 ctrl 键取相反方向)`,p="[角度(A)/方向(D)/半径(R)]",t.setLastInputPoint(s),y.startPoint=s,f=function(Z,Y){o=Z,c=o.distanceTo(r),u=Dn(o.x,o.y,r.x,r.y)-Math.PI,l=Dn(o.x,o.y,s.x,s.y)-Math.PI,E(Z,Y)},d(),V.abrupt("return",0);case 146:if(R){V.next=148;break}return V.abrupt("return",{v:void 0});case 148:if(r){V.next=155;break}return r=R,h=`
指定圆弧第二个点`,p="[圆心(C)/端点(E)]",f=function(Z,Y){Y.drawLine(r.toVector3(),Z.toVector3())},t.clearLastInputPoint(),V.abrupt("return",0);case 155:if(a){V.next=161;break}return a=R,h=`
指定圆弧的端点`,p="",f=function(Z,Y){s=Z,x(Y)},V.abrupt("return",0);case 161:return f(a,{drawMcDbEntity:function(Z){ne.getCurrentMxCAD().drawEntity(Z,!0)}}),V.abrupt("return",{v:void 0});case 163:case"end":return V.stop()}},k)});case 19:return B.delegateYield(S(),"t0",21);case 21:if(T=B.t0,T!==0){B.next=24;break}return B.abrupt("continue",19);case 24:if(!T){B.next=26;break}return B.abrupt("return",T.v);case 26:B.next=19;break;case 28:case"end":return B.stop()}},i)})),Rp.apply(this,arguments)}Ve.on("init",function(){Ve.addCommand("Mx_Arc",Jv)});function $v(){return Lp.apply(this,arguments)}function Lp(){return Lp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c;return me.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:r=1,a=0,s=Math.PI*2,o=0,u=function(){var m=new bo;return m.center=e,m.majorAxis=t,m.minorAxis=n,m.radiusRatio=r,m.startAngle=a,m.endAngle=s,m.rotate(e,o),m},l=me.mark(function p(){var m,v,g,d,y,b,_,w,E,x,S,T,L;return me.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return m=new Yt,m.setMessage("指定椭圆弧的轴端点"),m.setKeyWords("[中心点(C)]"),k.next=5,m.go();case 5:if(v=k.sent,g=0,d=null,!m.isKeyWordPicked("C")){k.next=29;break}return m.setMessage("指定椭圆弧的中心点"),m.setKeyWords(""),m.clearLastInputPoint(),k.next=14,m.go();case 14:if(y=k.sent,y){k.next=17;break}return k.abrupt("return",{v:void 0});case 17:return e=y,m.setMessage("指定椭圆弧轴的端点"),m.setBasePt(e),k.next=22,m.go();case 22:if(d=k.sent,d){k.next=25;break}return k.abrupt("return",{v:void 0});case 25:t=n=e.sub(d),g=e.distanceTo(d),k.next=42;break;case 29:if(v){k.next=31;break}return k.abrupt("return",{v:void 0});case 31:return m.setBasePt(v),m.setMessage("指定椭圆弧轴的另一个端点"),m.setKeyWords(""),k.next=36,m.go();case 36:if(d=k.sent,d){k.next=39;break}return k.abrupt("return",{v:void 0});case 39:e=new fe((v.x+d.x)/2,(v.y+d.y)/2),t=n=v.sub(d),g=v.distanceTo(d)/2;case 42:return b=new tn,b.setMessage(Pt("McDbEllipse_lengh","指定另一条半轴长度")),b.setKeyWords("[旋转(R)]"),b.setBasePt(e),b.setUserDraw(function(R,F){var W=e.distanceTo(R)/2;r=W/g;var K=u();F.drawMcDbEntity(K)}),k.next=49,b.go();case 49:if(_=k.sent,!b.isKeyWordPicked("R")){k.next=63;break}return b.setMessage(Pt("McDbEllipse_Rotation","指定绕主轴旋转的角度")),b.setKeyWords(""),b.setBasePt(e),b.setUserDraw(function(R,F){var W=Math.abs(R.x-e.x),K=Math.abs(R.y-e.y),$=W/(W+K);r=$;var U=u();F.drawMcDbEntity(U)}),k.next=57,b.go();case 57:if(w=k.sent,w){k.next=60;break}return k.abrupt("return",{v:void 0});case 60:b.getDetailedResult()===8&&(r=w),k.next=67;break;case 63:if(_){k.next=65;break}return k.abrupt("return",{v:void 0});case 65:E=_/2,r=E/g;case 67:if(d){k.next=69;break}return k.abrupt("return",{v:void 0});case 69:return x=Math.atan2(t.y,t.x)-Math.PI/2,b.setMessage(Pt("McDbEllipse_startAngle","指定起点角度")),b.setKeyWords(""),b.setBasePt(e),b.setUserDraw(function(R,F){var W=Math.atan2(R.y-e.y,R.x-e.x);a=(W-x+Math.PI*2)%(Math.PI*2);var K=u();F.drawMcDbEntity(K)}),k.next=76,b.go();case 76:if(S=k.sent,S){k.next=79;break}return k.abrupt("return",{v:void 0});case 79:return b.getDetailedResult()===8&&(a=S),b.clearLastInputPoint(),b.setBasePt(e),b.setMessage(Pt("McDbEllipse_endAngle","指定端点角度")),b.setKeyWords("[夹角(I)]"),b.setUserDraw(function(R,F){var W=Math.atan2(R.y-e.y,R.x-e.x);s=(W-x+Math.PI*2)%(Math.PI*2),s<a&&(s+=Math.PI*2);var K=u();F.drawMcDbEntity(K)}),k.next=87,b.go();case 87:if(T=k.sent,!b.isKeyWordPicked("I")){k.next=99;break}return b.setMessage(Pt("McDbEllipse_IncludedAngle","指定椭圆弧的夹角")),b.setKeyWords(""),b.setUserDraw(function(R,F){s=Dn(e.x,e.y,R.x,R.y);var W=u();F.drawMcDbEntity(W)}),k.next=94,b.go();case 94:if(L=k.sent,L){k.next=97;break}return k.abrupt("return",{v:void 0});case 97:return b.getDetailedResult()===8&&(s=L),k.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(u())});case 99:if(T){k.next=101;break}return k.abrupt("return",{v:void 0});case 101:return b.getDetailedResult()===8&&(s=T),k.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(u())}
指定椭圆的轴端点`),e.setKeyWords("[圆弧(A)/中心点(C)]"),u=function(){var m=new bo;return m.center=t,m.majorAxis=n,m.minorAxis=r,m.radiusRatio=a,m.startAngle=s,m.endAngle=o,m},l=me.mark(function p(){var m,v,g,d,y,b,_,w,E,x,S,T,L,B,k,R,F,W;return me.wrap(function($){for(;;)switch($.prev=$.next){case 0:return m=!1,v=!1,g=!1,$.next=5,e.go();case 5:if(d=$.sent,!e.isKeyWordPicked("A")){$.next=17;break}return e.setMessage(`
指定椭圆弧的轴端点`),e.setKeyWords("[中心点(C)]"),$.next=11,e.go();case 11:if(y=$.sent,e.isKeyWordPicked("C")&&(g=!0),!(!y&&!g)){$.next=15;break}return $.abrupt("return",{v:void 0});case 15:y&&(d=y),m=!0;case 17:if(!(e.isKeyWordPicked("C")||g)){$.next=27;break}return e.setMessage(`
指定椭圆中心`),e.setKeyWords(""),$.next=22,e.go();case 22:if(b=$.sent,b){$.next=25;break}return $.abrupt("return",{v:void 0});case 25:t=d=b,v=!0;case 27:if(!(!d&&!m&&!v)){$.next=29;break}return $.abrupt("return",{v:void 0});case 29:return e.setUserDraw(function(U,N){N.drawMcDbLine(d.x,d.y,d.z,U.x,U.y,U.z)}),e.setMessage(v?`
指定椭圆轴的端点`:`
指定椭圆轴的另一个端点`),e.setKeyWords(""),$.next=34,e.go();case 34:if(_=$.sent,_){$.next=37;break}return $.abrupt("return",{v:void 0});case 37:return t=v?d:new fe((d.x+_.x)/2,(d.y+_.y)/2),w=new tn,w.setBasePt(t),E=d.distanceTo(_)/2,r=n=d.sub(_),x=function(N,P){var D=u(),q=new pt(t,N);q.trueColor=new pr,q.trueColor.setRGB(255,255,0),P.drawMcDbEntity(q),P.drawMcDbEntity(D)},w.setUserDraw(function(U,N){var P=t.distanceTo(U)/2;a=P/E,x(U,N)}),w.setMessage(Pt("EllipticalArc_length","指定另一条半轴长度")),w.setKeyWords(""),$.next=48,w.go();case 48:if(S=$.sent,S){$.next=51;break}return $.abrupt("return",{v:void 0});case 51:if(w.getDetailedResult()===yr.kCoordIn&&(T=S/2,a=T/E),w.setLastInputPoint(t),!m){$.next=86;break}return w.setMessage(Pt("EllipticalArc_startAngle","指定起点角度")),w.setKeyWords(""),L=Math.atan2(n.y,n.x)-Math.PI/2,w.setUserDraw(function(U,N){var P=Math.atan2(U.y-t.y,U.x-t.x);s=(P-L+Math.PI*2)%(Math.PI*2),x(U,N)}),$.next=60,w.go();case 60:if(B=$.sent,B){$.next=63;break}return $.abrupt("return",{v:void 0});case 63:return w.getDetailedResult()==yr.kCoordIn&&(s=B),w.setLastInputPoint(t),w.setMessage(Pt("EllipticalArc_endAngle","指定端点角度")),w.setKeyWords("[夹角(I)]"),w.setUserDraw(function(U,N){var P=Math.atan2(U.y-t.y,U.x-t.x);o=(P-L+Math.PI*2)%(Math.PI*2),o<s&&(o+=Math.PI*2),x(U,N)}),$.next=70,w.go();case 70:if(k=$.sent,!w.isKeyWordPicked("I")){$.next=83;break}return w.setMessage(`
指定椭圆弧的夹角`),w.setKeyWords(""),w.setUserDraw(function(U,N){o=Dn(t.x,t.y,U.x,U.y)-Math.PI,x(U,N)}),$.next=77,w.go();case 77:if(R=$.sent,R){$.next=80;break}return $.abrupt("return",{v:void 0});case 80:return w.getDetailedResult()===yr.kCoordIn&&(o=R),F=u(),$.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(F)});case 83:if(k){$.next=85;break}return $.abrupt("return",{v:void 0});case 85:w.getDetailedResult()===yr.kCoordIn&&(o=k);case 86:return W=u(),$.abrupt("return",{v:ne.getCurrentMxCAD().drawEntity(W)});case 88:case"end":return $.stop()}},p)});case 8:return h.delegateYield(l(),"t0",10);case 10:if(c=h.t0,!c){h.next=13;break}return h.abrupt("return",c.v);case 13:h.next=8;break;case 15:case"end":return h.stop()}},i)})),Bp.apply(this,arguments)}Ve.on("init",function(){Ve.addCommand("Mx_EllipseArc",$v),Ve.addCommand("Mx_Ellipse",rC)});function Qv(){return Op.apply(this,arguments)}function Op(){return Op=ut(me.mark(function i(){var e,t;return me.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(e=Tt.getCurrentSelect(),!(e.length>0)){r.next=4;break}return e.forEach(function(a){a.erase()}),r.abrupt("return");case 4:return t=new wr,r.next=7,t.userSelect(`
选择删除对象`);case 7:if(r.sent){r.next=9;break}return r.abrupt("return");case 9:t.forEach(function(a){a.erase()});case 10:case"end":return r.stop()}},i)})),Op.apply(this,arguments)}function yl(i){var e=void 0,t=void 0;if(i.forEach(function(n){var r=n.getMcDbEntity();if(r!=null){var a=r.getBoundingBox();a.ret&&(!e||!t?(e=new THREE.Vector3(a.minPt.x,a.minPt.y,0),t=new THREE.Vector3(a.maxPt.x,a.maxPt.y,0)):(e.x>a.minPt.x&&(e.x=a.minPt.x),e.y>a.minPt.y&&(e.y=a.minPt.y),t.x<a.maxPt.x&&(t.x=a.maxPt.x),t.y<a.maxPt.y&&(t.y=a.maxPt.y)))}}),e&&t)return{minPt:e,maxPt:t}}function iC(){return Np.apply(this,arguments)}function Np(){return Np=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f;return me.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(e=Tt.getCurrentSelect(),!(e.length>0)){p.next=4;break}return p.abrupt("break",15);case 4:return t=new wr,p.next=7,t.userSelect(`
选择复制对象`);case 7:if(p.sent){p.next=9;break}return p.abrupt("return");case 9:if(e=t.getIds(),e.length!=0){p.next=12;break}return p.abrupt("return");case 12:return p.abrupt("break",15);case 15:return e.length>=10&&(a=yl(e),a&&(n=a.minPt,r=a.maxPt)),s=new Yt,s.setMessage(`
指定基点`),p.next=20,s.go();case 20:if(o=p.sent,o){p.next=23;break}return p.abrupt("return");case 23:s.setMessage("指定移动到点"),s.setBasePt(o),s.setUseBasePt(!0),s.setUserDraw(function(m,v){if(n&&r){var g=m.x-o.x,d=m.y-o.y,y=new THREE.Vector3(n.x+g,r.y+d,0),b=new THREE.Vector3(r.x+g,n.y+d,0),_=new THREE.Vector3(y.x,b.y,0),w=new THREE.Vector3(b.x,y.y,0);y=Vt.cad2doc2(y.x,y.y,y.z),b=Vt.cad2doc2(b.x,b.y,b.z),_=Vt.cad2doc2(_.x,_.y,_.z),w=Vt.cad2doc2(w.x,w.y,w.z),v.drawLine(w,y),v.drawLine(y,_),v.drawLine(_,b),v.drawLine(b,w)}for(var E=0;E<e.length&&E<10;E++){var x=e[E].clone();x&&(x.move(o,m),v.drawMcDbEntity(x))}});case 27:return p.next=30,s.go();case 30:if(u=p.sent,u){p.next=33;break}return p.abrupt("return");case 33:l=0;case 34:if(!(l<e.length)){p.next=44;break}if(c=e[l].clone(),c){p.next=38;break}return p.abrupt("continue",41);case 38:c.move(o,u),f=ne.getCurrentMxCAD().drawEntity(c).getMcDbDimension(),f&&f.needToUpdateDimBlock(!1);case 41:l++,p.next=34;break;case 44:p.next=27;break;case 46:case"end":return p.stop()}},i)})),Np.apply(this,arguments)}function aC(){return Gp.apply(this,arguments)}function Gp(){return Gp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f;return me.wrap(function(p){for(;;)switch(p.prev=p.next){case 0:if(e=Tt.getCurrentSelect(),!(e.length>0)){p.next=4;break}return p.abrupt("break",15);case 4:return t=new wr,p.next=7,t.userSelect(`
选择移动对象`);case 7:if(p.sent){p.next=9;break}return p.abrupt("return");case 9:if(e=t.getIds(),e.length!=0){p.next=12;break}return p.abrupt("return");case 12:return p.abrupt("break",15);case 15:return e.length>=10&&(a=yl(e),a&&(n=a.minPt,r=a.maxPt)),s=new Yt,s.setMessage("指定基点"),s.clearLastInputPoint(),p.next=21,s.go();case 21:if(o=p.sent,o){p.next=24;break}return p.abrupt("return");case 24:return s.setMessage("指定移动到点"),s.setBasePt(o),s.setUseBasePt(!0),u=function(v){for(var g=0;g<e.length;g++){var d=e[g].getMcDbEntity();d&&d.highlight(v)}},u(!0),s.setUserDraw(function(m,v){if(n&&r){var g=m.x-o.x,d=m.y-o.y,y=new THREE.Vector3(n.x+g,r.y+d,0),b=new THREE.Vector3(r.x+g,n.y+d,0),_=new THREE.Vector3(y.x,b.y,0),w=new THREE.Vector3(b.x,y.y,0);y=Vt.cad2doc2(y.x,y.y,y.z),b=Vt.cad2doc2(b.x,b.y,b.z),_=Vt.cad2doc2(_.x,_.y,_.z),w=Vt.cad2doc2(w.x,w.y,w.z),v.drawLine(w,y),v.drawLine(y,_),v.drawLine(_,b),v.drawLine(b,w)}for(var E=0;E<e.length&&E<10;E++){var x=e[E].clone();x&&(o&&x.move(o,m),v.drawMcDbEntity(x))}}),p.next=32,s.go();case 32:if(l=p.sent,l){p.next=35;break}return p.abrupt("return",u(!1));case 35:u(!1),c=0;case 37:if(!(c<e.length)){p.next=46;break}if(f=e[c].getMcDbObject(),f){p.next=41;break}return p.abrupt("continue",43);case 41:f.move(o,l),f instanceof Fa&&f.needToUpdateDimBlock(!1);case 43:c++,p.next=37;break;case 46:case"end":return p.stop()}},i)})),Gp.apply(this,arguments)}function sC(){return Up.apply(this,arguments)}function Up(){return Up=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h,p;return me.wrap(function(v){for(;;)switch(v.prev=v.next){case 0:if(e=Tt.getCurrentSelect(),!(e.length>0)){v.next=4;break}return v.abrupt("break",15);case 4:return t=new wr,v.next=7,t.userSelect(`
选择旋转对象`);case 7:if(v.sent){v.next=9;break}return v.abrupt("return");case 9:if(e=t.getIds(),e.length!=0){v.next=12;break}return v.abrupt("return");case 12:return v.abrupt("break",15);case 15:return a=yl(e),a&&(n=a.minPt,r=a.maxPt),s=new Yt,s.setMessage("指定基点"),v.next=21,s.go();case 21:if(o=v.sent,o!=null){v.next=24;break}return v.abrupt("return");case 24:u=!1,l=0,c=new Zi,c.setMessage(Pt("Entity_Rotate_Angle","指定旋转角度")),c.setKeyWords("[复制(C)/参照(R)]"),c.setBasePt(o),c.setUseBasePt(!0),f=function(d){for(var y=0;y<e.length;y++){var b=e[y].getMcDbEntity();b&&b.highlight(d)}},f(!0),v.prev=33,h=me.mark(function g(){var d,y,b,_,w,E,x,S,T,L,B,k;return me.wrap(function(F){for(;;)switch(F.prev=F.next){case 0:return c.setUserDraw(function(W,K){var $=W,U=o,N=$.sub(U),P=N.angleTo2(at.kXAxis,at.kNegateZAxis)-l,D=new Ir;if(D.setToRotation(P,at.kZAxis,U),n&&r){var q=new fe(n.x,r.y,0),V=new fe(r.x,n.y,0),Q=new fe(q.x,V.y,0),Z=new fe(V.x,q.y,0);q.transformBy(D),V.transformBy(D),Q.transformBy(D),Z.transformBy(D),q=Vt.cad2doc(q),V=Vt.cad2doc(V),Q=Vt.cad2doc(Q),Z=Vt.cad2doc(Z),K.drawLine(Z.toVector3(),q.toVector3()),K.drawLine(q.toVector3(),Q.toVector3()),K.drawLine(Q.toVector3(),V.toVector3()),K.drawLine(V.toVector3(),Z.toVector3())}D.setToRotation(P,at.kZAxis,U);for(var Y=0;Y<e.length&&Y<10;Y++){var ee=e[Y].clone();ee&&(ee.transformBy(D),K.drawMcDbEntity(ee))}}),F.next=3,c.go();case 3:if(d=F.sent,!c.isKeyWordPicked("C")){F.next=8;break}return u=!0,f(!1),F.abrupt("return",0);case 8:if(!c.isKeyWordPicked("R")){F.next=22;break}return y=new tn,y.setMessage(Pt("Entity_Rotate_Ref_Angle","指定参照角:<"+(l/(Math.PI/180)).toFixed(3)+">")),y.setKeyWords(""),y.setUseBasePt(!1),b=0,y.setUserDraw(function(W){if(o){var K=W.sub(o);b=K.angleTo2(at.kXAxis,at.kNegateZAxis)}}),F.next=17,y.go();case 17:if(_=F.sent,typeof _=="number"){F.next=20;break}return F.abrupt("return",{v:f(!1)});case 20:return y.getDetailedResult()===yr.kCoordIn?l=THREE.MathUtils.degToRad(_):b!==0&&(l=b),F.abrupt("return",0);case 22:if(typeof d=="number"){F.next=24;break}return F.abrupt("return",{v:f(!1)});case 24:if(w=o,E=new Ir,E.setToRotation(d-l,at.kZAxis,w),x=function(K){return K instanceof cn},!u){F.next=42;break}S=[],T=0;case 31:if(!(T<e.length)){F.next=39;break}if(L=e[T].clone(),L){F.next=35;break}return F.abrupt("continue",36);case 35:x(L)&&(L.transformBy(E),S.push(ne.getCurrentMxCAD().drawEntity(L)));case 36:T++,F.next=31;break;case 39:return F.abrupt("return",{v:S});case 42:f(!1),B=0;case 44:if(!(B<e.length)){F.next=52;break}if(k=e[B].getMcDbObject(),k){F.next=48;break}return F.abrupt("continue",49);case 48:k.transformBy(E);case 49:B++,F.next=44;break;case 52:return F.abrupt("return",{v:e});case 53:case"end":return F.stop()}},g)});case 35:return v.delegateYield(h(),"t0",37);case 37:if(p=v.t0,p!==0){v.next=40;break}return v.abrupt("continue",35);case 40:if(!p){v.next=42;break}return v.abrupt("return",p.v);case 42:v.next=35;break;case 44:v.next=50;break;case 46:v.prev=46,v.t1=v.catch(33),f(!1),console.error(v.t1);case 50:case"end":return v.stop()}},i,null,[[33,46]])})),Up.apply(this,arguments)}function oC(){return Vp.apply(this,arguments)}function Vp(){return Vp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h,p,m,v,g,d,y,b,_,w,E,x,S,T,L,B;return me.wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(e=Tt.getCurrentSelect(),!(e.length>0)){R.next=4;break}return R.abrupt("break",15);case 4:return t=new wr,R.next=7,t.userSelect(`
选择缩放对象`);case 7:if(R.sent){R.next=9;break}return R.abrupt("return");case 9:if(e=t.getIds(),e.length!=0){R.next=12;break}return R.abrupt("return");case 12:return R.abrupt("break",15);case 15:if(a=yl(e),a){R.next=18;break}return R.abrupt("return");case 18:return n=a.minPt,r=a.maxPt,s=r.x-n.x,o=r.y-n.y,u=(s+o)/3,u<1e-5&&(u=1),l=new Yt,l.setMessage("指定基点"),R.next=28,l.go();case 28:if(c=R.sent,c){R.next=31;break}return R.abrupt("return");case 31:f=0,h=!1,p=function(W,K){if(c){var $=new fe(W),U=new fe(c),N=$.distanceTo(U);if(!(N<1e-5)){f=N/u,f>1e5&&(f=1e5);var P=new Ir;if(P.setToScaling(f,U),n&&r){var D=new fe(n.x,r.y,0),q=new fe(r.x,n.y,0),V=new fe(D.x,q.y,0),Q=new fe(q.x,D.y,0);D.transformBy(P),q.transformBy(P),V.transformBy(P),Q.transformBy(P),D=Vt.cad2doc(D),q=Vt.cad2doc(q),V=Vt.cad2doc(V),Q=Vt.cad2doc(Q),K.drawLine(Q.toVector3(),D.toVector3()),K.drawLine(D.toVector3(),V.toVector3()),K.drawLine(V.toVector3(),q.toVector3()),K.drawLine(q.toVector3(),Q.toVector3())}P.setToScaling(f,U);for(var Z=0;Z<e.length&&Z<10;Z++){var Y=e[Z].clone();Y&&(Y.transformBy(P),K.drawMcDbEntity(Y))}}}},m=function(W){for(var K=0;K<e.length;K++){var $=e[K].getMcDbEntity();$&&$.highlight(W)}},m(!0),R.prev=36;case 37:return v=new tn,v.setMessage("指定比例因子"),v.setKeyWords("[复制(C)/参照(R)]"),v.setBasePt(c),v.setUseBasePt(!0),v.setUserDraw(p),R.next=46,v.go();case 46:if(g=R.sent,!v.isKeyWordPicked("C")){R.next=51;break}return h=!0,m(!1),R.abrupt("continue",37);case 51:if(!v.isKeyWordPicked("R")){R.next=77;break}return d=new tn,d.setMessage("指定参照长度"),d.setBasePt(c),R.next=57,d.go();case 57:if(y=R.sent,y){R.next=60;break}return R.abrupt("return",m(!1));case 60:return u=y,d.setMessage("指定新的长度"),d.setKeyWords("[点(P)]"),d.setBasePt(c),d.setUserDraw(p),R.next=67,d.go();case 67:if(b=R.sent,!d.isKeyWordPicked("P")){R.next=74;break}return _=new tn,_.setMessage("指定长度"),R.next=73,_.go();case 73:b=R.sent;case 74:if(b){R.next=76;break}return R.abrupt("return",m(!1));case 76:g=b/y;case 77:if(g){R.next=79;break}return R.abrupt("return",m(!1));case 79:if(v.getDetailedResult()===yr.kCoordIn&&(f=g),f>1e5&&(f=1e5),w=new Ir,w.setToScaling(f,c),!h){R.next=98;break}E=[],x=function(W){return W instanceof cn},S=0;case 87:if(!(S<e.length)){R.next=95;break}if(T=e[S].clone(),T){R.next=91;break}return R.abrupt("continue",92);case 91:x(T)&&(T.transformBy(w),E.push(ne.getCurrentMxCAD().drawEntity(T)));case 92:S++,R.next=87;break;case 95:return R.abrupt("return",E);case 98:m(!1),L=0;case 100:if(!(L<e.length)){R.next=108;break}if(B=e[L].getMcDbObject(),B){R.next=104;break}return R.abrupt("continue",105);case 104:B.transformBy(w);case 105:L++,R.next=100;break;case 108:return R.abrupt("return",e);case 109:R.next=37;break;case 111:R.next=117;break;case 113:R.prev=113,R.t0=R.catch(36),console.error(R.t0),m(!1);case 117:case"end":return R.stop()}},i,null,[[36,113]])})),Vp.apply(this,arguments)}function uC(){return Wp.apply(this,arguments)}function Wp(){return Wp=ut(me.mark(function i(){var e,t,n,r;return me.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return e=new Yt,e.disableAllTrace(),e.setMessage(`
点取缩放区域`),e.setDynamicInputType(cr.kDynTip),s.next=6,e.go();case 6:if(t=s.sent,t!=null){s.next=9;break}return s.abrupt("return");case 9:return n=ne.getCurrentMxCAD(),e.setUserDraw(function(o,u){u.drawRect(Vt.cad2doc1(t),Vt.cad2doc1(o))}),s.next=13,e.go();case 13:if(r=s.sent,r!=null){s.next=16;break}return s.abrupt("return");case 16:n.zoomW(t,r);case 17:case"end":return s.stop()}},i)})),Wp.apply(this,arguments)}function lC(){return zp.apply(this,arguments)}function zp(){return zp=ut(me.mark(function i(){return me.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:ne.getCurrentMxCAD().zoomAll(!0);case 1:case"end":return t.stop()}},i)})),zp.apply(this,arguments)}function cC(){return Hp.apply(this,arguments)}function Hp(){return Hp=ut(me.mark(function i(){var e,t;return me.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:e=Ve.getCurrentDraw().getViewAngle(),e+=Math.PI*.5,t=ne.getCurrentMxCAD(),t.zoomAngle(e);case 4:case"end":return r.stop()}},i)})),Hp.apply(this,arguments)}var Za,Gl=!1,Ns=!0;function fC(){return jp.apply(this,arguments)}function jp(){return jp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c;return me.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:e=new ln,e.AddMcDbEntityTypes("LINE,CIRCLE,LWPOLYLINE,ARC"),t=new Yt,n=!1,r=function(){var p=ut(me.mark(function m(){var v,g,d,y=arguments;return me.wrap(function(_){for(;;)switch(_.prev=_.next){case 0:v=y.length>0&&y[0]!==void 0?y[0]:!1,g=me.mark(function w(){var E,x,S,T,L,B;return me.wrap(function(R){for(;;)switch(R.prev=R.next){case 0:if(T=Tt.getCurrentSelect(),!(T.length>0&&v)){R.next=5;break}S=T,R.next=8;break;case 5:return R.next=7,Tt.selectEnt(`
选择偏移对象`,e,!1,function(F){F.setKeyWords("[退出(E)/放弃(U)]"),E=F},function(F){x=F});case 7:S=R.sent;case 8:if(!E){R.next=15;break}if(!E.isKeyWordPicked("E")){R.next=11;break}return R.abrupt("return",{v:void 0});case 11:if(!E.isKeyWordPicked("U")){R.next=13;break}return R.abrupt("return",0);case 13:if(E.getStatus()!==Lt.kCancel){R.next=15;break}return R.abrupt("return",{v:void 0});case 15:if(S.length!=0){R.next=17;break}return R.abrupt("return",0);case 17:L=me.mark(function F(){var W,K,$,U;return me.wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return t.setDynamicInputType(cr.kXYCoordInput),v?t.setMessage(`
指定通过点`+(n?" <下一个对象>":"")):t.setMessage(`
指定要偏移那一侧上的点`),t.setKeyWords(n?"[退出(E)/放弃(U)]":"[退出(E)/多个(M)/放弃(U)]"),t.disableAllTrace(),t.setUserDraw(function(D,q){var V=S.map(function(le){return le.clone()}),Q=V[0];if(Q){var Z=Za;if(v){var Y=Q.getClosestPointTo(D,!0);if(!Y.ret)return;x=Y.val,Z=D.distanceTo(x)}if(Z){var ee=Q.offsetCurves(Z,D);ee.empty()||ee.forEach(function(le){le instanceof cn&&q.drawMcDbEntity(le)})}}}),P.next=7,t.go();case 7:if(W=P.sent,!t.isKeyWordPicked("E")){P.next=10;break}return P.abrupt("return",{v:{v:void 0}});case 10:if(!t.isKeyWordPicked("M")){P.next=13;break}return n=!0,P.abrupt("return",0);case 13:if(!t.isKeyWordPicked("U")){P.next=15;break}return P.abrupt("return",{v:1});case 15:if(W){P.next=17;break}return P.abrupt("return",{v:{v:void 0}});case 17:if(K=S[0].getMcDbCurve(),K){P.next=20;break}return P.abrupt("return",{v:{v:void 0}});case 20:if(!v){P.next=25;break}if($=K.getClosestPointTo(W,!0),$.ret){P.next=24;break}return P.abrupt("return",{v:{v:void 0}});case 24:Za=W.distanceTo($.val);case 25:if(Za){P.next=27;break}return P.abrupt("return",{v:{v:void 0}});case 27:if(U=K.offsetCurves(Za,W),!U.empty()){P.next=30;break}return P.abrupt("return",{v:{v:void 0}});case 30:if(U.forEach(function(D){D instanceof cn&&(Ns&&K!==null&&K!==void 0&&K.layer&&(D.layer=K.layer),Ns||(D.layer=ne.getCurrentMxCAD().getDatabase().getCurrentlyLayerName()),ne.getCurrentMxCAD().drawEntity(D))}),n){P.next=34;break}return Gl&&S[0].erase(!0),P.abrupt("return",1);case 34:case"end":return P.stop()}},F)});case 19:return R.delegateYield(L(),"t0",21);case 21:if(B=R.t0,B!==0){R.next=24;break}return R.abrupt("continue",19);case 24:if(B!==1){R.next=26;break}return R.abrupt("break",30);case 26:if(!B){R.next=28;break}return R.abrupt("return",B.v);case 28:R.next=19;break;case 30:case"end":return R.stop()}},w)});case 2:return _.delegateYield(g(),"t0",4);case 4:if(d=_.t0,d!==0){_.next=7;break}return _.abrupt("continue",2);case 7:if(d!==1){_.next=9;break}return _.abrupt("continue",2);case 9:if(!d){_.next=11;break}return _.abrupt("return",d.v);case 11:_.next=2;break;case 13:case"end":return _.stop()}},m)}));return function(){return p.apply(this,arguments)}}();case 5:return a=new tn,a.setMessage(`
指定偏移距离<`.concat((Za||0).toFixed(3),">")),a.setKeyWords("[通过点(T)/删除(E)/图层(L))]"),h.next=11,a.go();case 11:if(s=h.sent,!(a.isKeyWordPicked("T")||a.getStatus()===Lt.kNone)){h.next=16;break}return h.next=15,r(!0);case 15:return h.abrupt("return");case 16:if(!a.isKeyWordPicked("E")){h.next=33;break}return o=new li,o.setMessage("要在偏移后删除源对象吗?<".concat(Gl?"是":"否",">")),o.setKeyWords("[是(Y)/否(N)]"),h.next=22,o.go();case 22:if(u=h.sent,o.getStatus()!==Lt.kCancel){h.next=25;break}return h.abrupt("return");case 25:if(o.getStatus()!==Lt.kNone){h.next=27;break}return h.abrupt("continue",5);case 27:if(u?.toLocaleLowerCase()!=="y"){h.next=30;break}return Gl=!0,h.abrupt("continue",5);case 30:if(u?.toLocaleLowerCase()!=="n"){h.next=33;break}return Gl=!1,h.abrupt("continue",5);case 33:if(!a.isKeyWordPicked("L")){h.next=51;break}return l=new li,l.setMessage("输入偏移对象的图层选项<".concat(Ns?"源":"当前",">")),l.setKeyWords("[当前(C)/源(S)]"),h.next=39,l.go();case 39:if(c=h.sent,l.getStatus()!==Lt.kCancel){h.next=42;break}return h.abrupt("return");case 42:if(l.getStatus()!==Lt.kNone){h.next=45;break}return Ns=!0,h.abrupt("continue",5);case 45:if(c?.toLocaleLowerCase()!=="c"){h.next=48;break}return Ns=!1,h.abrupt("continue",5);case 48:if(c?.toLocaleUpperCase()!=="s"){h.next=51;break}return Ns=!0,h.abrupt("continue",5);case 51:if(s&&(Za=s),Za){h.next=54;break}return h.abrupt("return");case 54:return h.next=56,r();case 56:return h.abrupt("break",59);case 59:case"end":return h.stop()}},i)})),jp.apply(this,arguments)}function hC(){ne.getCurrentMxCAD().regen()}function pC(){return Yp.apply(this,arguments)}function Yp(){return Yp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h;return me.wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,Tt.userSelect("选择镜像对象");case 2:if(e=m.sent,e.length!=0){m.next=6;break}return Ve.acutPrintf(`
没有能镜像的对象`),m.abrupt("return");case 6:return r=yl(e),r&&(t=r.minPt,n=r.maxPt),a=new Yt,a.setMessage("指定基点"),m.next=12,a.go();case 12:if(s=m.sent,s!=null){m.next=15;break}return m.abrupt("return");case 15:return a.setMessage("指定镜向点"),a.setBasePt(s),a.setUseBasePt(!0),a.setUserDraw(function(v,g){if(t&&n){var d=new Ir;d.setMirror(s,v);var y=new fe(t.x,n.y,0),b=new fe(n.x,t.y,0),_=new fe(y.x,b.y,0),w=new fe(b.x,y.y,0);y.transformBy(d),b.transformBy(d),_.transformBy(d),w.transformBy(d),y=Vt.cad2doc(y),b=Vt.cad2doc(b),_=Vt.cad2doc(_),w=Vt.cad2doc(w),g.drawLine(w.toVector3(),y.toVector3()),g.drawLine(y.toVector3(),_.toVector3()),g.drawLine(_.toVector3(),b.toVector3()),g.drawLine(b.toVector3(),w.toVector3())}for(var E=0;E<e.length&&E<10;E++){var x=e[E].clone();x&&(x.mirror(s,v),g.drawMcDbEntity(x))}}),a.setDynamicInputType(cr.kXYCoordInput),m.next=22,a.go();case 22:if(o=m.sent,o){m.next=25;break}return m.abrupt("return");case 25:return u=new li,u.clearLastInputPoint(),u.setMessage("要删除源对象吗?<N>"),u.setKeyWords("[是(Y)/否(N)]"),m.next=31,u.go();case 31:if(l=m.sent,u.getStatus()!==Lt.kCancel){m.next=34;break}return m.abrupt("return");case 34:c=0;case 35:if(!(c<e.length)){m.next=44;break}if(f=e[c].clone(),f){m.next=39;break}return m.abrupt("continue",41);case 39:f.mirror(s,o),ne.getCurrentMxCAD().drawEntity(f);case 41:c++,m.next=35;break;case 44:if(l?.toLocaleLowerCase()==="y")for(h=0;h<e.length;h++)e[h].erase();case 45:case"end":return m.stop()}},i)})),Yp.apply(this,arguments)}var Mu=function(e,t){e.layer=t.layer,e.trueColor=t.trueColor,e.colorIndex=t.colorIndex,e.linetype=t.linetype,e.visible=t.visible,e.textStyle=t.textStyle,e.lineweight=t.lineweight,e.drawOrder=t.drawOrder,e.linetypeScale=t.linetypeScale},qi=!1,dC=function(e){qi=e.shiftKey},vC=function(e){qi=e.shiftKey};window.addEventListener("keydown",dC);window.addEventListener("keyup",vC);function mC(){return Kp.apply(this,arguments)}function Kp(){return Kp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h;return me.wrap(function(m){for(;;)switch(m.prev=m.next){case 0:e=Number(localStorage.getItem("mx_chamfer_dist")),t=Number(localStorage.getItem("mx_chamfer_dist1")),typeof e!="number"&&(e=0),typeof t!="number"&&(t=0),n=0,r=0,a=!1,s=!0,o=!1,Ve.acutPrintf(`
(`.concat(s?"修剪":"不修剪","模式) 当前").concat(a?"倒角长度 = "+e.toFixed(4)+", 角度 = "+Math.trunc(r/(Math.PI/180)):"倒角距离1 = "+e.toFixed(4)+", 距离2 = "+t.toFixed(4),`
`)),u=function(){var v=ut(me.mark(function g(){var d,y,b;return me.wrap(function(w){for(;;)switch(w.prev=w.next){case 0:return d=new tn,d.setDynamicInputType(cr.kXYCoordInput),d.setMessage("指定第一个倒角距离<".concat(e.toFixed(4),">")),d.setKeyWords(""),w.next=6,d.go();case 6:if(y=w.sent,typeof y=="number"){w.next=9;break}return w.abrupt("return");case 9:return e=y,d.setMessage("指定第二个倒角距离<".concat(t.toFixed(4),">")),d.setKeyWords(""),w.next=14,d.go();case 14:if(b=w.sent,typeof b=="number"){w.next=17;break}return w.abrupt("return");case 17:return t=b,localStorage.setItem("mx_chamfer_dist",e.toString()),localStorage.setItem("mx_chamfer_dist1",t.toString()),a=!1,w.abrupt("return",[e,t]);case 22:case"end":return w.stop()}},g)}));return function(){return v.apply(this,arguments)}}(),l=function(){var v=ut(me.mark(function g(){var d,y,b,_;return me.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:return d=new tn,d.setMessage("指定第一条直线的倒角长度<".concat(n.toFixed(4),">")),d.setKeyWords(""),d.clearLastInputPoint(),E.next=6,d.go();case 6:if(y=E.sent,typeof y=="number"){E.next=9;break}return E.abrupt("return");case 9:return n=y,b=new Zi,b.setMessage("指定第一条直线的倒角角度<".concat(Math.trunc(r/(Math.PI/180)),">")),b.setKeyWords(""),d.clearLastInputPoint(),E.next=16,b.go();case 16:if(_=E.sent,typeof _=="number"){E.next=19;break}return E.abrupt("return");case 19:return b.getDetailedResult()===yr.kCoordIn?r=_*(Math.PI/180):r=_,a=!0,E.abrupt("return",[n,r]);case 22:case"end":return E.stop()}},g)}));return function(){return v.apply(this,arguments)}}(),c=function(g,d,y,b){var _=g.startPoint.clone(),w=d.startPoint.clone(),E=d.endPoint.clone(),x=w.clone().addvec(w.sub(_).normalize().mult(-y)),S=x.sub(w).rotateBy(-b).mult(-y),T=x.clone().addvec(S),L=new pt(x,T),B=new pt(w,E.clone().addvec(w.sub(E).normalize().mult(-y))),k=L.IntersectWith(B,yn.Intersect.kExtendBoth);if(!k.isEmpty()){var R=k.at(0);return R.distanceTo(w)}},f=me.mark(function v(){var g,d,y,b,_,w,E,x,S,T,L,B,k,R,F,W,K,$,U,N,P,D,q,V,Q,Z,Y,ee,le,Ee,j,ce,Ce,Ae,ke,Pe,Me,H,X,xe,_e,Le,Be,Se;return me.wrap(function(re){for(;;)switch(re.prev=re.next){case 0:return g=new Ci,g.setDynamicInputType(cr.kNoInput),d=new ln,d.AddMcDbEntityTypes("LINE,LWPOLYLINE"),g.setFilter(d),g.setMessage("选择一条直线"),g.setKeyWords("[放弃(U)/多段线(P)/距离(D)/角度(A)/修剪(T)/方式(E)/多个(M)]"),re.next=9,g.go();case 9:if(y=re.sent,!g.isKeyWordPicked("U")){re.next=12;break}return re.abrupt("return",0);case 12:if(!g.isKeyWordPicked("P")){re.next=77;break}case 13:return b=new Ci,b.setDynamicInputType(cr.kNoInput),_=new ln,_.AddMcDbEntityTypes("LWPOLYLINE"),b.setMessage("选择二维多段线"),b.setKeyWords("[距离(D)/角度(A)/方法(M)]"),w=function(M){var C=M.getMcDbEntity();if(C instanceof st){var A=C.numVerts();if(A<3)return Ve.acutPrintf(`没有线可以形成倒角
`);var G=e,I=t;if(a){var te=C.getPointAt(0).val,ae=C.getPointAt(1).val,ve=C.getPointAt(2).val;G=n;var we=c(new pt(te,ae),new pt(ae,ve),n,r);if(typeof we!="number")return Ve.acutPrintf(`
倒角角度无效`);I=we}var Te=new st;Te.isClosed=C.isClosed;for(var He=[],qe=function(Nt,Ut){var Gn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Hn=Nt.sub(Ut).normalize().mult(Gn?-I:-G),sn=Nt.clone().addvec(Hn),Un=Ut.sub(Nt).normalize().mult(Gn?-G:-I),Pn=Ut.clone().addvec(Un);return[sn,Pn]},ft=function(Nt,Ut){var Gn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,Hn=qe(Nt,Ut,Gn),sn=ci(Hn,2),Un=sn[0],Pn=sn[1];s?(Te.addVertexAt(Un),Te.addVertexAt(Pn)):He.push(Un,Pn)},bt=0;bt<A;bt++){var lt=C.getPointAt(bt).val,At=C.getPointAt(bt+1).val;if(C.isClosed)bt!==A-1&&ft(lt,At);else if(bt===0){Te.addVertexAt(lt);var dt=At.sub(lt).normalize().mult(-G),en=At.clone().addvec(dt);Te.addVertexAt(At.clone().addvec(dt)),He.unshift(en)}else if(bt===A-2){var et=lt.sub(At).normalize().mult(-I),Je=lt.clone().addvec(et);Te.addVertexAt(Je),Te.addVertexAt(At),He.push(Je)}else bt!==A-1&&ft(lt,At,!0)}if(C.isClosed&&ft(C.getPointAt(A-1).val,C.getPointAt(0).val),s)return Mu(Te,C),Te;var $e=[],dn=[];return C.isClosed&&He.unshift(He[He.length-1]),He.forEach(function(nn){if($e.push(nn),$e.length===2){var Nt=new pt($e[0],$e[1]);Mu(Nt,C),dn.push(Nt),$e=[]}}),dn}},re.next=23,b.go();case 23:if(E=re.sent,!b.isKeyWordPicked("D")){re.next=30;break}return re.next=27,u();case 27:if(re.sent){re.next=29;break}return re.abrupt("return",{v:void 0});case 29:return re.abrupt("continue",13);case 30:if(!b.isKeyWordPicked("A")){re.next=36;break}return re.next=33,l();case 33:if(re.sent){re.next=35;break}return re.abrupt("return",{v:void 0});case 35:return re.abrupt("continue",13);case 36:if(!b.isKeyWordPicked("M")){re.next=39;break}return o=!0,re.abrupt("continue",13);case 39:if(b.getStatus()!==Lt.kCancel){re.next=41;break}return re.abrupt("return",{v:void 0});case 41:if(E){re.next=43;break}return re.abrupt("continue",13);case 43:if(E.isValid()){re.next=45;break}return re.abrupt("continue",13);case 45:if(x=w(E),x){re.next=52;break}if(!o){re.next=51;break}return re.abrupt("continue",13);case 51:return re.abrupt("return",{v:void 0});case 52:if(S=E.getMcDbEntity(),S){re.next=59;break}if(!o){re.next=58;break}return re.abrupt("continue",13);case 58:return re.abrupt("return",{v:void 0});case 59:if(!(x instanceof st)){re.next=68;break}if(S instanceof st){re.next=62;break}return re.abrupt("return",{v:void 0});case 62:for(T=S.numVerts(),L=0;L<T;L++)S.removeVertexAt(0);for(B=x.numVerts(),k=0;k<B;k++)R=x.getWidthsAt(k),F=R.val1,W=R.val2,S.addVertexAt(x.getPointAt(k).val,x.getBulgeAt(k),F,W);re.next=70;break;case 68:x.forEach(function(Ge){ne.getCurrentMxCAD().drawEntity(Ge)}),S.visible=!0;case 70:if(!o){re.next=74;break}return re.abrupt("continue",13);case 74:return re.abrupt("return",{v:void 0});case 75:re.next=13;break;case 77:if(!g.isKeyWordPicked("D")){re.next=83;break}return re.next=80,u();case 80:if(re.sent){re.next=82;break}return re.abrupt("return",{v:void 0});case 82:return re.abrupt("return",0);case 83:if(!g.isKeyWordPicked("A")){re.next=89;break}return re.next=86,l();case 86:if(re.sent){re.next=88;break}return re.abrupt("return",{v:void 0});case 88:return re.abrupt("return",0);case 89:if(!g.isKeyWordPicked("T")){re.next=108;break}return K=new li,K.setMessage("输入修剪模式选项<".concat(s?"修剪":"不修剪",">")),K.setKeyWords("[修剪(T)/不修剪(N)]"),re.next=95,K.go();case 95:if($=re.sent,K.getStatus()!==Lt.kCancel){re.next=98;break}return re.abrupt("return",{v:void 0});case 98:if(K.getStatus()!==Lt.kNone){re.next=100;break}return re.abrupt("return",0);case 100:if($){re.next=102;break}return re.abrupt("return",{v:void 0});case 102:if($.toLocaleLowerCase()!=="t"){re.next=105;break}return s=!0,re.abrupt("return",0);case 105:if($.toLocaleLowerCase()!=="n"){re.next=108;break}return s=!1,re.abrupt("return",0);case 108:if(!g.isKeyWordPicked("E")){re.next=127;break}return U=new li,U.setMessage("输入剪切方法<".concat(a?"角度":"距离",">")),U.setKeyWords("[距离(D)/角度(A)]"),re.next=114,U.go();case 114:if(N=re.sent,U.getStatus()!==Lt.kCancel){re.next=117;break}return re.abrupt("return",{v:void 0});case 117:if(U.getStatus()!==Lt
图元无法用自身倒角`);return}var dt=C.IntersectWith(M,yn.Intersect.kOnBothOperands),en=dt.isEmpty();if(!en){var et=dt.at(0);if((M.startPoint.isEqualTo(et)||M.endPoint.isEqualTo(et)||C.startPoint.isEqualTo(et)||C.endPoint.isEqualTo(et))&&G===0&&I===0)return{apply:function(){}}}var Je=M.IntersectWith(C,yn.Intersect.kExtendBoth);if(Je.isEmpty()){Z(`
两直线平行`);return}var $e=Je.at(0),dn=function(Nt,Ut,Gn,Hn,sn,Un){var Pn=!1;return en?Pn=Math.max(Gn.distanceTo($e),Hn.distanceTo($e))<G&&G>0||Math.max(sn.distanceTo($e),Un.distanceTo($e))<I&&I>0:Pn=(Nt?Gn.distanceTo($e):Hn.distanceTo($e))<G&&G>0||(Ut?sn.distanceTo($e):Un.distanceTo($e))<I&&I>0,Pn&&Z(`
倒角距离太大`),Pn};return we=function(){var Nt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ae,Ut=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ve,Gn=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Nt.getHandle()===Ut.getHandle();if(Nt instanceof pt&&Ut instanceof pt){var Hn=yi(Nt.startPoint,Nt.endPoint,$e,P),sn=yi(Ut.startPoint,Ut.endPoint,$e,A);if(dn(Hn,sn,Nt.startPoint,Nt.endPoint,Ut.startPoint,Ut.endPoint))return;var Un=Sc(Nt,Ut,$e,Hn,sn,G,I,s);return Un&&te(Un),!0}var Pn=function(Rt,Gt,vr,Cr,O,z){var se=Rt.numVerts();if(Gn||(Rt.isClosed=!1),!!O){var be=O.start,Ie=O.end,tt=O.endIndex,Ue=O.startIndex,ot=O.isClosed,ze=[],Ze=function(hi,Ar){var va=hi.getBulgeAt(Ar),ja=hi.getPointAt(Ar).val,ma=hi.getWidthsAt(Ar),Tl=ma.val1,Bi=ma.val2;return{point:ja,bulge:va,startWidth:Tl,endWidth:Bi}},Mt=yi(be.clone(),Ie.clone(),$e,vr);if(Gt instanceof pt){if(Gn){Z(`
同一条直线无法倒角`);return}var It=yi(Gt.startPoint.clone(),Gt.endPoint.clone(),$e,Cr);if(dn(Mt,It,be,Ie,Gt.startPoint,Gt.endPoint))return;var wt=Gt.clone(),je=Sc(new pt(be.clone(),Ie.clone()),wt,$e,Mt,It,G,I,s);if(Mt){for(var it=ot?Rt.numVerts():tt,on=0;on<it;on++)ze.push(Ze(Rt,on));je?s?(ze.push({point:je.startPoint}),ze.push({point:je.endPoint})):te(je):ze.push({point:$e}),It?ze.push({point:wt.startPoint.clone()}):ze.push({point:wt.endPoint.clone()})}else{var Wt=Rt.numVerts();if(ot)ze.push(Ze(Rt,0));else for(var jn=tt;jn<Wt;jn++)ze.push(Ze(Rt,jn));je?s?(ze.unshift({point:je.startPoint}),ze.unshift({point:je.endPoint})):te(je):ze.unshift({point:$e}),It?ze.unshift({point:Gt.startPoint.clone()}):ze.unshift({point:Gt.endPoint.clone()})}}else if(Gt instanceof st&&z){var _t=z.start,ht=z.end,_n=z.startIndex,Yn=z.endIndex,Fn=z.isClosed,mr=yi(_t,ht,$e,Cr);if(dn(Mt,mr,be,Ie,_t,ht))return;var zt=Sc(new pt(be,Ie),new pt(_t,ht),$e,Mt,mr,G,I,s);if(Gn){var Qn=Rt.numVerts(),Gr=Gt.numVerts(),Fi=(Ue===0||Ue===Qn-(ot?1:2))&&(_n===0||_n===Gr-(Fn?1:2))&&Qn>(ot||Fn?2:4),za=_n-Ue;if(Fi)return zt?s?Ue===0||_n===0?(Ue===0?(Rt.setPointAt(0,zt.startPoint),ot||Fn?Rt.addVertexAt(zt.endPoint):Rt.setPointAt(Qn-1,zt.endPoint)):(Rt.setPointAt(0,zt.endPoint),ot||Fn?Rt.addVertexAt(zt.startPoint):Rt.setPointAt(Qn-1,zt.startPoint)),Rt.isClosed=!0):s&&(Rt.setPointAt(Qn-1,ot?zt.endPoint:zt.startPoint),Rt.addVertexAt(ot?zt.startPoint:zt.endPoint)):te(zt):s&&(Rt.setPointAt(0,$e),Rt.removeVertexAt(Qn-1),Rt.isClosed=!0),!0;if(Math.abs(za)>2){Z(`
多段线中的直线必须是连续的 或被一条线段断开`);return}else Gt=Gt.clone()}if(!(Gt instanceof st))return;if(Mt){for(var pa=0;pa<=Ue;pa++)ze.push(Ze(Rt,pa));if(zt?s?(ze.push({point:zt.startPoint}),ze.push({point:zt.endPoint})):te(zt):ze.push({point:$e}),mr)for(var Ur=_n;Ur>=0;Ur--)ze.push(Ze(Gt,Ur));else if(Fn)ze.push(Ze(Gt,0));else for(var Ri=Gt.numVerts(),da=Yn;da<Ri;da++)ze.push(Ze(Gt,da))}else{var nu=Rt.numVerts();if(ot)ze.push(Ze(Rt,0));else for(var Ds=tt;Ds<nu;Ds++)ze.push(Ze(Rt,Ds));if(zt?s?(ze.unshift({point:zt.startPoint}),ze.unshift({point:zt.endPoint})):te(zt):ze.unshift({point:$e}),mr)for(var Ha=_n;Ha>=0;Ha--)ze.unshift(Ze(Gt,Ha));else if(Fn)ze.unshift(Ze(Gt,0));else for(var xl=Gt.numVerts(),ks=Yn;ks<xl;ks++)ze.unshift(Ze(Gt,ks))}}else return!1;if(s){for(var Li=0;Li<se;Li++)Rt.removeVertexAt(0);ze.forEach(function(Sr){var hi=Sr.point,Ar=Sr.bulge,va=Sr.startWidth,ja=Sr.endWidth;Rt.addVertexAt(hi,Ar,va,ja)}),Gt.erase()}return!0}};return Nt instanceof st&&V?Pn(Nt,Ut,P,A,V,ft):Ut instanceof st&&ft?Pn(Ut,Nt,A,P,ft,V):!1},{apply:we,line1:M,line2:C}}},g.setUserDraw(function(Ge,M){var C=D.clone(),A=Tt.findEntAtPoint(Ge.x,Ge.y,Ge.z,-1,q);if(!A||!A.isValid())return Y();var G=A.getMcDbEntity();if(!G)return Y();var I=G?.clone();if(!I)return Y();var te=ee(C,I,Ge,qi?0:e,qi?0:t,function(ft){M.drawMcDbEntity(ft)})||{},ae=te.line1,ve=te.line2,we=te.apply,Te=we&&we(C,I,D.getHandle()===G.getHandle());if(ae&&ve&&Te){C.drawOrder=D.drawOrder+G.drawOrder+102,ae.drawOrder=D.drawOrder+G.drawOrder+101,ve.drawOrder=D.drawOrder+G.drawOrder+101;var He=new THREE.Color(Number(D.trueColor.getColorValue(D.layerId))),qe=He.clone();s&&(_y(qe,.5),M.setColor(qe)),M.drawMcDbEntity(ae),M.drawMcDbEntity(ve),M.setColor(He),M.drawMcDbEntity(C)}});case 152:return g.setMessage("选择第二条直线,或按住shift键选择直线以应用角点"),g.setKeyWords("[距离(D)/角度(A)/方法(M)]"),re.next=157,g.go();case 157:if(le=re.sent,!g.isKeyWordPicked("D")){re.next=164;break}return re.next=161,u();case 161:if(re.sent){re.next=163;break}return re.abrupt("return",{v:void 0});case 163:return re.abrupt("continue",152);case 164:if(!g.isKeyWordPicked("A")){re.next=170;break}return re.next=167,l();case 167:if(re.sent){re.next=169;break}return re.abrupt("return",{v:void 0});case 169:return re.abrupt("continue",152);case 170:if(!g.isKeyWordPicked("M")){re.next=173;break}return o=!0,re.abrupt("continue",152);case 173:if(g.getStatus()!==Lt.kCancel){re.next=175;break}return re.abrupt("return",{v:void 0});case 175:if(le){re.next=177;break}return re.abrupt("return",{v:Y()});case 177:if(le.isValid()){re.next=179;break}return re.abrupt("return",{v:Y()});case 179:if(Ee=le.getMcDbEntity(),Ee){re.next=182;break}return re.abrupt("return",{v:Y()});case 182:if(j=D,ce=g.pickPoint(),Ce=j.clone(),Ce){re.next=191;break}if(!o){re.next=190;break}return re.abrupt("continue",152);case 190:return re.abrupt("return",{v:Y()});case 191:if(Ae=j.clone(),Ae){re.next=198;break}if(!o){re.next=197;break}return re.abrupt("continue",152);case 197:return re.abrupt("return",{v:Y()});case 198:if(ke=Ce.IntersectWith(Ae,yn.Intersect.kOnBothOperands),!ke.isEmpty()){re.next=205;break}if(!o){re.next=204;break}return re.abrupt("continue",152);case 204:return re.abrupt("return",{v:Y()});case 205:if(Pe=e,Me=t,!a){re.next=219;break}if(H=ke.at(0),X=c(new pt(P,H),new pt(H,ce),n,r),typeof X=="number"){re.next=217;break}if(Ve.acutPrintf(`
倒角角度无效`),!o){re.next=216;break}return re.abrupt("continue",152);case 216:return re.abrupt("return",{v:Y()});case 217:Pe=n,Me=X;case 219:if(xe=ee(j,Ee,ce,qi?0:Pe,qi?0:Me)||{},_e=xe.line1,Le=xe.line2,Be=xe.apply,!(_e&&Le&&Ey(_e,Le))){re.next=223;break}return Ve.acutPrintf("共线直线不能为 倒角。"),re.abrupt("return",{v:Y()});case 223:if(!Be){re.next=232;break}if(Se=Be(),!(o&&typeof Se>"u")){re.next=229;break}return re.abrupt("continue",152);case 229:return re.abrupt("break",240);case 230:re.next=238;break;case 232:if(ne.App.MxCADAssist.MxChamfer(y.id,le.id,P.x,P.y,ce.x,ce.y,Pe,Me,s),!o){re.next=237;break}return re.abrupt("continue",152);case 237:return re.abrupt("break",240);case 238:re.next=152;break;case 240:if(D instanceof pt&&D.highlight(!1),!o){re.next=245;break}return re.abrupt("return",0);case 245:return Y(),re.abrupt("return",1);case 247:case"end":return re.stop()}},v)});case 14:return m.delegateYield(f(),"t0",16);case 16:if(h=m.t0,h!==0){m.next=19;break}return m.abrupt("continue",14);case 19:if(h!==1){m.next=21;break}return m.abrupt("break",25);case 21:if(!h){m.next=23;break}return m.abrupt("return",h.v);case 23:m.next=14;break;case 25:case"end":return m.stop()}},i)})),Kp.apply(this,arguments)}function gC(){return Xp.apply(this,arguments)}function Xp(){return Xp=ut(me.mark(function i(){var e,t,n,r,a,s,o,u;return me.wrap(function(c){for(;;)switch(c.prev=c.next){case 0:e=Number(localStorage.getItem("Mx_Fillet_radius"))||0,t=localStorage.getItem("Mx_Fillet_isPruning")!=="false",n=!1,Ve.acutPrintf(`
当前设置: 模式 = `.concat(t?"修剪":"不修剪",", 半径 = ").concat(e.toFixed(4))),r=function(){var f=ut(me.mark(function h(){var p,m;return me.wrap(function(g){for(;;)switch(g.prev=g.next){case 0:return p=new tn,p.setDynamicInputType(cr.kDistanceInput),p.setKeyWords("指定圆角半径<".concat(e.toFixed(4),">")),g.next=5,p.go();case 5:if(m=g.sent,p.getStatus()!==Lt.kCancel){g.next=8;break}return g.abrupt("return");case 8:if(p.getStatus()!==Lt.kNone){g.next=10;break}return g.abrupt("return",e);case 10:if(typeof m=="number"){g.next=12;break}return g.abrupt("return");case 12:return e=m,localStorage.setItem("Mx_Fillet_radius",e.toString()),g.abrupt("return",e);case 15:case"end":return g.stop()}},h)}));return function(){return f.apply(this,arguments)}}(),a=new Ci,s=new ln,s.AddMcDbEntityTypes("LINE,LWPOLYLINE"),o=me.mark(function f(){var h,p,m,v,g,d,y,b,_,w,E,x,S,T,L,B,k,R,F,W,K,$,U,N;return me.wrap(function(D){for(;;)switch(D.prev=D.next){case 0:return a.setDynamicInputType(cr.kNoInput),a.setFilter(s),a.setMessage("选择第一个对象"),a.setKeyWords("[放弃(U)/多段线(P)/半径(R)/修剪(T)/多个(M)]"),D.next=6,a.go();case 6:if(h=D.sent,a.getStatus()!==Lt.kCancel){D.next=9;break}return D.abrupt("return",{v:void 0});case 9:if(!a.isKeyWordPicked("U")){D.next=11;break}return D.abrupt("return",0);case 11:if(!a.isKeyWordPicked("P")){D.next=24;break}p=me.mark(function q(){var V,Q,Z,Y,ee,le,Ee,j,ce,Ce,Ae,ke,Pe,Me,H,X,xe,_e,Le,Be,Se,We,re,Ge,M,C,A;return me.wrap(function(I){for(;;)switch(I.prev=I.next){case 0:return a.setMessage("选择二维多段线"),a.setKeyWords("[半径(R)]"),V=new ln,V.AddMcDbEntityTypes("LWPOLYLINE"),a.setFilter(V),I.next=7,a.go();case 7:if(Q=I.sent,a.getStatus()!==Lt.kCancel){I.next=10;break}return I.abrupt("return",{v:{v:void 0}});case 10:if(!a.isKeyWordPicked("R")){I.next=17;break}return I.next=13,r();case 13:if(I.t0=qt(I.sent),I.t0==="number"){I.next=16;break}return I.abrupt("return",{v:{v:void 0}});case 16:return I.abrupt("return",0);case 17:if(Q){I.next=19;break}return I.abrupt("return",{v:{v:void 0}});case 19:if(Q.isValid()){I.next=21;break}return I.abrupt("return",{v:{v:void 0}});case 21:if(Z=Q.getMcDbEntity(),Z instanceof st){I.next=24;break}return I.abrupt("return",{v:{v:void 0}});case 24:Y=Z.numVerts(),ee=0,le=0,Ee=[],Z.isClosed||Y--;case 29:if(!(ee<Y)){I.next=82;break}if(ee++,le>Y-1&&(le=0),j=Z.getPointAt(le),ce=j.val,ce){I.next=39;break}if(!n){I.next=38;break}return I.abrupt("return",1);case 38:return I.abrupt("return",{v:{v:void 0}});case 39:if(le++,le>Y-1&&(le=0),Ce=Z.getPointAt(le),Ae=Ce.val,Ae){I.next=48;break}if(!n){I.next=47;break}return I.abrupt("return",1);case 47:return I.abrupt("return",{v:{v:void 0}});case 48:if(le++,le>Y-1&&(le=0),ke=Z.getPointAt(le),Pe=ke.val,Pe){I.next=57;break}if(!n){I.next=56;break}return I.abrupt("return",1);case 56:return I.abrupt("return",{v:{v:void 0}});case 57:if(le=ee,Me=Bl(e,new pt(ce,Ae),new pt(Ae,Pe),Ae,!0,!1,t),Me){I.next=61;break}return I.abrupt("return",{v:{v:console.log("两直线平行")}});case 61:if(H=Me.arc,X=Me.segmentLine,xe=Me.bulge,X){I.next=64;break}return I.abrupt("return",{v:{v:void 0}});case 64:if(!t){I.next=78;break}if(_e=Z.getWidthsAt(ee),Le=_e.ret,Be=_e.val1,Se=_e.val2,Le){I.next=74;break}if(!Z.isClosed){I.next=73;break}if(We=Z.getWidthsAt(0),re=We.ret,Ge=We.val1,M=We.val2,re){I.next=71;break}return I.abrupt("continue",29);case 71:Ee.push({width:Ge,width1:M,bulge:xe,point:X.startPoint}),Ee.unshift({width:Ge,width1:M,bulge:Z.getBulgeAt(0),point:X.endPoint});case 73:return I.abrupt("continue",29);case 74:Ee.push({width:Be,width1:Se,bulge:xe,point:X.startPoint}),Ee.push({width:Be,width1:Se,bulge:Z.getBulgeAt(ee),point:X.endPoint}),I.next=80;break;case 78:Mu(H,Z),ne.getCurrentMxCAD().drawEntity(H);case 80:I.next=29;break;case 82:if(t){for(C=Z.numVerts(),A=0;A<C;A++)Z.removeVertexAt(0);Ee.forEach(function(te){var ae=te.point,ve=te.bulge,we=te.width,Te=te.width1;Z.addVertexAt(ae,ve,we,Te)})}if(!n){I.next=87;break}return I.abrupt("return",0);case 87:return I.abrupt("return",{v:{v:void 0}});case 88:case"end":return I.stop()}
图元无法用自身倒角`);return}var H=Q.IntersectWith(V,yn.Intersect.kOnBothOperands),X=H.isEmpty();if(!X){var xe=H.at(0);if((V.startPoint.isEqualTo(xe)||V.endPoint.isEqualTo(xe)||Q.startPoint.isEqualTo(xe)||Q.endPoint.isEqualTo(xe))&&e===0)return{apply:function(){}}}var _e=V.IntersectWith(Q,yn.Intersect.kExtendBoth);if(_e.isEmpty()){S(`
两直线平行`);return}var Le=_e.at(0),Be=function(We,re,Ge,M,C,A,G){var I=!1;return X?I=Math.max(Ge.distanceTo(Le),M.distanceTo(Le))<G&&G>0||Math.max(C.distanceTo(Le),A.distanceTo(Le))<G&&G>0:I=(We?Ge.distanceTo(Le):M.distanceTo(Le))<G&&G>0||(re?C.distanceTo(Le):A.distanceTo(Le))<G&&G>0,I&&S(`
倒角距离太大`),I};return Ee=function(){var We=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ee,re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:le,Ge=arguments.length>2&&arguments[2]!==void 0?arguments[2]:We.getHandle()===re.getHandle();if(We instanceof pt&&re instanceof pt){var M=yi(We.startPoint,We.endPoint,Le,d),C=yi(re.startPoint,re.endPoint,Le,Z),A=Bl(e,We,re,Le,M,C,t,qi);if(!A){S(`
直线平行`);return}var G=A.arc,I=A.chamferDist;return Be(M,C,We.startPoint,We.endPoint,re.startPoint,re.endPoint,I)?void 0:(G&&Y(G),!0)}var te=function(ve,we,Te,He,qe,ft){var bt=ve.numVerts();if(Ge||(ve.isClosed=!1),!!qe){var lt=qe.start,At=qe.end,dt=qe.endIndex,en=qe.startIndex,et=qe.isClosed,Je=[],$e=function(zt,Qn){var Gr=zt.getBulgeAt(Qn),Fi=zt.getPointAt(Qn).val,za=zt.getWidthsAt(Qn),pa=za.val1,Ur=za.val2;return{point:Fi,bulge:Gr,startWidth:pa,endWidth:Ur}},dn=yi(lt.clone(),At.clone(),Le,Te);if(we instanceof pt){if(Ge){S(`
同一条直线无法倒角`);return}var nn=yi(we.startPoint.clone(),we.endPoint.clone(),Le,He),Nt=we.clone(),Ut=Bl(e,new pt(lt.clone(),At.clone()),Nt,Le,dn,nn,t,qi);if(!Ut){S(`
直线平行`);return}var Gn=Ut.chamferDist,Hn=Ut.bulge,sn=Ut.segmentLine,Un=Ut.arc;if(Be(dn,nn,lt,At,we.startPoint,we.endPoint,Gn))return;if(dn){for(var Pn=et?ve.numVerts():dt,Er=0;Er<Pn;Er++)Je.push($e(ve,Er));sn?t?(Je.push({point:sn.startPoint,bulge:Hn}),Je.push({point:sn.endPoint})):Y(Un):Je.push({point:Le}),nn?Je.push({point:Nt.startPoint.clone()}):Je.push({point:Nt.endPoint.clone()})}else{var Rt=ve.numVerts();if(et)Je.push($e(ve,0));else for(var Gt=dt;Gt<Rt;Gt++)Je.push($e(ve,Gt));sn?t?(Je.unshift({point:sn.startPoint}),Je.unshift({point:sn.endPoint,bulge:-Hn})):Y(sn):Je.unshift({point:Le}),nn?Je.unshift({point:we.startPoint.clone()}):Je.unshift({point:we.endPoint.clone()})}}else if(we instanceof st&&ft){var vr=ft.start,Cr=ft.end,O=ft.startIndex,z=ft.endIndex,se=ft.isClosed,be=yi(vr,Cr,Le,He),Ie=Bl(e,new pt(lt,At),new pt(vr,Cr),Le,dn,be,t,qi);if(!Ie){S(`
直线平行`);return}var tt=Ie.arc,Ue=Ie.segmentLine,ot=Ie.bulge,ze=Ie.chamferDist;if(Be(dn,be,lt,At,vr,Cr,ze))return;if(Ge){var Ze=ve.numVerts(),Mt=we.numVerts(),It=(en===0||en===Ze-(et?1:2))&&(O===0||O===Mt-(se?1:2))&&Ze>(et||se?2:4),wt=O-en;if(It)return Ue?t?en===0||O===0?(en===0?(console.log("start1"),ve.setPointAt(0,Ue.startPoint),et||se?ve.addVertexAt(Ue.endPoint,-ot):(ve.setPointAt(Ze-1,Ue.endPoint),ve.setBulgeAt(Ze-1,ot))):(ve.setPointAt(0,Ue.endPoint),et||se?ve.addVertexAt(Ue.startPoint,ot):(ve.setPointAt(Ze-1,Ue.startPoint),ve.setBulgeAt(Ze-1,ot))),ve.isClosed=!0):t&&(ve.setPointAt(Ze-1,et?Ue.endPoint:Ue.startPoint),ve.setBulgeAt(Ze-1,et?-ot:ot),ve.addVertexAt(et?Ue.startPoint:Ue.endPoint)):Y(tt):t&&(ve.setPointAt(0,Le),ve.removeVertexAt(Ze-1),ve.isClosed=!0),!0;if(Math.abs(wt)>2){S(`
多段线中的直线必须是连续的 或被一条线段断开`);return}else we=we.clone()}if(!(we instanceof st))return;if(dn){for(var je=0;je<=en;je++)Je.push($e(ve,je));if(Ue?t?(Je.push({point:Ue.startPoint,bulge:ot}),Je.push({point:Ue.endPoint})):Y(tt):Je.push({point:Le}),be)for(var it=O;it>=0;it--)Je.push($e(we,it));else if(se)Je.push($e(we,0));else for(var on=we.numVerts(),Wt=z;Wt<on;Wt++)Je.push($e(we,Wt))}else{var jn=ve.numVerts();if(et)Je.push($e(ve,0));else for(var _t=dt;_t<jn;_t++)Je.push($e(ve,_t));if(Ue?t?(Je.unshift({point:Ue.startPoint}),Je.unshift({point:Ue.endPoint,bulge:-ot})):Y(tt):Je.unshift({point:Le}),be)for(var ht=O;ht>=0;ht--)Je.unshift($e(we,ht));else if(se)Je.unshift($e(we,0));else for(var _n=we.numVerts(),Yn=z;Yn<_n;Yn++)Je.unshift($e(we,Yn))}}else return!1;if(t){for(var Fn=0;Fn<bt;Fn++)ve.removeVertexAt(0);Je.forEach(function(mr){var zt=mr.point,Qn=mr.bulge,Gr=mr.startWidth,Fi=mr.endWidth;ve.addVertexAt(zt,Qn,Gr,Fi)}),we.erase()}return!0}};return We instanceof st&&w?te(We,re,d,Z,w,Ae):re instanceof st&&Ae?te(re,We,Z,d,Ae,w):!1},{apply:Ee,line1:V,line2:Q}}},E.setUserDraw(function(q,V){var Q=_.clone(),Z=Tt.findEntAtPoint(q.x,q.y,q.z,-1,y);if(!Z||!Z.isValid())return T();var Y=Z.getMcDbEntity();if(!Y)return T();var ee=Y?.clone();if(!ee)return T();var le=L(Q,ee,q,function(Pe){console.log(121),V.drawMcDbEntity(Pe)})||{},Ee=le.line1,j=le.line2,ce=le.apply,Ce=ce&&ce(Q,ee,_.getHandle()===Y.getHandle());if(Ee&&j&&Ce){Q.drawOrder=_.drawOrder+Y.drawOrder+102,Ee.drawOrder=_.drawOrder+Y.drawOrder+101,j.drawOrder=_.drawOrder+Y.drawOrder+101;var Ae=new THREE.Color(Number(_.trueColor.getColorValue(_.layerId))),ke=Ae.clone();t&&(_y(ke,.5),V.setColor(ke)),V.drawMcDbEntity(Ee),V.drawMcDbEntity(j),V.setColor(Ae),V.drawMcDbEntity(Q)}});case 80:return E.setMessage("选择第二条直线"),E.setKeyWords("[半径(R)]"),D.next=85,E.go();case 85:if(B=D.sent,!E.isKeyWordPicked("R")){D.next=93;break}return D.next=89,r();case 89:if(D.t2=qt(D.sent),D.t2==="number"){D.next=92;break}return D.abrupt("return",{v:void 0});case 92:return D.abrupt("continue",80);case 93:if(B){D.next=95;break}return D.abrupt("return",{v:T()});case 95:if(B.isValid()){D.next=97;break}return D.abrupt("return",{v:T()});case 97:if(k=B.getMcDbEntity(),k){D.next=100;break}return D.abrupt("return",{v:T()});case 100:if(R=_,F=E.pickPoint(),W=L(R,k,F)||{},K=W.line1,$=W.line2,U=W.apply,!(K&&$&&Ey(K,$))){D.next=106;break}return Ve.acutPrintf("共线直线不能为 倒圆角角。"),D.abrupt("return",{v:T()});case 106:if(!U){D.next=115;break}if(N=U(),!(n&&typeof N>"u")){D.next=112;break}return D.abrupt("continue",80);case 112:return D.abrupt("break",123);case 113:D.next=121;break;case 115:if(ne.App.MxCADAssist.MxFillet(h.id,B.id,d.x,d.y,F.x,F.y,e,t),!n){D.next=120;break}return D.abrupt("continue",80);case 120:return D.abrupt("break",123);case 121:D.next=80;break;case 123:if(T(),!n){D.next=128;break}return D.abrupt("return",0);case 128:return D.abrupt("return",1);case 129:case"end":return D.stop()}},f)});case 9:return c.delegateYield(o(),"t0",11);case 11:if(u=c.t0,u!==0){c.next=14;break}return c.abrupt("continue",9);case 14:if(u!==1){c.next=16;break}return c.abrupt("break",20);case 16:if(!u){c.next=18;break}return c.abrupt("return",u.v);case 18:c.next=9;break;case 20:case"end":return c.stop()}},i)})),Xp.apply(this,arguments)}var Zy=function(){var i=ut(me.mark(function e(){var t,n,r,a;return me.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:t=[];case 1:return n=new Yt,n.setMessage(t.length===0?"指定第一个栏选点":"指定下一个栏选点"),n.setKeyWords(t.length===0?"":"[放弃(U)]"),n.setUserDraw(function(u,l){var c=new st;t.forEach(function(f){c.addVertexAt(f)}),c.addVertexAt(u),l.drawMcDbEntity(c)}),o.next=8,n.go();case 8:if(r=o.sent,!n.isKeyWordPicked("U")){o.next=13;break}return a=t.pop(),a&&n.setLastInputPoint(a),o.abrupt("continue",1);case 13:if(n.getStatus()!==Lt.kCancel){o.next=15;break}return o.abrupt("return",!1);case 15:if(n.getStatus()!==Lt.kNone){o.next=17;break}return o.abrupt("break",22);case 17:if(r){o.next=19;break}return o.ab
指定第二个打断点`),f.setKeyWords("[第一点(F)/打断长度(D)/中点打断(M)/交点打断(I)]"),f.setUserDraw(function(W,K){var $=r?.clone();if($&&$ instanceof Jn){var U=[];U.push(a),U.push(W);var N=$.splitCurves(U);N.empty()||N.forEach(function(P,D){D%2==0&&K.drawMcDbEntity(P)})}}),F.next=6,f.go();case 6:if(h=F.sent,!f.isKeyWordPicked("F")){F.next=17;break}return f.setMessage("指定第一个打断点"),f.setKeyWords(""),F.next=12,f.go();case 12:if(p=F.sent,p){F.next=15;break}return F.abrupt("return",{v:void 0});case 15:return a=p,F.abrupt("return",0);case 17:if(m=!1,!f.isKeyWordPicked("D")){F.next=33;break}return v=new tn,v.setMessage("输入打断长度"),v.setKeyWords(""),F.next=24,v.go();case 24:if(g=F.sent,typeof g=="number"){F.next=27;break}return F.abrupt("return",{v:void 0});case 27:if(a=r.getStartPoint().val,d=r.getPointAtDist(g),y=d.val,b=d.ret,b){F.next=31;break}return F.abrupt("return",{v:Ve.acutPrintf(`
打断长度不正确`)});case 31:h=y,m=!0;case 33:if(!f.isKeyWordPicked("M")){F.next=40;break}if(a=r.getStartPoint().val,_=r.getPointAtDist(r.getLength().val/2),w=_.val,E=_.ret,E){F.next=38;break}return F.abrupt("return",{v:void 0});case 38:h=w,m=!0;case 40:if(!f.isKeyWordPicked("I")){F.next=56;break}return F.next=43,Tt.userSelect("选择相交曲线");case 43:if(x=F.sent,S=r.clone(),T=[],x.forEach(function(W){if(S instanceof Jn){var K=W.clone();if(K instanceof Jn){var $=S.IntersectWith(K,yn.Intersect.kOnBothOperands);$.isEmpty()||$.forEach(function(U){return T.push(U)})}}}),T.length!==0){F.next=49;break}return F.abrupt("return",{v:Ve.acutPrintf(`
交点为空`)});case 49:if(L=r.splitCurves(T),!L.empty()){F.next=53;break}return r.highlight(!1),F.abrupt("return",{v:void 0});case 53:return L.forEach(function(W){W instanceof cn&&(r&&Mu(W,r),ne.getCurrentMxCAD().drawEntity(W))}),r.erase(),F.abrupt("return",1);case 56:if(h){F.next=59;break}return r.highlight(!1),F.abrupt("return",{v:void 0});case 59:if(B=[],B.push(a),B.push(h),k=r.splitCurves(B),!k.empty()){F.next=66;break}return r.highlight(!1),F.abrupt("return",{v:void 0});case 66:return k.forEach(function(W,K){W instanceof cn&&(r&&Mu(W,r),(K%2==0||m)&&ne.getCurrentMxCAD().drawEntity(W))}),r.erase(),F.abrupt("return",1);case 69:case"end":return F.stop()}},c)});case 16:return l.delegateYield(s(),"t0",18);case 18:if(o=l.t0,o!==0){l.next=21;break}return l.abrupt("continue",16);case 21:if(o!==1){l.next=23;break}return l.abrupt("break",27);case 23:if(!o){l.next=25;break}return l.abrupt("return",o.v);case 25:l.next=16;break;case 27:case"end":return l.stop()}},i)})),Qp.apply(this,arguments)}function CC(){return ed.apply(this,arguments)}function ed(){return ed=ut(me.mark(function i(){var e,t,n;return me.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=new wr,a.next=3,e.userSelect(`
选择对象`);case 3:if(a.sent){a.next=5;break}return a.abrupt("return");case 5:t=ne.getCurrentDatabase().currentSpace.getMinMaxDrawOrder(),n=t.maxDrawOrder+1,e.forEach(function(s){var o=s.getMcDbEntity();o&&(o.drawOrder=n)});case 8:case"end":return a.stop()}},i)})),ed.apply(this,arguments)}function SC(){return td.apply(this,arguments)}function td(){return td=ut(me.mark(function i(){var e,t,n;return me.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return e=new wr,a.next=3,e.userSelect(`
选择对象`);case 3:if(a.sent){a.next=5;break}return a.abrupt("return");case 5:t=ne.getCurrentDatabase().currentSpace.getMinMaxDrawOrder(),n=t.minDrawOrder-1,e.forEach(function(s){var o=s.getMcDbEntity();o&&(o.drawOrder=n)});case 8:case"end":return a.stop()}},i)})),td.apply(this,arguments)}function AC(){return nd.apply(this,arguments)}function nd(){return nd=ut(me.mark(function i(){var e,t,n,r,a;return me.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return e=new wr,o.next=3,e.userSelect(`
选择对象`);case 3:if(o.sent){o.next=5;break}return o.abrupt("return");case 5:if(!e.isNull()){o.next=7;break}return o.abrupt("return");case 7:return t=new Ci,t.setMessage("选择参照对象"),o.next=11,t.go();case 11:if(n=o.sent,!n.isNull()){o.next=14;break}return o.abrupt("return");case 14:if(r=n.getMcDbEntity(),r){o.next=17;break}return o.abrupt("return");case 17:a=r.drawOrder+1,e.forEach(function(u){var l=u.getMcDbEntity();l&&(l.drawOrder=a)});case 19:case"end":return o.stop()}},i)})),nd.apply(this,arguments)}function xC(){return rd.apply(this,arguments)}function rd(){return rd=ut(me.mark(function i(){var e,t,n,r,a;return me.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return e=new wr,o.next=3,e.userSelect(`
选择对象`);case 3:if(o.sent){o.next=5;break}return o.abrupt("return");case 5:if(!e.isNull()){o.next=7;break}return o.abrupt("return");case 7:return t=new Ci,t.setMessage("选择参照对象"),o.next=11,t.go();case 11:if(n=o.sent,!n.isNull()){o.next=14;break}return o.abrupt("return");case 14:if(r=n.getMcDbEntity(),r){o.next=17;break}return o.abrupt("return");case 17:a=r.drawOrder-1,e.forEach(function(u){var l=u.getMcDbEntity();l&&(l.drawOrder=a)});case 19:case"end":return o.stop()}},i)})),rd.apply(this,arguments)}var Iu="mx_clip_file_data",TC=1;function Jy(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:TC;return new Promise(function(e,t){var n=indexedDB.open("mx_clipboard",i);n.onerror=function(r){t(new Error("Error opening database: "+r))},n.onupgradeneeded=function(r){var a=r.target.result;a.objectStoreNames.contains(Iu)?console.log("Object store mx_clip_file_data already exists."):(a.createObjectStore(Iu),console.log("Object store mx_clip_file_data created."))},n.onsuccess=function(r){var a=r.target.result;console.log("Database opened successfully."),e(a)}})}var mo="_mxcad_clipboard_file.mxweb";function $y(i){return id.apply(this,arguments)}function id(){return id=ut(me.mark(function i(e){var t,n,r,a,s,o,u,l,c;return me.wrap(function(h){for(;;)switch(h.prev=h.next){case 0:if(t=Tt.getCurrentSelect(null,!0,!1),t.length!=0){h.next=4;break}return Ve.acutPrintf(`
没有复制的对象`),h.abrupt("return");case 4:if(n=ne.getCurrentDatabase(),r=new xs,n.wblock(r,t)){h.next=9;break}return Ve.acutPrintf(`
复制失败`),h.abrupt("return");case 9:if(r.saveAs(mo)){h.next=12;break}return Ve.acutPrintf(`
保存复制数据失败`),h.abrupt("return");case 12:return e&&t.forEach(function(p){p.erase()}),a=window.MX_WASM_FS,s=a.readFile(mo),a.unlink(mo),h.next=18,Jy();case 18:o=h.sent,u=o.transaction(Iu,"readwrite"),l=u.objectStore(Iu),c=l.put(s,"data"),c.onsuccess=function(p){console.log("Data saved to IndexedDB"),console.log(p)},c.onerror=function(p){console.error("Error saving data:",p.target.errorCode),console.log(p)};case 24:case"end":return h.stop()}},i)})),id.apply(this,arguments)}function DC(){$y(!1)}function kC(){$y(!0)}function MC(){return ad.apply(this,arguments)}function ad(){return ad=ut(me.mark(function i(){var e,t,n,r,a,s,o,u,l,c,f,h;return me.wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return t=function(g,d){return new Promise(function(){var y=ut(me.mark(function b(_){var w,E,x,S;return me.wrap(function(L){for(;;)switch(L.prev=L.next){case 0:return L.next=2,Jy();case 2:w=L.sent,E=w.transaction(g,"readonly"),x=E.objectStore(g),S=x.get("data"),S.onerror=function(){_(void 0)},S.onsuccess=function(){var B=S.result,k=window.MX_WASM_FS;k.writeFile(d,B),_(!0)};case 8:case"end":return L.stop()}},b)}));return function(b){return y.apply(this,arguments)}}())},e=ne.getCurrentMxCAD(),m.next=4,t(Iu,mo);case 4:if(m.sent){m.next=7;break}return Ve.acutPrintf(`
得到复制数据失败`),m.abrupt("return");case 7:if(n=new xs,n.readFile(mo)){m.next=11;break}return Ve.acutPrintf(`
读取复制数据失败`),m.abrupt("return");case 11:if(r=window.MX_WASM_FS,r.unlink(mo),a=ne.getCurrentDatabase(),s=a.insert(n,""),!s.isNull()){m.next=17;break}return m.abrupt("return");case 17:return o=s.getMcDbBlockTableRecord(),o&&(u=o.getBoundingBox(),u.ret&&(o.origin=u.minPt.addvec(u.maxPt.sub(u.minPt).mult(.5)))),l=new Au,l.blockTableRecordId=s,c=new Yt,c.setMessage("指定插入基点"),c.setUserDraw(function(v,g){l.position=v,g.drawMcDbEntity(l)}),m.next=26,c.go();case 26:if(f=m.sent,f){m.next=29;break}return m.abrupt("return");case 29:if(l.position=f,h=e.drawEntity(l),h.isValid){m.next=34;break}return console.log("insert error"),m.abrupt("return");case 34:case"end":return m.stop()}},i)})),ad.apply(this,arguments)}Ve.on("init",function(){Ve.addCommand("Mx_Erase",Qv),Ve.addCommand("Mx_Copy",iC),Ve.addCommand("Mx_Move",aC),Ve.addCommand("Mx_Rotate",sC),Ve.addCommand("Mx_Scale",oC),Ve.addCommand("Mx_WindowZoom",uC),Ve.addCommand("Mx_ZoomE",lC),Ve.addCommand("Mx_Plan90CW",cC),Ve.addCommand("Mx_Offset",fC),Ve.addCommand("Mx_Regen",hC),Ve.addCommand("Mx_Mirror",pC),Ve.addCommand("Mx_Chamfer",mC),Ve.addCommand("Mx_Fillet",gC),Ve.addCommand("Mx_Trim",yC),Ve.addCommand("Mx_Extend",bC),Ve.addCommand("Mx_Explode",wC),Ve.addCommand("Mx_Join",_C),Ve.addCommand("Mx_Break",EC),Ve.addCommand("Mx_DrawOrderTopmost",CC),Ve.addCommand("Mx_DrawOrderButtomost",SC),Ve.addCommand("Mx_DrawOrderTop",AC),Ve.addCommand("Mx_DrawOrderButtom",xC),Ve.addCommand("Mx_CopyClipboard",DC),Ve.addCommand("Mx_PasteClipboard",MC),Ve.addCommand("Mx_CutClipboard",kC)});var sd=function(e,t){return[t.x>=e.x&&t.y>=e.y,t.x<e.x&&t.y>=e.y,t.x<e.x&&t.y<e.y,t.x>=e.x&&t.y<e.y]};function m0(i,e,t){if(e===0&&t===0)return i;var n=ci(i,4),r=n[0],a=n[1],s=n[2],o=n[3],u=r.distanceTo(o),l=r.distanceTo(a),c=sd(r,s),f=ci(c,4);f[0];var h=f[1],p=f[2],m=f[3],v=h||p?-e:e,g=p||m?-t:t;if(u-Math.abs(v)*2<=0||l-Math.abs(g)*2<=0)return i;var d=new fe(r.x+v,r.y,r.z),y=new fe(r.x,r.y+g,r.z),b=new fe(a.x,a.y-g,a.z),_=new fe(a.x+v,a.y,a.z),w=new fe(s.x-v,s.y,s.z),E=new fe(s.x,a.y-g,s.z),x=new fe(o.x,o.y+g,o.z),S=new fe(o.x-v,o.y,o.z),T=[d,y,b,_,w,E,x,S];return T}var g0=function(e,t,n){var r=Math.cos(n),a=Math.sin(n),s=t.x-e.x,o=t.y-e.y,u=s*r-o*a+e.x,l=s*a+o*r+e.y,c=t.z;return new fe(u,l,c)},Rh=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=new fe((e.x+t.x)/2,(e.y+t.y)/2,(e.z+t.z)/2),a=new fe(e.x,t.y,e.z),s=new fe(t.x,e.y,t.z),o=g0(r,a,n),u=g0(r,s,n);return[e,o,t,u]},em=function(){var i=ut(me.mark(function e(){var t,n,r,a,s,o,u,l,c,f,h,p,m,v;return me.wrap(function(d){for(;;)switch(d.prev=d.next){case 0:t=new Yt,n=0,r=0,a=0,s=0,o=0,u=0,l=200,c=0,f=0,h=0,p="default",m=me.mark(function y(){var b,_,w,E,x,S,T,L;return me.wrap(function(k){for(;;)switch(k.prev=k.next){case 0:return b=function(){var R=ut(me.mark(function F(W,K){var $,U;return me.wrap(function(P){for(;;)switch(P.prev=P.next){case 0:return $=new tn,$.setMessage(Pt(W,K)),P.next=4,$.go();case 4:if(U=P.sent,U){P.next=7;break}throw"error getLength";case 7:return P.abrupt("return",$.value());case 8:case"end":return P.stop()}},F)}));return function(W,K){return R.apply(this,arguments)}}(),t.setUserDraw(function(){}),t.clearLastInputPoint(),t.setMessage(`
指定第一个角点`),t.setKeyWords("[倒角(C)/标高(E)/圆角(F)/厚度(T)/宽度(W)]"),k.next=7,t.go();case 7:if(_=k.sent,E=new st,k.prev=9,!t.isKeyWordPicked("C")){k.next=19;break}return k.next=13,b("ID_ARX_RECTANG_CHAMFEr1LENGTH",`
指定第一个倒角距离:`);case 13:return n=k.sent,k.next=16,b("ID_ARX_RECTANG_CHAMFEr2LENGTH",`
指定第二个倒角距离`);case 16:return r=k.sent,p="chamfer",k.abrupt("return",0);case 19:if(!t.isKeyWordPicked("E")){k.next=24;break}return k.next=22,b("ID_ARX_RECTANG_ELEVATION",`
指定矩形的标高`);case 22:return a=k.sent,k.abrupt("return",0);case 24:if(!t.isKeyWordPicked("F")){k.next=30;break}return k.next=27,b("ID_ARX_RECTANG_RADIUS",`
指定矩形的圆角半径`);case 27:return s=k.sent,p="angleRounded",k.abrupt("return",0);case 30:if(!t.isKeyWordPicked("T")){k.next=35;break}return k.next=33,b("ID_ARX_RECTANG_THICKNESS",`
指定矩形的厚度`);case 33:return o=k.sent,k.abrupt("return",0);case 35:if(!t.isKeyWordPicked("W")){k.next=40;break}return k.next=38,b("ID_ARX_RECTANG_WIDTH",`
指定矩形的线宽`);case 38:return u=k.sent,k.abrupt("return",0);case 40:k.next=45;break;case 42:return k.prev=42,k.t0=k.catch(9),k.abrupt("return",1);case 45:if(_){k.next=47;break}return k.abrupt("return",{v:void 0});case 47:return x=function(F,W){var K=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;E=new st,F.z=W.z=o;var $=Rh(F,W,K),U=new fe((F.x+W.x)/2,(F.y+W.y)/2,(F.z+W.z)/2),N=$;if(p==="chamfer"&&(N=m0(Rh(F,W),n,r)),p==="angleRounded"&&s!==0){N=m0(Rh(F,W),s,s);var P=sd(F,W),D=ci(P,4);D[0];var q=D[1],V=D[2],Q=D[3];if(N.length===8){var Z=function(ce,Ce,Ae){var ke=new at(Ae),Pe=ls(ce,Ce,ke);E.addVertexAt(ce,Pe),E.addVertexAt(Ce,0)},Y=new at(-1,0),ee=new at(0,1),le=new at(1,0),Ee=new at(0,-1);Q&&(ee.y=-1,le.x=1,Ee.y=1),q&&(Y.x=1,ee.y=1,le.x=-1,Ee.y=-1),V&&(Y.x=1,ee.y=-1,le.x=-1,Ee.y=1),Z(N[0],N[1],Y),Z(N[2],N[3],ee),Z(N[4],N[5],le),Z(N[6],N[7],Ee)}else N.forEach(function(j){E.addVertexAt(j,0)})}else N.forEach(function(j){E.addVertexAt(j,0,u,u)});return(p==="chamfer"||p==="angleRounded")&&E.rotate(U,K),E.isClosed=!0,E.constantWidth=u,w=W,E},S=function(F,W){if(_){var K=_,$=F;E=x(K,$,h),W.drawMcDbEntity(E)}},t.setUserDraw(S),T=function(){var R=ut(me.mark(function F(){var W,K,$,U,N,P,D,q,V,Q,Z;return me.wrap(function(ee){for(;;)switch(ee.prev=ee.next){case 0:return t.setMessage(`
指定另一个角点`),t.setKeyWords("[面积(A)/尺寸(D)/旋转(R)]"),ee.next=4,t.go();case 4:if(W=ee.sent,K=function(Ee,j){var ce=sd(_,Ee),Ce=ci(ce,4),Ae=Ce[0],ke=Ce[1],Pe=Ce[2],Me=Ce[3];Ae&&(W=new fe(_.x+c,_.y+f,o)),ke&&(W=new fe(_.x-c,_.y+f,o)),Pe&&(W=new fe(_.x-c,_.y-f,o)),Me&&(W=new fe(_.x+c,_.y-f,o)),W&&(E=x(_,W,h),j.drawMcDbEntity(E))},!t.isKeyWordPicked("A")){ee.next=40;break}return t.setUserDraw(function(){}),$=new $f,$.setMessage("输入当前单位计算的矩形面积<"+l+">"),ee.next=12,$.go();case 12:if(U=ee.sent,U){ee.next=15;break}return ee.abrupt("return");case 15:return l=U,N=new li,N.setMessage("计算矩形标注时的依据"),N.setKeyWords("[长度(L)/宽度(W)]"),ee.next=21,N.go();case 21:if(P=ee.sent,P!==null){ee.next=24;break}return ee.abrupt("return");case 24:if(P!=="w"){ee.next=31;break}return ee.next=27,b("ID_ARX_RECTANG_AREA_WIDTH","输入矩形宽度");case 27:c=ee.sent,f=l/c,ee.next=35;break;case 31:return ee.next=33,b("ID_ARX_RECTANG_AREA_LENGTH","输入矩形长度");case 33:f=ee.sent,c=l/f;case 35:W=new fe(_.x+c,_.y+f,o),E=x(_,W,h),ne.getCurrentMxCAD().drawEntity(E,!0),ee.next=98;break;case 40:if(!t.isKeyWordPicked("D")){ee.next=62;break}return ee.prev=41,ee.next=44,b("ID_ARX_RECTANG_AREA_WIDTH","指定矩形宽度");case 44:return c=ee.sent,ee.next=47,b("ID_ARX_RECTANG_AREA_LENGTH","指定矩形宽度");case 47:f=ee.sent,ee.next=53;break;case 50:return ee.prev=50,ee.t0=ee.catch(41),ee.abrupt("return");case 53:return t.clearLastInputPoint(),t.setUserDraw(K),ee.next=57,T();case 57:if(D=ee.sent,!(typeof D>"u")){ee.next=60;break}return ee.abrupt("return");case 60:ee.next=98;break;case 62:if(!t.isKeyWordPicked("R")){ee.next=97;break}return t.setMessage(`
指定旋转角度`),t.setKeyWords("[拾取点(P)]"),t.setUserDraw(function(le,Ee){h=Dn(le.x,le.y,_.x,_.y),E=x(_,w),E.rotate(_,h),Ee.drawMcDbEntity(E)}),ee.next=68,t.go();case 68:if(q=ee.sent,!t.isKeyWordPicked("P")){ee.next=87;break}return t.clearLastInputPoint(),t.setUserDraw(function(){}),t.setMessage(`
指定第一个点`),ee.next=75,t.go();case 75:if(V=ee.sent,V){ee.next=78;break}return ee.abrupt("return");case 78:return t.setUserDraw(function(le,Ee){Ee.drawLine(le.toVector3(),V.toVector3())}),ee.next=81,t.go();case 81:if(Q=ee.sent,Q){ee.next=84;break}return ee.abrupt("return");case 84:h=Dn(V.x,V.y,Q.x,Q.y),ee.next=89;break;case 87:if(q){ee.next=89;break}return ee.abrupt("return");case 89:return t.setUserDraw(S),ee.next=92,T();case 92:if(Z=ee.sent,!(typeof Z>"u")){ee.next=95;break}return ee.abrupt("return");case 95:ee.next=98;break;case 97:W&&ne.getCurrentMxCAD().drawEntity(E,!0);case 98:E.setxDataDouble("BG",a);case 99:case"end":return ee.stop()}},F,null,[[41,50]])}));return function(){return R.apply(this,arguments)}}(),k.next=53,T();case 53:if(L=k.sent,!(typeof L>"u")){k.next=56;break}return k.abrupt("return",1);case 56:case"end":return k.stop()}},y,null,[[9,42]])});case 13:return d.delegateYield(m(),"t0",15);case 15:if(v=d.t0,v!==0){d.next=18;break}return d.abrupt("continue",13);case 18:if(v!==1){d.next=20;break}return d.abrupt("break",24);case 20:if(!v){d.next=22;break}return d.abrupt("return",v.v);case 22:d.next=13;break;case 24:case"end":return d.stop()}},e)}));return function(){return i.apply(this,arguments)}}();Ve.on("init",function(){Ve.addCommand("Mx_Rectang",em)});var Co;(function(i){(function(e){e[e.Enum_COMPOUND=0]="Enum_COMPOUND",e[e.Enum_COMPSOLID=1]="Enum_COMPSOLID",e[e.Enum_SOLID=2]="Enum_SOLID",e[e.Enum_SHELL=3]="Enum_SHELL",e[e.Enum_FACE=4]="Enum_FACE",e[e.Enum_WIRE=5]="Enum_WIRE",e[e.Enum_EDGE=6]="Enum_EDGE",e[e.Enum_VERTEX=7]="Enum_VERTEX",e[e.Enum_SHAPE=8]="Enum_SHAPE"})(i.MxShapeEnum||(i.MxShapeEnum={})),function(e){e[e.HTA_LEFT=0]="HTA_LEFT",e[e.HTA_CENTER=1]="HTA_CENTER",e[e.HTA_RIGHT=2]="HTA_RIGHT"}(i.MxHorizontalTextAlignment||(i.MxHorizontalTextAlignment={})),function(e){e[e.CVTA_BOTTOM=0]="CVTA_BOTTOM",e[e.CVTA_CENTER=1]="CVTA_CENTER",e[e.CVTA_TOP=2]="CVTA_TOP",e[e.CVTA_TOPFIRSTLINE=3]="CVTA_TOPFIRSTLINE"}(i.MxVerticalTextAlignment||(i.MxVerticalTextAlignment={})),function(e){e[e.FA_UNDEFINED=-1]="FA_UNDEFINED",e[e.FA_Regular=0]="FA_Regular",e[e.FA_Bold=1]="FA_Bold",e[e.FA_Italic=2]="FA_Italic",e[e.FA_BoldItalic=3]="FA_BoldItalic"}(i.MxFontAspect||(i.MxFontAspect={})),function(e){e[e.TODT_NORMAL=0]="TODT_NORMAL",e[e.TODT_SUBTITLE=1]="TODT_SUBTITLE",e[e.TODT_DEKALE=2]="TODT_DEKALE",e[e.TODT_BLEND=3]="TODT_BLEND",e[e.TODT_DIMENSION=4]="TODT_DIMENSION",e[e.TODT_SHADOW=5]="TODT_SHADOW"}(i.MxTypeOfDisplayText||(i.MxTypeOfDisplayText={})),function(e){e[e.Enum_Rational=0]="Enum_Rational",e[e.Enum_QuasiAngular=1]="Enum_QuasiAngular",e[e.Enum_Polynomial=2]="Enum_Polynomial"}(i.MxCF3dFilletShapeEnum||(i.MxCF3dFilletShapeEnum={})),function(e){e[e.Enum_ClassicChamfer=0]="Enum_ClassicChamfer",e[e.Enum_ConstThroatChamfer=1]="Enum_ConstThroatChamfer",e[e.Enum_ConstThroatWithPenetrationChamfer=2]="Enum_ConstThroatWithPenetrationChamfer"}(i.MxCFDSChamfMode||(i.MxCFDSChamfMode={})),function(e){e[e.GF_IsCorrectedFrenet=0]="GF_IsCorrectedFrenet",e[e.GF_IsFixed=1]="GF_IsFixed",e[e.GF_IsFrenet=2]="GF_IsFrenet",e[e.GF_IsConstantNormal=3]="GF_IsConstantNormal",e[e.GF_IsDarboux=4]="GF_IsDarboux",e[e.GF_IsGuideAC=5]="GF_IsGuideAC",e[e.GF_IsGuidePlan=6]="GF_IsGuidePlan",e[e.GF_IsGuideACWithContact=7]="GF_IsGuideACWithContact",e[e.GF_IsGuidePlanWithContact=8]="GF_IsGuidePlanWithContact",e[e.GF_IsDiscreteTrihedron=9]="GF_IsDiscreteTrihedron"}(i.MxGFTrihedron||(i.MxGFTrihedron={})),function(e){e[e.GA_C0=0]="GA_C0",e[e.GA_G1=1]="GA_G1",e[e.GA_C1=2]="GA_C1",e[e.GA_G2=3]="GA_G2",e[e.GA_C2=4]="GA_C2",e[e.GA_C3=5]="GA_C3",e[e.GA_CN=6]="GA_CN"}(i.MxGAShapeEnum||(i.MxGAShapeEnum={})),function(e){e[e.Offset_Skin=0]="Offset_Skin",e[e.Offset_Pipe=1]="Offset_Pipe",e[e.Offset_RectoVerso=2]="Offset_RectoVerso"}(i.MxOffsetModeEnum||(i.MxOffsetModeEnum={})),function(e){e[e.GA_Arc=0]="GA_Arc",e[e.GA_Tangent=1]="GA_Tangent",e[e.GA_Intersection=2]="GA_Intersection"}(i.MxGAJoinTypeEnum||(i.MxGAJoinTypeEnum={})),function(e){e[e.Material_NOM_Brass=0]="Material_NOM_Brass",e[e.Material_NOM_Bronze=1]="Material_NOM_Bronze",e[e.Material_NOM_Co
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,s=!1,o;return{s:function(){t=t.call(i)},n:function(){var l=t.next();return a=l.done,l},e:function(l){s=!0,o=l},f:function(){try{!a&&t.return!=null&&t.return()}finally{if(s)throw o}}}}function zC(i,e){if(i){if(typeof i=="string")return w0(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return w0(i,e)}}function w0(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=i[t];return n}Object.freeze=function(i){return i};var HC=Object.create||function(){function i(){}return function(e){return i.prototype=e,new i}}();function jC(i,e){i.hasOwnProperty("options")||(i.options=i.options?HC(i.options):{});for(var t in e)i.options[t]=e[t]||i.options[t];return i.options}var YC=/\{ *([\w_-]+) *\}/g;function KC(i,e){return i.replace(YC,function(t,n){var r=e[n];if(r===void 0)throw new Error("No value provided for variable "+t);return typeof r=="function"&&(r=r(e)),r})}var fh=Array.isArray||function(i){return Object.prototype.toString.call(i)==="[object Array]"},hn=3.141592653589793,ef=6378245,tf=.006693421622965943,nf=hn*3e3/180;function Lh(i,e,t){var n=hn/180*e,r=Math.pow(2,t),a=parseInt((i+180)/360*r),s=parseInt((1-Math.asinh(Math.tan(n))/hn)/2*r);return[a,s]}function XC(i,e,t){var n=Math.pow(2,t),r=i/n*360-180,a=Math.atan(Math.sinh(hn*(1-2*e/n))),s=a*180/hn;return[r,s]}function qC(i,e){if(fh(i)){var t=i[0];e=i[1],i=t}if(i instanceof Object){var t=i.lng;e=i.lat,i=t}var n=JC(i,e),r=ib(n.lng,n.lat);return r}function _0(i,e){if(fh(i)){var t=i[0];e=i[1],i=t}if(i instanceof Object){var t=i.lng;e=i.lat,i=t}var n=ud(i,e),r=ZC(n.lng,n.lat);return r}function ud(i,e){if(fh(i)){var t=i[0];e=i[1],i=t}if(i instanceof Object){var t=i.lng;e=i.lat,i=t}var n=ab(i-105,e-35),r=sb(i-105,e-35),a=e/180*hn,s=Math.sin(a);s=1-tf*s*s;var o=Math.sqrt(s);n=n*180/(ef*(1-tf)/(s*o)*hn),r=r*180/(ef/o*Math.cos(a)*hn);var u=e+n,l=i+r,c={lng:l,lat:u};return c}function ib(i,e){if(fh(i)){var t=i[0];e=i[1],i=t}if(i instanceof Object){var t=i.lng;e=i.lat,i=t}var n=$C(i,e),r=i*2-n.lng,a=e*2-n.lat,s={lng:r,lat:a};return s}function ZC(i,e){var t=Math.sqrt(i*i+e*e)+2e-5*Math.sin(e*nf),n=Math.atan2(e,i)+3e-6*Math.cos(i*nf),r=t*Math.cos(n)+.0065,a=t*Math.sin(n)+.006,s={lng:r,lat:a};return s}function JC(i,e){var t=i-.0065,n=e-.006,r=Math.sqrt(t*t+n*n)-2e-5*Math.sin(n*nf),a=Math.atan2(n,t)-3e-6*Math.cos(t*nf),s=r*Math.cos(a),o=r*Math.sin(a),u={lng:s,lat:o};return u}function $C(i,e){var t=ab(i-105,e-35),n=sb(i-105,e-35),r=e/180*hn,a=Math.sin(r);a=1-tf*a*a;var s=Math.sqrt(a);t=t*180/(ef*(1-tf)/(a*s)*hn),n=n*180/(ef/s*Math.cos(r)*hn);var o=e+t,u=i+n,l={lng:u,lat:o};return l}function ab(i,e){var t=-100+2*i+3*e+.2*e*e+.1*i*e+.2*Math.sqrt(Math.abs(i));return t+=(20*Math.sin(6*i*hn)+20*Math.sin(2*i*hn))*2/3,t+=(20*Math.sin(e*hn)+40*Math.sin(e/3*hn))*2/3,t+=(160*Math.sin(e/12*hn)+320*Math.sin(e*hn/30))*2/3,t}function sb(i,e){var t=300+i+2*e+.1*i*i+.1*i*e+.1*Math.sqrt(Math.abs(i));return t+=(20*Math.sin(6*i*hn)+20*Math.sin(2*i*hn))*2/3,t+=(20*Math.sin(i*hn)+40*Math.sin(i/3*hn))*2/3,t+=(150*Math.sin(i/12*hn)+300*Math.sin(i/30*hn))*2/3,t}function ob(i,e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);return i}function QC(i,e){for(var t in e)i[t]=e[t]}function E0(i){return typeof i=="string"}var C0=void 0,Vl=null;function zr(i,e){isNaN(i)&&(i=Ib(i),i=isNaN(i)?0:i),E0(i)&&(i=parseFloat(i)),isNaN(e)&&(e=Ib(e),e=isNaN(e)?0:e),E0(e)&&(e=parseFloat(e)),this.lng=i,this.lat=e}zr.TL=function(i){return i&&180>=i.lng&&-180<=i.lng&&74>=i.lat&&-74<=i.lat};zr.prototype.lb=function(i){return i&&this.lat==i.lat&&this.lng==i.lng};function rf(i,e){this.x=i||0,this.y=e||0,this.x=this.x,this.y=this.y}rf.prototype.lb=function(i){return i&&i.x==this.x&&i.y==this.y};function cm(){}cm.prototype.nh=function(){aa("lngLatToPoint方法未实现")};cm.prototype.wi=function(){aa("pointToLngLat方法未实现")};function Xi(){}Xi
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yr(i,e){return i2(i)||a2(i,e)||s2(i,e)||o2()}var nr=1e-6,xo=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var i=0,e=arguments.length;e--;)i+=arguments[e]*arguments[e];return Math.sqrt(i)});function u2(){var i=new xo(4);return xo!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0,i[3]=0),i}function l2(i,e,t){return i[0]=e[0]*t,i[1]=e[1]*t,i[2]=e[2]*t,i[3]=e[3]*t,i}function cb(i,e,t){var n=e[0],r=e[1],a=e[2],s=e[3];return i[0]=t[0]*n+t[4]*r+t[8]*a+t[12]*s,i[1]=t[1]*n+t[5]*r+t[9]*a+t[13]*s,i[2]=t[2]*n+t[6]*r+t[10]*a+t[14]*s,i[3]=t[3]*n+t[7]*r+t[11]*a+t[15]*s,i}(function(){var i=u2();return function(e,t,n,r,a,s){var o,u;for(t||(t=4),n||(n=0),r?u=Math.min(r*t+n,e.length):u=e.length,o=n;o<u;o+=t)i[0]=e[o],i[1]=e[o+1],i[2]=e[o+2],i[3]=e[o+3],a(i,i,s),e[o]=i[0],e[o+1]=i[1],e[o+2]=i[2],e[o+3]=i[3];return e}})();function yu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Tc(i,e){var t=cb([],e,i);return l2(t,t,1/t[3]),t}function c2(i,e){var t=e[0],n=e[1],r=e[2],a=e[3],s=e[4],o=e[5],u=e[6],l=e[7],c=e[8],f=e[9],h=e[10],p=e[11],m=e[12],v=e[13],g=e[14],d=e[15],y=t*o-n*s,b=t*u-r*s,_=t*l-a*s,w=n*u-r*o,E=n*l-a*o,x=r*l-a*u,S=c*v-f*m,T=c*g-h*m,L=c*d-p*m,B=f*g-h*v,k=f*d-p*v,R=h*d-p*g,F=y*R-b*k+_*B+w*L-E*T+x*S;return F?(F=1/F,i[0]=(o*R-u*k+l*B)*F,i[1]=(r*k-n*R-a*B)*F,i[2]=(v*x-g*E+d*w)*F,i[3]=(h*E-f*x-p*w)*F,i[4]=(u*L-s*R-l*T)*F,i[5]=(t*R-r*L+a*T)*F,i[6]=(g*_-m*x-d*b)*F,i[7]=(c*x-h*_+p*b)*F,i[8]=(s*k-o*L+l*S)*F,i[9]=(n*L-t*k-a*S)*F,i[10]=(m*E-v*_+d*y)*F,i[11]=(f*_-c*E-p*y)*F,i[12]=(o*T-s*B-u*S)*F,i[13]=(t*B-n*T+r*S)*F,i[14]=(v*b-m*w-g*y)*F,i[15]=(c*w-f*b+h*y)*F,i):null}function bu(i,e,t){var n=e[0],r=e[1],a=e[2],s=e[3],o=e[4],u=e[5],l=e[6],c=e[7],f=e[8],h=e[9],p=e[10],m=e[11],v=e[12],g=e[13],d=e[14],y=e[15],b=t[0],_=t[1],w=t[2],E=t[3];return i[0]=b*n+_*o+w*f+E*v,i[1]=b*r+_*u+w*h+E*g,i[2]=b*a+_*l+w*p+E*d,i[3]=b*s+_*c+w*m+E*y,b=t[4],_=t[5],w=t[6],E=t[7],i[4]=b*n+_*o+w*f+E*v,i[5]=b*r+_*u+w*h+E*g,i[6]=b*a+_*l+w*p+E*d,i[7]=b*s+_*c+w*m+E*y,b=t[8],_=t[9],w=t[10],E=t[11],i[8]=b*n+_*o+w*f+E*v,i[9]=b*r+_*u+w*h+E*g,i[10]=b*a+_*l+w*p+E*d,i[11]=b*s+_*c+w*m+E*y,b=t[12],_=t[13],w=t[14],E=t[15],i[12]=b*n+_*o+w*f+E*v,i[13]=b*r+_*u+w*h+E*g,i[14]=b*a+_*l+w*p+E*d,i[15]=b*s+_*c+w*m+E*y,i}function hd(i,e,t){var n=t[0],r=t[1],a=t[2],s,o,u,l,c,f,h,p,m,v,g,d;return e===i?(i[12]=e[0]*n+e[4]*r+e[8]*a+e[12],i[13]=e[1]*n+e[5]*r+e[9]*a+e[13],i[14]=e[2]*n+e[6]*r+e[10]*a+e[14],i[15]=e[3]*n+e[7]*r+e[11]*a+e[15]):(s=e[0],o=e[1],u=e[2],l=e[3],c=e[4],f=e[5],h=e[6],p=e[7],m=e[8],v=e[9],g=e[10],d=e[11],i[0]=s,i[1]=o,i[2]=u,i[3]=l,i[4]=c,i[5]=f,i[6]=h,i[7]=p,i[8]=m,i[9]=v,i[10]=g,i[11]=d,i[12]=s*n+c*r+m*a+e[12],i[13]=o*n+f*r+v*a+e[13],i[14]=u*n+h*r+g*a+e[14],i[15]=l*n+p*r+d*a+e[15]),i}function pd(i,e,t){var n=t[0],r=t[1],a=t[2];return i[0]=e[0]*n,i[1]=e[1]*n,i[2]=e[2]*n,i[3]=e[3]*n,i[4]=e[4]*r,i[5]=e[5]*r,i[6]=e[6]*r,i[7]=e[7]*r,i[8]=e[8]*a,i[9]=e[9]*a,i[10]=e[10]*a,i[11]=e[11]*a,i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i}function f2(i,e,t){var n=Math.sin(t),r=Math.cos(t),a=e[4],s=e[5],o=e[6],u=e[7],l=e[8],c=e[9],f=e[10],h=e[11];return e!==i&&(i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[4]=a*r+l*n,i[5]=s*r+c*n,i[6]=o*r+f*n,i[7]=u*r+h*n,i[8]=l*r-a*n,i[9]=c*r-s*n,i[10]=f*r-o*n,i[11]=h*r-u*n,i}function h2(i,e,t){var n=Math.sin(t),r=Math.cos(t),a=e[0],s=e[1],o=e[2],u=e[3],l=e[4],c=e[5],f=e[6],h=e[7];return e!==i&&(i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]),i[0]=a*r+l*n,i[1]=s*r+c*n,i[2]=o*r+f*n,i[3]=u*r+h*n,i[4]=l*r-a*n,i[5]=c*r-s*n,i[6]=f*r-o*n,i[7]=h*r-u*n,i}function p2(i,e,t,n,r){var a=1/Math.tan(e/2),s;return i[0]=a/t,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=a,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,r!=null&&r!==1/0?(s=1/(n-r),i[10]=(r+n)*s,i[14]=2*r*n*s):(i[10]=-1,i[14]=-2*n),i}var d2=p2;function A0(i,e){var t=i[0],n=i[1],r=i[2],a=i[3],s=i[4],o=i[5],u=i[6],l=i[7],c=i[8],f=i[9],h=i[10],p=i[11],m=i[12],v=i[13],g=i[14],d=i[15],y=e[0],b=e[1],_=e[2],w=
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,dA=`void main() {
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;function br(i){mt.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=pA,this.fragmentShader=dA,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,i!==void 0&&(i.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(i))}br.prototype=Object.create(mt.prototype);br.prototype.constructor=br;br.prototype.isShaderMaterial=!0;br.prototype.copy=function(i){return mt.prototype.copy.call(this,i),this.fragmentShader=i.fragmentShader,this.vertexShader=i.vertexShader,this.uniforms=Do(i.uniforms),this.defines=Object.assign({},i.defines),this.wireframe=i.wireframe,this.wireframeLinewidth=i.wireframeLinewidth,this.lights=i.lights,this.clipping=i.clipping,this.skinning=i.skinning,this.morphTargets=i.morphTargets,this.morphNormals=i.morphNormals,this.extensions=i.extensions,this};br.prototype.toJSON=function(i){var e=mt.prototype.toJSON.call(this,i);e.uniforms={};for(var t in this.uniforms){var n=this.uniforms[t],r=n.value;r&&r.isTexture?e.uniforms[t]={type:"t",value:r.toJSON(i).uuid}:r&&r.isColor?e.uniforms[t]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[t]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[t]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[t]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[t]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[t]={type:"m4",value:r.toArray()}:e.uniforms[t]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;var a={};for(var s in this.extensions)this.extensions[s]===!0&&(a[s]=!0);return Object.keys(a).length>0&&(e.extensions=a),e};function Qi(){Xe.call(this),this.type="Camera",this.matrixWorldInverse=new Ft,this.projectionMatrix=new Ft,this.projectionMatrixInverse=new Ft}Qi.prototype=Object.assign(Object.create(Xe.prototype),{constructor:Qi,isCamera:!0,copy:function(e,t){return Xe.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new J),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Xe.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},updateWorldMatrix:function(e,t){Xe.prototype.updateWorldMatrix.call(this,e,t),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}});function On(i,e,t,n){Qi.call(this),this.type="PerspectiveCamera",this.fov=i!==void 0?i:50,this.zoom=1,this.near=t!==void 0?t:.1,this.far=n!==void 0?n:2e3,this.focus=10,this.aspect=e!==void 0?e:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}On.prototype=Object.assign(Object.create(Qi.prototype),{constructor:On,isPerspectiveCamera:!0,copy:function(e,t){return Qi.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=kt.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(kt.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return kt.RAD2DEG*2*Math.atan(Math.tan(kt.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.as
`),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {"," vec3 direction = normalize( vWorldDirection );"," vec2 sampleUV;"," sampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;"," sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;"," gl_FragColor = texture2D( tEquirect, sampleUV );","}"].join(`
`)},r=new br({type:"CubemapFromEquirect",uniforms:Do(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Vn,blending:ka});r.uniforms.tEquirect.value=e;var a=new pn(new mh(5,5,5),r);t.add(a);var s=new Nu(1,10,1);return s.renderTarget=this,s.renderTarget.texture.name="CubeCameraTexture",s.update(i,t),a.geometry.dispose(),a.material.dispose(),this};function Mo(i,e,t,n,r,a,s,o,u,l,c,f){Qt.call(this,null,a,s,o,u,l,n,r,c,f),this.image={data:i||null,width:e||1,height:t||1},this.magFilter=u!==void 0?u:kn,this.minFilter=l!==void 0?l:kn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Mo.prototype=Object.create(Qt.prototype);Mo.prototype.constructor=Mo;Mo.prototype.isDataTexture=!0;var Zs=new Wa,nc=new J;function Al(i,e,t,n,r,a){this.planes=[i!==void 0?i:new mi,e!==void 0?e:new mi,t!==void 0?t:new mi,n!==void 0?n:new mi,r!==void 0?r:new mi,a!==void 0?a:new mi]}Object.assign(Al.prototype,{set:function(e,t,n,r,a,s){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(a),o[5].copy(s),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromProjectionMatrix:function(e){var t=this.planes,n=e.elements,r=n[0],a=n[1],s=n[2],o=n[3],u=n[4],l=n[5],c=n[6],f=n[7],h=n[8],p=n[9],m=n[10],v=n[11],g=n[12],d=n[13],y=n[14],b=n[15];return t[0].setComponents(o-r,f-u,v-h,b-g).normalize(),t[1].setComponents(o+r,f+u,v+h,b+g).normalize(),t[2].setComponents(o+a,f+l,v+p,b+d).normalize(),t[3].setComponents(o-a,f-l,v-p,b-d).normalize(),t[4].setComponents(o-s,f-c,v-m,b-y).normalize(),t[5].setComponents(o+s,f+c,v+m,b+y).normalize(),this},intersectsObject:function(e){var t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Zs.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Zs)},intersectsSprite:function(e){return Zs.center.set(0,0,0),Zs.radius=.7071067811865476,Zs.applyMatrix4(e.matrixWorld),this.intersectsSphere(Zs)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,r=-e.radius,a=0;a<6;a++){var s=t[a].distanceToPoint(n);if(s<r)return!1}return!0},intersectsBox:function(e){for(var t=this.planes,n=0;n<6;n++){var r=t[n];if(nc.x=r.normal.x>0?e.max.x:e.min.x,nc.y=r.normal.y>0?e.max.y:e.min.y,nc.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(nc)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var Ye={common:{diffuse:{value:new Qe(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new ar},uv2Transform:{value:new ar},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new De(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Qe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowM
diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`,gA=`#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,yA=`#ifdef ALPHATEST
if ( diffuseColor.a < ALPHATEST ) discard;
#endif`,bA=`#ifdef USE_AOMAP
float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
#endif
#endif`,wA=`#ifdef USE_AOMAP
uniform sampler2D aoMap;
uniform float aoMapIntensity;
#endif`,_A="vec3 transformed = vec3( position );",EA=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
vec3 objectTangent = vec3( tangent.xyz );
#endif`,CA=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
vec4 r = roughness * c0 + c1;
float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
return vec2( -1.04, 1.04 ) * a004 + r.zw;
}
float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
if( cutoffDistance > 0.0 ) {
distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
}
return distanceFalloff;
#else
if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
}
return 1.0;
#endif
}
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
return ( 1.0 - specularColor ) * fresnel + specularColor;
}
vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
return Fr * fresnel + F0;
}
float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
return 1.0 / ( gl * gv );
}
float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
float a2 = pow2( alpha );
float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
float a2 = pow2( alpha );
float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
return RECIPROCAL_PI * a2 / pow2( denom );
}
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
float alpha = pow2( roughness );
vec3 halfDir = normalize( incidentLight.direction + viewDir );
float dotNL = saturate( dot( normal, incidentLight.direction ) );
float dotNV = saturate( dot( normal, viewDir ) );
float dotNH = saturate( dot( normal, halfDir ) );
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
vec3 F = F_Schlick( specularColor, dotLH );
float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
float D = D_GGX( alpha, dotNH );
return F * ( G * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
const float LUT_SIZE = 64.0;
const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
const float LUT_BIAS = 0.5 / LUT_SIZE;
float dotNV = saturate( dot( N, V ) );
vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
uv = uv * LUT_SCALE + LUT_BIAS;
return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
float l = length( f );
return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
float x = dot( v1, v2 );
float y = abs( x );
float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
float b = 3.4175940 + ( 4.1616724 + y ) * y;
float v = a / b;
float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
vec3 lightNormal = cross( v1, v2 );
if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
vec3 T1, T2;
T1 = normalize( V - N * dot( V, N ) );
T2 = - cross( N, T1 );
mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
vec3 coords[ 4 ];
coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
coords[ 0 ] = normalize( coords[ 0 ] );
coords[ 1 ] = normalize( coords[ 1 ] );
coords[ 2 ] = normalize( coords[ 2 ] );
coords[ 3 ] = normalize( coords[ 3 ] );
vec3 vectorFormFactor = vec3( 0.0 );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
return vec3( result );
}
vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
float dotNV = saturate( dot( normal, viewDir ) );
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
return specularColor * brdf.x + brdf.y;
}
void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
vec3 FssEss = F * brdf.x + brdf.y;
float Ess = brdf.x + brdf.y;
float Ems = 1.0 - Ess;
vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
singleScatter += FssEss;
multiScatter += Fms * Ems;
}
float G_BlinnPhong_Implicit( ) {
return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
float dotNH = saturate( dot( geometry.normal, halfDir ) );
float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
vec3 F = F_Schlick( specularColor, dotLH );
float G = G_BlinnPhong_Implicit( );
float D = D_BlinnPhong( shininess, dotNH );
return F * ( G * D );
}
float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
}
float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
}
#if defined( USE_SHEEN )
float D_Charlie(float roughness, float NoH) {
float invAlpha = 1.0 / roughness;
float cos2h = NoH * NoH;
float sin2h = max(1.0 - cos2h, 0.0078125); return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
}
float V_Neubelt(float NoV, float NoL) {
return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
}
vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
vec3 N = geometry.normal;
vec3 V = geometry.viewDir;
vec3 H = normalize( V + L );
float dotNH = saturate( dot( N, H ) );
return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
}
#endif`,SA=`#ifdef USE_BUMPMAP
uniform sampler2D bumpMap;
uniform float bumpScale;
vec2 dHdxy_fwd() {
vec2 dSTdx = dFdx( vUv );
vec2 dSTdy = dFdy( vUv );
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
return vec2( dBx, dBy );
}
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
vec3 vN = surf_norm;
vec3 R1 = cross( vSigmaY, vN );
vec3 R2 = cross( vN, vSigmaX );
float fDet = dot( vSigmaX, R1 );
fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
return normalize( abs( fDet ) * surf_norm - vGrad );
}
#endif`,AA=`#if NUM_CLIPPING_PLANES > 0
vec4 plane;
#pragma unroll_loop
for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;
}
#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
bool clipped = true;
#pragma unroll_loop
for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
plane = clippingPlanes[ i ];
clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;
}
if ( clipped ) discard;
#endif
#endif`,xA=`#if NUM_CLIPPING_PLANES > 0
#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )
varying vec3 vViewPosition;
#endif
uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,TA=`#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )
varying vec3 vViewPosition;
#endif`,DA=`#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )
vViewPosition = - mvPosition.xyz;
#endif`,kA=`#ifdef USE_COLOR
diffuseColor.rgb *= vColor;
#endif`,MA=`#ifdef USE_COLOR
varying vec3 vColor;
#endif`,IA=`#ifdef USE_COLOR
varying vec3 vColor;
#endif`,PA=`#ifdef USE_COLOR
vColor.xyz = color.xyz;
#endif`,FA=`#define PI 3.14159265359
#define PI2 6.28318530718
#define PI_HALF 1.5707963267949
#define RECIPROCAL_PI 0.31830988618
#define RECIPROCAL_PI2 0.15915494
#define LOG2 1.442695
#define EPSILON 1e-6
#ifndef saturate
#define saturate(a) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement(a) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
highp float rand( const in vec2 uv ) {
const highp float a = 12.9898, b = 78.233, c = 43758.5453;
highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
return fract(sin(sn) * c);
}
#ifdef HIGH_PRECISION
float precisionSafeLength( vec3 v ) { return length( v ); }
#else
float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float precisionSafeLength( vec3 v ) {
float maxComponent = max3( abs( v ) );
return length( v / maxComponent ) * maxComponent;
}
#endif
struct IncidentLight {
vec3 color;
vec3 direction;
bool visible;
};
struct ReflectedLight {
vec3 directDiffuse;
vec3 directSpecular;
vec3 indirectDiffuse;
vec3 indirectSpecular;
};
struct GeometricContext {
vec3 position;
vec3 normal;
vec3 viewDir;
#ifdef CLEARCOAT
vec3 clearcoatNormal;
#endif
};
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
float distance = dot( planeNormal, point - pointOnPlane );
return - distance * planeNormal + point;
}
float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
return sign( dot( point - pointOnPlane, planeNormal ) );
}
vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
}
mat3 transposeMat3( const in mat3 m ) {
mat3 tmp;
tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
return tmp;
}
float linearToRelativeLuminance( const in vec3 color ) {
vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
return dot( weights, color.rgb );
}
bool isPerspectiveMatrix( mat4 m ) {
return m[ 2 ][ 3 ] == - 1.0;
}`,RA=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_maxMipLevel 8.0
#define cubeUV_minMipLevel 4.0
#define cubeUV_maxTileSize 256.0
#define cubeUV_minTileSize 16.0
float getFace(vec3 direction) {
vec3 absDirection = abs(direction);
float face = -1.0;
if (absDirection.x > absDirection.z) {
if (absDirection.x > absDirection.y)
face = direction.x > 0.0 ? 0.0 : 3.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
} else {
if (absDirection.z > absDirection.y)
face = direction.z > 0.0 ? 2.0 : 5.0;
else
face = direction.y > 0.0 ? 1.0 : 4.0;
}
return face;
}
vec2 getUV(vec3 direction, float face) {
vec2 uv;
if (face == 0.0) {
uv = vec2(-direction.z, direction.y) / abs(direction.x);
} else if (face == 1.0) {
uv = vec2(direction.x, -direction.z) / abs(direction.y);
} else if (face == 2.0) {
uv = direction.xy / abs(direction.z);
} else if (face == 3.0) {
uv = vec2(direction.z, direction.y) / abs(direction.x);
} else if (face == 4.0) {
uv = direction.xz / abs(direction.y);
} else {
uv = vec2(-direction.x, direction.y) / abs(direction.z);
}
return 0.5 * (uv + 1.0);
}
vec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
float face = getFace(direction);
float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
mipInt = max(mipInt, cubeUV_minMipLevel);
float faceSize = exp2(mipInt);
float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);
vec2 uv = getUV(direction, face) * (faceSize - 1.0);
vec2 f = fract(uv);
uv += 0.5 - f;
if (face > 2.0) {
uv.y += faceSize;
face -= 3.0;
}
uv.x += face * faceSize;
if(mipInt < cubeUV_maxMipLevel){
uv.y += 2.0 * cubeUV_maxTileSize;
}
uv.y += filterInt * 2.0 * cubeUV_minTileSize;
uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);
uv *= texelSize;
vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
uv.x += texelSize;
vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
uv.y += texelSize;
vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
uv.x -= texelSize;
vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
vec3 tm = mix(tl, tr, f.x);
vec3 bm = mix(bl, br, f.x);
return mix(tm, bm, f.y);
}
#define r0 1.0
#define v0 0.339
#define m0 -2.0
#define r1 0.8
#define v1 0.276
#define m1 -1.0
#define r4 0.4
#define v4 0.046
#define m4 2.0
#define r5 0.305
#define v5 0.016
#define m5 3.0
#define r6 0.21
#define v6 0.0038
#define m6 4.0
float roughnessToMip(float roughness) {
float mip = 0.0;
if (roughness >= r1) {
mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
} else if (roughness >= r4) {
mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;
} else if (roughness >= r5) {
mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;
} else if (roughness >= r6) {
mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;
} else {
mip = -2.0 * log2(1.16 * roughness); }
return mip;
}
vec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {
float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);
float mipF = fract(mip);
float mipInt = floor(mip);
vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);
if (mipF == 0.0) {
return vec4(color0, 1.0);
} else {
vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);
return vec4(mix(color0, color1, mipF), 1.0);
}
}
#endif`,LA=`vec3 transformedNormal = objectNormal;
#ifdef USE_INSTANCING
transformedNormal = mat3( instanceMatrix ) * transformedNormal;
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#ifdef FLIP_SIDED
transformedTangent = - transformedTangent;
#endif
#endif`,BA=`#ifdef USE_DISPLACEMENTMAP
uniform sampler2D displacementMap;
uniform float displacementScale;
uniform float displacementBias;
#endif`,OA=`#ifdef USE_DISPLACEMENTMAP
transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
#endif`,NA=`#ifdef USE_EMISSIVEMAP
vec4 emissiveColor = texture2D( emissiveMap, vUv );
emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,GA=`#ifdef USE_EMISSIVEMAP
uniform sampler2D emissiveMap;
#endif`,UA="gl_FragColor = linearToOutputTexel( gl_FragColor );",VA=`
vec4 LinearToLinear( in vec4 value ) {
return value;
}
vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
}
vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
}
vec4 sRGBToLinear( in vec4 value ) {
return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 LinearTosRGB( in vec4 value ) {
return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 RGBEToLinear( in vec4 value ) {
return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
}
vec4 LinearToRGBE( in vec4 value ) {
float maxComponent = max( max( value.r, value.g ), value.b );
float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
}
vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
return vec4( value.rgb * value.a * maxRange, 1.0 );
}
vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
float maxRGB = max( value.r, max( value.g, value.b ) );
float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
M = ceil( M * 255.0 ) / 255.0;
return vec4( value.rgb / ( M * maxRange ), M );
}
vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
}
vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
float maxRGB = max( value.r, max( value.g, value.b ) );
float D = max( maxRange / maxRGB, 1.0 );
D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
}
const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
vec4 LinearToLogLuv( in vec4 value ) {
vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
vec4 vResult;
vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
vResult.w = fract( Le );
vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
return vResult;
}
const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
vec4 LogLuvToLinear( in vec4 value ) {
float Le = value.z * 255.0 + value.w;
vec3 Xp_Y_XYZp;
Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
return vec4( max( vRGB, 0.0 ), 1.0 );
}`,WA=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vec3 cameraToFrag;
if ( isOrthographic ) {
cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToFrag = normalize( vWorldPosition - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( cameraToFrag, worldNormal );
#else
vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
#endif
#else
vec3 reflectVec = vReflect;
#endif
#ifdef ENVMAP_TYPE_CUBE
vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
#elif defined( ENVMAP_TYPE_EQUIREC )
vec2 sampleUV;
reflectVec = normalize( reflectVec );
sampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
vec4 envColor = texture2D( envMap, sampleUV );
#elif defined( ENVMAP_TYPE_SPHERE )
reflectVec = normalize( reflectVec );
vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );
vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
#else
vec4 envColor = vec4( 0.0 );
#endif
#ifndef ENVMAP_TYPE_CUBE_UV
envColor = envMapTexelToLinear( envColor );
#endif
#ifdef ENVMAP_BLENDING_MULTIPLY
outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_MIX )
outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
#elif defined( ENVMAP_BLENDING_ADD )
outgoingLight += envColor.xyz * specularStrength * reflectivity;
#endif
#endif`,zA=`#ifdef USE_ENVMAP
uniform float envMapIntensity;
uniform float flipEnvMap;
uniform int maxMipLevel;
#ifdef ENVMAP_TYPE_CUBE
uniform samplerCube envMap;
#else
uniform sampler2D envMap;
#endif
#endif`,HA=`#ifdef USE_ENVMAP
uniform float reflectivity;
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
uniform float refractionRatio;
#else
varying vec3 vReflect;
#endif
#endif`,jA=`#ifdef USE_ENVMAP
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
#define ENV_WORLDPOS
#endif
#ifdef ENV_WORLDPOS
varying vec3 vWorldPosition;
#else
varying vec3 vReflect;
uniform float refractionRatio;
#endif
#endif`,YA=`#ifdef USE_ENVMAP
#ifdef ENV_WORLDPOS
vWorldPosition = worldPosition.xyz;
#else
vec3 cameraToVertex;
if ( isOrthographic ) {
cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
} else {
cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
}
vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
#ifdef ENVMAP_MODE_REFLECTION
vReflect = reflect( cameraToVertex, worldNormal );
#else
vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
#endif
#endif
#endif`,KA=`#ifdef USE_FOG
fogDepth = -mvPosition.z;
#endif`,XA=`#ifdef USE_FOG
varying float fogDepth;
#endif`,qA=`#ifdef USE_FOG
#ifdef FOG_EXP2
float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
#else
float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
#endif
gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,ZA=`#ifdef USE_FOG
uniform vec3 fogColor;
varying float fogDepth;
#ifdef FOG_EXP2
uniform float fogDensity;
#else
uniform float fogNear;
uniform float fogFar;
#endif
#endif`,JA=`#ifdef USE_GRADIENTMAP
uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
float dotNL = dot( normal, lightDirection );
vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
#ifdef USE_GRADIENTMAP
return texture2D( gradientMap, coord ).rgb;
#else
return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
#endif
}`,$A=`#ifdef USE_LIGHTMAP
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#endif`,QA=`#ifdef USE_LIGHTMAP
uniform sampler2D lightMap;
uniform float lightMapIntensity;
#endif`,ex=`vec3 diffuse = vec3( 1.0 );
GeometricContext geometry;
geometry.position = mvPosition.xyz;
geometry.normal = normalize( transformedNormal );
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
GeometricContext backGeometry;
backGeometry.position = geometry.position;
backGeometry.normal = -geometry.normal;
backGeometry.viewDir = geometry.viewDir;
vLightFront = vec3( 0.0 );
vIndirectFront = vec3( 0.0 );
#ifdef DOUBLE_SIDED
vLightBack = vec3( 0.0 );
vIndirectBack = vec3( 0.0 );
#endif
IncidentLight directLight;
float dotNL;
vec3 directLightColor_Diffuse;
#if NUM_POINT_LIGHTS > 0
#pragma unroll_loop
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#endif
#if NUM_SPOT_LIGHTS > 0
#pragma unroll_loop
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#endif
#if NUM_DIR_LIGHTS > 0
#pragma unroll_loop
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
dotNL = dot( geometry.normal, directLight.direction );
directLightColor_Diffuse = PI * directLight.color;
vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
#ifdef DOUBLE_SIDED
vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
#endif
}
#endif
#if NUM_HEMI_LIGHTS > 0
#pragma unroll_loop
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
#ifdef DOUBLE_SIDED
vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
#endif
}
#endif`,tx=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
float x = normal.x, y = normal.y, z = normal.z;
vec3 result = shCoefficients[ 0 ] * 0.886227;
result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
vec3 irradiance = ambientLightColor;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
return irradiance;
}
#if NUM_DIR_LIGHTS > 0
struct DirectionalLight {
vec3 direction;
vec3 color;
int shadow;
float shadowBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
directLight.color = directionalLight.color;
directLight.direction = directionalLight.direction;
directLight.visible = true;
}
#endif
#if NUM_POINT_LIGHTS > 0
struct PointLight {
vec3 position;
vec3 color;
float distance;
float decay;
int shadow;
float shadowBias;
float shadowRadius;
vec2 shadowMapSize;
float shadowCameraNear;
float shadowCameraFar;
};
uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
vec3 lVector = pointLight.position - geometry.position;
directLight.direction = normalize( lVector );
float lightDistance = length( lVector );
directLight.color = pointLight.color;
directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
directLight.visible = ( directLight.color != vec3( 0.0 ) );
}
#endif
#if NUM_SPOT_LIGHTS > 0
struct SpotLight {
vec3 position;
vec3 direction;
vec3 color;
float distance;
float decay;
float coneCos;
float penumbraCos;
int shadow;
float shadowBias;
float shadowRadius;
vec2 shadowMapSize;
};
uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
vec3 lVector = spotLight.position - geometry.position;
directLight.direction = normalize( lVector );
float lightDistance = length( lVector );
float angleCos = dot( directLight.direction, spotLight.direction );
if ( angleCos > spotLight.coneCos ) {
float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
directLight.color = spotLight.color;
directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
directLight.visible = true;
} else {
directLight.color = vec3( 0.0 );
directLight.visible = false;
}
}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
struct RectAreaLight {
vec3 color;
vec3 position;
vec3 halfWidth;
vec3 halfHeight;
};
uniform sampler2D ltc_1; uniform sampler2D ltc_2;
uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
struct HemisphereLight {
vec3 direction;
vec3 skyColor;
vec3 groundColor;
};
uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
float dotNL = dot( geometry.normal, hemiLight.direction );
float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
return irradiance;
}
#endif`,nx=`#if defined( USE_ENVMAP )
#ifdef ENVMAP_MODE_REFRACTION
uniform float refractionRatio;
#endif
vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
#ifdef ENVMAP_TYPE_CUBE
vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
#ifdef TEXTURE_LOD_EXT
vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
#else
vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
#endif
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
#else
vec4 envMapColor = vec4( 0.0 );
#endif
return PI * envMapColor.rgb * envMapIntensity;
}
float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
float maxMIPLevelScalar = float( maxMIPLevel );
float sigma = PI * roughness * roughness / ( 1.0 + roughness );
float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
}
vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
#ifdef ENVMAP_MODE_REFLECTION
vec3 reflectVec = reflect( -viewDir, normal );
reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
#else
vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
#endif
reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
#ifdef ENVMAP_TYPE_CUBE
vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
#ifdef TEXTURE_LOD_EXT
vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
#else
vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
#endif
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
#elif defined( ENVMAP_TYPE_CUBE_UV )
vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
#elif defined( ENVMAP_TYPE_EQUIREC )
vec2 sampleUV;
sampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
#ifdef TEXTURE_LOD_EXT
vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );
#else
vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );
#endif
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
#elif defined( ENVMAP_TYPE_SPHERE )
vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );
#ifdef TEXTURE_LOD_EXT
vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
#else
vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
#endif
envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
#endif
return envMapColor.rgb * envMapIntensity;
}
#endif`,rx=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,ix=`varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
struct ToonMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_Toon
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
#define Material_LightProbeLOD( material ) (0)`,ax=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,sx=`varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
struct BlinnPhongMaterial {
vec3 diffuseColor;
vec3 specularColor;
float specularShininess;
float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct RE_Direct_BlinnPhong
#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong
#define Material_LightProbeLOD( material ) (0)`,ox=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
material.specularRoughness = min( material.specularRoughness, 1.0 );
#ifdef REFLECTIVITY
material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
#else
material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
#endif
#ifdef CLEARCOAT
material.clearcoat = saturate( clearcoat ); material.clearcoatRoughness = max( clearcoatRoughness, 0.0525 );
material.clearcoatRoughness += geometryRoughness;
material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_SHEEN
material.sheenColor = sheen;
#endif`,ux=`struct PhysicalMaterial {
vec3 diffuseColor;
float specularRoughness;
vec3 specularColor;
#ifdef CLEARCOAT
float clearcoat;
float clearcoatRoughness;
#endif
#ifdef USE_SHEEN
vec3 sheenColor;
#endif
};
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
}
#if NUM_RECT_AREA_LIGHTS > 0
void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
vec3 normal = geometry.normal;
vec3 viewDir = geometry.viewDir;
vec3 position = geometry.position;
vec3 lightPos = rectAreaLight.position;
vec3 halfWidth = rectAreaLight.halfWidth;
vec3 halfHeight = rectAreaLight.halfHeight;
vec3 lightColor = rectAreaLight.color;
float roughness = material.specularRoughness;
vec3 rectCoords[ 4 ];
rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
vec2 uv = LTC_Uv( normal, viewDir, roughness );
vec4 t1 = texture2D( ltc_1, uv );
vec4 t2 = texture2D( ltc_2, uv );
mat3 mInv = mat3(
vec3( t1.x, 0, t1.y ),
vec3( 0, 1, 0 ),
vec3( t1.z, 0, t1.w )
);
vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
vec3 irradiance = dotNL * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
irradiance *= PI;
#endif
#ifdef CLEARCOAT
float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
vec3 ccIrradiance = ccDotNL * directLight.color;
#ifndef PHYSICALLY_CORRECT_LIGHTS
ccIrradiance *= PI;
#endif
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
#else
float clearcoatDHR = 0.0;
#endif
#ifdef USE_SHEEN
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
material.specularRoughness,
directLight.direction,
geometry,
material.sheenColor
);
#else
reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
#endif
reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
#ifdef CLEARCOAT
float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
float ccDotNL = ccDotNV;
float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
#else
float clearcoatDHR = 0.0;
#endif
float clearcoatInv = 1.0 - clearcoatDHR;
vec3 singleScattering = vec3( 0.0 );
vec3 multiScattering = vec3( 0.0 );
vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct RE_Direct_Physical
#define RE_Direct_RectArea RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,lx=`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
#ifdef CLEARCOAT
geometry.clearcoatNormal = clearcoatNormal;
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
PointLight pointLight;
#pragma unroll_loop
for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
pointLight = pointLights[ i ];
getPointDirectLightIrradiance( pointLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
directLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
SpotLight spotLight;
#pragma unroll_loop
for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
spotLight = spotLights[ i ];
getSpotDirectLightIrradiance( spotLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
directLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
DirectionalLight directionalLight;
#pragma unroll_loop
for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
directionalLight = directionalLights[ i ];
getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
directLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
#endif
RE_Direct( directLight, geometry, material, reflectedLight );
}
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
RectAreaLight rectAreaLight;
#pragma unroll_loop
for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
rectAreaLight = rectAreaLights[ i ];
RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
}
#endif
#if defined( RE_IndirectDiffuse )
vec3 iblIrradiance = vec3( 0.0 );
vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
irradiance += getLightProbeIrradiance( lightProbe, geometry );
#if ( NUM_HEMI_LIGHTS > 0 )
#pragma unroll_loop
for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
}
#endif
#endif
#if defined( RE_IndirectSpecular )
vec3 radiance = vec3( 0.0 );
vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,cx=`#if defined( RE_IndirectDiffuse )
#ifdef USE_LIGHTMAP
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#ifndef PHYSICALLY_CORRECT_LIGHTS
lightMapIrradiance *= PI;
#endif
irradiance += lightMapIrradiance;
#endif
#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
#ifdef CLEARCOAT
clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
#endif
#endif`,fx=`#if defined( RE_IndirectDiffuse )
RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
#endif`,hx=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,px=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
uniform float logDepthBufFC;
varying float vFragDepth;
varying float vIsPerspective;
#endif`,dx=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
varying float vFragDepth;
varying float vIsPerspective;
#else
uniform float logDepthBufFC;
#endif
#endif`,vx=`#ifdef USE_LOGDEPTHBUF
#ifdef USE_LOGDEPTHBUF_EXT
vFragDepth = 1.0 + gl_Position.w;
vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#else
if ( isPerspectiveMatrix( projectionMatrix ) ) {
gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
gl_Position.z *= gl_Position.w;
}
#endif
#endif`,mx=`#ifdef USE_MAP
vec4 texelColor = texture2D( map, vUv );
texelColor = mapTexelToLinear( texelColor );
diffuseColor *= texelColor;
#endif`,gx=`#ifdef USE_MAP
uniform sampler2D map;
#endif`,yx=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
#endif
#ifdef USE_MAP
vec4 mapTexel = texture2D( map, uv );
diffuseColor *= mapTexelToLinear( mapTexel );
#endif
#ifdef USE_ALPHAMAP
diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,bx=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
uniform mat3 uvTransform;
#endif
#ifdef USE_MAP
uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
uniform sampler2D alphaMap;
#endif`,wx=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
vec4 texelMetalness = texture2D( metalnessMap, vUv );
metalnessFactor *= texelMetalness.b;
#endif`,_x=`#ifdef USE_METALNESSMAP
uniform sampler2D metalnessMap;
#endif`,Ex=`#ifdef USE_MORPHNORMALS
objectNormal *= morphTargetBaseInfluence;
objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
#endif`,Cx=`#ifdef USE_MORPHTARGETS
uniform float morphTargetBaseInfluence;
#ifndef USE_MORPHNORMALS
uniform float morphTargetInfluences[ 8 ];
#else
uniform float morphTargetInfluences[ 4 ];
#endif
#endif`,Sx=`#ifdef USE_MORPHTARGETS
transformed *= morphTargetBaseInfluence;
transformed += morphTarget0 * morphTargetInfluences[ 0 ];
transformed += morphTarget1 * morphTargetInfluences[ 1 ];
transformed += morphTarget2 * morphTargetInfluences[ 2 ];
transformed += morphTarget3 * morphTargetInfluences[ 3 ];
#ifndef USE_MORPHNORMALS
transformed += morphTarget4 * morphTargetInfluences[ 4 ];
transformed += morphTarget5 * morphTargetInfluences[ 5 ];
transformed += morphTarget6 * morphTargetInfluences[ 6 ];
transformed += morphTarget7 * morphTargetInfluences[ 7 ];
#endif
#endif`,Ax=`#ifdef FLAT_SHADED
vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
vec3 normal = normalize( cross( fdx, fdy ) );
#else
vec3 normal = normalize( vNormal );
#ifdef DOUBLE_SIDED
normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
#endif
#ifdef USE_TANGENT
vec3 tangent = normalize( vTangent );
vec3 bitangent = normalize( vBitangent );
#ifdef DOUBLE_SIDED
tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
#endif
#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
mat3 vTBN = mat3( tangent, bitangent, normal );
#endif
#endif
#endif
vec3 geometryNormal = normal;`,xx=`#ifdef OBJECTSPACE_NORMALMAP
normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
#ifdef FLIP_SIDED
normal = - normal;
#endif
#ifdef DOUBLE_SIDED
normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
#endif
normal = normalize( normalMatrix * normal );
#elif defined( TANGENTSPACE_NORMALMAP )
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
mapN.xy *= normalScale;
#ifdef USE_TANGENT
normal = normalize( vTBN * mapN );
#else
normal = perturbNormal2Arb( -vViewPosition, normal, mapN );
#endif
#elif defined( USE_BUMPMAP )
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
#endif`,Tx=`#ifdef USE_NORMALMAP
uniform sampler2D normalMap;
uniform vec2 normalScale;
#endif
#ifdef OBJECTSPACE_NORMALMAP
uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {
vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
vec2 st0 = dFdx( vUv.st );
vec2 st1 = dFdy( vUv.st );
float scale = sign( st1.t * st0.s - st0.t * st1.s );
vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
vec3 N = normalize( surf_norm );
mat3 tsn = mat3( S, T, N );
mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
return normalize( tsn * mapN );
}
#endif`,Dx=`#ifdef CLEARCOAT
vec3 clearcoatNormal = geometryNormal;
#endif`,kx=`#ifdef USE_CLEARCOAT_NORMALMAP
vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
clearcoatMapN.xy *= clearcoatNormalScale;
#ifdef USE_TANGENT
clearcoatNormal = normalize( vTBN * clearcoatMapN );
#else
clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );
#endif
#endif`,Mx=`#ifdef USE_CLEARCOAT_NORMALMAP
uniform sampler2D clearcoatNormalMap;
uniform vec2 clearcoatNormalScale;
#endif`,Ix=`vec3 packNormalToRGB( const in vec3 normal ) {
return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
vec4 r = vec4( fract( v * PackFactors ), v );
r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
return dot( v, UnpackFactors );
}
vec4 pack2HalfToRGBA( vec2 v ) {
vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
}
vec2 unpackRGBATo2Half( vec4 v ) {
return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
return linearClipZ * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
return ( near * far ) / ( ( far - near ) * invClipZ - far );
}`,Px=`#ifdef PREMULTIPLIED_ALPHA
gl_FragColor.rgb *= gl_FragColor.a;
#endif`,Fx=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,Rx=`#ifdef DITHERING
gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,Lx=`#ifdef DITHERING
vec3 dithering( vec3 color ) {
float grid_position = rand( gl_FragCoord.xy );
vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
return color + dither_shift_RGB;
}
#endif`,Bx=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
vec4 texelRoughness = texture2D( roughnessMap, vUv );
roughnessFactor *= texelRoughness.g;
#endif`,Ox=`#ifdef USE_ROUGHNESSMAP
uniform sampler2D roughnessMap;
#endif`,Nx=`#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
#endif
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
}
vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
return unpackRGBATo2Half( texture2D( shadow, uv ) );
}
float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
float occlusion = 1.0;
vec2 distribution = texture2DDistribution( shadow, uv );
float hard_shadow = step( compare , distribution.x );
if (hard_shadow != 1.0 ) {
float distance = compare - distribution.x ;
float variance = max( 0.00000, distribution.y * distribution.y );
float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
}
return occlusion;
}
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
float shadow = 1.0;
shadowCoord.xyz /= shadowCoord.w;
shadowCoord.z += shadowBias;
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
bool inFrustum = all( inFrustumVec );
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
bool frustumTest = all( frustumTestVec );
if ( frustumTest ) {
#if defined( SHADOWMAP_TYPE_PCF )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx0 = - texelSize.x * shadowRadius;
float dy0 = - texelSize.y * shadowRadius;
float dx1 = + texelSize.x * shadowRadius;
float dy1 = + texelSize.y * shadowRadius;
float dx2 = dx0 / 2.0;
float dy2 = dy0 / 2.0;
float dx3 = dx1 / 2.0;
float dy3 = dy1 / 2.0;
shadow = (
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
) * ( 1.0 / 17.0 );
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
float dx = texelSize.x;
float dy = texelSize.y;
vec2 uv = shadowCoord.xy;
vec2 f = fract( uv * shadowMapSize + 0.5 );
uv -= f * texelSize;
shadow = (
texture2DCompare( shadowMap, uv, shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
f.x ) +
mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
f.y ) +
mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
f.x ),
mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
texture2DCompare( shadowMap, uv + + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
f.x ),
f.y )
) * ( 1.0 / 9.0 );
#elif defined( SHADOWMAP_TYPE_VSM )
shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
#else
shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
#endif
}
return shadow;
}
vec2 cubeToUV( vec3 v, float texelSizeY ) {
vec3 absV = abs( v );
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
absV *= scaleToCube;
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
vec2 planar = v.xy;
float almostATexel = 1.5 * texelSizeY;
float almostOne = 1.0 - almostATexel;
if ( absV.z >= almostOne ) {
if ( v.z > 0.0 )
planar.x = 4.0 - v.x;
} else if ( absV.x >= almostOne ) {
float signX = sign( v.x );
planar.x = v.z * signX + 2.0 * signX;
} else if ( absV.y >= almostOne ) {
float signY = sign( v.y );
planar.x = v.x + 2.0 * signY + 2.0;
planar.y = v.z * signY - 2.0;
}
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
}
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
vec3 lightToPosition = shadowCoord.xyz;
float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;
vec3 bd3D = normalize( lightToPosition );
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
return (
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
) * ( 1.0 / 9.0 );
#else
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
#endif
}
#endif`,Gx=`#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
#endif
#endif`,Ux=`#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
#pragma unroll_loop
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;
}
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
#pragma unroll_loop
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;
}
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
#pragma unroll_loop
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;
}
#endif
#endif`,Vx=`float getShadowMask() {
float shadow = 1.0;
#ifdef USE_SHADOWMAP
#if NUM_DIR_LIGHT_SHADOWS > 0
DirectionalLight directionalLight;
#pragma unroll_loop
for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
directionalLight = directionalLights[ i ];
shadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
}
#endif
#if NUM_SPOT_LIGHT_SHADOWS > 0
SpotLight spotLight;
#pragma unroll_loop
for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
spotLight = spotLights[ i ];
shadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
}
#endif
#if NUM_POINT_LIGHT_SHADOWS > 0
PointLight pointLight;
#pragma unroll_loop
for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
pointLight = pointLights[ i ];
shadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
}
#endif
#endif
return shadow;
}`,Wx=`#ifdef USE_SKINNING
mat4 boneMatX = getBoneMatrix( skinIndex.x );
mat4 boneMatY = getBoneMatrix( skinIndex.y );
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,zx=`#ifdef USE_SKINNING
uniform mat4 bindMatrix;
uniform mat4 bindMatrixInverse;
#ifdef BONE_TEXTURE
uniform highp sampler2D boneTexture;
uniform int boneTextureSize;
mat4 getBoneMatrix( const in float i ) {
float j = i * 4.0;
float x = mod( j, float( boneTextureSize ) );
float y = floor( j / float( boneTextureSize ) );
float dx = 1.0 / float( boneTextureSize );
float dy = 1.0 / float( boneTextureSize );
y = dy * ( y + 0.5 );
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
mat4 bone = mat4( v1, v2, v3, v4 );
return bone;
}
#else
uniform mat4 boneMatrices[ MAX_BONES ];
mat4 getBoneMatrix( const in float i ) {
mat4 bone = boneMatrices[ int(i) ];
return bone;
}
#endif
#endif`,Hx=`#ifdef USE_SKINNING
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
vec4 skinned = vec4( 0.0 );
skinned += boneMatX * skinVertex * skinWeight.x;
skinned += boneMatY * skinVertex * skinWeight.y;
skinned += boneMatZ * skinVertex * skinWeight.z;
skinned += boneMatW * skinVertex * skinWeight.w;
transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,jx=`#ifdef USE_SKINNING
mat4 skinMatrix = mat4( 0.0 );
skinMatrix += skinWeight.x * boneMatX;
skinMatrix += skinWeight.y * boneMatY;
skinMatrix += skinWeight.z * boneMatZ;
skinMatrix += skinWeight.w * boneMatW;
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
#ifdef USE_TANGENT
objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
#endif
#endif`,Yx=`float specularStrength;
#ifdef USE_SPECULARMAP
vec4 texelSpecular = texture2D( specularMap, vUv );
specularStrength = texelSpecular.r;
#else
specularStrength = 1.0;
#endif`,Kx=`#ifdef USE_SPECULARMAP
uniform sampler2D specularMap;
#endif`,Xx=`#if defined( TONE_MAPPING )
gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,qx=`#ifndef saturate
#define saturate(a) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
uniform float toneMappingWhitePoint;
vec3 LinearToneMapping( vec3 color ) {
return toneMappingExposure * color;
}
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
vec3 Uncharted2ToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 ACESFilmicToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );
}`,Zx=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
varying vec2 vUv;
#endif`,Jx=`#ifdef USE_UV
#ifdef UVS_VERTEX_ONLY
vec2 vUv;
#else
varying vec2 vUv;
#endif
uniform mat3 uvTransform;
#endif`,$x=`#ifdef USE_UV
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`,Qx=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
varying vec2 vUv2;
#endif`,eT=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
attribute vec2 uv2;
varying vec2 vUv2;
uniform mat3 uv2Transform;
#endif`,tT=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
#endif`,nT=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
vec4 worldPosition = vec4( transformed, 1.0 );
#ifdef USE_INSTANCING
worldPosition = instanceMatrix * worldPosition;
#endif
worldPosition = modelMatrix * worldPosition;
#endif`,rT=`uniform sampler2D t2D;
varying vec2 vUv;
void main() {
vec4 texColor = texture2D( t2D, vUv );
gl_FragColor = mapTexelToLinear( texColor );
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,iT=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,aT=`#include <envmap_common_pars_fragment>
uniform float opacity;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
vec3 vReflect = vWorldDirection;
#include <envmap_fragment>
gl_FragColor = envColor;
gl_FragColor.a *= opacity;
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,sT=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
gl_Position.z = gl_Position.w;
}`,oT=`#if DEPTH_PACKING == 3200
uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#if DEPTH_PACKING == 3200
diffuseColor.a = opacity;
#endif
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <logdepthbuf_fragment>
#if DEPTH_PACKING == 3200
gl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );
#elif DEPTH_PACKING == 3201
gl_FragColor = packDepthToRGBA( gl_FragCoord.z );
#endif
}`,uT=`#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
}`,lT=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( 1.0 );
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
float dist = length( vWorldPosition - referencePosition );
dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
dist = saturate( dist );
gl_FragColor = packDepthToRGBA( dist );
}`,cT=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <skinbase_vertex>
#ifdef USE_DISPLACEMENTMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
vWorldPosition = worldPosition.xyz;
}`,fT=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
vec3 direction = normalize( vWorldDirection );
vec2 sampleUV;
sampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;
vec4 texColor = texture2D( tEquirect, sampleUV );
gl_FragColor = mapTexelToLinear( texColor );
#include <tonemapping_fragment>
#include <encodings_fragment>
}`,hT=`varying vec3 vWorldDirection;
#include <common>
void main() {
vWorldDirection = transformDirection( position, modelMatrix );
#include <begin_vertex>
#include <project_vertex>
}`,pT=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
if ( mod( vLineDistance, totalSize ) > dashSize ) {
discard;
}
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <color_fragment>
outgoingLight = diffuseColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,dT=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <color_vertex>
vLineDistance = scale * lineDistance;
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,vT=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
#ifdef USE_LIGHTMAP
vec4 lightMapTexel= texture2D( lightMap, vUv2 );
reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
#else
reflectedLight.indirectDiffuse += vec3( 1.0 );
#endif
#include <aomap_fragment>
reflectedLight.indirectDiffuse *= diffuseColor.rgb;
vec3 outgoingLight = reflectedLight.indirectDiffuse;
#include <envmap_fragment>
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,mT=`#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <skinbase_vertex>
#ifdef USE_ENVMAP
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <worldpos_vertex>
#include <clipping_planes_vertex>
#include <envmap_vertex>
#include <fog_vertex>
}`,gT=`uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
varying vec3 vLightBack;
varying vec3 vIndirectBack;
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <fog_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <emissivemap_fragment>
reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
#ifdef DOUBLE_SIDED
reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
#else
reflectedLight.indirectDiffuse += vIndirectFront;
#endif
#include <lightmap_fragment>
reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
#ifdef DOUBLE_SIDED
reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
#else
reflectedLight.directDiffuse = vLightFront;
#endif
reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
#include <envmap_fragment>
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,yT=`#define LAMBERT
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
varying vec3 vLightBack;
varying vec3 vIndirectBack;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <bsdfs>
#include <lights_pars_begin>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <envmap_vertex>
#include <lights_lambert_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,bT=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <fog_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
vec3 viewDir = normalize( vViewPosition );
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
vec3 y = cross( viewDir, x );
vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
#ifdef USE_MATCAP
vec4 matcapColor = texture2D( matcap, uv );
matcapColor = matcapTexelToLinear( matcapColor );
#else
vec4 matcapColor = vec4( 1.0 );
#endif
vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,wT=`#define MATCAP
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
vViewPosition = - mvPosition.xyz;
}`,_T=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_toon_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,ET=`#define TOON
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,CT=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <cube_uv_reflection_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <specularmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_phong_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#include <envmap_fragment>
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,ST=`#define PHONG
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <envmap_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,AT=`#define STANDARD
#ifdef PHYSICAL
#define REFLECTIVITY
#define CLEARCOAT
#define TRANSPARENCY
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef TRANSPARENCY
uniform float transparency;
#endif
#ifdef REFLECTIVITY
uniform float reflectivity;
#endif
#ifdef CLEARCOAT
uniform float clearcoat;
uniform float clearcoatRoughness;
#endif
#ifdef USE_SHEEN
uniform vec3 sheen;
#endif
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <bsdfs>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <lights_physical_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_normalmap_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec4 diffuseColor = vec4( diffuse, opacity );
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
vec3 totalEmissiveRadiance = emissive;
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <color_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
#include <roughnessmap_fragment>
#include <metalnessmap_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
#include <clearcoat_normal_fragment_begin>
#include <clearcoat_normal_fragment_maps>
#include <emissivemap_fragment>
#include <lights_physical_fragment>
#include <lights_fragment_begin>
#include <lights_fragment_maps>
#include <lights_fragment_end>
#include <aomap_fragment>
vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
#ifdef TRANSPARENCY
diffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
#include <dithering_fragment>
}`,xT=`#define STANDARD
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <uv2_vertex>
#include <color_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
vViewPosition = - mvPosition.xyz;
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,TT=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <packing>
#include <uv_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
#include <logdepthbuf_fragment>
#include <normal_fragment_begin>
#include <normal_fragment_maps>
gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
}`,DT=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
varying vec3 vNormal;
#ifdef USE_TANGENT
varying vec3 vTangent;
varying vec3 vBitangent;
#endif
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
#include <beginnormal_vertex>
#include <morphnormal_vertex>
#include <skinbase_vertex>
#include <skinnormal_vertex>
#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
vNormal = normalize( transformedNormal );
#ifdef USE_TANGENT
vTangent = normalize( transformedTangent );
vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
#endif
#endif
#include <begin_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
vViewPosition = - mvPosition.xyz;
#endif
}`,kT=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_particle_fragment>
#include <color_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
#include <premultiplied_alpha_fragment>
}`,MT=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <color_vertex>
#include <begin_vertex>
#include <morphtarget_vertex>
#include <project_vertex>
gl_PointSize = size;
#ifdef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
#endif
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <worldpos_vertex>
#include <fog_vertex>
}`,IT=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}`,PT=`#include <fog_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
#include <begin_vertex>
#include <project_vertex>
#include <worldpos_vertex>
#include <shadowmap_vertex>
#include <fog_vertex>
}`,FT=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
#include <clipping_planes_fragment>
vec3 outgoingLight = vec3( 0.0 );
vec4 diffuseColor = vec4( diffuse, opacity );
#include <logdepthbuf_fragment>
#include <map_fragment>
#include <alphamap_fragment>
#include <alphatest_fragment>
outgoingLight = diffuseColor.rgb;
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
#include <tonemapping_fragment>
#include <encodings_fragment>
#include <fog_fragment>
}`,RT=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
#include <uv_vertex>
vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
vec2 scale;
scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
#ifndef USE_SIZEATTENUATION
bool isPerspective = isPerspectiveMatrix( projectionMatrix );
if ( isPerspective ) scale *= - mvPosition.z;
#endif
vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
vec2 rotatedPosition;
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
mvPosition.xy += rotatedPosition;
gl_Position = projectionMatrix * mvPosition;
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
#include <fog_vertex>
}`,Bt={alphamap_fragment:mA,alphamap_pars_fragment:gA,alphatest_fragment:yA,aomap_fragment:bA,aomap_pars_fragment:wA,begin_vertex:_A,beginnormal_vertex:EA,bsdfs:CA,bumpmap_pars_fragment:SA,clipping_planes_fragment:AA,clipping_planes_pars_fragment:xA,clipping_planes_pars_vertex:TA,clipping_planes_vertex:DA,color_fragment:kA,color_pars_fragment:MA,color_pars_vertex:IA,color_vertex:PA,common:FA,cube_uv_reflection_fragment:RA,defaultnormal_vertex:LA,displacementmap_pars_vertex:BA,displacementmap_vertex:OA,emissivemap_fragment:NA,emissivemap_pars_fragment:GA,encodings_fragment:UA,encodings_pars_fragment:VA,envmap_fragment:WA,envmap_common_pars_fragment:zA,envmap_pars_fragment:HA,envmap_pars_vertex:jA,envmap_physical_pars_fragment:nx,envmap_vertex:YA,fog_vertex:KA,fog_pars_vertex:XA,fog_fragment:qA,fog_pars_fragment:ZA,gradientmap_pars_fragment:JA,lightmap_fragment:$A,lightmap_pars_fragment:QA,lights_lambert_vertex:ex,lights_pars_begin:tx,lights_toon_fragment:rx,lights_toon_pars_fragment:ix,lights_phong_fragment:ax,lights_phong_pars_fragment:sx,lights_physical_fragment:ox,lights_physical_pars_fragment:ux,lights_fragment_begin:lx,lights_fragment_maps:cx,lights_fragment_end:fx,logdepthbuf_fragment:hx,logdepthbuf_pars_fragment:px,logdepthbuf_pars_vertex:dx,logdepthbuf_vertex:vx,map_fragment:mx,map_pars_fragment:gx,map_particle_fragment:yx,map_particle_pars_fragment:bx,metalnessmap_fragment:wx,metalnessmap_pars_fragment:_x,morphnormal_vertex:Ex,morphtarget_pars_vertex:Cx,morphtarget_vertex:Sx,normal_fragment_begin:Ax,normal_fragment_maps:xx,normalmap_pars_fragment:Tx,clearcoat_normal_fragment_begin:Dx,clearcoat_normal_fragment_maps:kx,clearcoat_normalmap_pars_fragment:Mx,packing:Ix,premultiplied_alpha_fragment:Px,project_vertex:Fx,dithering_fragment:Rx,dithering_pars_fragment:Lx,roughnessmap_fragment:Bx,roughnessmap_pars_fragment:Ox,shadowmap_pars_fragment:Nx,shadowmap_pars_vertex:Gx,shadowmap_vertex:Ux,shadowmask_pars_fragment:Vx,skinbase_vertex:Wx,skinning_pars_vertex:zx,skinning_vertex:Hx,skinnormal_vertex:jx,specularmap_fragment:Yx,specularmap_pars_fragment:Kx,tonemapping_fragment:Xx,tonemapping_pars_fragment:qx,uv_pars_fragment:Zx,uv_pars_vertex:Jx,uv_vertex:$x,uv2_pars_fragment:Qx,uv2_pars_vertex:eT,uv2_vertex:tT,worldpos_vertex:nT,background_frag:rT,background_vert:iT,cube_frag:aT,cube_vert:sT,depth_frag:oT,depth_vert:uT,distanceRGBA_frag:lT,distanceRGBA_vert:cT,equirect_frag:fT,equirect_vert:hT,linedashed_frag:pT,linedashed_vert:dT,meshbasic_frag:vT,meshbasic_vert:mT,meshlambert_frag:gT,meshlambert_vert:yT,meshmatcap_frag:bT,meshmatcap_vert:wT,meshtoon_frag:_T,meshtoon_vert:ET,meshphong_frag:CT,meshphong_vert:ST,meshphysical_frag:AT,meshphysical_vert:xT,normal_frag:TT,normal_vert:DT,points_frag:kT,points_vert:MT,shadow_frag:IT,shadow_vert:PT,sprite_frag:FT,sprite_vert:RT},Ki={basic:{uniforms:rr([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.fog]),vertexShader:Bt.meshbasic_vert,fragmentShader:Bt.meshbasic_frag},lambert:{uniforms:rr([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.fog,Ye.lights,{emissive:{value:new Qe(0)}}]),vertexShader:Bt.meshlambert_vert,fragmentShader:Bt.meshlambert_frag},phong:{uniforms:rr([Ye.common,Ye.specularmap,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.fog,Ye.lights,{emissive:{value:new Qe(0)},specular:{value:new Qe(1118481)},shininess:{value:30}}]),vertexShader:Bt.meshphong_vert,fragmentShader:Bt.meshphong_frag},standard:{uniforms:rr([Ye.common,Ye.envmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.roughnessmap,Ye.metalnessmap,Ye.fog,Ye.lights,{emissive:{value:new Qe(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Bt.meshphysical_vert,fragmentShader:Bt.meshphysical_frag},toon:{uniforms:rr([Ye.common,Ye.specularmap,Ye.aomap,Ye.lightmap,Ye.emissivemap,Ye.bumpmap,Ye.normalmap,Ye.displacementmap,Ye.gradientmap,Ye.fog,Ye.lights,{emissive:{value:new Qe(0)},specular:{value:new Qe(1118481)},shininess:{value:30}}]),vertexShader:Bt.meshtoon_ver
`),t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
`)}function Xb(i){switch(i){case Fr:return["Linear","( value )"];case bm:return["sRGB","( value )"];case wm:return["RGBE","( value )"];case Rb:return["RGBM","( value, 7.0 )"];case Lb:return["RGBM","( value, 16.0 )"];case Bb:return["RGBD","( value, 256.0 )"];case Fb:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case YS:return["LogLuv","( value )"];default:throw new Error("unsupported encoding: "+i)}}function lg(i,e,t){var n=i.getShaderParameter(e,35713),r=i.getShaderInfoLog(e).trim();if(n&&r==="")return"";var a=i.getShaderSource(e);return"THREE.WebGLShader: gl.getShaderInfoLog() "+t+`
`+r+D5(a)}function lu(i,e){var t=Xb(e);return"vec4 "+i+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function k5(i,e){var t=Xb(e);return"vec4 "+i+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function M5(i,e){var t;switch(e){case hm:t="Linear";break;case oS:t="Reinhard";break;case uS:t="Uncharted2";break;case lS:t="OptimizedCineon";break;case cS:t="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+e)}return"vec3 "+i+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function I5(i){var e=[i.extensionDerivatives||i.envMapCubeUV||i.bumpMap||i.tangentSpaceNormalMap||i.clearcoatNormalMap||i.flatShading||i.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(i.extensionFragDepth||i.logarithmicDepthBuffer)&&i.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",i.extensionDrawBuffers&&i.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(i.extensionShaderTextureLOD||i.envMap)&&i.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""];return e.filter(mu).join(`
`)}function P5(i){var e=[];for(var t in i){var n=i[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
`)}function F5(i,e){for(var t={},n=i.getProgramParameter(e,35721),r=0;r<n;r++){var a=i.getActiveAttrib(e,r),s=a.name;t[s]=i.getAttribLocation(e,s)}return t}function mu(i){return i!==""}function cg(i,e){return i.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function fg(i,e){return i.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var R5=/^[ \t]*#include +<([\w\d./]+)>/gm;function Cd(i){return i.replace(R5,L5)}function L5(i,e){var t=Bt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Cd(t)}var B5=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function hg(i){return i.replace(B5,O5)}function O5(i,e,t,n){for(var r="",a=parseInt(e);a<parseInt(t);a++)r+=n.replace(/\[ i \]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function pg(i){var e="precision "+i.precision+` float;
precision `+i.precision+" int;";return i.precision==="highp"?e+=`
#define HIGH_PRECISION`:i.precision==="mediump"?e+=`
#define MEDIUM_PRECISION`:i.precision==="lowp"&&(e+=`
#define LOW_PRECISION`),e}function N5(i){var e="SHADOWMAP_TYPE_BASIC";return i.shadowMapType===Cb?e="SHADOWMAP_TYPE_PCF":i.shadowMapType===N2?e="SHADOWMAP_TYPE_PCF_SOFT":i.shadowMapType===vu&&(e="SHADOWMAP_TYPE_VSM"),e}function G5(i){var e="ENVMAP_TYPE_CUBE";if(i.envMap)switch(i.envMapMode){case dm:case vm:e="ENVMAP_TYPE_CUBE";break;case Cl:case gm:e="ENVMAP_TYPE_CUBE_UV";break;case Db:case mm:e="ENVMAP_TYPE_EQUIREC";break;case kb:e="ENVMAP_TYPE_SPHERE";break}return e}function U5(i){var e="ENVMAP_MODE_REFLECTION";if(i.envMap)switch(i.envMapMode){case vm:case mm:e="ENVMAP_MODE_REFRACTION";break}return e}function V5(i){var e="ENVMAP_BLENDING_NONE";if(i.envMap)switch(i.combine){case ph:e="ENVMAP_BLENDING_MULTIPLY";break;case aS:e="ENVMAP_BLENDING_MIX";break;case sS:e="ENVMAP_BLENDING_ADD";break}return e}function W5(i,e,t){var n=i.getContext(),r=t.defines,a=t.vertexShader,s=t.fragmentShader,o=N5(t),u=G5(t),l=U5(t),c=V5(t),f=i.gammaFactor>0?i.gammaFactor:1,h=t.isWebGL2?"":I5(t),p=P5(r),m=n.createProgram(),v,g,d=t.numMultiviewViews;if(t.isRawShaderMaterial?(v=[p].filter(mu).join(`
`),v.length>0&&(v+=`
`),g=[h,p].filter(mu).join(`
`),g.length>0&&(g+=`
`)):(v=[pg(t),"#define SHADER_NAME "+t.shaderName,p,t.instancing?"#define USE_INSTANCING":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+f,"#define MAX_BONES "+t.maxBones,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+o:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#ifdef USE_COLOR"," attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",`
`].filter(mu).join(`
`),g=[h,pg(t),"#define SHADER_NAME "+t.shaderName,p,t.alphaTest?"#define ALPHATEST "+t.alphaTest+(t.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+f,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+l:"",t.envMap?"#define "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.sheen?"#define USE_SHEEN":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+o:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Dc?"#define TONE_MAPPING":"",t.toneMapping!==Dc?Bt.tonemapping_pars_fragment:"",t.toneMapping!==Dc?M5("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.outputEncoding||t.mapEncoding||t.matcapEncoding||t.envMapEncoding||t.emissiveMapEncoding||t.lightMapEncoding?Bt.encodings_pars_fragment:"",t.mapEncoding?lu("mapTexelToLinear",t.mapEncoding):"",t.matcapEncoding?lu("matcapTexelToLinear",t.matcapEncoding):"",t.envMapEncoding?lu("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMapEncoding?lu("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.lightMapEncoding?lu("lightMapTexelToLinear",t.lightMapEncoding):"",t.outputEncoding?k5("linearToOutputTexel",t.outputEncoding):"",t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
`].filter(mu).join(`
`)),a=Cd(a),a=cg(a,t),a=fg(a,t),s=Cd(s),s=cg(s,t),s=fg(s,t),a=hg(a),s=hg(s),t.isWebGL2&&!t.isRawShaderMaterial){var y=!1,b=/^\s*#version\s+300\s+es\s*\n/;t.isShaderMaterial&&a.match(b)!==null&&s.match(b)!==null&&(y=!0,a=a.replace(b,""),s=s.replace(b,"")),v=[`#version 300 es
`,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+v,g=[`#version 300 es
`,"#define varying in",y?"":"out highp vec4 pc_fragColor;",y?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+g,d>0&&(v=v.replace(`#version 300 es
`,[`#version 300 es
`,"#extension GL_OVR_multiview2 : require","layout(num_views = "+d+") in;","#define VIEW_ID gl_ViewID_OVR"].join(`
`)),v=v.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join(`
`),["uniform mat4 modelViewMatrices["+d+"];","uniform mat4 projectionMatrices["+d+"];","uniform mat4 viewMatrices["+d+"];","uniform mat3 normalMatrices["+d+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join(`
`)),g=g.replace(`#version 300 es
`,[`#version 300 es
`,"#extension GL_OVR_multiview2 : require","#define VIEW_ID gl_ViewID_OVR"].join(`
`)),g=g.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+d+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join(`
`)))}var _=v+a,w=g+s,E=ug(n,35633,_),x=ug(n,35632,w);if(n.attachShader(m,E),n.attachShader(m,x),t.index0AttributeName!==void 0?n.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&n.bindAttribLocation(m,0,"position"),n.linkProgram(m),i.debug.checkShaderErrors){var S=n.getProgramInfoLog(m).trim(),T=n.getShaderInfoLog(E).trim(),L=n.getShaderInfoLog(x).trim(),B=!0,k=!0;if(n.getProgramParameter(m,35714)===!1){B=!1;var R=lg(n,E,"vertex"),F=lg(n,x,"fragment");console.error("THREE.WebGLProgram: shader error: ",n.getError(),"35715",n.getProgramParameter(m,35715),"gl.getProgramInfoLog",S,R,F)}else S!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",S):(T===""||L==="")&&(k=!1);k&&(this.diagnostics={runnable:B,programLog:S,vertexShader:{log:T,prefix:v},fragmentShader:{log:L,prefix:g}})}n.deleteShader(E),n.deleteShader(x);var W;this.getUniforms=function(){return W===void 0&&(W=new Ma(n,m)),W};var K;return this.getAttributes=function(){return K===void 0&&(K=F5(n,m)),K},this.destroy=function(){n.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=T5++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=E,this.fragmentShader=x,this.numMultiviewViews=d,this}function z5(i,e,t){var n=[],r=t.isWebGL2,a=t.logarithmicDepthBuffer,s=t.floatVertexTextures,o=t.precision,u=t.maxVertexUniforms,l=t.vertexTextures,c={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},f=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","numMultiviewViews","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen"];function h(v,g){var d;if(g){var y=Ki[g];d={name:v.type,uniforms:hA.clone(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.fragmentShader}}else d={name:v.type,uniforms:v.uniforms,vertexShader:v.vertexShader,fragmentShader:v.fragmentShader};return d}function p(v){var g=v.skeleton,d=g.bones;if(s)return 1024;var y=u,b=Math.floor((y-20)/4),_=Math.min(b,d.length);return _<d.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+d.length+" bones. This GPU supports "+_+"."),0):_}function m(v){var g;return v?v.isTexture?g=v.encoding:v.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),g=v.texture.encoding):g=Fr,g}this.getParameters=function(v,g,d,y,b,_,w){var E=y.fog,x=v.isMeshStandardMaterial?y.environment:null,S=v.envMap||x,T=c[v.type],L=w.isSkinnedMesh?p(w):0;v.precision!==null&&(o=t.getMaxPrecision(v.precision),o!==v.precision&&console.warn("THREE.WebGLProgram.getParameters:",v.precision,"not supported, using",o,"instead."));var B=h(v,T);v.onBeforeCompile(B,i);var k=i.getRenderTarget(),R=k&&k.isWebGLMultiviewRenderTarget?k.numViews:0,F={isWebGL2:r,shaderID:T,shaderName:B.name,uniforms:B.uniforms,vertexSha
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
float mean = 0.0;
float squared_mean = 0.0;
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
#ifdef HORIZONAL_PASS
vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
mean += distribution.x;
squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
#else
float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
mean += depth;
squared_mean += depth * depth;
#endif
}
mean = mean * HALF_SAMPLE_RATE;
squared_mean = squared_mean * HALF_SAMPLE_RATE;
float std_dev = sqrt( squared_mean - mean * mean );
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`,eD=`void main() {
gl_Position = vec4( position, 1.0 );
}`;function qb(i,e,t){var n=new Al,r=new De,a=new De,s=new $t,o=[],u=[],l={},c={0:Vn,1:_l,2:hh},f=new br({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new De},radius:{value:4}},vertexShader:eD,fragmentShader:Q5}),h=f.clone();h.defines.HORIZONAL_PASS=1;var p=new nt;p.setAttribute("position",new gt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new pn(p,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Cb,this.render=function(w,E,x){if(v.enabled!==!1&&!(v.autoUpdate===!1&&v.needsUpdate===!1)&&w.length!==0){var S=i.getRenderTarget(),T=i.getActiveCubeFace(),L=i.getActiveMipmapLevel(),B=i.state;B.setBlending(ka),B.buffers.color.setClear(1,1,1,1),B.buffers.depth.setTest(!0),B.setScissorTest(!1);for(var k=0,R=w.length;k<R;k++){var F=w[k],W=F.shadow;if(W===void 0){console.warn("THREE.WebGLShadowMap:",F,"has no shadow.");continue}r.copy(W.mapSize);var K=W.getFrameExtents();if(r.multiply(K),a.copy(W.mapSize),(r.x>t||r.y>t)&&(console.warn("THREE.WebGLShadowMap:",F,"has shadow exceeding max texture size, reducing"),r.x>t&&(a.x=Math.floor(t/K.x),r.x=a.x*K.x,W.mapSize.x=a.x),r.y>t&&(a.y=Math.floor(t/K.y),r.y=a.y*K.y,W.mapSize.y=a.y)),W.map===null&&!W.isPointLightShadow&&this.type===vu){var $={minFilter:Nn,magFilter:Nn,format:Ai};W.map=new fr(r.x,r.y,$),W.map.texture.name=F.name+".shadowMap",W.mapPass=new fr(r.x,r.y,$),W.camera.updateProjectionMatrix()}if(W.map===null){var $={minFilter:kn,magFilter:kn,format:Ai};W.map=new fr(r.x,r.y,$),W.map.texture.name=F.name+".shadowMap",W.camera.updateProjectionMatrix()}i.setRenderTarget(W.map),i.clear();for(var U=W.getViewportCount(),N=0;N<U;N++){var P=W.getViewport(N);s.set(a.x*P.x,a.y*P.y,a.x*P.z,a.y*P.w),B.viewport(s),W.updateMatrices(F,N),n=W.getFrustum(),_(E,x,W.camera,F,this.type)}!W.isPointLightShadow&&this.type===vu&&g(W,x)}v.needsUpdate=!1,i.setRenderTarget(S,T,L)}};function g(w,E){var x=e.update(m);f.uniforms.shadow_pass.value=w.map.texture,f.uniforms.resolution.value=w.mapSize,f.uniforms.radius.value=w.radius,i.setRenderTarget(w.mapPass),i.clear(),i.renderBufferDirect(E,null,x,f,m,null),h.uniforms.shadow_pass.value=w.mapPass.texture,h.uniforms.resolution.value=w.mapSize,h.uniforms.radius.value=w.radius,i.setRenderTarget(w.map),i.clear(),i.renderBufferDirect(E,null,x,h,m,null)}function d(w,E,x){var S=w<<0|E<<1|x<<2,T=o[S];return T===void 0&&(T=new bs({depthPacking:XS,morphTargets:w,skinning:E}),o[S]=T),T}function y(w,E,x){var S=w<<0|E<<1|x<<2,T=u[S];return T===void 0&&(T=new ws({morphTargets:w,skinning:E}),u[S]=T),T}function b(w,E,x,S,T,L){var B=w.geometry,k=null,R=d,F=w.customDepthMaterial;if(x.isPointLight===!0&&(R=y,F=w.customDistanceMaterial),F===void 0){var W=!1;E.morphTargets===!0&&(B.isBufferGeometry===!0?W=B.morphAttributes&&B.morphAttributes.position&&B.morphAttributes.position.length>0:B.isGeometry===!0&&(W=B.morphTargets&&B.morphTargets.length>0));var K=!1;w.isSkinnedMesh===!0&&(E.skinning===!0?K=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",w));var $=w.isInstancedMesh===!0;k=R(W,K,$)}else k=F;if(i.localClippingEnabled&&E.clipShadows===!0&&E.clippingPlanes.length!==0){var U=k.uuid,N=E.uuid,P=l[U];P===void 0&&(P={},l[U]=P);var D=P[N];D===void 0&&(D=k.clone(),P[N]=D),k=D}return k.visible=E.visible,k.wireframe=E.wireframe,L===vu?k.side=E.shadowSide!==null?E.shadowSide:E.side:k.side=E.shadowSide!==null?E.shadowSide:c[E.side],k.clipShadows=E.clipShadows,k.clippingPlanes=E.clippingPlanes,k.clipIntersection=E.clipIntersection,k.wireframeLinewidth=E.wireframeLinewidth,k.linewidth=E.linewidth,x.isPointLight===!0&&k.isMeshDistanceMaterial===!0&&(k.referencePosition.setFromMatrixPosition(x.matrixWorld),k.nearDistance=S,k.farDistance=T),k}function _(w,E,x,S,T){if(w.visible!==!1){var L=w.layers.test(E.layers);if(L&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&T===vu)&&(!w.frustumCulled||n.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(x.matrixWorldInverse,w.matrixWorld);var B=e.update(w),k=w.material;if(Array.isArray(k))for
Object.assign(Xr.prototype,{beforeStart_:Xr.prototype.copySampleValue_,afterEnd_:Xr.prototype.copySampleValue_});function Bd(i,e,t,n){Xr.call(this,i,e,t,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}Bd.prototype=Object.assign(Object.create(Xr.prototype),{constructor:Bd,DefaultSettings_:{endingStart:To,endingEnd:To},intervalChanged_:function(e,t,n){var r=this.parameterPositions,a=e-2,s=e+1,o=r[a],u=r[s];if(o===void 0)switch(this.getSettings_().endingStart){case so:a=e,o=2*t-n;break;case hf:a=r.length-2,o=t+r[a]-r[a+1];break;default:a=e,o=n}if(u===void 0)switch(this.getSettings_().endingEnd){case so:s=e,u=2*n-t;break;case hf:s=1,u=n+r[1]-r[0];break;default:s=e-1,u=t}var l=(n-t)*.5,c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(u-n),this._offsetPrev=a*c,this._offsetNext=s*c},interpolate_:function(e,t,n,r){for(var a=this.resultBuffer,s=this.sampleValues,o=this.valueSize,u=e*o,l=u-o,c=this._offsetPrev,f=this._offsetNext,h=this._weightPrev,p=this._weightNext,m=(n-t)/(r-t),v=m*m,g=v*m,d=-h*g+2*h*v-h*m,y=(1+h)*g+(-1.5-2*h)*v+(-.5+h)*m+1,b=(-1-p)*g+(1.5+p)*v+.5*m,_=p*g-p*v,w=0;w!==o;++w)a[w]=d*s[c+w]+y*s[l+w]+b*s[u+w]+_*s[f+w];return a}});function Nf(i,e,t,n){Xr.call(this,i,e,t,n)}Nf.prototype=Object.assign(Object.create(Xr.prototype),{constructor:Nf,interpolate_:function(e,t,n,r){for(var a=this.resultBuffer,s=this.sampleValues,o=this.valueSize,u=e*o,l=u-o,c=(n-t)/(r-t),f=1-c,h=0;h!==o;++h)a[h]=s[l+h]*f+s[u+h]*c;return a}});function Od(i,e,t,n){Xr.call(this,i,e,t,n)}Od.prototype=Object.assign(Object.create(Xr.prototype),{constructor:Od,interpolate_:function(e){return this.copySampleValue_(e-1)}});function sr(i,e,t,n){if(i===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+i);this.name=i,this.times=Sn.convertArray(e,this.TimeBufferType),this.values=Sn.convertArray(t,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}Object.assign(sr,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:Sn.convertArray(e.times,Array),values:Sn.convertArray(e.values,Array)};var r=e.getInterpolation();r!==e.DefaultInterpolation&&(n.interpolation=r)}return n.type=e.ValueTypeName,n}});Object.assign(sr.prototype,{constructor:sr,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:kc,InterpolantFactoryMethodDiscrete:function(e){return new Od(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new Nf(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new Bd(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case ff:t=this.InterpolantFactoryMethodDiscrete;break;case kc:t=this.InterpolantFactoryMethodLinear;break;case Vh:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ff;case this.InterpolantFactoryMethodLinear:return kc;case this.InterpolantFactoryMethodSmooth:return Vh}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,r=t.length;n!==r;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,r=n.length,a=0,s=r-1;a!==r&&n[a]<e;)++a;for(;s!==-1&&n[s]>t;)--s;if(++s,a!==0||s!==r){a>=s&&(s=Math.max(s,1),a=s-1);var o=this.getValueSize();this.times=Sn.arraySlice(n,a,s),this.values=Sn.arraySlice(this.values,a*o,s*o)}return this},validate:function(){var e=!0,t=this.g
`)o=0,u-=a;else{var f=BD(c,r,o,u,t);o+=f.offsetX,s.push(f.path)}}return s}function BD(i,e,t,n,r){var a=r.glyphs[i]||r.glyphs["?"];if(!a){console.error('THREE.Font: character "'+i+'" does not exists in font family '+r.familyName+".");return}var s=new sw,o,u,l,c,f,h,p,m;if(a.o)for(var v=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),g=0,d=v.length;g<d;){var y=v[g++];switch(y){case"m":o=v[g++]*e+t,u=v[g++]*e+n,s.moveTo(o,u);break;case"l":o=v[g++]*e+t,u=v[g++]*e+n,s.lineTo(o,u);break;case"q":l=v[g++]*e+t,c=v[g++]*e+n,f=v[g++]*e+t,h=v[g++]*e+n,s.quadraticCurveTo(f,h,l,c);break;case"b":l=v[g++]*e+t,c=v[g++]*e+n,f=v[g++]*e+t,h=v[g++]*e+n,p=v[g++]*e+t,m=v[g++]*e+n,s.bezierCurveTo(f,h,p,m,l,c);break}}return{offsetX:a.ha*e,path:s}}function Og(i){Kt.call(this,i)}Og.prototype=Object.assign(Object.create(Kt.prototype),{constructor:Og,load:function(e,t,n,r){var a=this,s=new xi(this.manager);s.setPath(this.path),s.load(e,function(o){var u;try{u=JSON.parse(o)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),u=JSON.parse(o.substring(65,o.length-2))}var l=a.parse(u);t&&t(l)},n,r)},parse:function(e){return new ow(e)}});var dc,uw={getContext:function(){return dc===void 0&&(dc=new(window.AudioContext||window.webkitAudioContext)),dc},setContext:function(e){dc=e}};function sv(i){Kt.call(this,i)}sv.prototype=Object.assign(Object.create(Kt.prototype),{constructor:sv,load:function(e,t,n,r){var a=new xi(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.load(e,function(s){var o=s.slice(0),u=uw.getContext();u.decodeAudioData(o,function(l){t(l)})},n,r)}});function Em(){this.coefficients=[];for(var i=0;i<9;i++)this.coefficients.push(new J)}Object.assign(Em.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,r=e.y,a=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScale(s[1],.488603*r),t.addScale(s[2],.488603*a),t.addScale(s[3],.488603*n),t.addScale(s[4],1.092548*(n*r)),t.addScale(s[5],1.092548*(r*a)),t.addScale(s[6],.315392*(3*a*a-1)),t.addScale(s[7],1.092548*(n*a)),t.addScale(s[8],.546274*(n*n-r*r)),t},getIrradianceAt:function(e,t){var n=e.x,r=e.y,a=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScale(s[1],2*.511664*r),t.addScale(s[2],2*.511664*a),t.addScale(s[3],2*.511664*n),t.addScale(s[4],2*.429043*n*r),t.addScale(s[5],2*.429043*r*a),t.addScale(s[6],.743125*a*a-.247708),t.addScale(s[7],2*.429043*n*a),t.addScale(s[8],.429043*(n*n-r*r)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e,t){t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].fromArray(e,t+r*3);return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);for(var n=this.coefficients,r=0;r<9;r++)n[r].toArray(e,t+r*3);return e}});Object.assign(Em,{getBasisAt:function(e,t){var n=e.x,r=e.y,a=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*a,t[3]=.488603*n,t[4]=1.092548*n*r,t[5]=1.092548*r*a,t[6]=.315392*(3*a*a-1),t[7]=1.092548*n*a,t[8]=.546274*(n*n-r*r)}});function Si(i,e){rn.call(this,void 0,e),this.sh=i!==void 0?i:new Em}Si.prototype=Object.assign(Object.create(rn.prototype),{constructor:Si,isLightProbe:!0,copy:function(e){return rn.prototype.copy.call(this,e),this.sh.copy(e.sh),this.intensity=e.intensity,this},toJSON:function(e){var t=rn.prototype.toJSON.call(this,e);return t}});function Ng(i,e,t){Si.call(this,void 0,t);var n=new Qe().set(i),r=new Qe().set(e),a=new J(n.r,n.g,n.b),s=new J(r.r,r.g,r.b
Object.assign(hr.prototype,{_getValue_unbound:hr.prototype.getValue,_setValue_unbound:hr.prototype.setValue});function XD(){this.uuid=kt.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var i={};this._indicesByUUID=i;for(var e=0,t=arguments.length;e!==t;++e)i[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var n=this;this.stats={objects:{get total(){return n._objects.length},get inUse(){return this.total-n.nCachedObjects_}},get bindingsPerObject(){return n._bindings.length}}}Object.assign(XD.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._paths,s=this._parsedPaths,o=this._bindings,u=o.length,l=void 0,c=0,f=arguments.length;c!==f;++c){var h=arguments[c],p=h.uuid,m=r[p];if(m===void 0){m=t++,r[p]=m,e.push(h);for(var v=0,g=u;v!==g;++v)o[v].push(new hr(h,a[v],s[v]))}else if(m<n){l=e[m];var d=--n,y=e[d];r[y.uuid]=m,e[m]=y,r[p]=d,e[d]=h;for(var v=0,g=u;v!==g;++v){var b=o[v],_=b[d],w=b[m];b[m]=_,w===void 0&&(w=new hr(h,a[v],s[v])),b[d]=w}}else e[m]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,r=this._bindings,a=r.length,s=0,o=arguments.length;s!==o;++s){var u=arguments[s],l=u.uuid,c=n[l];if(c!==void 0&&c>=t){var f=t++,h=e[f];n[h.uuid]=c,e[c]=h,n[l]=f,e[f]=u;for(var p=0,m=a;p!==m;++p){var v=r[p],g=v[f],d=v[c];v[c]=g,v[f]=d}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,r=this._indicesByUUID,a=this._bindings,s=a.length,o=0,u=arguments.length;o!==u;++o){var l=arguments[o],c=l.uuid,f=r[c];if(f!==void 0)if(delete r[c],f<n){var h=--n,p=e[h],m=--t,v=e[m];r[p.uuid]=f,e[f]=p,r[v.uuid]=h,e[h]=v,e.pop();for(var g=0,d=s;g!==d;++g){var y=a[g],b=y[h],_=y[m];y[f]=b,y[h]=_,y.pop()}}else{var m=--t,v=e[m];r[v.uuid]=f,e[f]=v,e.pop();for(var g=0,d=s;g!==d;++g){var y=a[g];y[f]=y[m],y.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,r=n[e],a=this._bindings;if(r!==void 0)return a[r];var s=this._paths,o=this._parsedPaths,u=this._objects,l=u.length,c=this.nCachedObjects_,f=new Array(l);r=a.length,n[e]=r,s.push(e),o.push(t),a.push(f);for(var h=c,p=u.length;h!==p;++h){var m=u[h];f[h]=new hr(m,e,t)}return f},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var r=this._paths,a=this._parsedPaths,s=this._bindings,o=s.length-1,u=s[o],l=e[o];t[l]=n,s[n]=u,s.pop(),a[n]=a[o],a.pop(),r[n]=r[o],r.pop()}}});function pw(i,e,t){this._mixer=i,this._clip=e,this._localRoot=t||null;for(var n=e.tracks,r=n.length,a=new Array(r),s={endingStart:To,endingEnd:To},o=0;o!==r;++o){var u=n[o].createInterpolant(null);a[o]=u,u.settings=s}this._interpolantSettings=s,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=zS,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}Object.assign(pw.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform int samples;
uniform float weights[n];
uniform bool latitudinal;
uniform float dTheta;
uniform float mipInt;
uniform vec3 poleAxis;
`.concat(km(),`
#define ENVMAP_TYPE_CUBE_UV
#include <cube_uv_reflection_fragment>
void main() {
gl_FragColor = vec4(0.0);
for (int i = 0; i < n; i++) {
if (i >= samples)
break;
for (int dir = -1; dir < 2; dir += 2) {
if (i == 0 && dir == 1)
continue;
vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);
if (all(equal(axis, vec3(0.0))))
axis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);
axis = normalize(axis);
float theta = dTheta * float(dir * i);
float cosTheta = cos(theta);
// Rodrigues' axis-angle rotation
vec3 sampleDirection = vOutputDirection * cosTheta
+ cross(axis, vOutputDirection) * sin(theta)
+ axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);
gl_FragColor.rgb +=
weights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);
}
}
gl_FragColor = linearToOutputTexel(gl_FragColor);
}
`),blending:ka,depthTest:!1,depthWrite:!1});return n.type="SphericalGaussianBlur",n}function ww(){var i=new De(1,1),e=new Na({uniforms:{envMap:{value:null},texelSize:{value:i},inputEncoding:{value:Ii[Fr]},outputEncoding:{value:Ii[Fr]}},vertexShader:Dm(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform sampler2D envMap;
uniform vec2 texelSize;
`.concat(km(),`
#define RECIPROCAL_PI 0.31830988618
#define RECIPROCAL_PI2 0.15915494
void main() {
gl_FragColor = vec4(0.0);
vec3 outputDirection = normalize(vOutputDirection);
vec2 uv;
uv.y = asin(clamp(outputDirection.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;
uv.x = atan(outputDirection.z, outputDirection.x) * RECIPROCAL_PI2 + 0.5;
vec2 f = fract(uv / texelSize - 0.5);
uv -= f * texelSize;
vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
uv.x += texelSize.x;
vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
uv.y += texelSize.y;
vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
uv.x -= texelSize.x;
vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;
vec3 tm = mix(tl, tr, f.x);
vec3 bm = mix(bl, br, f.x);
gl_FragColor.rgb = mix(tm, bm, f.y);
gl_FragColor = linearToOutputTexel(gl_FragColor);
}
`),blending:ka,depthTest:!1,depthWrite:!1});return e.type="EquirectangularToCubeUV",e}function _w(){var i=new Na({uniforms:{envMap:{value:null},inputEncoding:{value:Ii[Fr]},outputEncoding:{value:Ii[Fr]}},vertexShader:Dm(),fragmentShader:`
precision mediump float;
precision mediump int;
varying vec3 vOutputDirection;
uniform samplerCube envMap;
`.concat(km(),`
void main() {
gl_FragColor = vec4(0.0);
gl_FragColor.rgb = envMapTexelToLinear(textureCube(envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ))).rgb;
gl_FragColor = linearToOutputTexel(gl_FragColor);
}
`),blending:ka,depthTest:!1,depthWrite:!1});return i.type="CubemapToCubeUV",i}function Dm(){return`
precision mediump float;
precision mediump int;
attribute vec3 position;
attribute vec2 uv;
attribute float faceIndex;
varying vec3 vOutputDirection;
vec3 getDirection(vec2 uv, float face) {
uv = 2.0 * uv - 1.0;
vec3 direction = vec3(uv, 1.0);
if (face == 0.0) {
direction = direction.zyx;
direction.z *= -1.0;
} else if (face == 1.0) {
direction = direction.xzy;
direction.z *= -1.0;
} else if (face == 3.0) {
direction = direction.zyx;
direction.x *= -1.0;
} else if (face == 4.0) {
direction = direction.xzy;
direction.y *= -1.0;
} else if (face == 5.0) {
direction.xz *= -1.0;
}
return direction;
}
void main() {
vOutputDirection = getDirection(uv, faceIndex);
gl_Position = vec4( position, 1.0 );
}
`}function km(){return`
uniform int inputEncoding;
uniform int outputEncoding;
#include <encodings_pars_fragment>
vec4 inputTexelToLinear(vec4 value){
if(inputEncoding == 0){
return value;
}else if(inputEncoding == 1){
return sRGBToLinear(value);
}else if(inputEncoding == 2){
return RGBEToLinear(value);
}else if(inputEncoding == 3){
return RGBMToLinear(value, 7.0);
}else if(inputEncoding == 4){
return RGBMToLinear(value, 16.0);
}else if(inputEncoding == 5){
return RGBDToLinear(value, 256.0);
}else{
return GammaToLinear(value, 2.2);
}
}
vec4 linearToOutputTexel(vec4 value){
if(outputEncoding == 0){
return value;
}else if(outputEncoding == 1){
return LinearTosRGB(value);
}else if(outputEncoding == 2){
return LinearToRGBE(value);
}else if(outputEncoding == 3){
return LinearToRGBM(value, 7.0);
}else if(outputEncoding == 4){
return LinearToRGBM(value, 16.0);
}else if(outputEncoding == 5){
return LinearToRGBD(value, 256.0);
}else{
return LinearToGamma(value, 2.2);
}
}
vec4 envMapTexelToLinear(vec4 color) {
return inputTexelToLinear(color);
}
`}ct.create=function(i,e){return console.log("THREE.Curve.create() has been deprecated"),i.prototype=Object.create(ct.prototype),i.prototype.constructor=i,i.prototype.getPoint=e,i};Object.assign(Ta.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new yt,n=0,r=e.length;n<r;n++){var a=e[n];t.vertices.push(new J(a.x,a.y,a.z||0))}return t}});Object.assign(_i.prototype,{fromPoints:function(e){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}});Object.create(Br.prototype);Object.create(Br.prototype);function Ew(i){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Br.call(this,i),this.type="catmullrom"}Ew.prototype=Object.create(Br.prototype);Object.assign(Ew.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});lv.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};cl.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};Object.assign(Kt.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),aw.extractUrlBase(e)}});Kt.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Object.assign(av.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}});Object.assign(dw.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(Pi.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}});Al.prototype.setFromMatrix=function(i){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(i)};vw.prototype.center=function(i){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(i)};Object.assign(kt,{random16:function(){return