!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Potree={})}(this,function(W){"use strict";function i(o){var r,a;function s(n,e){try{var i=o[n](e),r=i.value,a=r instanceof u;Promise.resolve(a?r.v:r).then(function(e){if(a){var t="return"===n?"return":"next";if(!r.k||e.done)return s(t,e);e=o[t](e).value}l(i.done?"return":"normal",e)},function(e){s("throw",e)})}catch(e){l("throw",e)}}function l(e,t){switch(e){case"return":r.resolve({value:t,done:!0});break;case"throw":r.reject(t);break;default:r.resolve({value:t,done:!1})}(r=r.next)?s(r.key,r.arg):a=null}this._invoke=function(n,i){return new Promise(function(e,t){e={key:n,arg:i,resolve:e,reject:t,next:null};a?a=a.next=e:(r=a=e,s(n,i))})},"function"!=typeof o.return&&(this.return=void 0)}function u(e,t){this.v=e,this.k=t}function c(e){var t,n,i,r=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,i=Symbol.iterator);r--;){if(n&&null!=(t=e[n]))return t.call(e);if(i&&null!=(t=e[i]))return new o(t.call(e));n="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}function o(e){function n(e){var t;return Object(e)!==e?Promise.reject(new TypeError(e+" is not an object.")):(t=e.done,Promise.resolve(e.value).then(function(e){return{value:e,done:t}}))}return(o=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return n(this.n.apply(this.s,arguments))},return:function(e){var t=this.s.return;return void 0===t?Promise.resolve({value:e,done:!0}):n(t.apply(this.s,arguments))},throw:function(e){var t=this.s.return;return void 0===t?Promise.reject(e):n(t.apply(this.s,arguments))}},new o(e)}function h(e){return new u(e,0)}function s(t,e){var n,i=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)),i}function g(t){for(var e=1;ee.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function se(e){e=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);if("object"!=typeof(n=n.call(e,t||"default")))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}(e,"string");return"symbol"==typeof e?e:String(e)}i.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},i.prototype.next=function(e){return this._invoke("next",e)},i.prototype.throw=function(e){return this._invoke("throw",e)},i.prototype.return=function(e){return this._invoke("return",e)};var le={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ue=0,ce=1,he=2,de=1,pe=3,fe=0,me=1,ve=2,ge=0,Ae=1,ye=2,we=3,be=4,xe=5,Ee=100,Ce=101,Te=102,Se=103,Ie=104,De=200,Pe=201,ke=202,Fe=203,Oe=204,Ne=205,Ge=206,Ue=207,ze=208,He=209,Qe=210,Ve=0,je=1,We=2,Je=3,qe=4,Xe=5,Ye=6,Ke=7,Ze=0,$e=0,et=301,tt=302,nt=303,it=304,rt=306,at=307,ot=1e3,st=1001,lt=1002,ut=1003,ct=1004,ht=1005,U=1006,dt=1007,pt=1008,ft=1008,mt=1009,vt=1010,gt=1011,At=1012,yt=1013,wt=1014,bt=1015,xt=1016,Et=1017,Ct=1018,Bt=1019,_t=1020,Mt=1021,Tt=1022,St=1023,It=1024,Dt=1025,Pt=St,kt=1026,Lt=1027,Rt=1028,Ft=1029,Ot=1030,Nt=1031,Gt=1032,Ut=1033,zt=33776,Ht=33777,Qt=33778,Vt=33779,jt=35840,Wt=35841,Jt=35842,qt=35843,Xt=36196,Yt=37492,Kt=37496,Zt=37808,$t=37809,en=37810,tn=37811,nn=37812,rn=37813,an=37814,on=37815,sn=37816,ln=37817,un=37818,cn=37819,hn=37820,dn=37821,pn=36492,fn=37840,mn=37841,vn=37842,gn=37843,An=37844,yn=37845,wn=37846,bn=37847,xn=37848,En=37849,Cn=37850,Bn=37851,_n=37852,Mn=37853,Tn=2300,Sn=2301,In=2400,Dn=2401,Pn=2402,kn=3e3,Ln=3001,Rn=3201,Fn=0,On=1,Nn=35044,Gn=35048,Un="300 es";function zn(){}Object.assign(zn.prototype,{addEventListener:function(e,t){void 0===this._listeners&&(this._listeners={});var n=this._listeners;void 0===n[e]&&(n[e]=[]),-1===n[e].indexOf(t)&&n[e].push(t)},hasEventListener:function(e,t){var n;return void 0!==this._listeners&&void 0!==(n=this._listeners)[e]&&-1!==n[e].indexOf(t)},dispatchEvent:function(e){if(void 0!==this._listeners){var t=this._listeners[e.type];if(void 0!==t){e.target=this;for(var n=t.slice(0),i=0,r=n.length;i>8&255]+Hn[e>>16&255]+Hn[e>>24&255]+"-"+Hn[255&t]+Hn[t>>8&255]+"-"+Hn[t>>16&15|64]+Hn[t>>24&255]+"-"+Hn[63&n|128]+Hn[n>>8&255]+"-"+Hn[n>>16&255]+Hn[n>>24&255]+Hn[255&i]+Hn[i>>8&255]+Hn[i>>16&255]+Hn[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:n<=e?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){return((jn=16807*(jn=void 0!==e?e%2147483647:jn)%2147483647)-1)/2147483646},degToRad:function(e){return e*Be.DEG2RAD},radToDeg:function(e){return e*Be.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+i)/2),c=o((t+i)/2),h=a((t-i)/2),d=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*c,l*h,l*d,s*u);break;case"YZY":e.set(l*d,s*c,l*h,s*u);break;case"ZXZ":e.set(l*h,l*d,s*c,s*u);break;case"XZX":e.set(s*c,l*f,l*p,s*u);break;case"YXY":e.set(l*p,s*c,l*f,s*u);break;case"ZYZ":e.set(l*f,l*p,s*c,s*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}},Le=function(){function n(){var e=0Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(Be.clamp(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);return 0!==n&&(t=Math.min(1,t/n),this.slerp(e,t)),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(e=1/e),this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,i=e._y,r=e._z,e=e._w,a=t._x,o=t._y,s=t._z,t=t._w;return this._x=n*t+e*a+i*s-r*o,this._y=i*t+e*o+r*a-n*s,this._z=r*t+e*s+n*o-i*a,this._w=e*t-n*a-i*o-r*s,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0!==t){if(1===t)return this.copy(e);var n,i=this._x,r=this._y,a=this._z,o=this._w,s=o*e._w+i*e._x+r*e._y+a*e._z;s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s?(this._w=o,this._x=i,this._y=r,this._z=a):((e=1-s*s)<=Number.EPSILON?(this._w=(n=1-t)*o+t*this._w,this._x=n*i+t*this._x,this._y=n*r+t*this._y,this._z=n*a+t*this._z,this.normalize()):(n=Math.sqrt(e),e=Math.atan2(n,s),s=Math.sin((1-t)*e)/n,t=Math.sin(t*e)/n,this._w=o*s+this._w*t,this._x=i*s+this._x*t,this._y=r*s+this._y*t,this._z=a*s+this._z*t),this._onChangeCallback())}return this}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=1Number.EPSILON&&(u=Math.sqrt(u),l=Math.atan2(u,l*s),a=Math.sin(a*l)/u,o=Math.sin(o*l)/u),c=c*a+i*(l=o*s),h=h*a+p*l,d=d*a+f*l,n=n*a+r*l,a===1-o&&(c*=u=1/Math.sqrt(c*c+h*h+d*d+n*n),h*=u,d*=u,n*=u)),e[t]=c,e[t+1]=h,e[t+2]=d,e[t+3]=n}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],n=n[i+3],i=r[a],u=r[a+1],c=r[a+2],r=r[a+3];return e[t]=o*r+n*i+s*c-l*u,e[t+1]=s*r+n*u+l*i-o*c,e[t+2]=l*r+n*c+o*u-s*i,e[t+3]=n*r-o*i-s*u-l*c,e}}]),r}(),Re=function(){function i(){var e=0this.max.x||e.ythis.max.y||e.zthis.max.z)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}},{key:"getParameter",value:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new Re),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}},{key:"intersectsSphere",value:function(e){return this.clampPoint(e.center,ri),ri.distanceToSquared(e.center)<=e.radius*e.radius}},{key:"intersectsPlane",value:function(e){var t,n=0=-e.constant}},{key:"intersectsTriangle",value:function(e){return!this.isEmpty()&&(this.getCenter(di),pi.subVectors(this.max,di),oi.subVectors(e.a,di),si.subVectors(e.b,di),li.subVectors(e.c,di),ui.subVectors(si,oi),ci.subVectors(li,si),hi.subVectors(oi,li),!!ni([0,-ui.z,ui.y,0,-ci.z,ci.y,0,-hi.z,hi.y,ui.z,0,-ui.x,ci.z,0,-ci.x,hi.z,0,-hi.x,-ui.y,ui.x,0,-ci.y,ci.x,0,-hi.y,hi.x,0],oi,si,li,pi))&&!!ni([1,0,0,0,1,0,0,0,1],oi,si,li,pi)&&(fi.crossVectors(ui,ci),ni([fi.x,fi.y,fi.z],oi,si,li,pi))}},{key:"clampPoint",value:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Re),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return ri.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"getBoundingSphere",value:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(ri).length(),e}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"applyMatrix4",value:function(e){return this.isEmpty()||(ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ii)),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),n}();function ni(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){mi.fromArray(e,a);var s=r.x*Math.abs(mi.x)+r.y*Math.abs(mi.y)+r.z*Math.abs(mi.z),l=t.dot(mi),u=n.dot(mi),c=i.dot(mi);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var ii=[new Re,new Re,new Re,new Re,new Re,new Re,new Re,new Re],ri=new Re,ai=new Y,oi=new Re,si=new Re,li=new Re,ui=new Re,ci=new Re,hi=new Re,di=new Re,pi=new Re,fi=new Re,mi=new Re,vi=new Y,gi=function(){function n(e,t){te(this,n),this.center=void 0!==e?e:new Re,this.radius=void 0!==t?t:-1}return A(n,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){for(var n=this.center,i=(void 0!==t?n.copy(t):vi.setFromPoints(e).getCenter(n),0),r=0,a=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Y),this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}},{key:"applyMatrix4",value:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}},{key:"translate",value:function(e){return this.center.add(e),this}},{key:"equals",value:function(e){return e.center.equals(this.center)&&e.radius===this.radius}}]),n}(),Ai=new Re,yi=new Re,wi=new Re,bi=new Re,xi=new Re,Ei=new Re,Ci=new Re,Bi=function(){function n(e,t){te(this,n),this.origin=void 0!==e?e:new Re,this.direction=void 0!==t?t:new Re(0,0,-1)}return A(n,[{key:"set",value:function(e,t){return this.origin.copy(e),this.direction.copy(t),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}},{key:"at",value:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new Re),t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"lookAt",value:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this}},{key:"recast",value:function(e){return this.origin.copy(this.at(e,Ai)),this}},{key:"closestPointToPoint",value:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Re),t.subVectors(e,this.origin);e=t.dot(this.direction);return e<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(e).add(this.origin)}},{key:"distanceToPoint",value:function(e){return Math.sqrt(this.distanceSqToPoint(e))}},{key:"distanceSqToPoint",value:function(e){var t=Ai.subVectors(e,this.origin).dot(this.direction);return(t<0?this.origin:(Ai.copy(this.direction).multiplyScalar(t).add(this.origin),Ai)).distanceToSquared(e)}},{key:"distanceSqToSegment",value:function(e,t,n,i){yi.copy(e).add(t).multiplyScalar(.5),wi.copy(t).sub(e).normalize(),bi.copy(this.origin).sub(yi);var r,a,o,e=.5*e.distanceTo(t),t=-this.direction.dot(wi),s=bi.dot(this.direction),l=-bi.dot(wi),u=bi.lengthSq(),c=Math.abs(1-t*t);return c=0>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}},{key:"setRGB",value:function(e,t,n){return this.r=e,this.g=t,this.b=n,this}},{key:"setHSL",value:function(e,t,n){return e=Be.euclideanModulo(e,1),t=Be.clamp(t,0,1),n=Be.clamp(n,0,1),0===t?this.r=this.g=this.b=n:(this.r=fr(t=2*n-(n=n<=.5?n*(1+t):n+t-n*t),n,e+1/3),this.g=fr(t,n,e),this.b=fr(t,n,e-1/3)),this}},{key:"setStyle",value:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}if(l=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,i,r,a,o=l[1],s=l[2];switch(o){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[4]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[4]),this;break;case"hsl":case"hsla":if(n=/^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i=parseFloat(n[1])/360,r=parseInt(n[2],10)/100,a=parseInt(n[3],10)/100,e(n[4]),this.setHSL(i,r,a)}}else if(l=/^\#([A-Fa-f\d]+)$/.exec(t)){var o=l[1],l=o.length;if(3===l)return this.r=parseInt(o.charAt(0)+o.charAt(0),16)/255,this.g=parseInt(o.charAt(1)+o.charAt(1),16)/255,this.b=parseInt(o.charAt(2)+o.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(o.charAt(0)+o.charAt(1),16)/255,this.g=parseInt(o.charAt(2)+o.charAt(3),16)/255,this.b=parseInt(o.charAt(4)+o.charAt(5),16)/255,this}return t&&0t&&(t=e[n]);return t}var kr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Lr(e,t){return new kr[e](t)}var Rr=1,Fr=new _e,Or=new K,Nr=new Re,Gr=new Y,Ur=new Y,zr=new Re;function j(){Object.defineProperty(this,"id",{value:Rr+=2}),this.uuid=Be.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}j.prototype=Object.assign(Object.create(zn.prototype),{constructor:j,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){return Array.isArray(e)?this.index=new(65535n.far?null:{distance:r,point:ra.clone(),object:e}}function oa(e,t,n,i,r,a,o,s,l,u,c,h){jr.fromBufferAttribute(r,u),Wr.fromBufferAttribute(r,c),Jr.fromBufferAttribute(r,h);var d=e.morphTargetInfluences;if(t.morphTargets&&a&&d){Kr.set(0,0,0),Zr.set(0,0,0),$r.set(0,0,0);for(var p=0,f=a.length;p\n\t\t\t\t#include \n\n\t\t\t}\n\t\t",r="\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t",a=new sa(5,5,5),n=new pa({name:"CubemapFromEquirect",uniforms:la(n),vertexShader:i,fragmentShader:r,side:me,blending:ge}),i=(n.uniforms.tEquirect.value=t,new Z(a,n)),r=t.minFilter;return t.minFilter===pt&&(t.minFilter=U),new va(1,10,this).update(e,i),t.minFilter=r,i.geometry.dispose(),i.material.dispose(),this},Aa.prototype.clear=function(e,t,n,i){for(var r=e.getRenderTarget(),a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)},((ya.prototype=Object.create(Xn.prototype)).constructor=ya).prototype.isDataTexture=!0;var wa=new gi,ba=new Re,xa=function(){function o(e,t,n,i,r,a){te(this,o),this.planes=[void 0!==e?e:new $i,void 0!==t?t:new $i,void 0!==n?n:new $i,void 0!==i?i:new $i,void 0!==r?r:new $i,void 0!==a?a:new $i]}return A(o,[{key:"set",value:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,e=e.elements,n=e[0],i=e[1],r=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],v=e[14],e=e[15];return t[0].setComponents(a-n,u-o,p-c,e-f).normalize(),t[1].setComponents(a+n,u+o,p+c,e+f).normalize(),t[2].setComponents(a+i,u+s,p+h,e+m).normalize(),t[3].setComponents(a-i,u-s,p-h,e-m).normalize(),t[4].setComponents(a-r,u-l,p-d,e-v).normalize(),t[5].setComponents(a+r,u+l,p+d,e+v).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),wa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(wa)}},{key:"intersectsSprite",value:function(e){return wa.center.set(0,0,0),wa.radius=.7071067811865476,wa.applyMatrix4(e.matrixWorld),this.intersectsSphere(wa)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n) 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},D={common:{diffuse:{value:new Me(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Wn},uv2Transform:{value:new Wn},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 Le(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 Me(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Me(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Wn}},sprite:{diffuse:{value:new Me(15658734)},opacity:{value:1},center:{value:new Le(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Wn}}},Ma={basic:{uniforms:ua([D.common,D.specularmap,D.envmap,D.aomap,D.lightmap,D.fog]),vertexShader:_a.meshbasic_vert,fragmentShader:_a.meshbasic_frag},lambert:{uniforms:ua([D.common,D.specularmap,D.envmap,D.aomap,D.lightmap,D.emissivemap,D.fog,D.lights,{emissive:{value:new Me(0)}}]),vertexShader:_a.meshlambert_vert,fragmentShader:_a.meshlambert_frag},phong:{uniforms:ua([D.common,D.specularmap,D.envmap,D.aomap,D.lightmap,D.emissivemap,D.bumpmap,D.normalmap,D.displacementmap,D.fog,D.lights,{emissive:{value:new Me(0)},specular:{value:new Me(1118481)},shininess:{value:30}}]),vertexShader:_a.meshphong_vert,fragmentShader:_a.meshphong_frag},standard:{uniforms:ua([D.common,D.envmap,D.aomap,D.lightmap,D.emissivemap,D.bumpmap,D.normalmap,D.displacementmap,D.roughnessmap,D.metalnessmap,D.fog,D.lights,{emissive:{value:new Me(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_a.meshphysical_vert,fragmentShader:_a.meshphysical_frag},toon:{uniforms:ua([D.common,D.aomap,D.lightmap,D.emissivemap,D.bumpmap,D.normalmap,D.displacementmap,D.gradientmap,D.fog,D.lights,{emissive:{value:new Me(0)}}]),vertexShader:_a.meshtoon_vert,fragmentShader:_a.meshtoon_frag},matcap:{uniforms:ua([D.common,D.bumpmap,D.normalmap,D.displacementmap,D.fog,{matcap:{value:null}}]),vertexShader:_a.meshmatcap_vert,fragmentShader:_a.meshmatcap_frag},points:{uniforms:ua([D.points,D.fog]),vertexShader:_a.points_vert,fragmentShader:_a.points_frag},dashed:{uniforms:ua([D.common,D.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_a.linedashed_vert,fragmentShader:_a.linedashed_frag},depth:{uniforms:ua([D.common,D.displacementmap]),vertexShader:_a.depth_vert,fragmentShader:_a.depth_frag},normal:{uniforms:ua([D.common,D.bumpmap,D.normalmap,D.displacementmap,{opacity:{value:1}}]),vertexShader:_a.normal_vert,fragmentShader:_a.normal_frag},sprite:{uniforms:ua([D.sprite,D.fog]),vertexShader:_a.sprite_vert,fragmentShader:_a.sprite_frag},background:{uniforms:{uvTransform:{value:new Wn},t2D:{value:null}},vertexShader:_a.background_vert,fragmentShader:_a.background_frag},cube:{uniforms:ua([D.envmap,{opacity:{value:1}}]),vertexShader:_a.cube_vert,fragmentShader:_a.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_a.equirect_vert,fragmentShader:_a.equirect_frag},distanceRGBA:{uniforms:ua([D.common,D.displacementmap,{referencePosition:{value:new Re},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_a.distanceRGBA_vert,fragmentShader:_a.distanceRGBA_frag},shadow:{uniforms:ua([D.lights,D.fog,{color:{value:new Me(0)},opacity:{value:1}}]),vertexShader:_a.shadow_vert,fragmentShader:_a.shadow_frag}};function Ta(a,o,n,s,i){var l,u,c=new Me(0),h=0,d=null,p=0,f=null;function m(e,t){n.buffers.color.setClear(e.r,e.g,e.b,t,i)}return{getClearColor:function(){return c},setClearColor:function(e){var t=1/gm;function qo(e){return e.replace(Jo,Xo)}function Xo(e,t){var n=_a[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return qo(n)}var Yo=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Ko=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Zo(e){return e.replace(Ko,es).replace(Yo,$o)}function $o(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),es(0,t,n,i)}function es(e,t,n,i){for(var r="",a=parseInt(t);a=a.get(e).length?(t=new ps(i,r),a.get(e).push(t)):t=a.get(e)[n],t},dispose:function(){a=new WeakMap}}}function ms(e){yr.call(this),this.type="MeshDepthMaterial",this.depthPacking=3200,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}function vs(e){yr.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Re,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}((ms.prototype=Object.create(yr.prototype)).constructor=ms).prototype.isMeshDepthMaterial=!0,ms.prototype.copy=function(e){return yr.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this},((vs.prototype=Object.create(yr.prototype)).constructor=vs).prototype.isMeshDistanceMaterial=!0,vs.prototype.copy=function(e){return yr.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};var gs="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );\n\tfor ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean * HALF_SAMPLE_RATE;\n\tsquared_mean = squared_mean * HALF_SAMPLE_RATE;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}",As="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function ys(g,A,y){var w=new xa,b=new Le,x=new Le,E=new Kn,r=[],a=[],h={},d={0:me,1:fe,2:ve},C=new pa({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Le},radius:{value:4}},vertexShader:As,fragmentShader:gs}),B=C.clone(),e=(B.defines.HORIZONTAL_PASS=1,new j),_=(e.setAttribute("position",new Q(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3)),new Z(e,C)),M=this;function p(e,t,n){var n=e<<0|t<<1|n<<2,i=r[n];return void 0===i&&(i=new ms({depthPacking:Rn,morphTargets:e,skinning:t}),r[n]=i),i}function f(e,t,n){var n=e<<0|t<<1|n<<2,i=a[n];return void 0===i&&(i=new vs({morphTargets:e,skinning:t}),a[n]=i),i}function T(e,t,n,i,r,a,o){var s,l=null,u=p,c=e.customDepthMaterial;return!0===i.isPointLight&&(u=f,c=e.customDistanceMaterial),l=void 0===c?(!(s=!1)===n.morphTargets&&(s=t.morphAttributes&&t.morphAttributes.position&&0y||b.y>y)&&(b.x>y&&(x.x=Math.floor(y/p.x),b.x=x.x*p.x,d.mapSize.x=x.x),b.y>y)&&(x.y=Math.floor(y/p.y),b.y=x.y*p.y,d.mapSize.y=x.y),null!==d.map||d.isPointLightShadow||this.type!==pe||(d.map=new Zn(b.x,b.y,p={minFilter:U,magFilter:U,format:St}),d.map.texture.name=h.name+".shadowMap",d.mapPass=new Zn(b.x,b.y,p),d.camera.updateProjectionMatrix()),null===d.map&&(d.map=new Zn(b.x,b.y,{minFilter:ut,magFilter:ut,format:St}),d.map.texture.name=h.name+".shadowMap",d.camera.updateProjectionMatrix()),g.setRenderTarget(d.map),g.clear(),d.getViewportCount()),m=0;mi||e.height>i?i/Math.max(e.width,e.height):r)<1||!0===t?"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?(t=(i=t?Be.floorPowerOfTwo:Math.floor)(r*e.width),i=i(r*e.height),void 0===a&&(a=s(t,i)),(r=n?s(t,i):a).width=t,r.height=i,r.getContext("2d").drawImage(e,0,0,t,i),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+t+"x"+i+")."),r):("data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e):e}function S(e){return Be.isPowerOfTwo(e.width)&&Be.isPowerOfTwo(e.height)}function I(e,t){return e.generateMipmaps&&t&&e.minFilter!==ut&&e.minFilter!==U}function D(e,t,n,i){x.generateMipmap(e),C.get(t).__maxMipLevel=Math.log(Math.max(n,i))*Math.LOG2E}function P(e,t,n){if(!1===_)return t;if(null!==e){if(void 0!==x[e])return x[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}e=t;return 6403===t&&(5126===n&&(e=33326),5131===n&&(e=33325),5121===n)&&(e=33321),6407===t&&(5126===n&&(e=34837),5131===n&&(e=34843),5121===n)&&(e=32849),33325!==(e=6408===t&&(5126===n&&(e=34836),5131===n&&(e=34842),5121===n)?32856:e)&&33326!==e&&34842!==e&&34836!==e||i.get("EXT_color_buffer_float"),e}function l(e){return e===ut||e===ct||e===ht?9728:9729}function c(e){var t,n,e=e.target;e.removeEventListener("dispose",c),t=e,void 0!==(n=C.get(t)).__webglInit&&(x.deleteTexture(n.__webglTexture),C.remove(t)),e.isVideoTexture&&o.delete(e),u.memory.textures--}function h(e){var e=e.target,t=(e.removeEventListener("dispose",h),C.get(e)),n=C.get(e.texture);if(e){if(void 0!==n.__webglTexture&&x.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(var i=0;i<6;i++)x.deleteFramebuffer(t.__webglFramebuffer[i]),t.__webglDepthbuffer&&x.deleteRenderbuffer(t.__webglDepthbuffer[i]);else x.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&x.deleteRenderbuffer(t.__webglDepthbuffer),t.__webglMultisampledFramebuffer&&x.deleteFramebuffer(t.__webglMultisampledFramebuffer),t.__webglColorRenderbuffer&&x.deleteRenderbuffer(t.__webglColorRenderbuffer),t.__webglDepthRenderbuffer&&x.deleteRenderbuffer(t.__webglDepthRenderbuffer);C.remove(e.texture),C.remove(e)}u.memory.textures--}var d=0;function p(e,t){var n,i=C.get(e);if(e.isVideoTexture&&(n=e,r=u.render.frame,o.get(n)!==r)&&(o.set(n,r),n.update()),0e.far||t.push({distance:r,point:Ns.clone(),uv:cr.getUV(Ns,Vs,js,Ws,Js,qs,Xs,new Le),face:null,object:this})},copy:function(e){return K.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}});var Zs=new Re,$s=new Re;function el(){K.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}el.prototype=Object.assign(Object.create(K.prototype),{constructor:el,isLOD:!0,copy:function(e){K.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;ne.far||t.push({distance:m,point:l.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}else for(var g,A=0,y=h.count-1;Ae.far||t.push({distance:g,point:l.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}else if(n.isGeometry)for(var w,b=n.vertices,x=b.length,E=0;Ee.far||t.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(0r.far||a.push({distance:e,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o}))}function Ll(t,e,n,i,r,a,o,s,l){Xn.call(this,t,e,n,i,r,a,o,s,l),this.format=void 0!==o?o:Tt,this.minFilter=void 0!==a?a:U,this.magFilter=void 0!==r?r:U,this.generateMipmaps=!1;var u=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){u.needsUpdate=!0,t.requestVideoFrameCallback(e)})}function Rl(e,t,n,i,r,a,o,s,l,u,c,h){Xn.call(this,null,a,o,s,l,u,i,r,c,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function Fl(e,t,n,i,r,a,o,s,l){Xn.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function Ol(e,t,n,i,r,a,o,s,l,u){if((u=void 0!==u?u:kt)!==kt&&u!==Lt)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");Xn.call(this,null,i,r,a,o,s,u,n=void 0===(n=void 0===n&&u===kt?At:n)&&u===Lt?_t:n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:ut,this.minFilter=void 0!==s?s:ut,this.flipY=!1,this.generateMipmaps=!1}Pl.prototype=Object.assign(Object.create(K.prototype),{constructor:Pl,isPoints:!0,copy:function(e){return K.prototype.copy.call(this,e),this.material=e.material,this.geometry=e.geometry,this},raycast:function(e,t){var n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold;if(null===n.boundingSphere&&n.computeBoundingSphere(),Il.copy(n.boundingSphere),Il.applyMatrix4(i),Il.radius+=r,!1!==e.ray.intersectsSphere(Il)){Tl.copy(i).invert(),Sl.copy(e.ray).applyMatrix4(Tl);var r=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=r*r;if(n.isBufferGeometry){var r=n.index,o=n.attributes.position;if(null!==r)for(var s=r.array,l=0,u=s.length;l=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),((Rl.prototype=Object.create(Xn.prototype)).constructor=Rl).prototype.isCompressedTexture=!0,((Fl.prototype=Object.create(Xn.prototype)).constructor=Fl).prototype.isCanvasTexture=!0,((Ol.prototype=Object.create(Xn.prototype)).constructor=Ol).prototype.isDepthTexture=!0;var Nl=0,Gl=new _e,Ul=new K,zl=new Re;function Hl(){Object.defineProperty(this,"id",{value:Nl+=2}),this.uuid=Be.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Hl.prototype=Object.assign(Object.create(zn.prototype),{constructor:Hl,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Wn).getNormalMatrix(e),n=0,i=this.vertices.length;n=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&o=i.x&&i.x>=c&&r!==i.x&&cu(an.x||i.x===n.x&&function(e,t){return hu(e.prev,e,t.prev)<0&&hu(t.next,e,e.next)<0}(n,i)))&&(n=i,d=l),(i=i.next)!==u;);}return n}(e,t))&&(e=gu(t,e),ou(t,t.next),ou(e,e.next))}(l[r],n),n=ou(n,n.next);return n}(e,t,c,n)),e.length>80*n){for(var d=i=e[0],p=r=e[1],f=n;fa.x?r.x>o.x?r:o:a.x>o.x?a:o).x,c=(r.y>a.y?r.y>o.y?r:o:a.y>o.y?a:o).y,h=uu(s,l,t,n,i),d=uu(u,c,t,n,i),p=e.prevZ,f=e.nextZ;for(;p&&p.z>=h&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&cu(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=hu(p.prev,p,p.next))return;if(p=p.prevZ,f!==e.prev&&f!==e.next&&cu(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=hu(f.prev,f,f.next))return;f=f.nextZ}for(;p&&p.z>=h;){if(p!==e.prev&&p!==e.next&&cu(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=hu(p.prev,p,p.next))return;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&cu(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=hu(f.prev,f,f.next))return;f=f.nextZ}return 1}(e,i,r,a):function(e){var t=e.prev,n=e,i=e.next;if(0<=hu(t,n,i))return;var r=e.next.next;for(;r!==e.prev;){if(cu(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&0<=hu(r.prev,r,r.next))return;r=r.next}return 1}(e))t.push(x.i/n),t.push(e.i/n),t.push(E.i/n),yu(e),e=E.next,C=E.next;else if((e=E)===C){o?1===o?su(e=function(e,t,n){var i=e;do{var r=i.prev,a=i.next.next}while(!du(r,a)&&pu(r,i,i.next,a)&&vu(r,a)&&vu(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),yu(i),yu(i.next),i=e=a),i=i.next,i!==e);return ou(i)}(ou(e),t,n),t,n,i,r,a,2):2===o&&function(e,t,n,i,r,a){var o=e;do{for(var s,l=o.next.next;l!==o.prev;){if(o.i!==l.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&pu(n,n.next,e,t))return 1}while(n=n.next,n!==e);return}(e,t)&&(vu(e,t)&&vu(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;for(;n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next,n!==e;);return i}(e,t)&&(hu(e.prev,e,t.prev)||hu(e,t.prev,t))||du(e,t)&&0=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function mu(e){return 0Number.EPSILON){var l=Math.sqrt(s),u=Math.sqrt(a*a+o*o),c=t.x-r/l,t=t.y+i/l,l=((n.x-o/u-c)*o-(n.y+a/u-t)*a)/(i*o-r*a),n=(u=c+i*l-e.x)*u+(c=t+r*l-e.y)*c;if(n<=2)return new Le(u,c);l=Math.sqrt(n/2)}else{t=!1;i>Number.EPSILON?a>Number.EPSILON&&(t=!0):i<-Number.EPSILON?a<-Number.EPSILON&&(t=!0):Math.sign(r)===Math.sign(o)&&(t=!0),l=t?(u=-r,c=i,Math.sqrt(s)):(u=i,c=r,Math.sqrt(s/2))}return new Le(u/l,c/l)}for(var E=[],C=0,B=y.length,_=B-1,M=C+1;Ca.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g=t.times[l]?dc.arraySlice(t.values,r=l*a+e,r+a-e):(r=a-(l=e),(a=t.createInterpolant()).evaluate(g),dc.arraySlice(a.resultBuffer,l,r)),"quaternion"===n&&(new X).fromArray(u).normalize().conjugate().toArray(u),i.times.length),h=0;h>>1;et;)--o;return++o,0===a&&o===r||(o<=a&&(a=(o=Math.max(o,1))-1),n=this.getValueSize(),this.times=dc.arraySlice(i,a,o),this.values=dc.arraySlice(this.values,a*n,o*n)),this},validate:function(){for(var e=!0,t=this.getValueSize(),n=(t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1),this.times),i=this.values,r=n.length,a=(0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1),null),o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&sNumber.EPSILON&&(o.normalize(),p=Math.acos(Be.clamp(i[f-1].dot(i[f]),-1,1)),r[f].applyMatrix4(s.makeRotationAxis(o,p))),a[f].crossVectors(i[f],r[f]);if(!0===t){var m=Math.acos(Be.clamp(r[0].dot(r[e]),-1,1));m/=e,0n.length-2?n.length-1:i+1],n=n[i>n.length-3?n.length-1:i+2];return t.set(qc(e,r.x,a.x,o.x,n.x),qc(e,r.y,a.y,o.y,n.y)),t},ih.prototype.copy=function(e){Gc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=r)return t=a[o]-r,i=(n=this.curves[o]).getLength(),n.getPointAt(0===i?0:1-t/i);o++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;nNumber.EPSILON){if(u<0&&(o=t[a],l=-l,s=t[r],u=-u),!(e.ys.y))if(e.y===o.y){if(e.x===o.x)return 1}else{u=u*(e.x-o.x)-l*(e.y-o.y);if(0==u)return 1;u<0||(i=!i)}}else if(e.y===o.y&&(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x))return 1}return i}(B.p,d[M].p)||(b!==M&&A.push({froms:b,tos:M,hole:C}),_?(_=!1,h[M].push(B)):g=!0);_&&h[b].push(B)}0t.parameterPositions[1])&&(this.stopFading(),0===n)&&(this.enabled=!1),this._effectiveWeight=i}},{key:"_updateTimeScale",value:function(e){var t,n=0;return this.paused||(n=this.timeScale,null!==(t=this._timeScaleInterpolant)&&(n*=t.evaluate(e)[0],e>t.parameterPositions[1])&&(this.stopWarping(),0===n?this.paused=!0:this.timeScale=n)),this._effectiveTimeScale=n}},{key:"_updateTime",value:function(e){var t,n=this._clip.duration,i=this.loop,r=this.time+e,a=this._loopCount,o=2202===i;if(0===e)return-1!==a&&o&&1==(1&a)?n-r:r;if(2200===i){-1===a&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n<=r)r=n;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else if(-1===a&&(0<=e?this._setEndings(!(a=0),0===this.repetitions,o):this._setEndings(0===this.repetitions,!0,o)),n<=r||r<0?(r-=n*(i=Math.floor(r/n)),a+=Math.abs(i),(t=this.repetitions-a)<=0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r=0this.max.x||e.ythis.max.y)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}},{key:"getParameter",value:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Le),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{key:"intersectsBox",value:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}},{key:"clampPoint",value:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Le),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return wd.copy(e).clamp(this.min,this.max).sub(e).length()}},{key:"intersect",value:function(e){return this.min.max(e.min),this.max.min(e.max),this}},{key:"union",value:function(e){return this.min.min(e.min),this.max.max(e.max),this}},{key:"translate",value:function(e){return this.min.add(e),this.max.add(e),this}},{key:"equals",value:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}]),n}(),xd=new Re,Ed=new Re,Cd=function(){function n(e,t){te(this,n),this.start=void 0!==e?e:new Re,this.end=void 0!==t?t:new Re}return A(n,[{key:"set",value:function(e,t){return this.start.copy(e),this.end.copy(t),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){return this.start.copy(e.start),this.end.copy(e.end),this}},{key:"getCenter",value:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new Re),e.addVectors(this.start,this.end).multiplyScalar(.5)}},{key:"delta",value:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new Re),e.subVectors(this.end,this.start)}},{key:"distanceSq",value:function(){return this.start.distanceToSquared(this.end)}},{key:"distance",value:function(){return this.start.distanceTo(this.end)}},{key:"at",value:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new Re),this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){xd.subVectors(e,this.start),Ed.subVectors(this.end,this.start);e=Ed.dot(Ed),e=Ed.dot(xd)/e;return e=t?Be.clamp(e,0,1):e}},{key:"closestPointToPoint",value:function(e,t,n){e=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Re),this.delta(n).multiplyScalar(e).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}]),n}();function Bd(e){K.call(this),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}((Bd.prototype=Object.create(K.prototype)).constructor=Bd).prototype.isImmediateRenderObject=!0;var _d=new Re,ad=function(){y(u,K);var l=C(u);function u(e,t){te(this,u),(n=l.call(this)).light=e,n.light.updateMatrixWorld(),n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n.color=t;for(var n,e=new j,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1;r<32;r++,a++){var o=r/32*Math.PI*2,s=a/32*Math.PI*2;i.push(Math.cos(o),Math.sin(o),1,Math.cos(s),Math.sin(s),1)}e.setAttribute("position",new ne(i,3));t=new vl({fog:!1,toneMapped:!1});return n.cone=new Bl(e,t),n.add(n.cone),n.update(),n}return A(u,[{key:"dispose",value:function(){this.cone.geometry.dispose(),this.cone.material.dispose()}},{key:"update",value:function(){this.light.updateMatrixWorld();var e=this.light.distance||1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),_d.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(_d),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),u}(),Md=new Re,Td=new _e,Sd=new _e,Id=function(){y(h,Bl);var c=C(h);function h(e){te(this,h);for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i>16&32768,n=e>>12&2047,i=e>>23&255;if(!(i<103)){if(142>114-i)+(n>>113-i&1);t=(t|(i-112<<10|n>>1))+(1&n)}return t}},rp=Math.pow(2,8),ap=[.125,.215,.35,.446,.526,.582],op=5+ap.length,sp=(z(up={},kn,0),z(up,Ln,1),z(up,3002,2),z(up,3004,3),z(up,3005,4),z(up,3006,5),z(up,3007,6),up),lp=new mh,up=gp(),cp=up._lodPlanes,hp=up._sizeLods,dp=up._sigmas,pp=new Me,fp=null,up=(1+Math.sqrt(5))/2,mp=1/up,vp=[new Re(1,1,1),new Re(-1,1,1),new Re(1,1,-1),new Re(-1,1,-1),new Re(0,up,mp),new Re(0,up,-mp),new Re(mp,0,up),new Re(-mp,0,up),new Re(up,mp,0),new Re(-up,mp,0)],up=function(){function i(e){var t,n;te(this,i),this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(e=20,t=new Float32Array(e),n=new Re(0,1,0),new nc({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n},inputEncoding:{value:sp[kn]},outputEncoding:{value:sp[kn]}},vertexShader:xp(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t".concat(Ep(),"\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:ge,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}return A(i,[{key:"fromScene",value:function(e){var t=1\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:ge,depthTest:!1,depthWrite:!1})}function bp(){return new nc({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:sp[kn]},outputEncoding:{value:sp[kn]}},vertexShader:xp(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\t".concat(Ep(),"\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:ge,depthTest:!1,depthWrite:!1})}function xp(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Ep(){return"\n\n\t\tuniform int inputEncoding;\n\t\tuniform int outputEncoding;\n\n\t\t#include \n\n\t\tvec4 inputTexelToLinear( vec4 value ) {\n\n\t\t\tif ( inputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( inputEncoding == 1 ) {\n\n\t\t\t\treturn sRGBToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 2 ) {\n\n\t\t\t\treturn RGBEToLinear( value );\n\n\t\t\t} else if ( inputEncoding == 3 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 7.0 );\n\n\t\t\t} else if ( inputEncoding == 4 ) {\n\n\t\t\t\treturn RGBMToLinear( value, 16.0 );\n\n\t\t\t} else if ( inputEncoding == 5 ) {\n\n\t\t\t\treturn RGBDToLinear( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn GammaToLinear( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 linearToOutputTexel( vec4 value ) {\n\n\t\t\tif ( outputEncoding == 0 ) {\n\n\t\t\t\treturn value;\n\n\t\t\t} else if ( outputEncoding == 1 ) {\n\n\t\t\t\treturn LinearTosRGB( value );\n\n\t\t\t} else if ( outputEncoding == 2 ) {\n\n\t\t\t\treturn LinearToRGBE( value );\n\n\t\t\t} else if ( outputEncoding == 3 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 7.0 );\n\n\t\t\t} else if ( outputEncoding == 4 ) {\n\n\t\t\t\treturn LinearToRGBM( value, 16.0 );\n\n\t\t\t} else if ( outputEncoding == 5 ) {\n\n\t\t\t\treturn LinearToRGBD( value, 256.0 );\n\n\t\t\t} else {\n\n\t\t\t\treturn LinearToGamma( value, 2.2 );\n\n\t\t\t}\n\n\t\t}\n\n\t\tvec4 envMapTexelToLinear( vec4 color ) {\n\n\t\t\treturn inputTexelToLinear( color );\n\n\t\t}\n\t"}function Cp(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Pl(e,t)}function Bp(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Jc.call(this,e),this.type="catmullrom",this.closed=!0}function _p(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Jc.call(this,e),this.type="catmullrom"}function Mp(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Jc.call(this,e),this.type="catmullrom"}Gc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Gc.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(ah.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");e=this.getPoints(e);return this.createGeometry(e)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");e=this.getSpacedPoints(e);return this.createGeometry(e)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Hl,n=0,i=e.length;na.factor)&&(a={line:e,factor:n})}),a.line)}}]),r}(),Fp=0,Op=function(){function a(t){var n=this;if(te(this,a),t.points[0]!=t.points[1]){if(this.points=t.points,this.type=t.type||"line","line"==this.type){var e=Dp.find(function(e){return e.points.includes(t.points[0])&&e.points.includes(t.points[1])});if(e)return null!=t.id&&e.ids.push(t.id),e;this.id=null==t.id?"line"+Fp++:t.id,this.ids=[this.id],t.dontWriteToPoint||this.points.forEach(function(e){e.lines.push(n)}),t.isChild||Dp.push(this),this.searchTime=0}this.children=[],this.parents=[],this.match=[]}}return A(a,[{key:"getAngleInfo",value:function(){t=this.points,(e={}).angle=t[1].clone().sub(t[0]).angle(),ee.closeTo(e.angle,2*Math.PI)?e.angle-=2*Math.PI:(e.angle>Math.PI||ee.closeTo(e.angle,Math.PI))&&(e.angle-=Math.PI,e.reverse=!0);var e,t=e;this.angle=t.angle,this.reverse=t.reverse}},{key:"getIntersectWithLine",value:function(e,t){var n=this,i=e.points.find(function(e){return n.points.includes(e)});return i?{point:i,type:"joint"}:(i=ee.isLineIntersect(e.points,this.points,!1,t))?{point:i,type:"intersect"}:void 0}},{key:"writeToPoint",value:function(){var t=this;this.points.forEach(function(e){e.lines.includes(t)||e.lines.push(t)})}},{key:"checkIfParent",value:function(t){return this==t||this.parents.find(function(e){return e.checkIfParent(t)})}},{key:"splitByPoint",value:function(e){var t,n=this,i=new a({points:[e,this.points[0]],dontWriteToPoint:!0,hasntsure:!0}),e=new a({points:[e,this.points[1]],dontWriteToPoint:!0,hasntsure:!0});if(i.points&&e.points){if(!(this.checkIfParent(i)||this.checkIfParent(e)||i.checkIfParent(this)||e.checkIfParent(this)))return(t=function(e){n.children.push(e),e.parents.push(n),Dp.includes(e)||Dp.push(e),e.writeToPoint()})(i),t(e),-1<(t=this.points[0].lines.indexOf(this))&&this.points[0].lines.splice(t,1),-1<(t=this.points[1].lines.indexOf(this))&&this.points[1].lines.splice(t,1),[i,e];console.warn("splitByPoint 发现parent和children一样")}else console.warn("splitByPoint 线有点相同")}},{key:"splitByPoints",value:function(n){var i=this,r=((n=n.map(function(e){return{dis:e.distanceTo(i.points[0]),point:e}})).sort(function(e,t){return e.dis-t.dis}),[]),e=(n.forEach(function(e,t){e=new a({points:[e.point,0==t?i.points[0]:n[t-1].point],group:i.group,dontWriteToPoint:!0,hasntsure:!0});r.push(e)}),new a({points:[n[n.length-1].point,this.points[1]],group:this.group,dontWriteToPoint:!0,hasntsure:!0}));r.push(e),r.find(function(e){return!e.points||i.checkIfParent(e)||e.checkIfParent(i)})?console.error("splitByPoints return"):(r.forEach(function(e){i.children.push(e),e.parents.push(i),Dp.includes(e)||Dp.push(e),e.writeToPoint(),e.writeToPoint()}),-1<(e=this.points[0].lines.indexOf(this))&&this.points[0].lines.splice(e,1),-1<(e=this.points[1].lines.indexOf(this))&&this.points[1].lines.splice(e,1))}},{key:"getAllSlices",value:function(){var n=[];return function e(t){0==t.children.length?n.push(t):t.children.forEach(e)}(this),n}},{key:"getVector",value:function(){return this.points[1].clone().sub(this.points[0])}},{key:"getLength",value:function(){return this.points[0].distanceTo(this.points[1])}},{key:"getCenter",value:function(){return this.points[1].clone().add(this.points[0]).multiplyScalar(.5)}}]),a}(),Np=function(t,n){var e=t.filter(function(e){return!n.includes(e)}),i=n.filter(function(e){return!t.includes(e)});return e.concat(i)};function Gp(t,n){return Dp.find(function(e){return e.points.includes(t)&&e.points.includes(n)})}function Up(e,t){if(e instanceof Hp&&(e=e.points),t instanceof Hp&&(t=t.points),e.length!=t.length)return!1;if(e.lines&&t.lines){if(0==Np(e.lines,t.lines).length)return!0}else if(Qp(e,t))return!0}var zp=0,Hp=A(function e(t){te(this,e),this.id=zp++,this.type=t.type||"normal",this.points=t.points,this.lines=t.lines,Pp.push(this),this.child=[],this.parent=[],this.smallNeibours=[];t=ee.getArea(this.points);this.area=Math.abs(t),this.isClockwise=t<0}),Qp=function(e,t){for(var n,i,r=[],a=0,o=e.length;aMath.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e},getFOVDotThreshold:function(e){return Math.cos(Be.degToRad(e/2))},transform2DForwardVectorByCubeFace:function(e,t,n,i){switch(e){case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_X:n.set(1,t.y,t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:n.set(-1,t.y,-t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:n.set(-t.x,1,-t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:n.set(-t.x,-1,t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:n.set(-t.x,t.y,1);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:n.set(t.x,t.y,-1)}i&&n.normalize()},getFootPoint:function(e,t,n,i){var r,a;return t.equals(n)?t.clone():(e=e.clone().sub(t),r=(a=t.clone().sub(n)).length(),e=e.dot(a)/r,a=t.clone().add(a.multiplyScalar(e/r)),i&&0a.max.x||n.ya.max.y)return!1;for(var o=!1,s=n.x,l=n.y,u=0,c=e.length-1;u=Math.min(h,p)&&s<=Math.max(h,p)&&l>=Math.min(d,f)&&l<=Math.max(d,f))return{atLine:!0};l=e.x?n+r:r,n=t;return((r=1/o*(n-e.x)+e.y)Math.abs(e.z)?b.setVector(ef,-e.y,e.x,0):b.setVector(ef,0,-e.z,e.y)):b.cross(e,t,ef),this._x=ef.x,this._y=ef.y,this._z=ef.z,this._w=tf,this.normalize()},multiply:function(e){return this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,e=e._w,a=t._x,o=t._y,s=t._z,t=t._w;return this._x=n*t+e*a+i*s-r*o,this._y=i*t+e*o+r*a-n*s,this._z=r*t+e*s+n*o-i*a,this._w=e*t-n*a-i*o-r*s,this}},b.convertWorkshopVector=function(e){return new b.Vector3(-e.x,e.y,e.z)},b.convertWorkshopQuaternion=function(e){return new b.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new b.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},b.convertWorkshopOrthoZoom=function(e){return-1===e?-1:e*($("#player").width()/$("#player").height())},b.convertWorkshopPanoramaQuaternion=function(e){return new b.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new b.Quaternion).setFromAxisAngle(new b.Vector3(0,1,0),270*b.RADIANS_PER_DEGREE))},b.normalize=function(e){var t=e.x*e.x+e.y*e.y+e.z*e.z,t=Math.sqrt(t);e.x/=t,e.y/=t,e.z/=t},b.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},b.cross=function(e,t,n){var i=e.x,r=e.y,e=e.z;n.x=r*t.z-e*t.y,n.y=e*t.x-i*t.z,n.z=i*t.y-r*t.x},b.setVector=function(e,t,n,i){e.x=t,e.y=n,e.z=i},b.copyVector=function(e,t){t.x=e.x,t.y=e.y,t.z=e.z},b.addVector=function(e,t){e.x+=t.x,e.y+=t.y,e.z+=t.z},b.subVector=function(e,t){e.x-=t.x,e.y-=t.y,e.z-=t.z},b.applyQuaternionToVector=function(e,t){var n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,s=e.z,e=e.w,l=e*n+o*r-s*i,u=e*i+s*n-a*r,c=e*r+a*i-o*n,n=-a*n-o*i-s*r;t.x=l*e+n*-a+u*-s-c*-o,t.y=u*e+n*-o+c*-a-l*-s,t.z=c*e+n*-s+l*-o-u*-a},{clampVFOV:function(e,t,n,i){return t\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float lineWidth;\n\t\tuniform vec2 resolution;\n uniform float devicePixelRatio; //add\n \n \n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * lineWidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * lineWidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y * devicePixelRatio;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float lineWidth;\n uniform vec3 backColor;\n uniform float occlusionDistance;\n uniform float clipDistance;\n uniform float maxClipFactor;\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\n //加\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n uniform sampler2D depthTexture;\n uniform float nearPlane;\n uniform float farPlane; \n uniform vec2 resolution;\n uniform vec2 viewportOffset;\n #endif\n\n\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n float convertToLinear(float zValue)\n {\n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n }\n #endif\n\n\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t/*#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif*/\n \n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n \n \n bool unvisible = mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize;\n //加\n #ifdef DASH_with_depth\n \n #else \n if (unvisible) discard; // todo - FIX\n #endif\n\t\t\t#endif\n \n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / lineWidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\n //加\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n\n float fragDepth = convertToLinear(gl_FragCoord.z);\n //gl_FragCoord大小为 viewport client大小 \n vec2 depthTxtCoords = vec2(gl_FragCoord.x - viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)\n {\n \n mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);\n clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);\n }\n \n if (clipFactor == 1.0)\n {\n discard;\n }\n \n vec4 backColor_ = vec4(backColor, opacity); //vec4(0.8,0.8,0.8, 0.8*opacity);\n \n #ifdef DASH_with_depth \n // 只在被遮住的部分显示虚线, 所以若同时是虚线不可见部分和被遮住时, a为0\n if(unvisible) backColor_.a = 0.0;\n #endif \n \n //vec4 diffuseColor = vec4(mix(diffuse, backColor_, mixFactor), opacity*(1.0 - clipFactor));\n \n \n \n diffuseColor = mix(diffuseColor, backColor_ , mixFactor); \n \n \n diffuseColor.a *= (1.0 - clipFactor); \n \n #endif\n\n\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\t//gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"},function(){y(r,pa);var i=C(r);function r(e){function t(e){var t=(e=e.viewport).offset||new Le;n.uniforms.resolution.value.copy(e.resolution),n.uniforms.viewportOffset.value.copy(t),n.uniforms.devicePixelRatio.value=window.devicePixelRatio,n.lineWidth=n.lineWidth_}te(this,r),(n=i.call(this,{type:"LineMaterial",uniforms:ca.clone(Ma.line.uniforms),vertexShader:Ma.line.vertexShader,fragmentShader:Ma.line.fragmentShader,clipping:!0})).isLineMaterial=!0,n.lineWidth_=0,n.supportExtDepth=e.supportExtDepth,n.depthTestWhenPick=!1,e.color&&(n.color=new Me(e.color)),e.backColor&&(n.uniforms.backColor.value=new Me(e.backColor)),e.clipDistance&&(n.uniforms.clipDistance.value=e.clipDistance),e.occlusionDistance&&(n.uniforms.occlusionDistance.value=e.occlusionDistance),e.maxClipFactor&&(n.uniforms.maxClipFactor.value=e.maxClipFactor),Object.defineProperties(G(n),{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(e){this.uniforms.diffuse.value=e}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(e){!0===e?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},lineWidth:{enumerable:!0,get:function(){return this.lineWidth_},set:function(e){this.uniforms.lineWidth.value=e*window.devicePixelRatio,this.lineWidth_=e}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===e?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(e){this.uniforms.dashScale.value=e}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(e){this.uniforms.dashSize.value=e}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(e){this.uniforms.gapSize.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(e){Boolean(e)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===e?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}},useDepth:{enumerable:!0,get:function(){return"useDepth"in this.defines},set:function(e){(e=e&&!!this.supportExtDepth)!=this.useDepth&&(e?(this.defines.useDepth="",this.updateDepthParams()):delete this.defines.useDepth,this.needsUpdate=!0)}},dashWithDepth:{enumerable:!0,get:function(){return"DASH_with_depth"in this.defines},set:function(e){(e=e&&!!this.supportExtDepth)!=this.dashWithDepth&&(e?this.defines.DASH_with_depth="":delete this.defines.DASH_with_depth,this.needsUpdate=!0)}}}),n.setValues(e);var n,e=viewer.mainViewport;return t({viewport:e}),viewer.addEventListener("resize",function(e){t(e)}),n.supportExtDepth&&(n.updateDepthParams(),viewer.addEventListener("render.begin",function(e){e.viewport.camera.isPerspectiveCamera&&n.updateDepthParams(e)})),n}return A(r,[{key:"updateDepthParams",value:function(){var e,t;this.useDepth&&(t=(e=(0w&&xf.z>w||(bf.z>w?(b=bf.z-xf.z,b=(bf.z-w)/b,bf.lerp(xf,b)):xf.z>w&&(b=xf.z-bf.z,x=(xf.z-w)/b,xf.lerp(bf,x)),bf.applyMatrix4(m),xf.applyMatrix4(m),bf.multiplyScalar(1/bf.w),xf.multiplyScalar(1/xf.w),bf.x*=v.x/2,bf.y*=v.y/2,xf.x*=v.x/2,xf.y*=v.y/2,_f.start.copy(bf),_f.start.z=0,_f.end.copy(xf),_f.end.z=0,x=_f.closestPointToPointParameter(Cf,!0),_f.at(x,Mf),E=-1<=(E=Be.lerp(bf.z,xf.z,x))&&E<=1,C=Cf.distanceTo(Mf)<.5*of,E&&C&&(_f.start.fromBufferAttribute(A,B),_f.end.fromBufferAttribute(y,B),_f.start.applyMatrix4(g),_f.end.applyMatrix4(g),E=new Re,C=new Re,nf.distanceSqToSegment(_f.start,_f.end,C,E),f.push({point:C,pointOnLine:E,distance:nf.origin.distanceTo(C),object:p,face:null,faceIndex:B,uv:null,uv2:null})))}}}]),i}(),kf=function(){y(r,gf);var t=C(r);function r(){var e;return te(this,r),(e=t.call(this)).isLineGeometry=!0,e.type="LineGeometry",e}return A(r,[{key:"setPositions",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i=this.points.length?0:(t=0===e?this.points[this.points.length-1]:this.points[e-1],n=this.points[e],e=this.points[(e+1)%this.points.length],this.getAngleBetweenLines(n,t,e))}},{key:"update",value:function(){if(0!==this.points.length)if(1===this.points.length)m=this.points[0].position,this.spheres[0].position.copy(m),v=this.coordinateLabels[0],m=m.toArray().map(function(e){return ie.addCommas(e.toFixed(2))}).join(" / "),v.setText(m),v.visible=this.showCoordinates;else{for(var e=this.points.length-1,t=new Re,n=0;n<=e;n++){var i=this.points[n];t.add(i.position)}t.divideScalar(this.points.length);for(var r=0;r<=e;r++){var a=r,o=this.points[a],s=this.points[e=t.radius?2:1}},{key:"generateDataTexture",value:function(e,t,n){for(var i=e*t,r=new Uint8Array(4*e*t),a=Math.floor(255*n.r),o=Math.floor(255*n.g),s=Math.floor(255*n.b),l=0;le.versionMajor||this.versionMajor===e.versionMajor&&this.versionMinor>e.versionMinor}},{key:"equalOrHigher",value:function(e){e=new n(e);return this.versionMajor>e.versionMajor||this.versionMajor===e.versionMajor&&this.versionMinor>=e.versionMinor}},{key:"upTo",value:function(e){return!this.newerThan(e)}}]),n}()),Hf=function(){function i(e,t,n){te(this,i),this.version="string"==typeof e?new zf(e):e,this.boundingBox=t,this.scale=n}return A(i,[{key:"load",value:function(t){var n=this;if(!t.loaded){var i=t.getURL(),r=(this.version.equalOrHigher("1.4")&&(i+=".bin"),uf.createXMLHttpRequest());r.open("GET",i,!0),r.responseType="arraybuffer",r.overrideMimeType("text/plain; charset=x-user-defined"),r.onreadystatechange=function(){if(4===r.readyState){if(200!==r.status&&0!==r.status||null===r.response)throw new Error("Failed to load file! HTTP status: ".concat(r.status,", file: ").concat(i));var e=r.response;n.parse(t,e)}};try{r.send(null)}catch(e){console.log("fehler beim laden der punktwolke: "+e)}}}},{key:"parse",value:function(o,e){var s=o.pcoGeometry.pointAttributes,t=e.byteLength/o.pcoGeometry.pointAttributes.byteSize,l=(this.version.upTo("1.5")&&(o.numPoints=t),Potree.scriptPath+"/workers/BinaryDecoderWorker.js"),u=Potree.workerPool.getWorker(l),t=(u.onmessage=function(e){var t,n=e.data,r=n.attributeBuffers,i=new Y((new Re).fromArray(n.tightBoundingBox.min),(new Re).fromArray(n.tightBoundingBox.max)),a=(Potree.workerPool.returnWorker(l,u),new j);for(t in r)!function(e){var t,n=r[e].buffer,i=r[e].attribute;"POSITION_CARTESIAN"===e?a.setAttribute("position",new Q(new Float32Array(n),3)):"rgba"===e?a.setAttribute("rgba",new Q(new Uint8Array(n),4,!0)):"NORMAL_SPHEREMAPPED"===e||"NORMAL_OCT16"===e||"NORMAL"===e?a.setAttribute("normal",new Q(new Float32Array(n),3)):"INDICES"===e?((t=new Q(new Uint8Array(n),4)).normalized=!0,a.setAttribute("indices",t)):"SPACING"===e?(t=new Q(new Float32Array(n),1),a.setAttribute("spacing",t)):((t=new Q(new Float32Array(n),1)).potree={offset:r[e].offset,scale:r[e].scale,preciseBuffer:r[e].preciseBuffer,range:i.range},a.setAttribute(e,t),(n=s.attributes.find(function(e){return e.name===i.name})).range[0]=Math.min(n.range[0],i.range[0]),n.range[1]=Math.max(n.range[1],i.range[1]),0===o.getLevel()&&(n.initialRange=i.range))}(t);i.max.sub(i.min),i.min.set(0,0,0);e=e.data.buffer.byteLength/s.byteSize;o.numPoints=e,o.geometry=a,o.mean=re(Re,J(n.mean)),o.tightBoundingBox=i,o.loaded=!0,o.loading=!1,o.estimatedSpacing=n.estimatedSpacing,Potree.numNodesLoading--},{buffer:e,pointAttributes:s,version:this.version.version,min:[o.boundingBox.min.x,o.boundingBox.min.y,o.boundingBox.min.z],offset:[o.pcoGeometry.offset.x,o.pcoGeometry.offset.y,o.pcoGeometry.offset.z],scale:this.scale,spacing:o.spacing,hasChildren:o.hasChildren,name:o.name});u.postMessage(t,[t.buffer])}}]),i}(),nd=document.createElement("canvas"),Qf=null===(Of=nd.getContext("webgl")||nd.getContext("experimental-webgl"))?null:(Xh=Of.getShaderPrecisionFormat(Of.VERTEX_SHADER,Of.HIGH_FLOAT),Yd=Of.getShaderPrecisionFormat(Of.VERTEX_SHADER,Of.MEDIUM_FLOAT),Vd=Of.getShaderPrecisionFormat(Of.FRAGMENT_SHADER,Of.HIGH_FLOAT),ql=Of.getShaderPrecisionFormat(Of.FRAGMENT_SHADER,Of.MEDIUM_FLOAT),Xh=0=Potree.maxNodesLoading||(this.loading=!0,Potree.numNodesLoading++,this.pcoGeometry.loader.version.equalOrHigher("1.5")&&this.level%this.pcoGeometry.hierarchyStepSize==0&&this.hasChildren?this.loadHierachyThenPoints():this.loadPoints())}},{key:"loadPoints",value:function(){this.pcoGeometry.loader.load(this)}},{key:"loadHierachyThenPoints",value:function(){var E=this;if(E.level%E.pcoGeometry.hierarchyStepSize==0){var C=E.pcoGeometry.octreeDir+"/"+E.getHierarchyPath()+"/"+E.name+".hrc",B=uf.createXMLHttpRequest();B.open("GET",C,!0),B.responseType="arraybuffer",B.overrideMimeType("text/plain; charset=x-user-defined"),B.onreadystatechange=function(){if(4===B.readyState)if(200===B.status||0===B.status){for(var e=B.response,t=E,n=e,e=performance.now(),i=new DataView(n),r=[],a=i.getUint8(0),o=i.getUint32(1,!0),s=(t.numPoints=o,r.push({children:a,numPoints:o,name:t.name}),[]),l=5;0 0\n\tuniform mat4 clipBoxes_in[num_in_clipboxes];\n#endif\n#if defined(num_out_clipboxes) && num_out_clipboxes > 0\n\tuniform mat4 clipBoxes_out[num_out_clipboxes];\n#endif\n\n\n#if defined(num_clipspheres) && num_clipspheres > 0\n\tuniform mat4 uClipSpheres[num_clipspheres];\n#endif\n\n \n#if defined(num_highlightBox) && num_highlightBox > 0\n uniform mat4 boxes_highlight[num_highlightBox]; \n#endif \n\t\t \n\nuniform float size;\nuniform float minSize;\nuniform float maxSize;\n\nuniform float uPCIndex;\nuniform float uOctreeSpacing;\nuniform float uNodeSpacing;\nuniform float uOctreeSize;\nuniform vec3 uBBSize;\nuniform float uLevel;\nuniform float uVNStart;\nuniform bool uIsLeafNode;\n\nuniform vec3 uColor;\nuniform float uOpacity; \nvarying float vOpacity; //add\n\n\n\nuniform vec2 elevationRange;\nuniform vec2 intensityRange;\n\nuniform vec2 uFilterReturnNumberRange;\nuniform vec2 uFilterNumberOfReturnsRange;\nuniform vec2 uFilterPointSourceIDClipRange;\nuniform vec2 uFilterGPSTimeClipRange;\n//uniform float ufilterByNormalThreshold; \n\nuniform float uGpsScale;\nuniform float uGpsOffset;\n\nuniform vec2 uNormalizedGpsBufferRange;\n\nuniform vec3 uIntensity_gbc;\nuniform vec3 uRGB_gbc;\nuniform vec3 uExtra_gbc;\n\nuniform float uTransition;\nuniform float wRGB;\nuniform float wIntensity;\nuniform float wElevation;\nuniform float wClassification;\nuniform float wReturnNumber;\nuniform float wSourceID;\n\nuniform vec2 uExtraNormalizedRange;\nuniform vec2 uExtraRange;\nuniform float uExtraScale;\nuniform float uExtraOffset;\n\nuniform vec3 uShadowColor;\n\nuniform sampler2D visibleNodes;\nuniform sampler2D gradient;\nuniform sampler2D classificationLUT;\n\n#if defined(color_type_matcap)\nuniform sampler2D matcapTextureUniform;\n#endif\nuniform bool backfaceCulling;\n\n#if defined(num_shadowmaps) && num_shadowmaps > 0\nuniform sampler2D uShadowMap[num_shadowmaps];\nuniform mat4 uShadowWorldView[num_shadowmaps];\nuniform mat4 uShadowProj[num_shadowmaps];\n#endif\n\n\n\nvarying vec3\tvColor;\nvarying float\tvLogDepth;\nvarying vec3\tvViewPosition;\nvarying float \tvRadius;\nvarying float \tvPointSize;\n\n\nfloat round(float number){\n\treturn floor(number + 0.5);\n}\n\n// \n// ### ######## ### ######## ######## #### ## ## ######## ###### #### ######## ######## ###### \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ######## ## ## ## ## ###### ###### ## ## ###### ###### \n// ######### ## ## ######### ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ######## ## ## ## ## #### ### ######## ###### #### ######## ######## ###### \n// \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_octree)\n/**\n * number of 1-bits up to inclusive index position\n * number is treated as if it were an integer in the range 0-255\n *\n */\nint numberOfOnes(int number, int index){\n\tint numOnes = 0;\n\tint tmp = 128;\n\tfor(int i = 7; i >= 0; i--){\n\t\t\n\t\tif(number >= tmp){\n\t\t\tnumber = number - tmp;\n\n\t\t\tif(i <= index){\n\t\t\t\tnumOnes++;\n\t\t\t}\n\t\t}\n\t\t\n\t\ttmp = tmp / 2;\n\t}\n\n\treturn numOnes;\n}\n\n\n/**\n * checks whether the bit at index is 1\n * number is treated as if it were an integer in the range 0-255\n *\n */\nbool isBitSet(int number, int index){\n\n\t// weird multi else if due to lack of proper array, int and bitwise support in WebGL 1.0\n\tint powi = 1;\n\tif(index == 0){\n\t\tpowi = 1;\n\t}else if(index == 1){\n\t\tpowi = 2;\n\t}else if(index == 2){\n\t\tpowi = 4;\n\t}else if(index == 3){\n\t\tpowi = 8;\n\t}else if(index == 4){\n\t\tpowi = 16;\n\t}else if(index == 5){\n\t\tpowi = 32;\n\t}else if(index == 6){\n\t\tpowi = 64;\n\t}else if(index == 7){\n\t\tpowi = 128;\n\t}else{\n\t\treturn false;\n\t}\n\n\tint ndp = number / powi;\n\n\treturn mod(float(ndp), 2.0) != 0.0;\n}\n\n\n/**\n * find the LOD at the point position\n */\nfloat getLOD(){//////\n\t \n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tint iOffset = int(uVNStart);\n\tfloat depth = uLevel;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tint index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));\n\t\tint mask = int(round(value.r * 255.0));\n\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tint advanceG = int(round(value.g * 255.0)) * 256;\n\t\t\tint advanceB = int(round(value.b * 255.0));\n\t\t\tint advanceChild = numberOfOnes(mask, index - 1);\n\t\t\tint advance = advanceG + advanceB + advanceChild;\n\n\t\t\tiOffset = iOffset + advance;\n\t\t\t\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\t//return value.a * 255.0;\n\n\t\t\tfloat lodOffset = (255.0 * value.a) / 10.0 - 10.0;\n\n\t\t\treturn depth + lodOffset;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn depth;\n}\n\nfloat getSpacing(){\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tint iOffset = int(uVNStart);\n\tfloat depth = uLevel;\n\tfloat spacing = uNodeSpacing;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tint index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));\n\t\tint mask = int(round(value.r * 255.0));\n\t\tfloat spacingFactor = value.a;\n\n\t\tif(i > 0.0){\n\t\t\tspacing = spacing / (255.0 * spacingFactor);\n\t\t}\n\t\t\n\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tint advanceG = int(round(value.g * 255.0)) * 256;\n\t\t\tint advanceB = int(round(value.b * 255.0));\n\t\t\tint advanceChild = numberOfOnes(mask, index - 1);\n\t\t\tint advance = advanceG + advanceB + advanceChild;\n\n\t\t\tiOffset = iOffset + advance;\n\n\t\t\t//spacing = spacing / (255.0 * spacingFactor);\n\t\t\t//spacing = spacing / 3.0;\n\t\t\t\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn spacing;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn spacing;\n}\n\nfloat getPointSizeAttenuation(){\n\treturn pow(2.0, getLOD());\n}\n\n\n#endif\n\n\n// ---------------------\n// KD-TREE\n// ---------------------\n\n#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_kdtree)\n\nfloat getLOD(){\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat iOffset = 0.0;\n\tfloat depth = 0.0;\n\t\t\n\t\t\n\tvec3 size = uBBSize;\t\n\tvec3 pos = position;\n\t\t\n\tfor(float i = 0.0; i <= 1000.0; i++){\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));\n\t\t\n\t\tint children = int(value.r * 255.0);\n\t\tfloat next = value.g * 255.0;\n\t\tint split = int(value.b * 255.0);\n\t\t\n\t\tif(next == 0.0){\n\t\t \treturn depth;\n\t\t}\n\t\t\n\t\tvec3 splitv = vec3(0.0, 0.0, 0.0);\n\t\tif(split == 1){\n\t\t\tsplitv.x = 1.0;\n\t\t}else if(split == 2){\n\t\t \tsplitv.y = 1.0;\n\t\t}else if(split == 4){\n\t\t \tsplitv.z = 1.0;\n\t\t}\n\t\t\n\t\tiOffset = iOffset + next;\n\t\t\n\t\tfloat factor = length(pos * splitv / size);\n\t\tif(factor < 0.5){\n\t\t\t// left\n\t\tif(children == 0 || children == 2){\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t}else{\n\t\t\t// right\n\t\t\tpos = pos - size * splitv * 0.5;\n\t\t\tif(children == 0 || children == 1){\n\t\t\t\treturn depth;\n\t\t\t}\n\t\t\tif(children == 3){\n\t\t\t\tiOffset = iOffset + 1.0;\n\t\t\t}\n\t\t}\n\t\tsize = size * ((1.0 - (splitv + 1.0) / 2.0) + 0.5);\n\t\t\n\t\tdepth++;\n\t}\n\t\t\n\t\t\n\treturn depth;\t\n}\n\nfloat getPointSizeAttenuation(){\n\treturn 0.5 * pow(1.3, getLOD());\n}\n\n#endif\n\n\n\n// \n// ### ######## ######## ######## #### ######## ## ## ######## ######## ###### \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ######## ## ######## ## ## ## ###### ###### \n// ######### ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n// ## ## ## ## ## ## #### ######## ####### ## ######## ###### \n// \n\n\n\n// formula adapted from: http://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/\nfloat getContrastFactor(float contrast){\n\treturn (1.0158730158730156 * (contrast + 1.0)) / (1.0158730158730156 - contrast);\n}\n\nvec3 getRGB(){\n\tvec3 rgb = color;\n\t\n\trgb = pow(rgb, vec3(uRGB_gbc.x));\n\trgb = rgb + uRGB_gbc.y;\n\trgb = (rgb - 0.5) * getContrastFactor(uRGB_gbc.z) + 0.5;\n\trgb = clamp(rgb, 0.0, 1.0);\n\n\treturn rgb;\n}\n\nfloat getIntensity(){\n\tfloat w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);\n\tw = pow(w, uIntensity_gbc.x);\n\tw = w + uIntensity_gbc.y;\n\tw = (w - 0.5) * getContrastFactor(uIntensity_gbc.z) + 0.5;\n\tw = clamp(w, 0.0, 1.0);\n\n\treturn w;\n}\n\nvec3 getGpsTime(){\n\n\tfloat w = (gpsTime + uGpsOffset) * uGpsScale;\n\n\n\tvec3 c = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\n\n\t// vec2 r = uNormalizedGpsBufferRange;\n\t// float w = gpsTime * (r.y - r.x) + r.x;\n\t// w = clamp(w, 0.0, 1.0);\n\t// vec3 c = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t\n\treturn c;\n}\n\nvec3 getElevation(){\n\tvec4 world = modelMatrix * vec4( position, 1.0 );\n\tfloat w = (world.z - elevationRange.x) / (elevationRange.y - elevationRange.x);\n\tvec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t\n\treturn cElevation;\n}\n\nvec4 getClassification(){\n\tvec2 uv = vec2(classification / 255.0, 0.5);\n\tvec4 classColor = texture2D(classificationLUT, uv);\n\t\n\treturn classColor;\n}\n\nvec3 getReturns(){\n\n\t// 0b 00_000_111\n\tfloat rn = mod(returnNumber, 8.0);\n\t// 0b 00_111_000\n\tfloat nr = mod(returnNumber / 8.0, 8.0);\n\n\tif(nr <= 1.0){\n\t\treturn vec3(1.0, 0.0, 0.0);\n\t}else{\n\t\treturn vec3(0.0, 1.0, 0.0);\n\t}\n\n\t// return vec3(nr / 4.0, 0.0, 0.0);\n\n\t// if(nr == 1.0){\n\t// \treturn vec3(1.0, 1.0, 0.0);\n\t// }else{\n\t// \tif(rn == 1.0){\n\t// \t\treturn vec3(1.0, 0.0, 0.0);\n\t// \t}else if(rn == nr){\n\t// \t\treturn vec3(0.0, 0.0, 1.0);\n\t// \t}else{\n\t// \t\treturn vec3(0.0, 1.0, 0.0);\n\t// \t}\n\t// }\n\n\t// if(numberOfReturns == 1.0){\n\t// \treturn vec3(1.0, 1.0, 0.0);\n\t// }else{\n\t// \tif(returnNumber == 1.0){\n\t// \t\treturn vec3(1.0, 0.0, 0.0);\n\t// \t}else if(returnNumber == numberOfReturns){\n\t// \t\treturn vec3(0.0, 0.0, 1.0);\n\t// \t}else{\n\t// \t\treturn vec3(0.0, 1.0, 0.0);\n\t// \t}\n\t// }\n}\n\nvec3 getReturnNumber(){\n\tif(numberOfReturns == 1.0){\n\t\treturn vec3(1.0, 1.0, 0.0);\n\t}else{\n\t\tif(returnNumber == 1.0){\n\t\t\treturn vec3(1.0, 0.0, 0.0);\n\t\t}else if(returnNumber == numberOfReturns){\n\t\t\treturn vec3(0.0, 0.0, 1.0);\n\t\t}else{\n\t\t\treturn vec3(0.0, 1.0, 0.0);\n\t\t}\n\t}\n}\n\nvec3 getNumberOfReturns(){\n\tfloat value = numberOfReturns;\n\n\tfloat w = value / 6.0;\n\n\tvec3 color = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n\n\treturn color;\n}\n\nvec3 getSourceID(){\n\tfloat w = mod(pointSourceID, 10.0) / 10.0;\n\treturn texture2D(gradient, vec2(w,1.0 - w)).rgb;\n}\n\nvec3 getCompositeColor(){\n\tvec3 c;\n\tfloat w;\n\n\tc += wRGB * getRGB();\n\tw += wRGB;\n\t\n\tc += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);\n\tw += wIntensity;\n\t\n\tc += wElevation * getElevation();\n\tw += wElevation;\n\t\n\tc += wReturnNumber * getReturnNumber();\n\tw += wReturnNumber;\n\t\n\tc += wSourceID * getSourceID();\n\tw += wSourceID;\n\t\n\tvec4 cl = wClassification * getClassification();\n\tc += cl.a * cl.rgb;\n\tw += wClassification * cl.a;\n\n\tc = c / w;\n\t\n\tif(w == 0.0){\n\t\t//c = color;\n\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t}\n\t\n\treturn c;\n}\n\n\nvec3 getNormal(){\n\t//vec3 n_hsv = vec3( modelMatrix * vec4( normal, 0.0 )) * 0.5 + 0.5; // (n_world.xyz + vec3(1.,1.,1.)) / 2.;\n\tvec3 n_view = normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );\n\treturn n_view;\n}\nbool applyBackfaceCulling() {\n\t// Black not facing vertices / Backface culling\n \n\tvec3 e = normalize(vec3(modelViewMatrix * vec4( position, 1. )));\n\tvec3 n = getNormal(); // normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );\n\n\tif((uUseOrthographicCamera && n.z <= 0.) || (!uUseOrthographicCamera && dot( n, e ) >= 0.)) { \n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}\n\n#if defined(color_type_matcap)\n// Matcap Material\nvec3 getMatcap(){ \n\tvec3 eye = normalize( vec3( modelViewMatrix * vec4( position, 1. ) ) ); \n\tif(uUseOrthographicCamera) { \n\t\teye = vec3(0., 0., -1.);\n\t}\n\tvec3 r_en = reflect( eye, getNormal() ); // or r_en = e - 2. * dot( n, e ) * n;\n\tfloat m = 2. * sqrt(pow( r_en.x, 2. ) + pow( r_en.y, 2. ) + pow( r_en.z + 1., 2. ));\n\tvec2 vN = r_en.xy / m + .5;\n\treturn texture2D(matcapTextureUniform, vN).rgb; \n}\n#endif\n\nvec3 getExtra(){\n\n\tfloat w = (aExtra + uExtraOffset) * uExtraScale;\n\tw = clamp(w, 0.0, 1.0);\n\n\tvec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n\t// vec2 r = uExtraNormalizedRange;\n\n\t// float w = aExtra * (r.y - r.x) + r.x;\n\n\t// w = (w - uExtraRange.x) / (uExtraRange.y - uExtraRange.x);\n\n\t// w = clamp(w, 0.0, 1.0);\n\n\t// vec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n\treturn color;\n}\n\nvec3 getColor(){\n\tvec3 color;\n\t\n\t#ifdef color_type_rgba\n\t\tcolor = getRGB();\n \n \n\t#elif defined color_type_height || defined color_type_elevation\n\t\tcolor = getElevation();\n\t#elif defined color_type_rgb_height\n\t\tvec3 cHeight = getElevation();\n\t\tcolor = (1.0 - uTransition) * getRGB() + uTransition * cHeight;\n\t#elif defined color_type_depth\n\t\tfloat linearDepth = gl_Position.w;\n\t\tfloat expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;\n\t\tcolor = vec3(linearDepth, expDepth, 0.0);\n\t\t//color = vec3(1.0, 0.5, 0.3);\n\t#elif defined color_type_intensity\n\t\tfloat w = getIntensity();\n\t\tcolor = vec3(w, w, w);\n\t#elif defined color_type_gps_time\n\t\tcolor = getGpsTime();\n\t#elif defined color_type_intensity_gradient\n\t\tfloat w = getIntensity();\n\t\tcolor = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t#elif defined color_type_color\n\t\tcolor = uColor;\n\t#elif defined color_type_level_of_detail\n\t\tfloat depth = getLOD();\n\t\tfloat w = depth / 10.0;\n\t\tcolor = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\t#elif defined color_type_indices\n\t\tcolor = indices.rgb;\n\t#elif defined color_type_classification\n\t\tvec4 cl = getClassification(); \n\t\tcolor = cl.rgb;\n\t#elif defined color_type_return_number\n\t\tcolor = getReturnNumber();\n\t#elif defined color_type_returns\n\t\tcolor = getReturns();\n\t#elif defined color_type_number_of_returns\n\t\tcolor = getNumberOfReturns();\n\t#elif defined color_type_source_id\n\t\tcolor = getSourceID();\n\t#elif defined color_type_point_source_id\n\t\tcolor = getSourceID();\n\t#elif defined color_type_normal\n\t\tcolor = (modelMatrix * vec4(normal, 0.0)).xyz;\n\t#elif defined color_type_phong\n\t\tcolor = color;\n\t#elif defined color_type_composite\n\t\tcolor = getCompositeColor();\n\t#elif defined color_type_matcap\n\t\tcolor = getMatcap();\n\t#else \n\t\tcolor = getExtra();\n\t#endif\n\t\n\tif (backfaceCulling && applyBackfaceCulling()){\n //color = vec3(0.);\n }\n //applyBackfaceCulling直接返回false或者注释color = vec3(0.);都没问题\n\treturn color;\n}\n\nfloat getPointSize(){\n\tfloat pointSize = 1.0;\n\t\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * resolution.y / (slope * vViewPosition.z);\n \n \n \n /*\n\tfloat scale = length(\n\t\tmodelViewMatrix * vec4(0, 0, 0, 1) - \n\t\tmodelViewMatrix * vec4(uOctreeSpacing, 0, 0, 1)\n\t) / uOctreeSpacing;\n \n\tprojFactor = projFactor * scale;\n\t*/\n \n \n\tfloat r = uOctreeSpacing * 1.7;\n\t//vRadius = r;\n \n \n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tif(uUseOrthographicCamera){\n\t\t\t//pointSize = size * 100.0; //加个乘数\n \n pointSize = size / uOrthoWidth * resolution.x; //改成近似adaptive_point_size根据窗口缩放\n \n\t\t}else{ //近大远小,模拟真实mesh,边缘放大\n\t\t\t//pointSize = size * spacing * projFactor; //spacing是attribute 为空 如果有这个值就能更自适应填补\n //pointSize = size * uOctreeSpacing * projFactor / 18.0; //直接用cloud的spacing里,不过因为都一样所以可能没有什么意义\n\t\t\t//pointSize = pointSize * projFactor;\n pointSize = size * projFactor ;\n\t\t}\n\t#elif defined adaptive_point_size\n\t\tif(uUseOrthographicCamera) {\n\t\t\tfloat worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = (worldSpaceSize / uOrthoWidth) * resolution.x; //uScreenWidth;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n} \n\n\nbool insideBox(mat4 clipBox){//add\n vec4 clipPosition = clipBox * modelMatrix * vec4( position, 1.0 );\n bool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;\n inside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;\n inside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;\n\n return inside;\n}\n\n\nvoid doClipping(){\n\n\t{\n\t\tvec4 cl = getClassification(); \n\t\tif(cl.a == 0.0){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\n\t#if defined(clip_return_number_enabled)\n\t{ // return number filter\n\t\tvec2 range = uFilterReturnNumberRange;\n\t\tif(returnNumber < range.x || returnNumber > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_number_of_returns_enabled)\n\t{ // number of return filter\n\t\tvec2 range = uFilterNumberOfReturnsRange;\n\t\tif(numberOfReturns < range.x || numberOfReturns > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_gps_enabled)\n\t{ // GPS time filter\n\t\tfloat time = (gpsTime + uGpsOffset) * uGpsScale;\n\t\tvec2 range = uFilterGPSTimeClipRange;\n\n\t\tif(time < range.x || time > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_point_source_id_enabled)\n\t{ // point source id filter\n\t\tvec2 range = uFilterPointSourceIDClipRange;\n\t\tif(pointSourceID < range.x || pointSourceID > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t \n\n\n //总共三种box : 最外层可见、内层可见和不可见(外层可见和内层可见是交集,内层可见和内层不可见是并集)\n \n #if defined(bigClipInBox) \n if(!insideBox(clipBoxBig_in)){ \n gl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n return;;\n } \n #endif \n \n #if defined(num_in_clipboxes) && num_in_clipboxes > 0\n //当有可见box时,需要在任一可见box内才可见\n bool visi1 = false;\n\t\tfor(int i = 0; i < num_in_clipboxes; i++){ \n if(insideBox(clipBoxes_in[i])){\n visi1 = true;\n break;\n } \n\t\t}\n if(!visi1){\n gl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n return;\n }\n\t#endif\n\n\n #if defined(num_out_clipboxes) && num_out_clipboxes > 0\n //当有不可见box时,不在所有不可见box内才可见\n bool visi2 = true;\n\t\tfor(int i = 0; i < num_out_clipboxes; i++){ \n if(insideBox(clipBoxes_out[i])){\n visi2 = false;\n break;\n } \n\t\t}\n if(!visi2){\n gl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n return;\n }\n\t#endif \n \n \n #if defined(num_highlightBox) && num_highlightBox > 0\n //当有高亮box时,需要在任一可见高亮内都高宽\n bool highlight = false;\n\t\tfor(int i = 0; i < num_highlightBox; i++){ \n if(insideBox(boxes_highlight[i])){\n highlight = true;\n break;\n } \n\t\t}\n if(highlight){\n vColor.r += 0.5; \n }\n\t#endif\n \n}\n\n\n\n// \n// ## ## ### #### ## ## \n// ### ### ## ## ## ### ## \n// #### #### ## ## ## #### ## \n// ## ### ## ## ## ## ## ## ## \n// ## ## ######### ## ## #### \n// ## ## ## ## ## ## ### \n// ## ## ## ## #### ## ## \n//\n\n\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \n\nvec3 transformAxis( vec3 direction ) //navvis->4dkk\n{\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n}\n\nvoid main() {\n //bool filtered_by_normal = false; \n float normalZ = 0.0;\n\n\n\n #ifdef use_filter_by_normal\n /*if(abs(getNormal().z) > 0.4) { //ufilterByNormalThreshold 暂定 3\n\t\t\t// Move point outside clip space space to discard it.\n\t\t\t//gl_Position = vec4(0.0, 0.0, 2.0, 1.0); //gl_Position的可视区域是 x,y,z都是[-1,1] \n //return;\n //filtered_by_normal = true; //标记一下。不直接不绘制,因为有的法线都是垂直向上\n \n\t\t}*/\n \n normalZ = abs(getNormal().z);\n #endif\n \n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 );\n vViewPosition = mvPosition.xyz;\n gl_Position = projectionMatrix * mvPosition;\n vLogDepth = log2(-mvPosition.z);\n \n \n \n // COLOR\n //加-------------------\n #if defined(usePanoMap)\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vec3 vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz; \n vWorldPosition0.x *= -1.0;\n vWorldPosition0 = transformAxis(vWorldPosition0);\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vec3 vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz; \n vWorldPosition1.x *= -1.0;\n vWorldPosition1 = transformAxis(vWorldPosition1);\n \n /*\n vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);\n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n vec4 colorFromPano0 = texture2D(pano0Map,samplerCoord0);\n vec4 colorFromPano1 = texture2D(pano1Map,samplerCoord1);\n */\n \n \n \n \n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n\n vColor = mix(colorFromPano0,colorFromPano1,progress).xyz; \n\n \n //float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色 \n if(progress < easeInOutRatio){\n float easeProgress = (easeInOutRatio - progress) / easeInOutRatio;\n vec3 vColor1 = getColor();\n vColor = mix(vColor,vColor1,easeProgress); \n }else if(progress > 1.0 - easeInOutRatio){ \n float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio;\n vec3 vColor1 = getColor();\n vColor = mix(vColor,vColor1,easeProgress); \n }\n \n\n #else\n \n vColor = getColor();\n \n #endif\n \n \n //------------------- \n \n #ifdef attenuated_opacity \n //zoom不会改变z 所以这并不是用在分屏时候的\n //vOpacity = uOpacity * exp(-length(-mvPosition.xyz) / 1000.0); // e为底的指数函数 opacityAttenuation = 1000\n vOpacity = uOpacity * exp(gl_Position.z/50.0); \n vOpacity = clamp(vOpacity, 0.001, 1.0); \n \n #else\n vOpacity = uOpacity; \n \n #endif\n \n vOpacity *= max(0.1, (1.0 - normalZ));//垂直朝相机时降低透明度 \n\n // POINT SIZE\n float pointSize = getPointSize();\n \n gl_PointSize = pointSize;\n vPointSize = pointSize;\n\n \n \n \n \n\n // only for "replacing" approaches\n // if(getLOD() != uLevel){\n // \tgl_Position = vec4(10.0, 10.0, 10.0, 1.0);\n // }\n\n\n #if defined hq_depth_pass\n float originalDepth = gl_Position.w;\n float adjustedDepth = originalDepth + 2.0 * vRadius;\n float adjust = adjustedDepth / originalDepth;\n\n mvPosition.xyz = mvPosition.xyz * adjust;\n gl_Position = projectionMatrix * mvPosition;\n #endif\n\n\n // CLIPPING\n doClipping();\n\n #if defined(num_clipspheres) && num_clipspheres > 0\n for(int i = 0; i < num_clipspheres; i++){\n vec4 sphereLocal = uClipSpheres[i] * mvPosition;\n\n float distance = length(sphereLocal.xyz);\n\n if(distance < 1.0){\n float w = distance;\n vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n \n vColor = cGradient;\n //vColor = cGradient * 0.7 + vColor * 0.3;\n }\n }\n #endif\n\n #if defined(num_shadowmaps) && num_shadowmaps > 0\n\n const float sm_near = 0.1;\n const float sm_far = 10000.0;\n\n for(int i = 0; i < num_shadowmaps; i++){\n vec3 viewPos = (uShadowWorldView[i] * vec4(position, 1.0)).xyz;\n float distanceToLight = abs(viewPos.z);\n \n vec4 projPos = uShadowProj[i] * uShadowWorldView[i] * vec4(position, 1);\n vec3 nc = projPos.xyz / projPos.w;\n \n float u = nc.x * 0.5 + 0.5;\n float v = nc.y * 0.5 + 0.5;\n\n vec2 sampleStep = vec2(1.0 / (2.0*1024.0), 1.0 / (2.0*1024.0)) * 1.5;\n vec2 sampleLocations[9];\n sampleLocations[0] = vec2(0.0, 0.0);\n sampleLocations[1] = sampleStep;\n sampleLocations[2] = -sampleStep;\n sampleLocations[3] = vec2(sampleStep.x, -sampleStep.y);\n sampleLocations[4] = vec2(-sampleStep.x, sampleStep.y);\n\n sampleLocations[5] = vec2(0.0, sampleStep.y);\n sampleLocations[6] = vec2(0.0, -sampleStep.y);\n sampleLocations[7] = vec2(sampleStep.x, 0.0);\n sampleLocations[8] = vec2(-sampleStep.x, 0.0);\n\n float visibleSamples = 0.0;\n float numSamples = 0.0;\n\n float bias = vRadius * 2.0;\n\n for(int j = 0; j < 9; j++){\n vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);\n\n float linearDepthFromSM = depthMapValue.x + bias;\n float linearDepthFromViewer = distanceToLight;\n\n if(linearDepthFromSM > linearDepthFromViewer){\n visibleSamples += 1.0;\n }\n\n numSamples += 1.0;\n }\n\n float visibility = visibleSamples / numSamples;\n\n if(u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0 || nc.x < -1.0 || nc.x > 1.0 || nc.y < -1.0 || nc.y > 1.0 || nc.z < -1.0 || nc.z > 1.0){\n //vColor = vec3(0.0, 0.0, 0.2);\n }else{\n //vColor = vec3(1.0, 1.0, 1.0) * visibility + vec3(1.0, 1.0, 1.0) * vec3(0.5, 0.0, 0.0) * (1.0 - visibility);\n vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);\n }\n\n\n }\n\n #endif\n\n \n \n}\n',"pointcloud_new.fs":"\n#if defined paraboloid_point_shape\n\t#extension GL_EXT_frag_depth : enable\n#endif\n#define PI 3.141592653589793\n\n\n\nprecision highp float;\nprecision highp int;\n\n/*\n#if defined(usePanoMap) \n \n uniform samplerCube pano0Map; //随便设置一个samplerCube去使用都会让点云消失\n uniform samplerCube pano1Map;\n \n uniform float progress;\n uniform float easeInOutRatio;\n\n \n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix; \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n#endif \n*/\n\n\n\n//------------\n\n\n\n\n\nuniform mat4 viewMatrix;\nuniform mat4 uViewInv;\nuniform mat4 uProjInv;\nuniform vec3 cameraPosition;\n\n\nuniform mat4 projectionMatrix;\n//uniform float uOpacity;\nvarying float vOpacity; //add\n\nuniform float blendHardness;\nuniform float blendDepthSupplement;\nuniform float fov;\nuniform float uSpacing;\nuniform float near;\nuniform float far;\nuniform float uPCIndex;\nuniform float uScreenWidth;\nuniform float uScreenHeight;\n\nvarying vec3\tvColor;\nvarying float\tvLogDepth;\nvarying vec3\tvViewPosition;\nvarying float\tvRadius;\nvarying float \tvPointSize;\nvarying vec3 \tvPosition;\n\n\nfloat specularStrength = 1.0;\n\n\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \n\n\n\n\nvoid main() {\n\n vec3 color = vColor; \n\t \n \n /*#if defined(usePanoMap) //加 经测试,即使全部写在fragment里也是无论pointsize多大都是一个点一个颜色,所以干脆写在vectex里\n \n \n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n \n color = mix(colorFromPano0,colorFromPano1,progress).xyz; \n \n \n //float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色 \n if(progress < easeInOutRatio){\n float easeProgress = (easeInOutRatio - progress) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }else if(progress > 1.0 - easeInOutRatio){ \n float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }\n \n \n #else \n color = vColor;\n #endif*/\n \n \n \n\tfloat depth = gl_FragCoord.z;\n\n\t#if defined(circle_point_shape) || defined(paraboloid_point_shape) \n\t\tfloat u = 2.0 * gl_PointCoord.x - 1.0;\n\t\tfloat v = 2.0 * gl_PointCoord.y - 1.0;\n\t#endif\n\t\n\t#if defined(circle_point_shape) \n\t\tfloat cc = u*u + v*v;\n\t\tif(cc > 1.0){\n\t\t\tdiscard;\n\t\t}\n\t#endif\n\t\n\n \n\n\t\n \n #if defined color_type_indices //pick point recognize\n\t\tgl_FragColor = vec4(color, uPCIndex / 255.0); //uPCIndex : node Index\n\t#else\n\t\tgl_FragColor = vec4(color, vOpacity);\n\t#endif\n \n \n \n \n \n \n \n \n\n\t#if defined paraboloid_point_shape\n\t\tfloat wi = 0.0 - ( u*u + v*v);\n\t\tvec4 pos = vec4(vViewPosition, 1.0);\n\t\tpos.z += wi * vRadius;\n\t\tfloat linearDepth = -pos.z;\n\t\tpos = projectionMatrix * pos;\n\t\tpos = pos / pos.w;\n\t\tfloat expDepth = pos.z;\n\t\tdepth = (pos.z + 1.0) / 2.0;\n\t\tgl_FragDepthEXT = depth;\n\t\t\n\t\t#if defined(color_type_depth)\n\t\t\tcolor.r = linearDepth;\n\t\t\tcolor.g = expDepth;\n\t\t#endif\n\t\t\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = log2(linearDepth);\n\t\t#endif\n\t\t\n\t#else\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = vLogDepth;\n\t\t#endif\n\t#endif\n\n\t#if defined(weighted_splats)\n\t\tfloat distance = 2.0 * length(gl_PointCoord.xy - 0.5);\n\t\tfloat weight = max(0.0, 1.0 - distance);\n\t\tweight = pow(weight, 1.5);\n\n\t\tgl_FragColor.a = weight;\n\t\tgl_FragColor.xyz = gl_FragColor.xyz * weight;\n\t#endif\n\n\t//gl_FragColor = vec4(0.0, 0.7, 0.0, 1.0);\n\t\n}\n\n\n","pointcloud_sm.vs":"\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec3 color;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\n\nuniform float uScreenWidth;\nuniform float uScreenHeight;\nuniform float near;\nuniform float far;\n\nuniform float uSpacing;\nuniform float uOctreeSize;\nuniform float uLevel;\nuniform float uVNStart;\n\nuniform sampler2D visibleNodes;\n\nvarying float vLinearDepth;\nvarying vec3 vColor;\n\n#define PI 3.141592653589793\n\n\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if defined(adaptive_point_size)\n/**\n * number of 1-bits up to inclusive index position\n * number is treated as if it were an integer in the range 0-255\n *\n */\nfloat numberOfOnes(float number, float index){\n\tfloat tmp = mod(number, pow(2.0, index + 1.0));\n\tfloat numOnes = 0.0;\n\tfor(float i = 0.0; i < 8.0; i++){\n\t\tif(mod(tmp, 2.0) != 0.0){\n\t\t\tnumOnes++;\n\t\t}\n\t\ttmp = floor(tmp / 2.0);\n\t}\n\treturn numOnes;\n}\n\n\n/**\n * checks whether the bit at index is 1\n * number is treated as if it were an integer in the range 0-255\n *\n */\nbool isBitSet(float number, float index){\n\treturn mod(floor(number / pow(2.0, index)), 2.0) != 0.0;\n}\n\n\n/**\n * find the LOD at the point position\n */\nfloat getLOD(){\n\t\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat iOffset = uVNStart;\n\tfloat depth = uLevel;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tfloat index = 4.0 * index3d.x + 2.0 * index3d.y + index3d.z;\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));\n\t\tfloat mask = value.r * 255.0;\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tiOffset = iOffset + value.g * 255.0 * 256.0 + value.b * 255.0 + numberOfOnes(mask, index - 1.0);\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn depth;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn depth;\n}\n\n#endif\n\nfloat getPointSize(){\n\tfloat pointSize = 1.0;\n\t\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * uScreenHeight / (slope * vViewPosition.z);\n\t\n\tfloat r = uOctreeSpacing * 1.5;\n\tvRadius = r;\n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tif(uUseOrthographicCamera){\n\t\t\tpointSize = size;\t\t\t\n\t\t}else{\n\t\t\tpointSize = pointSize * projFactor;\n\t\t}\n\t#elif defined adaptive_point_size\n\t\tif(uUseOrthographicCamera) {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = (worldSpaceSize / uOrthoWidth) * uScreenWidth;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n}\n\n\nvoid main() {\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tvLinearDepth = gl_Position.w;\n\n\tfloat pointSize = getPointSize();\n\tgl_PointSize = pointSize;\n\n}\n","pointcloud_sm.fs":"\nprecision mediump float;\nprecision mediump int;\n\nvarying vec3 vColor;\nvarying float vLinearDepth;\n\nvoid main() {\n\n\t//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\t//gl_FragColor = vec4(vColor, 1.0);\n\t//gl_FragColor = vec4(vLinearDepth, pow(vLinearDepth, 2.0), 0.0, 1.0);\n\tgl_FragColor = vec4(vLinearDepth, vLinearDepth / 30.0, vLinearDepth / 30.0, 1.0);\n\t\n}\n\n\n","normalize.vs":"\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}","normalize.fs":"\n#extension GL_EXT_frag_depth : enable\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uDepthMap;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\t\n\tif(depth >= 1.0){\n\t\tdiscard;\n\t}\n\n\tgl_FragColor = vec4(depth, 1.0, 0.0, 1.0);\n\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\t\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\t\n\tgl_FragDepthEXT = depth;\n\n\n}","normalize_and_edl.fs":"\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uEDLMap;\nuniform sampler2D uDepthMap;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\n\nvarying vec2 vUv;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t\n\t\tfloat neighbourDepth = texture2D(uEDLMap, uvNeighbor).a;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\tif(depth == 0.0){\n\t\t\t\tsum += 100.0;\n\t\t\t}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth);\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main() {\n\n\tfloat edlDepth = texture2D(uEDLMap, vUv).a;\n\tfloat res = response(edlDepth);\n\tfloat shade = exp(-res * 300.0 * edlStrength);\n\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\tif(depth >= 1.0 && res == 0.0){\n\t\tdiscard;\n\t}\n\t\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\tcolor = color * shade;\n\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\n\tgl_FragDepthEXT = depth;\n}","edl_new.vs":"\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\t\n\tvec4 mvPosition = modelViewMatrix * vec4(position,1.0);\n\n\tgl_Position = projectionMatrix * mvPosition;\n}","edl_new.fs":"\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\n//uniform float screenWidth;\n//uniform float screenHeight;\nuniform vec2 resolution;\n\n\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\nuniform float opacity;\n\n//uniform float uNear;\n//uniform float uFar;\n\nuniform mat4 uProj;\n\nuniform sampler2D uEDLColor;\nuniform sampler2D uEDLDepth;\n\nvarying vec2 vUv;\n\nuniform int useEDL;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / resolution; //vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t//获取周围八个格子的值\n\t\tfloat neighbourDepth = texture2D(uEDLColor, uvNeighbor).a;\n\t\tneighbourDepth = (neighbourDepth == 1.0) ? 0.0 : neighbourDepth;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\t //if(depth == 0.0){\n\t\t\t //\tsum += 100.0;\n\t\t\t //}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth); //获取差值\n\t\t\t //}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main(){\n\tvec4 cEDL = texture2D(uEDLColor, vUv);\n\t\n\tfloat depth = cEDL.a;\n\tdepth = (depth == 1.0) ? 0.0 : depth;\n \n if(depth == 0.0){ //去掉这句就能在无点云像素的地方渲染outline,但会遮住其他mesh\n\t\tdiscard;\n\t}\n \n \n if(useEDL == 1){\n float res = response(depth); \n float shade = exp(-res * 300.0 * edlStrength); //自然常数e为底的指数函数 \n const float min = 0.2; //add 使边缘色变浅 范围从0-1 变为min-1\n shade = shade * (1.0-min) + min;\n gl_FragColor = vec4(cEDL.rgb * shade, opacity); \n }else{//加 不改颜色的情况 \n gl_FragColor = vec4(cEDL.rgb, opacity);\n } \n //注意,edlStrength越强,在相同depth的叠放的点云间的轮廓线颜色越深\n //作用:勾勒边缘,强化深度差异,模拟阴影,加强结构立体感\n \n { // write regular hyperbolic depth values to depth buffer 修改深度\n float dl = pow(2.0, depth);\n\n vec4 dp = uProj * vec4(0.0, 0.0, -dl, 1.0);\n float pz = dp.z / dp.w;\n float fragDepth = (pz + 1.0) / 2.0;\n\n gl_FragDepthEXT = fragDepth;\n }\n\t\n}\n","blur.vs":"\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}","blur.fs":"\nuniform mat4 projectionMatrix;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform float near;\nuniform float far;\n\nuniform sampler2D map;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tfloat dx = 1.0 / screenWidth;\n\tfloat dy = 1.0 / screenHeight;\n\n\tvec3 color = vec3(0.0, 0.0, 0.0);\n\tcolor += texture2D(map, vUv + vec2(-dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, dy)).rgb;\n\n\tcolor = color / 9.0;\n\t\n\tgl_FragColor = vec4(color, 1.0);\n}","depthBasic.vs":"\n \n\nvarying vec2 vUv;\nvoid main() {\n \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ","depthBasic.fs":"varying vec2 vUv;\nuniform float opacity;\n\nuniform vec3 baseColor;\nuniform vec3 backColor;\nuniform float occlusionDistance;\nuniform float clipDistance;\nuniform float maxClipFactor;\n\n\n#if defined use_map\n uniform sampler2D map; \n#endif\n \n#if defined(GL_EXT_frag_depth) && defined(useDepth) \n //似乎通过gl.getExtension('EXT_frag_depth')得到的GL_EXT_frag_depth\n \n uniform sampler2D depthTexture;\n uniform float nearPlane;\n uniform float farPlane; \n uniform vec2 resolution;\n uniform vec2 viewportOffset; // viewportOffset 范围从0-整个画布的像素\n \n float convertToLinear(float zValue)\n {\n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n }\n#endif\n \nvoid main() {\n \n \n vec4 color = vec4(baseColor, opacity);\n \n \n \n #if defined(GL_EXT_frag_depth) && defined(useDepth)\n // mixFactor and clipFactor define the color mixing proportion between the states of\n // full visibility and occluded visibility\n // and\n // full visibility and total invisibility\n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n \n \n // The linear depth value of the current fragment\n float fragDepth = convertToLinear(gl_FragCoord.z);\n\n // The coordinates of the current fragment in the depth texture\n vec2 depthTxtCoords = vec2(gl_FragCoord.x-viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n //gl_FragCoord大小为 viewport client大小 \n \n // The linear depth value of the pixel occupied by this fragment in the depth buffer\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n // The difference between the two depths\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)//差距\n {\n // occlusionDistance and clipDistance define the width of the respective zones and\n // mixFactor and clipFactor express the interpolation between the two colors depending on the position\n // of the current fragment withing those zones.\n \n \n mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);\n clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);\n }\n \n // If the fragment is totally transparent, don't bother drawing it\n if (clipFactor == 1.0)\n {\n discard;\n }else{\n \n #if defined use_map\n color = texture2D(map, vUv) * color; \n #endif\n \n \n \n color = vec4(mix(color.rgb, backColor, mixFactor), color.a * (1.0 - clipFactor));\n }\n \n #else\n #if defined use_map\n color = texture2D(map, vUv) * color;\n #endif \n #endif\n \n gl_FragColor = color;\n \n}\n","copyCubeMap.vs":"varying vec3 vWorldPos;\nvec3 transformAxis( vec3 direction ) //navvis->4dkk\n{\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n}\nvoid main() {\n vWorldPos = vec3(-position.x, -position.y, position.z);\n //vWorldPos = transformAxis(vWorldPos);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ","copyCubeMap.fs":"varying vec3 vWorldPos;\nuniform float alpha;\nuniform samplerCube tDiffuse;\n\n\nvoid main() {\n vec4 texColor = textureCube(tDiffuse, vWorldPos);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n} \n ","basicTextured.vs":"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ","basicTextured.fs":"varying vec2 vUv;\nuniform float opacity;\nuniform sampler2D map;\n\n\nvoid main() {\n vec4 texColor = texture2D(map, vUv);\n gl_FragColor = vec4(texColor.rgb, texColor.a * opacity);\n}\n","skybox.vs":"uniform mat4 matrix; \nvarying vec3 vWorldPosition;\n\n\n\nvoid main() \n{ \n \n vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz ; // - cameraPosition; \n vWorldPosition = (vec4(vWorldPosition, 1.0) * matrix).xyz;\n vWorldPosition.x *= -1.0;\n\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}","skybox.fs":"varying vec3 vWorldPosition;\nuniform sampler2D tDiffuse; \n\n#define PI 3.141592653 \n\n/*vec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5;\n float ty=acos(direction.y)/PI;\n\n return vec2(tx,ty);\n}*/\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \nvoid main() \n{\n vec2 samplerCoord = getSamplerCoord(vWorldPosition);\n vec4 color = texture2D(tDiffuse, samplerCoord);\n //gl_FragColor = RGBEToLinear( color ); //对于hdr必须加这一句,否则效果很奇怪。copy自meshBasicMaterial里的mat_fragment的mapTexelToLinear函数,只要有map就会使用该函数\n gl_FragColor = color;\n //#include \n //////#include \n\n} \n"},im={DEFAULT:{0:{visible:!0,name:"never classified",color:[.5,.5,.5,1]},1:{visible:!0,name:"unclassified",color:[.5,.5,.5,1]},2:{visible:!0,name:"ground",color:[.63,.32,.18,1]},3:{visible:!0,name:"low vegetation",color:[0,1,0,1]},4:{visible:!0,name:"medium vegetation",color:[0,.8,0,1]},5:{visible:!0,name:"high vegetation",color:[0,.6,0,1]},6:{visible:!0,name:"building",color:[1,.66,0,1]},7:{visible:!0,name:"low point(noise)",color:[1,0,1,1]},8:{visible:!0,name:"key-point",color:[1,0,0,1]},9:{visible:!0,name:"water",color:[0,0,1,1]},12:{visible:!0,name:"overlap",color:[1,1,0,1]},DEFAULT:{visible:!0,name:"default",color:[.3,.6,.6,.5]}}},rm=(Object.defineProperty(im,"RANDOM",{get:function(){for(var e={},t=0;t<=255;t++)e[t]=new Kn(Math.random(),Math.random(),Math.random());return e.DEFAULT=new Kn(Math.random(),Math.random(),Math.random()),e}}),function(){function r(e){te(this,r);for(var t=0,n=Object.keys(e);t>8,n[4*s+2]=a[s]%256),l.geometryNode.density);"number"==typeof u?(s=Math.log2(u)/2-1.5,n[4*o+3]=10*(10+s)):n[4*o+3]=100}return Potree.measureTimings&&(performance.mark("computeVisibilityTextureData-end"),performance.measure("render.computeVisibilityTextureData","computeVisibilityTextureData-start","computeVisibilityTextureData-end")),{data:n,offsets:i}}},{key:"nodeIntersectsProfile",value:function(e,t){for(var n=e.boundingBox.clone().applyMatrix4(this.matrixWorld).getBoundingSphere(new gi),i=!1,r=0;r1/0))for(var s=o.geometryNode.buffer,l=s.offset("position"),u=s.stride,c=new DataView(s.data),h=(new _e).multiplyMatrices(r,o.sceneNode.matrixWorld),d=new Kn,p=0;px.vbos.get(E).version&&N.updateBuffer(b);else x=N.createBuffer(b),N.buffers.set(b,x);if(G.bindVertexArray(x.vao),void 0===Am[U.activeAttributeName]&&Object.keys(b.attributes).includes(U.activeAttributeName)){var C,B=Am.aExtra.location;for(C in b.attributes){b.attributes[C];var _=x.vbos.get(C);G.bindBuffer(G.ARRAY_BUFFER,_.handle),G.disableVertexAttribArray(B)}var M=U.activeAttributeName,v=b.attributes[M],T=x.vbos.get(M),e=(void 0!==v&&void 0!==T&&(i=N.glTypeMapping.get(v.array.constructor),n=v.normalized,G.bindBuffer(G.ARRAY_BUFFER,T.handle),G.vertexAttribPointer(B,v.itemSize,i,n,0,0),G.enableVertexAttribArray(B)),L.pcoGeometry.pointAttributes.attributes.find(function(e){return e.name===M})),T=(T=U.getRange(M))||e.range,v=e.initialRange,i=v[1]-v[0],n=T=T||[0,1],e=i/(n[1]-n[0]),T=-(n[0]-v[0])/i,e=Number.isNaN(e)?1:e,T=Number.isNaN(T)?0:T;F.setUniform1f("uExtraScale",e),F.setUniform1f("uExtraOffset",T)}else for(var S in b.attributes){var I,D,P=b.attributes[S],k=x.vbos.get(S);void 0!==Am[S]&&(S=Am[S].location,I=N.glTypeMapping.get(P.array.constructor),D=P.normalized,G.bindBuffer(G.ARRAY_BUFFER,k.handle),G.vertexAttribPointer(S,P.itemSize,I,D,0,0),G.enableVertexAttribArray(S))}n=x.numElements;G.drawArrays(G.POINTS,0,n),j++})()}catch(e){r.e(e)}finally{r.f()}G.bindVertexArray(null),W.measureTimings&&(performance.mark("renderNodes-end"),performance.measure("render.renderNodes","renderNodes-start","renderNodes-end"))}},{key:"renderOctree",value:function(e,t,n,i){var r=4=this.batchSize){for(var a=0,o=Object.keys(this.currentBatch.geometry.attributes);a",l=0,u=Object.keys(a);l\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\ty\n\t\t\t\t\t\t\t\t\t").concat(c[1],"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tz\n\t\t\t\t\t\t\t\t\t").concat(c[2],"\n\t\t\t\t\t\t\t\t")):"rgba"===h?s+="\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t".concat(h,"\n\t\t\t\t\t\t\t\t\t").concat(d.join(", "),"\n\t\t\t\t\t\t\t\t"):"normal"!==h&&(s+="mileage"===h?"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t".concat(h,"\n\t\t\t\t\t\t\t\t\t").concat(d.toFixed(3),"\n\t\t\t\t\t\t\t\t"):"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t".concat(h,"\n\t\t\t\t\t\t\t\t\t").concat(f(d),"\n\t\t\t\t\t\t\t\t"))}i.html(s+=""),v.selectedPoint=a}else{v.viewer.scene.scene.add(v.viewerPickSphere);e=v.viewer.scene.scene.children.indexOf(v.viewerPickSphere);0<=e&&v.viewer.scene.scene.children.splice(e,1),v.viewer.removeEventListener("update",m)}v.render()}v.mouse.copy(t)}}),$(this.renderArea)[0].addEventListener("mousewheel",e,!1),$(this.renderArea)[0].addEventListener("DOMMouseScroll",e,!1),$("#closeProfileContainer").click(function(){v.hide()});$("#potree_download_csv_icon").click(function(){var e=t(),e=qf.toString(e),e=new Blob([e],{type:"text/string"});$("#potree_download_profile_ortho_link").attr("href",URL.createObjectURL(e))}),$("#potree_download_las_icon").click(function(){var e=t(),e=Xf.toLAS(e),e=new Blob([e],{type:"application/octet-binary"});$("#potree_download_profile_link").attr("href",URL.createObjectURL(e))})}},{key:"selectPoint",value:function(e,t,n){var i,r={distance:1/0,pointcloud:null,points:null,index:null},a=new bd(new Le(e-n,t-n),new Le(e+n,t+n)),o=q(this.pointclouds);try{for(o.s();!(i=o.n()).done;){var s,l=N(i.value,2),u=l[0],c=q(l[1].points);try{for(c.s();!(s=c.n()).done;){var h=s.value;if(new bd(new Le(h.projectedBox.min.x,h.projectedBox.min.z),new Le(h.projectedBox.max.x,h.projectedBox.max.z)).intersectsBox(a)){h.numPoints;for(var d=0;d(new Date).getTime())){this.scheduledRecomputeTime=(new Date).getTime()+100,this.scheduledRecomputeTime=null,this.reset();var i,t=q(this.viewer.scene.pointclouds.filter(function(e){return e.visible}));try{for(t.s();!(i=t.n()).done;)!function(){var t=i.value,e=t.getPointsInProfile(n.profile,null,{onProgress:function(e){n.enabled&&(n.progressHandler(t,e.points),n.numPoints>n.threshold)&&n.finishLevelThenCancel()},onFinish:function(e){n.enabled},onCancel:function(){n.enabled}});n.requests.push(e)}()}catch(e){t.e(e)}finally{t.f()}}}}]),n}(),Sm=function(){y(o,zn);var a=C(o);function o(e){te(this,o),(t=a.call(this)).viewer=e,t.renderer=e.renderer,t.addEventListener("start_inserting_volume",function(e){t.viewer.dispatchEvent({type:"cancel_insertions"})}),t.scene=new Ps,t.scene.name="scene_volume",t.viewer.inputHandler.registerInteractiveScene(t.scene),t.onRemove=function(e){t.scene.remove(e.volume)},t.onAdd=function(e){t.scene.add(e.volume)};var t,n,i=q(e.scene.volumes);try{for(i.s();!(n=i.n()).done;){var r=n.value;t.onAdd({volume:r})}}catch(e){i.e(e)}finally{i.f()}return t.viewer.inputHandler.addEventListener("delete",function(e){e.selection.filter(function(e){return e instanceof hf}).forEach(function(e){return t.viewer.scene.removeVolume(e)})}),e.addEventListener("update",t.update.bind(G(t))),e.addEventListener("render.pass.scene",function(e){return t.render(e)}),e.addEventListener("scene_changed",t.onSceneChange.bind(G(t))),e.scene.addEventListener("volume_added",t.onAdd),e.scene.addEventListener("volume_removed",t.onRemove),t}return A(o,[{key:"onSceneChange",value:function(e){e.oldScene&&(e.oldScene.removeEventListeners("volume_added",this.onAdd),e.oldScene.removeEventListeners("volume_removed",this.onRemove)),e.scene.addEventListener("volume_added",this.onAdd),e.scene.addEventListener("volume_removed",this.onRemove)}},{key:"startInsertion",value:function(){function t(e){i.removeEventListener("drag",a),i.removeEventListener("drop",t),r.callback()}var n=this,e=0Potree.pointLoadLimit;){var e=this.first.node;this.disposeDescendants(e)}}},{key:"disposeDescendants",value:function(e){var t=[];for(t.push(e);0Potree.pointBudget))&&!(_.get(r)+n.getNumPoints()>r.pointBudget),r.material.clipBoxes_in),h=(r.material.clipBoxes_out,r.material.bigClipInBox);if((o=o&&u<=l)&&h&&(e(h)||(o=!1)),o&&0Potree.pointBudget)return"break";if(!o)return"continue";B+=n.getNumPoints();for(var u=_.get(r),m=(_.set(r,u+n.getNumPoints()),r.numVisibleNodes++,r.numVisiblePoints+=n.getNumPoints(),!n.isGeometryNode()||i&&!i.isTreeNode()||(n.isLoaded()&&L<2?(n=r.toTreeNode(n,i),L++):(S.push({pointcloud:r,node:n}),T.push(n))),n.isTreeNode()&&(Potree.lru.touch(n.geometryNode),n.sceneNode.visible=!0,n.sceneNode.material=r.material,M.push(n),r.visibleNodes.push(n),void 0===n._transformVersion&&(n._transformVersion=-1),l=F.get(r),n._transformVersion!==l.number&&(n.sceneNode.updateMatrix(),n.sceneNode.matrixWorld.multiplyMatrices(r.matrixWorld,n.sceneNode.matrix),n._transformVersion=l.number),r.showBoundingBox&&!n.boundingBoxNode&&n.getBoundingBox?((h=new Im(n.getBoundingBox())).matrixAutoUpdate=!1,r.boundingBoxNodes.push(h),n.boundingBoxNode=h,n.boundingBoxNode.matrix.copy(r.matrixWorld)):r.showBoundingBox?(n.boundingBoxNode.visible=!0,n.boundingBoxNode.matrix.copy(r.matrixWorld)):!r.showBoundingBox&&n.boundingBoxNode&&(n.boundingBoxNode.visible=!1)),n.getChildren()),v=0;vt;){var n=this.getLRUItem();n&&this.disposeDescendants(n)}},Sm.prototype.update=function(){},Sm.prototype.startInsertion=function(){var n,i=this,r=0Potree.config.clickMaxDragDis))return u();a.removeEventListener("drag",s),a.removeEventListener("drop",e),i.viewer.removeEventListener("cancel_insertions",l),a.isNew=!1,viewer.removeEventListener("camera_changed",o),"remove"==t?viewer.scene.removeVolume(a):(viewer.transformObject(a),a.highlight=!1),a.dispatchEvent({type:"createFinish",success:"remove"!=t}),n&&n.forEach(function(e){return e.highlight=!1})},u=function(){return setTimeout(function(){a.parent&&a.isNew&&viewer.inputHandler.startDragging(a,{notPressMouse:!0})},1)};return a.addEventListener("drag",s),a.addEventListener("drop",e),this.viewer.addEventListener("cancel_insertions",l),viewer.addEventListener("camera_changed",o),this.viewer.inputHandler.startDragging(a,{notPressMouse:!0}),a};var Gm={displayMode:{showPointCloud:{atPano:{showPoint:!0,showSkybox:!(kf.prototype.setPositions=function(e){e=new Float32Array(e);return gf.prototype.setPositions.call(this,e),this}),pointUsePanoTex:!1},transition:{showPoint:!0,showSkybox:!1,pointUsePanoTex:!1},canLeavePano:!0},showPanos:{atPano:{showPoint:!1,showSkybox:!0,pointUsePanoTex:!1},transition:{showSkybox:!0},canLeavePano:!1},showBoth:{atPano:{showPoint:!0,showSkybox:!0,pointUsePanoTex:!1},transition:{showPoint:!0,showSkybox:!0,pointUsePanoTex:!0},canLeavePano:!0},pointUsePanoTex:{atPano:{showPoint:!0,showSkybox:!1,pointUsePanoTex:!0},transition:{showPoint:!0,showSkybox:!0,pointUsePanoTex:!0},canLeavePano:!1}},urls:{prefix1:"https://laser-oss.4dkankan.com",prefix2:"https://testlaser.4dkankan.com",prefix3:"https://4dkk.4dage.com",prefix4:"https://uat-laser.4dkankan.com",prefix5:"https://laser.4dkankan.com",prefix6:"https://mix3d.4dkankan.com/backend"},transitionsTime:{flyMinTime:500,flytimeDistanceMultiplier:150,panoToPanoMax:2e3,flyIn:1e3,flyOut:1e3},view:{fov:70,near:.1,far:1e4},map:{mapHeight:-1e3,cameraHeight:1e3},minNodeSize:30,pointDensity:{magnifier:{maxLevelPercent:1,pointBudget:8e6},panorama:{maxLevelPercent:.6,pointBudget:sf.isMobile()?1e5:4e5,minNodeSize:100},fourViewports:{maxLevelPercent:.4,pointBudget:1e6,minNodeSize:70},fourViewportsMain:{maxLevelPercent:.8,pointBudget:1e6,minNodeSize:70},panoEdit:{maxLevelPercent:1,pointBudget:4e6,percentByUser:!0,minNodeSize:50},low:{maxLevelPercent:.4,percentByUser:!0,pointBudget:sf.isMobile()?1e6:2e6,minNodeSize:40},middle:{maxLevelPercent:.7,percentByUser:!0,pointBudget:sf.isMobile()?2e6:35e5,minNodeSize:30},high:{maxLevelPercent:1,percentByUser:!0,pointBudget:sf.isMobile()?3e6:6e6,minNodeSize:30}},clip:{color:"#FFC266"},panoFieldRadius:10,measure:{color:"#00C8AF",default:{color:"#64C8BB",opacity:.7},highlight:{color:"#00C8AF",opacity:1},guide:{color:"#FFFFFF",opacity:1},backColor:"#333333",lineWidth:4,textColor:"#FFFFFF"},material:{pointSize:.1,realPointSize:.1,minSize:.1,maxSize:1e4,pointSizeType:"ATTENUATED",absolutePanoramaSize:1.3,pointColor:"#ffffff"},skyboxBgWidth:100,renderLayers:{bg:20,bg2:21,skybox:1,pointcloud:11,sceneObjects:0,model:2,measure:4,magnifier:5,magnifierContent:16,volume:6,transformationTool:7,map:8,mapObjects:9,bothMapAndScene:3,siteModeOnlyMapVisi:12,siteModelMapUnvisi:13,siteModeSideVisi:14,layer1:10,layer2:15},renderOrders:{model:10},siteModel:{names:{building:"建筑",floor:"楼层",room:"房间"},floorHeightDefault:5},panosEdit:{},tiling:{panoPreRenderRepeatDelay:2500,panoPreRenderDelay:500,preRenderTourPanos:sf.valueFromHash("tileprerender",0),tilingFlagNames:["usetiles","tiles"],maxNavPanoQuality:sf.valueFromHash("maxtileq",null),maxZoomPanoQuality:sf.valueFromHash("maxztileq",null),overlayStyle:sf.valueFromHash("tileoverlay",0),uploadIntervalDelay:sf.valueFromHash("tileupdelay",10),initialIntervalDelay:sf.valueFromHash("itiledelay",0),maxNonBaseUploadsPerFrame:sf.valueFromHash("maxnbtpf",2),maxBaseUploadsPerFrame:sf.valueFromHash("maxbtpf",6),customCompression:sf.valueFromHash("tilecustcomp",0),mobileHighQualityOverride:!1,allowUltraHighResolution:!0},navigation:{panoScores:!1,mouseDirection:!0,filterStrictness:.75,angleFactor:-30,directionFactor:10,distanceFactor:-1,optionalityFactor:3},axis:{x:{color:"#ea3f3f"},y:{color:"#86c215"},z:{color:"#3396f8"},xyz:{color:"#ccc"}},highQualityMaxZoom:2,ultraHighQualityMaxZoom:3,clickMaxDragDis:5,clickMaxPressTime:500,doubleClickTime:200,background:"#232323",mapBG:"#F5F5F5",colors:{red:[213,0,0],pink:[197,17,98],purple:[170,0,255],"deep purple":[98,0,234],blue:[41,98,255],"light blue":[0,145,234],cyan:[0,184,212],teal:[0,191,165],green:[0,200,83],"light green":[100,221,23],lime:[174,234,0],yellow:[255,214,0],amber:[255,171,0],orange:[255,109,0],"deep orange":[255,61,0]}};Gm.OrthoCameraLimit={standard:{zoom:{min:.001,max:500},posBound:{min:{x:-1e5,y:-1e5,z:Gm.map.cameraHeight},max:{x:1e5,y:1e5,z:1/0}}},expand:{zoom:{min:4e-4,max:100},posBound:{min:{x:-5e6,y:-1e6,z:Gm.map.cameraHeight},max:{x:5e6,y:1e6,z:1/0}}}};var zd={editType:"",number:"",originDatasetId:"",isOfficial:!(window.testLevelSteps=function(e){e||(e=[(t=Potree.config.pointDensity).low.maxLevelPercent,t.middle.maxLevelPercent,t.high.maxLevelPercent]);for(var t,n=1;++n<=12;){var i=e.map(function(e){return e*n}),r=e.map(function(e){return Math.round(e*n)});console.log("当nodeMaxLevel为".concat(n,"时,每一级的level分别为").concat(r,", (小数:").concat(i,")"))}console.log("请检查每一层的三个level是否有重复")}),webSite:"testdata",isLocal:!1,libsUrl:"../libs/",displayMode:"",isTest:sf.urlHasValue("test"),prefix:window.location.href.split("//")[1].split("/")[0],pointDensity:"",UserPointDensity:"",UserDensityPercent:null,ifShowMarker:!0,floorplanType:{},floorplanEnable:!1,floorplanEnables:{},floorplanRequests:{},mapEnable:!0,cameraFar:Gm.view.far,showPanoMesh:!1,dblToFocusPoint:!1,unableNavigate:!1,sizeFitToLevel:!1,zoom:{enabled:!0,min:1,max:Gm.highQualityMaxZoom},navConstantly:!0,navTileClass:sf.isMobile()?"1k":"2k",tileClass:"4k",drawEntityData:!1,zoomFromPointert:{whenPanos:!0,whenPointCloud:!0,map:!0},rotAroundPoint:!0,tourTestCameraMove:!1,cameraAniSmoothRatio:20,urls:$.extend({},Gm.urls,{prefix:Gm.urls.prefix4}),useDepthTex:!0,datasetsPanos:{},boundAddObjs:!1,intersectOnObjs:!1,intersectWhenHover:!0,depTexLocBindDataset:!0,notAdditiveBlending:!1,precision:2,testV4url:!0},Um=(zd.isLocalhost=zd.prefix.includes("localhost"),function(){y(i,Yf);var n=C(i);function i(){var e,t=0\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t').concat(n._description,"\n\t\t\t\t
\n\t\t\t\n\t\t")),n.elTitlebar=n.domElement.find(".annotation-titlebar"),n.elTitle=n.elTitlebar.find(".annotation-label"),n.elTitle.append(n._title),n.elDescription=n.domElement.find(".annotation-description"),n.elDescriptionClose=n.elDescription.find(".annotation-description-close"),n.clickTitle=function(){n.hasView()&&n.moveHere(n.scene.getActiveCamera()),n.dispatchEvent({type:"click",target:G(n)})},n.elTitle.click(n.clickTitle),n.actions=n.actions.map(function(e){return e instanceof Um?e:new Um(e)}),q(n.actions));try{for(i.s();!(e=i.n()).done;)e.value.pairWith(G(n))}catch(e){i.e(e)}finally{i.f()}var r,a=q(n.actions.filter(function(e){return void 0===e.showIn||e.showIn.includes("scene")}));try{for(a.s();!(r=a.n()).done;)!function(){var e=r.value,t=$(''));n.elTitlebar.append(t),t.click(function(){return e.onclick({annotation:G(n)})})}()}catch(e){a.e(e)}finally{a.f()}return n.elDescriptionClose.hover(function(e){return n.elDescriptionClose.css("opacity","1")},function(e){return n.elDescriptionClose.css("opacity","0.5")}),n.elDescriptionClose.click(function(e){return n.setHighlighted(!1)}),n.domElement.mouseenter(function(e){return n.setHighlighted(!0)}),n.domElement.mouseleave(function(e){return n.setHighlighted(!1)}),n.domElement.on("touchstart",function(e){n.setHighlighted(!n.isHighlighted)}),n.display=!1,n}return A(s,[{key:"installHandles",value:function(o){var i,r,a,s,l,u,c,h,e,d=this;void 0===this.handles&&(i=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t'),r=i.find("svg")[0],a=i.find("line")[0],s=i.find("circle")[0],l=i.find("circle")[1],u=function(e,t){s.setAttribute("cx","".concat(e.x)),s.setAttribute("cy","".concat(e.y)),l.setAttribute("cx","".concat(t.x)),l.setAttribute("cy","".concat(t.y)),a.setAttribute("x1",e.x),a.setAttribute("y1",e.y),a.setAttribute("x2",t.x),a.setAttribute("y2",t.y);var n=r.getBBox(),n=(r.setAttribute("width","".concat(n.width)),r.setAttribute("height","".concat(n.height)),r.setAttribute("viewBox","".concat(n.x," ").concat(n.y," ").concat(n.width," ").concat(n.height)),e.y-t.y),t=e.x-t.x;0=Potree.maxNodesLoading||(this.loading=!0,++Potree.numNodesLoading,-1==this.numPoints&&this.loadHierarchy(),this.loadPoints())}},{key:"loadPoints",value:function(){this.ept.loader.load(this)}},{key:"loadHierarchy",value:(e=d(V().mark(function e(){var l,t,u,c=this;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return((l={})[this.filename()]=this).hasChildren=!1,t="".concat(this.ept.url,"ept-hierarchy/").concat(this.filename(),".json"),e.next=6,fetch(t);case 6:return t=e.sent,e.next=9,t.json();case 9:u=e.sent,Object.keys(u).sort(function(e,t){var e=N(e.split("-").map(function(e){return parseInt(e,10)}),4),n=e[0],i=e[1],r=e[2],e=e[3],t=N(t.split("-").map(function(e){return parseInt(e,10)}),4),a=t[0],o=t[1],s=t[2],t=t[3];return n>1)+"-"+(r>>1)+"-"+(t>>1)];i&&(i.hasChildren=!0,r=i.key.step(a,o,s),(t=new Potree.PointCloudEptGeometryNode(c.ept,r.b,r.d,r.x,r.y,r.z)).level=n,t.numPoints=u[e],i.addChild(t),l[r.name()]=t)});case 12:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"doneLoading",value:function(e,t,n,i){e.boundingBox=this.boundingBox,this.geometry=e,this.tightBoundingBox=t,this.numPoints=n,this.mean=i,this.loaded=!0,this.loading=!1,--Potree.numNodesLoading}},{key:"toPotreeName",value:function(e,t,n,i){for(var r="r",a=0;athis.maxDepth)return e.abrupt("continue",10);e.next=9}else e.next=13;break;case 9:a.loaded?(n.push(a),W.lru.touch(a),this.highestLevelServed=Math.max(a.getLevel(),this.highestLevelServed),s=a.pcoGeometry,s=s?s.hierarchyStepSize:1,(0===a.getLevel()||a.level%s==0&&a.hasChildren)&&this.traverse(a)):(a.load(),this.priorityQueue.push(r));case 10:i++,e.next=4;break;case 13:if(!(0=Potree.maxNodesLoading||this.octreeGeometry.loader.load(this)}},{key:"getNumPoints",value:function(){return this.numPoints}},{key:"dispose",value:function(){if(this.geometry&&null!=this.parent){this.geometry.dispose(),this.geometry=null,this.loaded=!1;for(var e=0;e\n\n\t\t\t\n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\n\t\t\t\n\t\t')),$(e.parentElement).append(r),n=new Uf(this.viewer.scene.getActiveCamera().clone()),this.dispatchEvent({type:"start_inserting_clipping_volume"}),this.viewer.scene.addPolygonClipVolume(n),this.sceneMarker.add(n),i=function(i){i.button===le.LEFT?(n.addMarker(),r.find("polyline").each(function(e,t){var n=r[0].createSVGPoint();n.x=i.offsetX,n.y=i.offsetY,t.points.appendItem(n)}),n.markers.length>o.maxPolygonVertices&&a.callback(),o.viewer.inputHandler.startDragging(n.markers[n.markers.length-1])):i.button===le.RIGHT&&a.callback(i)},(a={callback:null}).callback=function(e){r.remove(),3\n\t\t\t\t\n\t\t\t\t\n\t\t\t')),this.elClose=this.element.find("img[name=close]"),this.elContainer=this.element.find("span[name=content_container]"),"string"==typeof e?this.elContainer.append($("".concat(e,""))):this.elContainer.append(e)}return A(n,[{key:"setMessage",value:function(e){this.elContainer.empty(),"string"==typeof e?this.elContainer.append($("".concat(e,""))):this.elContainer.append(e)}}]),n}()),Nu=function(){function t(e){te(this,t),this.potreeRenderer=e,this.threeRenderer=this.potreeRenderer.threeRenderer,this.target=new Zn(2048,2048,{minFilter:U,magFilter:U,format:St,type:bt}),this.target.depthTexture=new Ol,this.target.depthTexture.type=wt,this.threeRenderer.setClearColor(16711680,1);e=this.threeRenderer.getRenderTarget();this.threeRenderer.setRenderTarget(this.target),this.threeRenderer.clear(!0,!0,!0),this.threeRenderer.setRenderTarget(e)}return A(t,[{key:"setLight",value:function(e){var t=180*(this.light=e).angle/Math.PI,n=e.shadow.mapSize.width/e.shadow.mapSize.height,i=0===e.distance?1e4:e.distance,t=(this.camera=new ma(t,n,.1,i),this.camera.up.set(0,0,1),this.camera.position.copy(e.position),(new Re).subVectors(e.position,e.getWorldDirection(new Re)));this.camera.lookAt(t),this.camera.updateProjectionMatrix(),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.matrixWorldInverse.copy(this.camera.matrixWorld).invert()}},{key:"setSize",value:function(e,t){this.target.width===e&&this.target.height===t||this.target.dispose(),this.target.setSize(e,t)}},{key:"render",value:function(e,t){this.threeRenderer.setClearColor(0,1);var n=this.threeRenderer.getRenderTarget();this.threeRenderer.setRenderTarget(this.target),this.threeRenderer.clear(!0,!0,!0),this.potreeRenderer.render(e,this.camera,this.target,{}),this.threeRenderer.setRenderTarget(n)}}]),t}(),Lv=function(){y(r,zn);var i=C(r);function r(){function e(e){t.update(e)}var t,n=0'),n.className&&t.elem.addClass(n.className),t.elem.find("a").html(t.text),$("#potree_labels").append(t.elem),t.pos2d=new Re,t.dom=n.dom||viewer.renderArea,t.camera=n.camera||viewer.scene.getActiveCamera();return viewer.addEventListener("camera_changed",e),t.addEventListener("dispose",function(){viewer.removeEventListener("camera_changed",e),t.dispose()}),t}return A(r,[{key:"update",value:function(){var e;this.position&&!this.elem.hasClass("unvisible")&&((e=ie.getPos2d(this.position,this.camera,this.dom,viewer.mainViewport)).trueSide?(this.elem.css({left:e.pos.x+"px",top:e.pos.y+"px"}),this.elem.removeClass("hide"),this.pos2d=e.vector):this.elem.addClass("hide"))}},{key:"setVisible",value:function(e){e?(this.elem.removeClass("unvisible"),this.update()):this.elem.addClass("unvisible")}},{key:"setText",value:function(e){this.text=e||"",this.elem.find("a").html(this.text)}},{key:"setPos",value:function(e){this.position=e}},{key:"dispose",value:function(){this.elem.remove(),this.removeAllListeners()}}]),r}(),Rv=new Me(1,1,1),Fv={createLine:function(e){var t=1Math.abs(u.z)?a.setZ(l[0].z):(a.setX(l[0].x),a.setY(l[0].y)));else{this.cannotConfirmNormal=!0;for(var u,c=this.isRect?1:r-2,h=0;hPotree.config.clickMaxDragDis)return this.continueDrag(null,e);if(e.isTouch){if(e.hoverViewport!=viewer.mainViewport&&this.unableDragAtMap)return viewer.dispatchEvent({type:"reticule_forbit",v:!0}),this.continueDrag(null,e);viewer.dispatchEvent({type:"reticule_forbit",v:!1}),this.dragMarker(e)}var t;return e.button!=le.RIGHT&&(this.isIntersectSelf&&this.isNew||this.isAtWrongPlace&&this.isNew||!e.isAtDomElement&&this.isNew||e.hoverViewport!=viewer.mainViewport&&this.unableDragAtMap||this.isNew&&!Uv(this.points,this.points.length))?this.continueDrag(null,e):(-1!==(t=this.markers.indexOf(e.drag.object))&&(this.dispatchEvent({type:"marker_dropped",index:t}),2i.count&&(i={id:n,count:r[n]});this.datasetId=0"),r.setText(i),r.setPos(e),r.setVisible(!0);else{for(var t,n,i,r,o=function(e,t,n,i){var r=(new Re).addVectors(t,n).multiplyScalar(.5),r=(e.setPos(r),i=null==i?t.distanceTo(n):i,viewer.unitConvert.convert(i,"distance",Potree.settings.precision,a.unitSystem,.1,!0));return e.setText(r),i},s=this.points.length-1,l=0;l<=s;l++){var u,c,h=this.points[l],d=this.points[sthis.points[1].z?(t=this.points[0],this.points[1]):(t=this.points[1],this.points[0]),i=new Re(t.x,t.y,n.z),e=t.distanceTo(i)/n.distanceTo(i),r=Math.atan(e),this.shouldShowHorVerGuide=Zv=this.points.length?0:(t=0===e?this.points[this.points.length-1]:this.points[e-1],n=this.points[e],e=this.points[(e+1)%this.points.length],this.getAngleBetweenLines(n,t,e))}},{key:"getCenter",value:function(){var e;return this.closed?this.center.clone():((e=this.points.reduce(function(e,t){return e.add(t)},new Re)).multiplyScalar(1/this.points.length),e)}},{key:"createGuideLine",value:function(){var e=Fv.createFatLine([],{material:this.getLineMat("guide")});e.visible=!1,this.guideLine=e,this.add(e)}},{key:"createHorVerGuideLine",value:function(){var e=Fv.createFatLine([],{material:this.getLineMat("guide")}),e=(e.visible=!1,(this.verGuideEdge=e).name="verGuideEdge",Fv.createFatLine([],{material:this.getLineMat("guide")}));e.visible=!1,e.name="horGuideEdge",this.horGuideEdge=e,this.add(this.verGuideEdge),this.add(this.horGuideEdge),this.verEdgeLabel=this.createEdgeLabel("verGuideEdge"),this.horEdgeLabel=this.createEdgeLabel("horGuideEdge")}},{key:"createEdgeLabel",value:function(e,t){var n=this,e=new qm($.extend(t?Yv:Kv,{sizeInfo:Xv,name:e||"edgeLabel"}));return t&&(e.addEventListener("mouseover",function(){n.setSelected(!0,"edgeLabel")}),e.addEventListener("mouseleave",function(){n.setSelected(!1,"edgeLabel")}),e.addEventListener("click",function(){n.isNew||viewer.focusOnObject(n,"measure")})),e.visible=!1,e.sprite.material.depthTestWhenPick=!0,viewer.setObjectLayers(e,"measure"),this.add(e),e}},{key:"createAreaLabel",value:function(){var e=this,t=new qm($.extend(Yv,{sizeInfo:Xv,name:"areaLabel_"}));return t.addEventListener("mouseover",function(){e.setSelected(!0,"areaLabel")}),t.addEventListener("mouseleave",function(){e.setSelected(!1,"areaLabel")}),t.addEventListener("click",function(){e.isNew||viewer.focusOnObject(e,"measure")}),viewer.setObjectLayers(t,"measure"),t.visible=!1,t}},{key:"getMarkerMaterial",value:function(e){return zv||(zv={default:new jm($.extend({},Wv,{transparent:!0,opacity:1,map:Qv.load(Potree.resourcePath+"/textures/pic_point_s32.png"),useDepth:!0})),select:new L({transparent:!0,opacity:1,depthTest:!1,map:Qv.load(Potree.resourcePath+"/textures/pic_point32.png")})},p.markerMats=zv),zv[e]}},{key:"getLineMat",value:function(e){return(p.lineMats=p.lineMats?p.lineMats:{edgeDefault:Fv.createFatLineMat({color:Gm.measure.default.color,lineWidth:Gm.measure.lineWidth,useDepth:!0,dashWithDepth:!0,dashed:!0,dashSize:.04,gapSize:.04,transparent:!0,opacity:Gm.measure.default.opacity,depthTestWhenPick:!0}),edgeSelect:Fv.createFatLineMat({color:Gm.measure.highlight.color,dashSize:.5,gapSize:.2,lineWidth:Gm.measure.lineWidth,transparent:!0,opacity:Gm.measure.highlight.opacity}),guide:Fv.createFatLineMat({color:Gm.measure.guide.color,dashSize:.1,gapSize:.02,dashed:!0,lineWidth:Gm.measure.lineWidth})})[e]}},{key:"createAreaPlane",value:function(){return Hv||(Hv={default:new jm($.extend({},Jv,{color:jv,side:ve,opacity:.2,transparent:!0,useDepth:!0})),selected:new L({color:jv,side:ve,opacity:.3,transparent:!0})},p.planeMats=Hv),k(_(p.prototype),"createAreaPlane",this).call(this,Hv.default)}},{key:"raycast",value:function(e,t){for(var n=0;n=s.maxMarkers?u({finish:!0}):(t=s.addMarker({point:s.points[n-1].clone()}),a.isRect&&3==s.markers.length?s.addMarker({point:s.points[0].clone()}):(s.markers[n].visible=!1,s.edges[n].visible=!1),s.edges[n-1].visible=!0,s.markers[n-1].visible=!0,s.editStateChange(!0),t.isDragging=!0,s.continueDrag(t,e)):e.button===le.RIGHT&&(e.pressDistancea.minMarkers&&(s.removeMarker(s.points.length-1),s.markers[0].removeEventListener("mouseover",h),s.markers[0].removeEventListener("mouseleave",d),s.markers[0].removeEventListener("click",c),n.byClickMarker)&&s.markers.length>a.minMarkers&&s.removeMarker(s.points.length-1),s.isNew=!1,(t=s.points.length)&&(s.markers[t-1].visible=!0,s.edges[t-1].visible=!!s.closed,s.markers.forEach(function(e){e.dispatchEvent("addHoverEvent")}),s.edges.forEach(function(e){e.dispatchEvent("addHoverEvent")}),s.update()),clearTimeout(i),r.viewer.removeEventListener("cancel_insertions",c),r.viewer.removeEventListener("global_click",p),r.viewer.removeEventListener("global_mousemove",f),viewer.dispatchEvent({type:"CursorChange",action:"remove",name:"polygon_AtWrongPlace"}),viewer.inputHandler.dispatchEvent({type:"isMeasuring",v:!1,cause:"stopInsertion"}),n.remove||o&&o()))},c=(s.addEventListener("finish",u),function(e){e.measure&&e.measure!=s||(e.remove&&viewer.scene.removeMeasurement(s),s.editStateChange(!1),s.cannotConfirmNormal=!1,s.guideLine&&(s.guideLine.visible=!1),u({finish:!0,remove:e.remove,byClickMarker:"click"==e.type}),r.viewer.inputHandler.drag&&(r.viewer.inputHandler.drag.object=null))}),h=(this.viewer.addEventListener("cancel_insertions",c),function(e){s.setMarkerSelected(e.object,"hover","single")}),d=function(e){s.setMarkerSelected(e.object,"unhover","single")},p=function e(t){var n;if(!f(t)&&(!t.clickElement&&t.button!==le.RIGHT))return(n=t.intersect&&(t.intersect.orthoIntersect||t.intersect.location))?("mapViewport"==t.drag.dragViewport.name&&(n=n.clone().setZ(viewer.mainViewport.camera.position.z)),(n=s.addMarker({point:n})).isDragging=!0,r.viewer.inputHandler.startDragging(n,{endDragFun:l,notPressMouse:!0}),t.drag=r.viewer.inputHandler.drag,t.drag.endDragFun=l,t.drag.notPressMouse=!0,s.dragMarker(t),s.dropMarker(t),1')),b=($(e.parentElement).append(w),w.css("right","10px"),w.css("bottom","10px"),function(e){y.visible=!0;var t=e.drag.start,n=e.drag.end,i=new bd,t=(i.expandByPoint(t),i.expandByPoint(n),w.css("left","".concat(i.min.x,"px")),w.css("top","".concat(i.min.y,"px")),w.css("width","".concat(i.max.x-i.min.x,"px")),w.css("height","".concat(i.max.y-i.min.y,"px")),e.viewer.scene.getActiveCamera()),n=e.viewer.renderer.getSize(new Le),i=new Le(t.right-t.left,t.top-t.bottom),r=(new Le).addVectors(e.drag.end,e.drag.start).multiplyScalar(.5),r=ie.mouseToRay(r,t,n.width,n.height),a=(new Le).subVectors(e.drag.end,e.drag.start);a.divide(n).multiply(i),y.position.copy(r.origin),y.up.copy(t.up),y.rotation.copy(t.rotation),y.scale.set(a.x,a.y,1e5),e.consume()});return this.addEventListener("drag",b),this.addEventListener("drop",g),viewer.inputHandler.addInputListener(this),y}},{key:"update",value:function(e){}},{key:"render",value:function(){this.viewer.renderer.render(this.scene,this.viewer.scene.getActiveCamera())}}]),i}(),Yu=function(){y(r,K);var i=C(r);function r(e,t){te(this,r),(n=i.call(this)).light=e,n.color=t,n.updateMatrix(),n.updateMatrixWorld();var n,e=new Hu(1,32,32),t=new sc,e=(n.sphere=new Z(e,t),n.sphere.scale.set(.5,.5,.5),n.add(n.sphere),new Float32Array([0,0,0,0,0,-1,0,0,0,-1,-1,-1,0,0,0,1,-1,-1,0,0,0,1,1,-1,0,0,0,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,-1,1,-1,-1,1,-1,-1,-1,-1])),t=new j,e=(t.setAttribute("position",new Q(e,3)),new vl);return n.frustum=new Bl(t,e),n.add(n.frustum),n.update(),n}return A(r,[{key:"update",value:function(){this.light.updateMatrix(),this.light.updateMatrixWorld();var e=this.light.position,t=(new Re).addVectors(this.light.position,this.light.getWorldDirection(new Re).multiplyScalar(-1)),t=(new X).setFromRotationMatrix((new _e).lookAt(e,t,new Re(0,0,1))),t=(this.setRotationFromQuaternion(t),this.position.copy(e),0'),$(viewer.renderArea).append(this.dom)),this.dom.css({display:"none",position:"absolute",right:"1%",top:"60px",width:"100px",height:"100px","z-index":100,"pointer-events":"none"}),$("
"));this.dom.append(e),this.dom.find(".dirText").css({textAlign:"center","font-size":"10px",position:"absolute",width:"100%",height:"25px","line-height":"25px"}),this.dom.find(".north").css({color:"#02a0e9",top:"0"}),this.dom.find(".south").css({color:"#ff1414",bottom:"0"}),this.dom.find(".center").css({width:"50px",height:"50px","background-size":"contain","background-position":"center",left:"50%",top:"50%",transform:"translate(-50%,-50%)",position:"absolute"}),this.dom.find(".dirText").css({"text-align":"center","font-size":"10px",color:"rgb(255, 255, 255)",position:"absolute",top:"50%",left:"50%",width:"45%",height:"0px","transform-origin":"left center"}),this.dom.find(".dirText span").css({display:"block",position:"absolute",right:"5px",top:"0",width:"20px",height:"20px","line-height":"20px","margin-top":"-10px"});try{this.renderer=new Ts({antialias:!0,alpha:!0}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio||1),this.renderer.domElement.setAttribute("name","compass"),this.renderer.setClearAlpha(0),this.renderer.setDrawingBufferSize(50,50,window.devicePixelRatio||1)}catch(e){viewer.dispatchEvent("webglError",{msg:e})}this.dom.find(".center")[0].appendChild(this.renderer.domElement),this.renderer.domElement.style.width=this.renderer.domElement.style.height="100%",this.camera=new ma,this.camera.fov=50,this.camera.updateProjectionMatrix(),this.scene=new Ps,this.scene.add(this.camera),this.createCompass(),viewer.addEventListener("camera_changed",function(e){e.viewport==t.viewport&&(e.changeInfo.positionChanged||e.changeInfo.quaternionChanged)&&t.update()}),this.setDomPos(),this.viewport&&this.setDisplay(!0)}},{key:"createCompass",value:function(){function e(e,t,n){for(var i=[],r=0,a=e.attributes.position.count;r=e.duration&&!e.cycling?(t=e.easing(1,0,1,1),e.func(t,1e3*n),e.done&&e.done(),e.running=!1):(t=e.easing(e.current%e.duration/e.duration,0,1,1),e.func(t,1e3*n)&&(e.done&&e.done(),e.running=!1)))});var e=this.funcs.length,t=(this.funcs=this.funcs.filter(function(e){return e.running}),this.funcs.length);0t?(t=l.y,(n.resolution.y-c.y)/t):(t=l.x,(n.resolution.x-c.x)/t)),a.zoom=u*e+o*(1-e),a.updateProjectionMatrix())},Easing:i})}},{key:"zoomOrthoCamera",value:function(n,i,e,t,r){var a=this,o=n.zoom,s=new Re(e.x,e.y,.5);Tg.start(function(e){var t=s.clone().unproject(n),e=(n.zoom=i*e+o*(1-e),n.updateProjectionMatrix(),s.clone().unproject(n)),e=(new Re).subVectors(e,t);n.position.sub(e),a.position.copy(n.position),r&&r()},t,null,0,Cg.easeInOutSine,null,"zoomInView")}}]),i}(),Pg=(Object.assign(Dg.prototype,zn.prototype),function(){y(n,Yf);var t=C(n);function n(){var e;return te(this,n),(e=t.call(this)).annotations=new zm,e.scene=new Ps,e.sceneBG=new Ps,e.scenePointCloud=new Ps,e.cameraP=new ma(e.fov,1,.1,1e6),e.cameraO=new mh(-1,1,1,-1,.1,1e6),e.cameraVR=new ma,e.cameraBG=new fa,e.cameraScreenSpace=new mh(-1,1,1,-1,.1,10),e.cameraMode=am.PERSPECTIVE,e.overrideCamera=null,e.pointclouds=[],e.measurements=[],e.profiles=[],e.volumes=[],e.polygonClipVolumes=[],e.cameraAnimations=[],e.orientedImages=[],e.images360=[],e.geopackages=[],e.fpControls=null,e.orbitControls=null,e.earthControls=null,e.geoControls=null,e.deviceControls=null,e.inputHandler=null,e.view=new Dg,e.directionalLight=null,e.initialize(),e}return A(n,[{key:"estimateHeightAt",value:function(e){var t,n=null,i=1/0,r=q(this.pointclouds);try{for(r.s();!(t=r.n()).done;){var a=t.value;if(void 0!==a.root.geometryNode){for(var o=null,s=1/0,l=e.clone().sub(a.position),u=(l.z=0,new Bi(l,new Re(0,0,1))),c=[a.root];0x.vbos.get(E).version&&N.updateBuffer(b);else x=N.createBuffer(b),N.buffers.set(b,x);if(G.bindVertexArray(x.vao),void 0===$g[U.activeAttributeName]&&Object.keys(b.attributes).includes(U.activeAttributeName)){var C,B=$g.aExtra.location;for(C in b.attributes){b.attributes[C];var _=x.vbos.get(C);G.bindBuffer(G.ARRAY_BUFFER,_.handle),G.disableVertexAttribArray(B)}var M=U.activeAttributeName,v=b.attributes[M],T=x.vbos.get(M),e=(void 0!==v&&void 0!==T&&(i=N.glTypeMapping.get(v.array.constructor),n=v.normalized,G.bindBuffer(G.ARRAY_BUFFER,T.handle),G.vertexAttribPointer(B,v.itemSize,i,n,0,0),G.enableVertexAttribArray(B)),L.pcoGeometry.pointAttributes.attributes.find(function(e){return e.name===M})),T=(T=U.getRange(M))||e.range,v=e.initialRange,i=v[1]-v[0],n=T=T||[0,1],e=i/(n[1]-n[0]),T=-(n[0]-v[0])/i,e=Number.isNaN(e)?1:e,T=Number.isNaN(T)?0:T;F.setUniform1f("uExtraScale",e),F.setUniform1f("uExtraOffset",T)}else for(var S in b.attributes){var I,D,P=b.attributes[S],k=x.vbos.get(S);void 0!==$g[S]&&(S=$g[S].location,I=N.glTypeMapping.get(P.array.constructor),D=P.normalized,G.bindBuffer(G.ARRAY_BUFFER,k.handle),G.vertexAttribPointer(S,P.itemSize,I,D,0,0),G.enableVertexAttribArray(S))}n=x.numElements;G.drawArrays(G.POINTS,0,n),j++})()}catch(e){r.e(e)}finally{r.f()}G.bindVertexArray(null),W.measureTimings&&(performance.mark("renderNodes-end"),performance.measure("render.renderNodes","renderNodes-start","renderNodes-end"))}},{key:"renderOctree",value:function(e,t,n,i){var r=4e.pointer.x&&(l*=-1),h.yawDelta+=l),h.pointerDragStart.copy(e.pointer),n.matrixWorld=u)}if(i.includes("pan")){if(!h.canMovePos(t))return;if("OrthographicCamera"==n.type){var a,r=ie.getOrthoCameraMoveVec(e.drag.pointerDelta,n),o=window.viewer.modules.Alignment,s=window.viewer.modules.MergeEditor,l=o.handleState,u=e.buttons===AA.LEFT&&t.alignment&&l&&t.alignment[l];if("pano"==Potree.settings.editType){var o=window.viewer.modules.PanoEditor;if(u&&o.selectedPano&&(o.selectedGroup&&o.checkIfAllLinked({group:o.selectedGroup})?(o.dispatchEvent("needToDisConnect"),console.warn("选中的漫游点连通了整个数据集,不允许移动")):("translate"==l&&(e.drag.intersectStart.pointclouds&&ag.getMixedSet(o.selectedClouds,e.drag.intersectStart.pointclouds).length||o.selectedPano.hovered)||"rotate"==l)&&(a=o.selectedClouds)),!a&&e.buttons===AA.LEFT&&t.rotateSide)return o.rotateSideCamera(-e.drag.pointerDelta.x)}else if("merge"==Potree.settings.editType){if(e.buttons===AA.LEFT&&t.rotateSide)return s.rotateSideCamera(-e.drag.pointerDelta.x)}else a=u&&e.drag.intersectStart.pointcloud&&[e.drag.intersectStart.pointcloud];a?("translate"==l&&t.alignment.translateVec&&r.projectOnVector(t.alignment.translateVec),h.dispatchEvent({type:"transformPointcloud",intersect:e.intersect.orthoIntersect,intersectStart:e.drag.intersectStart.orthoIntersect,moveVec:r,pointclouds:a,camera:n})):h.translationWorldDelta.add(r.negate())}else e.drag.intersectStart?(null==e.drag.z&&(o=e.drag.intersectStart.location.clone().project(n),e.drag.z=o.z,e.drag.projectionMatrixInverse=n.projectionMatrixInverse.clone(),s=new Re(h.pointerDragStart.x,h.pointerDragStart.y,e.drag.z),e.drag.translateStartPos=s.clone().unproject(n)),u=n.projectionMatrixInverse,n.projectionMatrixInverse=e.drag.projectionMatrixInverse,l=new Re(e.pointer.x,e.pointer.y,e.drag.z).clone().unproject(n).clone().sub(e.drag.translateStartPos),n.projectionMatrixInverse=u,h.translationWorldDelta.copy(l.negate())):((a=h.target||t.lastIntersect&&(t.lastIntersect.location||t.lastIntersect))&&a instanceof Re||(a=c.bound.center),r=n.position.distanceTo(a),o=lf.getHFOVForCamera(n,!0),s=r*Math.tan(o/2),h.translationDelta.x-=e.drag.pointerDelta.x*s,h.translationDelta.z-=e.drag.pointerDelta.y*s);h.useAttenuation=!1}i.includes("scale")&&(h.dollyEnd.subVectors(e.touches[0].pointer,e.touches[1].pointer),u=h.dollyEnd.length()/h.dollyStart.length(),l=(new Le).addVectors(e.touches[0].pointer,e.touches[1].pointer).multiplyScalar(.5),d({pointer:l,scale:u,camera:n}),h.dollyStart.copy(h.dollyEnd))}}},d=function(){var e=04dkk\n {\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n }\n \n \n void main() {\n \n vUv = uv;\n vec4 worldPosition = modelMatrix * vec4(position, 1.0);\n \n \n \n vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;\n vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz;\n vWorldPosition0.x *= -1.0;\n vWorldPosition0 = transformAxis(vWorldPosition0);\n \n vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;\n vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz;\n vWorldPosition1.x *= -1.0;\n vWorldPosition1 = transformAxis(vWorldPosition1);\n \n /* \n vec3 positionLocalToPanoCenter12 = worldPosition.xyz - pano1Position;\n vWorldPosition12 = (vec4(positionLocalToPanoCenter12, 1.0) * pano1Matrix2).xyz;\n vWorldPosition12.x *= -1.0;\n vWorldPosition12 = transformAxis(vWorldPosition12);\n */\n \n \n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n\n ",fragmentShader:"precision highp float;\nprecision highp int;\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n\n \n #define PI 3.141592653 \n \n \n uniform float modelAlpha;\n uniform float opacity;\n uniform float progress;\n uniform int blackout;\n uniform vec3 pano0Position;\n uniform vec3 pano1Position;\n uniform float maxDistance;\n uniform float minDistance;\n uniform float minOpa;\n \n uniform float cameraHeight0;\n uniform float cameraHeight1;\n\n \n \n /* uniform sampler2D pano0Map;\n uniform sampler2D pano1Map; */ \n uniform samplerCube pano0Map;\n uniform samplerCube pano1Map;\n \n \n varying vec2 vUv; \n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n //varying vec3 vWorldPosition12;\n \n /* vec2 getSamplerCoord( vec3 direction ) \n {\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n } */\n\n vec2 getSamplerCoord2( vec3 direction ) \n { \n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5;\n float ty=acos(direction.y)/PI;\n\n return vec2(tx,ty); \n }\n \n #extension GL_EXT_frag_depth : enable\n #if defined(GL_EXT_frag_depth) && defined(hasDepthTex) \n uniform sampler2D depthMap0;\n uniform sampler2D depthMap1;\n uniform mat4 inverseProjectionMatrix;\n uniform mat4 projectionMatrix;\n uniform vec4 viewport; \n \n vec2 getDepth(vec3 dir, sampler2D depthMap, float height, vec4 eyePos){\n vec2 depthValue = vec2(0.0, 0.0);\n vec2 uv2 = getSamplerCoord2(/* vWorldPosition12 */dir.xyz); //暂时只用基于目标漫游点的方向\n uv2.x -= 0.25; //全景图和Cube的水平采样起始坐标相差90度,这里矫正 0.25 个采样偏移\n vec4 depth = texture2D(depthMap, uv2);\n //float distance = depth.r + 256. * (depth.g + 256. * depth.b);\n //distance *= 255. * .001; // distance is now in meters\n \n //更改\n float distance = (depth.g + depth.r / 256.) * 255.; //为什么要乘以255 \n \n if(distance == 0.0){//漫游点底部识别不到的区域,给一个地板高度 \n if(uv2.y > 0.75) distance = height / dir.y; \n else distance = 100000.0;//给个超级远的值\n } \n \n if(distance == 0.0)distance = 100000.0;//给个超级远的值\n \n depthValue.x = distance;\n \n // return r[1] + r[0] / 256 \n distance += .1; // add a safety margin\n\n vec4 eyePos2 = vec4(normalize(eyePos.xyz) * distance, 1.);\n vec4 clipPos2 = projectionMatrix * eyePos2;\n vec4 ndcPos2 = clipPos2 * 1. / clipPos2.w;\n\n \n depthValue.y = 0.5 * ((gl_DepthRange.far - gl_DepthRange.near) * ndcPos2.z\n + gl_DepthRange.near + gl_DepthRange.far); \n return depthValue; \n }\n //注:未加载好的话,depth为0,导致第一次漫游过去的时候许多mesh会立刻被遮挡,所以要确保加载完\n #endif\n \n void main()\n {\n vec3 vWorldPosition0N = normalize(vWorldPosition0);\n vec3 vWorldPosition1N = normalize(vWorldPosition1);\n /* vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);\n vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); \n vec4 colorFromPano0=texture2D(pano0Map,samplerCoord0);\n vec4 colorFromPano1=texture2D(pano1Map,samplerCoord1); */\n \n vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);\n if(progress < 1.0){//通常是1\n colorFromPano0=textureCube(pano0Map,vWorldPosition0N.xyz);\n }\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1N.xyz);\n \n gl_FragColor=mix(colorFromPano0,colorFromPano1,progress);\n \n \n \n \n //深度图修改深度\n \n #if defined(GL_EXT_frag_depth) && defined(hasDepthTex) \n vec4 ndcPos;\n ndcPos.xy = ((2.0 * gl_FragCoord.xy) - (2.0 * viewport.xy)) / (viewport.zw) - 1.;\n ndcPos.z = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) /\n (gl_DepthRange.far - gl_DepthRange.near);\n ndcPos.w = 1.0;\n\n vec4 clipPos = ndcPos / gl_FragCoord.w;\n vec4 eyePos = inverseProjectionMatrix * clipPos;\n vec2 depth0 = vec2(0.0,0.0); \n if(progress < 1.0){\n depth0 = getDepth(vWorldPosition0N, depthMap0, cameraHeight0, eyePos);\n }\n vec2 depth1 = getDepth(vWorldPosition1N, depthMap1, cameraHeight1, eyePos);\n \n /* if(progress < 1.0 && depth1.x == 0.0 && depth0.x > 0.0){\n gl_FragDepthEXT = depth0.y; \n }else{ */\n gl_FragDepthEXT = mix(depth0.y,depth1.y,progress);\n //}\n \n \n\n #endif\n\n \n }\n "},BA=function(){y(r,nc);var i=C(r);function r(){te(this,r);function t(e){e=e.viewport.resolution2,n.uniforms.viewport.value.set(0,0,e.x,e.y)}var n=i.call(this,{fragmentShader:CA.fragmentShader,vertexShader:CA.vertexShader,uniforms:ca.clone(CA.uniforms),side:ve,name:"ModelTextureMaterial",defines:{}}),e=viewer.mainViewport;return t({viewport:e}),viewer.addEventListener("resize",function(e){"MainView"==e.viewport.name&&t(e)}),viewer.addEventListener("camera_changed",function(e){"MainView"==e.viewport.name&&e.camera&&n.uniforms.inverseProjectionMatrix.value.copy(e.camera.projectionMatrixInverse)}),n}return A(r,[{key:"setProjectedPanos",value:function(e,t,n){null!=n&&(this.uniforms.progress.value=n),e&&(this.uniforms.pano0Map.value=e.getSkyboxTexture(),this.uniforms.pano0Position.value.copy(e.position),this.uniforms.pano0Matrix.value.copy(e.panoMatrix),this.uniforms.cameraHeight0.value=e.floorPosition.distanceTo(e.position)),this.uniforms.pano1Map.value=t.getSkyboxTexture(),this.uniforms.pano1Position.value.copy(t.position),this.uniforms.pano1Matrix.value.copy(t.panoMatrix),this.uniforms.cameraHeight1.value=t.floorPosition.distanceTo(t.position),this.pano0=e,this.pano1=t,this.updateDepthTex(e),this.updateDepthTex(t),this.needsUpdate=!0}},{key:"updateDepthTex",value:function(e){Potree.settings.useDepthTex&&e&&e.depthTex&&(e==this.pano0||e==this.pano1)&&(this.uniforms.depthMap0.value=this.pano0&&this.pano0.depthTex,this.uniforms.depthMap1.value=this.pano1&&this.pano1.depthTex,this.updateDepthTexEnable())}},{key:"updateDepthTexEnable",value:function(){var e=this.pano0&&this.pano1&&this.pano0.pointcloud.hasDepthTex&&this.pano1.pointcloud.hasDepthTex;ag.addOrRemoveDefine(this,"hasDepthTex",e?"add":"remove")}}]),r}(),_A=Potree.defines.GLCubeFaces,E={TILE_SIZE:512,FACES_PER_PANO:6,LocationOnTile:{Center:0,UpperLeft:1,UpperRight:2,LowerRight:3,LowerLeft:4},getTileVector:function(e,t,n,i,r,a,o,s){var l=e/t,u=2*(t/e),c=u/2,h=2*(i/l)-1+c,d=2*((r=l-1-r)/l)-1+c;switch(a=a||E.LocationOnTile.Center){case E.LocationOnTile.UpperLeft:d+=c,h=h-c+o*u;break;case E.LocationOnTile.UpperRight:h+=c,d=d+c-o*u;break;case E.LocationOnTile.LowerRight:d-=c,h=h+c-o*u;break;case E.LocationOnTile.LowerLeft:h-=c,d=d-c+o*u;break;case E.LocationOnTile.Center:}switch(n){case _A.GL_TEXTURE_CUBE_MAP_POSITIVE_X:b.setVector(s,-1,d,-h);break;case _A.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:b.setVector(s,1,d,h);break;case _A.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:b.setVector(s,-h,1,-d);break;case _A.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:b.setVector(s,-h,-1,d);break;case _A.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:b.setVector(s,-h,d,1);break;case _A.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:b.setVector(s,h,d,-1)}b.normalize(s)},getFaceForTile:function(e,t){var n=E.TILE_SIZE,e=(ethis.images360.qualityManager.maxNavPanoSize?this.images360.panoRenderer.zoomRenderTarget:(this.tiledPanoRenderTarget.texture.mapping=300,this.tiledPanoRenderTarget)).texture:null}},{key:"isLoaded",value:function(e){return e&&"string"==typeof e&&console.error("Wrong panoSize given to Panorama.isLoaded(); a tiled pano uses PanoSizeClass"),!!this.minimumTiledPanoLoaded&&(!e||this.highestFullTileRenderOpCompleted>=e)}},{key:"getWaitDeferred",value:function(e){var t=this.resolutionPromise[this.id],n=(t||(this.resolutionPromise[this.id]=t={}),t[e]);return n||(n={deferred:$.Deferred(),active:!1},t[e]=n),n}},{key:"clearWaitDeferreds",value:function(){var e,t,n=this.resolutionPromise[this.id];for(e in n||(this.resolutionPromise[this.id]=n={}),n)n.hasOwnProperty(e)&&((t=n[e]).active=!1,t.deferred=$.Deferred())}},{key:"resetWaitDeferred",value:function(e){e=this.getWaitDeferred(e);e.active=!1,e.deferred=$.Deferred()}},{key:"onTileRendered",value:function(e){e.id===this.id&&this.dispatchEvent({type:TA.TileLoaded,size:e.panoSize,index:e.tileIndex,count:e.totalTiles})}},{key:"onPanoRendered",value:function(e){e.id===this.id&&(this.minimumTiledPanoLoaded=!0,this.updateSkyboxForZoomLevel(),e.panoSize>this.highestPartialTileRenderOpCompleted&&(this.highestPartialTileRenderOpCompleted=e.panoSize),e.updateFullComplete&&e.panoSize>this.highestFullTileRenderOpCompleted&&(this.highestFullTileRenderOpCompleted=e.panoSize),viewer.ifAllLoaded(this),this.dispatchEvent({type:TA.LoadComplete,size:e.panoSize,count:e.totalTiles}))}},{key:"onTileRenderFail",value:function(e){e.id===this.id&&this.dispatchEvent({type:TA.LoadFailed})}},{key:"onUploadAttemptedForAllTiles",value:function(e){var t;e.id===this.id&&(t=this.images360.qualityManager.getPanoSize(SA.BASE),e.panoSize===t)&&this.shouldRedrawOnBaseLoaded&&(this.shouldRedrawOnBaseLoaded=!1,this.panoRenderer.resetRenderStatus(this.id,!0,!1),this.panoRenderer.renderPanoTiles(this.id,null,!0,!0))}},{key:"createTextLabel",value:function(){this.removeTextLabel(),this.label=new qm(Object.assign({},DA,{text:this.id+"("+this.originID+")"})),this.images360.node.add(this.label),this.floorPosition&&this.label.position.copy(this.floorPosition)}},{key:"createTextLabel2",value:function(){this.label2=new qm(Object.assign({},PA,{text:parseInt(this.id)+1})),this.images360.node.add(this.label2),this.floorPosition&&this.label2.position.copy(this.floorPosition);this.label2.scale.set(.4,.4,.4),viewer.updateVisible(this.label2,"notDisplay",!1)}},{key:"removeTextLabel",value:function(){this.label&&this.label.parent.remove(this.label)}},{key:"dispose",value:function(){var e=viewer.images360.panos.indexOf(this);-1!=e&&(this.marker.parent.remove(this.marker),this.removeTextLabel(),this.depthTex&&this.depthTex.dispose(),viewer.images360.panos.splice(e,1),this.dispatchEvent("dispose"))}}]),a}(),Vd=(FA.prototype.loadTiledPano=(Yg={},Kg={},Zg={},function(t,n,i,r,a,o){var s,l=this,u=n.datasetsLocal.find(function(e){return e.datasetId==l.pointcloud.dataset_id}).direction,c=(null==r&&(r=!0),null==a&&(a=!0),this.getWaitDeferred(t)),h=c.deferred,d=null,p=null;return i&&("number"==typeof i?d=i:(d=i.hFov,p=i.vFov)),this.isLoaded(t)?h.resolve(t):(c.active||(c.active=!0,s=this.id+":"+t,Yg[s]=Yg[s]||[],Zg[s]=null,i&&(E.matchingTilesInDirection(this,t,u,d,p,c=[]),Zg[s]=c,Yg[s].forEach(function(t){var e=Zg[s].find(function(e){return t.faceTileIndex==e.faceTileIndex&&t.face==e.face});e&&(e.loaded=!0)}),Zg[s].some(function(e){return!e.loaded})||(h.resolve(t),this.resetWaitDeferred(t),Zg[s]=null)),Kg[this.id])||(Kg[this.id]=!0,this.addEventListener(TA.LoadComplete,function(e){var t=this.getWaitDeferred(e.size).deferred;t&&"pending"===t.state()&&this.highestPartialTileRenderOpCompleted>=e.size&&(t.resolve(e.size,e.count),this.resetWaitDeferred(e.size))}.bind(this)),this.addEventListener(TA.LoadFailed,function(t){var n=this.getWaitDeferred(e).deferred;n&&"pending"===n.state()&&this.highestPartialTileRenderOpCompleted>=t.t&&(n.reject(t.t),this.resetWaitDeferred(t.t))}.bind(this)),this.addEventListener(TA.TileLoaded,function(e){var t=e.index,n=e.count,e=e.size,i=this.id+":"+e,r=(Yg[i]=Yg[i]||[],E.getTileLocation(e,t,{})),a=r.faceTileIndex,o=r.face,r=(Yg[i].push({faceTileIndex:a,face:o}),this.getWaitDeferred(e).deferred);r&&"pending"===r.state()&&(r.notify(e,t,n),Zg[i])&&((t=Zg[i].find(function(e){return e.faceTileIndex==a&&e.face==o}))&&(t.loaded=!0),Zg[i].some(function(e){return!e.loaded})||(this.onPanoRendered(this.id,e,n,!0),r.resolve(e,n),this.resetWaitDeferred(e),Zg[i]=null))}.bind(this))),this.images360.tileDownloader.clearForceQueue(),this.images360.tileDownloader.forceQueueTilesForPano(this,t,u,d,p,o),this.tiledPanoRenderTarget=this.images360.panoRenderer.activateTiledPano(this,this.images360.qualityManager.getMaxNavPanoSize(),r),this.images360.panoRenderer.renderPanoTiles(this.id,n,a)),h.promise()}),Potree.defines),OA=(Vd.ModelManagerEvents,Vd.PanoSizeClass),NA=function(){function i(e,t,n){te(this,i),this.maxNavPanoSize=-1,this.maxZoomPanoSize=-1,this.devicePixelDensity=e,this.deviceScreenSize=t,this.clientBandwidth=n,this.panoSizeClassMap={},this.useHighResolutionPanos=!0,this.useUltraHighResolutionPanos=!1,this.modelHasUltraHighPanos=!1,(this.qualityManager=this).maxRenderTargetSize=sf.isMobile()?2048:4096,this.init()}return A(i,[{key:"init",value:function(e){this.buildPanoSizeClassMap(this.devicePixelDensity,this.deviceScreenSize,this.clientBandwidth),this.ultraHighSize=this.getPanoSize(OA.ULTRAHIGH),this.highSize=this.getPanoSize(OA.HIGH),this.standardSize=this.getPanoSize(OA.STANDARD),this.baseSize=this.getPanoSize(OA.BASE),Gm.tiling.maxZoomPanoQuality&&this.ultraHighSize<=Gm.tiling.maxZoomPanoQuality&&(Gm.tiling.allowUltraHighResolution=!0),this.highQualityThreshold=sf.valueFromHash("threshold2k",Gm.windowHeightHighQualityThreshold),this.updateMaximums()}},{key:"updateFromModel",value:function(e){this.updateUltraHighResolutionSettings(e)}},{key:"updateUltraHighResolutionSettings",value:function(e){Gm.tiling.allowUltraHighResolution&&this.modelHasUltraHighPanos?this.useUltraHighResolutionPanos=!0:this.useUltraHighResolutionPanos=!1,this.updateMaximums()}},{key:"enableUltraHighQualityMode",value:function(){this.modelHasUltraHighPanos=!0,this.updateUltraHighResolutionSettings(null)}},{key:"ultraHighQualityModeEnabled",value:function(){return this.modelHasUltraHighPanos}},{key:"onModelChanged",value:function(e){this.updateFromModel(e.model),this.updateMaximums()}},{key:"updateMaximums",value:function(){this.maxNavPanoSize=Gm.tiling.maxNavPanoQuality||this.detectMaxNavPanoSize(),this.maxZoomPanoSize=Gm.tiling.maxZoomPanoQuality||this.detectMaxZoomPanoSize(),this.maxZoomPanoSizet.panoSize?1:t.panoSize>e.panoSize?-1:-(a-n)}function QA(e){for(var t=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,r=new Uint8Array(i);i--;)r[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function VA(){}var jA,WA,JA,qA,XA,YA,KA,ZA=function(){function u(e,t,n,i,r){te(this,u),this.qualityManager=e,this.maxNavQuality=this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize(),this.baseSize=t,this.standardSize=n,this.highSize=i,this.ultraHighSize=r,this.priorityCriteria=new u.PriorityCriteria(null,new Re(0,0,0),new Re(0,0,-1),new Re(0,0,-1))}return A(u,[{key:"updateCriteria",value:function(e,t,n,i){this.priorityCriteria.pano=e,this.priorityCriteria.cameraPosition.copy(t),this.priorityCriteria.cameraDirs=n,this.priorityCriteria.upcomingPanos=i,this.maxNavQuality=this.qualityManager.getMaxNavPanoSize(),this.maxZoomQuality=this.qualityManager.getMaxZoomPanoSize()}},{key:"canDownloadSize",value:function(e){return this.maxNavQuality>=e||this.maxZoomQuality>=e&&this.zoomingActive}},{key:"populateScoredPanos",value:function(e,t,n,i,r){(n=n||[]).length=0;var a=[cy.filters.inPanoDirection(e.position,i,u.DIRECTION_SCORE_STRICTNESS),cy.filters.not(e)],e=[cy.scoreFunctions.distanceSquared(e),cy.scoreFunctions.direction(e.position,i)],o=ag.sortByScore(t,a,e);if(o)for(var s=0;st.levels)return null;var r=new c0(t,n);t.allNodes.push(r);for(var a=0;athis.qualityManager.getMaxNavPanoSize()&&(t=this.qualityManager.getMaxNavPanoSize()),r&&t===r.size||(r&&this.deactiveDescripor(r.renderTarget),(r=this.activeDescripor(t))||(t=this.initTiledPano(t,!sf.isMobile()),(r=this.initDescriptor(t.width)).renderTarget=t),r.pano=e,this.resetPanoDescriptor(e.id),this.resetPanoLODDescriptors(e.id),this.resetRenderStatus(e.id,!0,!0)),this.setActiveRenderTargetDescriptor(e.id,r),n?0:1);return this.updateActivePanos(e,t),r.renderTarget}},{key:"deactivateTiledPano",value:function(e){var t=this.getActiveRenderTargetDescriptor(e.id),t=(this.isRenderTargetDescriptorValid(t)&&(this.deactiveDescripor(t.renderTarget),this.setActiveRenderTargetDescriptor(e.id,null)),this.getUploadQueueForPano(e.id));this.clearUploadQueue(t),this.updateActivePanos(),viewer.cancelLoad(e)}},{key:"getActivePanoCount",value:function(){return this.activePanos.length}},{key:"resetRenderStatus",value:function(e,r,a,t){var n=null;t&&(n=f0.getLevelCountForSize(E.TILE_SIZE,t)+1);for(var i=function(e,t,n,i){a&&(t.tile.zoomUploaded=!1),r&&(t.tile.uploaded=!1)},o=0;o Tree array not yet initialized!"),e=e[t];return e||console.error("PanoRenderer.getTileTree() -> Tree not yet initialized!"),e}},{key:"initTiledPano",value:function(e,t){var n=this.viewer.renderer,e=new Aa(e,{stencilBuffer:!1}),i=new ga([]),t=(i.image=[null,null,null,null,null,null],i.flipY=!0,i.format=St,t?(i.generateMipmaps=!0,i.magFilter=U,i.minFilter=ft):(i.generateMipmaps=!1,i.magFilter=U,i.minFilter=U),e.texture=i,n.setRenderTarget(e),n.setRenderTarget(null),n.properties.get(i));return t.__image__webglTextureCube=t.__webglTexture,e}},{key:"getUploadQueueForPano",value:function(e){var t=this.uploadQueues[e];return t||(this.uploadQueues[e]=t=[]),t}},{key:"isTileUploaded",value:function(e){return this.isPanoZoomed(e.panoId)?e.zoomUploaded:e.uploaded}},{key:"setUploaded",value:function(e,t){this.isPanoZoomed(e.panoId)?e.zoomUploaded=t:e.uploaded=t}},{key:"queueTileUpload",value:function(e,t,n){var i,r=this.getActiveRenderTargetDescriptor(e.panoId);!this.isRenderTargetDescriptorValid(r)||!e.downloaded||this.isTileUploaded(e)||e.uploadQueued&&!n||e.panoSize>this.qualityManager.getMaxNavPanoSize()&&!this.zoomingActive||(i=this.getUploadQueueForPano(e.panoId),n?this.uploadTile(e,!1):(this.shoulPushToFrontOfQueue(e)?this.forceQueue.push(e):t&&this.direction?ZA.insertSortedPanoTile(i,e,r.pano,this.direction):i.push(e),e.uploadQueued=!0,this.uploadInterval||this.uploadIntervalCancelled||this.refreshUploadInterval(0)))}},{key:"shoulPushToFrontOfQueue",value:function(e){return 0===f0.getLevelCountForSize(E.TILE_SIZE,e.panoSize)}},{key:"getTopUploadQueue",value:function(){for(var e,t,n=W0;n<=J0;n++)for(var i=0;i=t?(r.uploadQueued=!1,e.splice(i,1)):i++}}},{key:"updateUploadQueue",value:function(e,t){e=e||1;for(var n=0,i=0;!(t<=i||e<=n);){var r,a=this.getNextFromUploadQueue();if(!a)break;0!==a.level?n++:i++,a.panoSize>this.qualityManager.getMaxNavPanoSize()&&!this.zoomingActive||(r=this.getActiveRenderTargetDescriptor(a.panoId),this.isRenderTargetDescriptorValid(r)&&this.uploadTile(a,a.forceUpload))}}},{key:"updateDirection",value:function(e){if(e=e||this.direction){this.direction=e;for(var t=0;t=this.qualityManager.getMaxNavPanoSize()?this.zoomRenderTarget&&this.zoomRenderTarget.width===this.qualityManager.getMaxZoomPanoSize()||(e=this.zoomRenderTarget,(t=this.qualityManager.getMaxZoomPanoSize())>this.qualityManager.maxRenderTargetSize)||(w0[t]?this.zoomRenderTarget=w0[t]:(this.zoomRenderTarget=this.initTiledPano(t,!1),w0[t]=this.zoomRenderTarget),e&&(t=e.width,n=this.zoomRenderTarget.width,this.copyCubeMap(e.texture,this.zoomRenderTarget,t,t,n,n),e.texture.dispose(),e.texture.loaded=!1,e.texture.version=0,this.deallocateCubeTexture(e.texture),e.texture=null),this.zoomPanoRenderingDisabled=!1):this.zoomPanoRenderingDisabled=!0)}),q0.prototype.updateActivePanos=(b0=[],function(e,t){for(var n=b0.length=0;n Cannot render to a pano that is not activated.");for(var a=0;athis.qualityManager.maxRenderTargetSize?(r=this.initSizedTexture2D(l,st),i=this.viewer.images360.isHighMapLoaded(e.cubeFace,d,p)):r=_0[l],this.uploadTexture2D(s,r,0,0,l,l),u>this.qualityManager.maxRenderTargetSize?i||this.viewer.images360.updateHighMap(r,e.cubeFace,d,p):1===M0||2===M0?(w=1===M0?this.overlayTilesBasic:this.overlayTilesEnhanced,this.renderToCubeMap(r,y,l,l,0,0,l,l,t,f,A,A,e.cubeFace),this.renderToCubeMap(w[u],y,l,l,0,0,l,l,t,f,A,A,e.cubeFace,Ae,!0,.5)):this.renderToCubeMap(r,y,l,l,0,0,l,l,t,f,A,A,e.cubeFace),n()):v?n():(o+":"+u+":"+c,this.setUploaded(e,!1)),e.uploadAttempted||(g.uploadAttempts++,this.dispatchEvent({type:v0.TileUploadAttempted,id:o,panoSize:u,tileIndex:c,totalTiles:h})),e.uploadAttempted=!0,g.uploadAttempts===h&&this.dispatchEvent({type:v0.UploadAttemptedForAllTiles,id:o,panoSize:u,totalTiles:h}),m}),q0.prototype.renderToCubeMap=(T0=!1,k0=P0=D0=I0=S0=null,function(e,t,n,i,r,a,o,s,l,u,c,h,d,p,f,m){var v=this.viewer.renderer,g=(T0||((I0=new mh(-.5,.5,.5,-.5,-200,200)).position.z=150,(S0=new Ps).add(I0),D0=new pa({uniforms:{map:{type:"t",value:null},opacity:{type:"f",value:1}},vertexShader:nm["basicTextured.vs"],fragmentShader:nm["basicTextured.fs"],depthWrite:!1,depthTest:!1,side:ve}),P0=new Ba(1,1),(k0=new Z(P0,D0)).position.z=0,S0.add(k0),T0=!0),P0.getAttribute("uv")),g=(g.setDynamic(!0),g.needsUpdate=!0,g.array),r=r/n,a=a/i,o=o/n,n=s/i,s=(g[0]=r,g[1]=a+n,g[2]=r+o,g[3]=a+n,g[4]=r,g[5]=a,g[6]=r+o,g[7]=a,P0.getAttribute("position")),i=(s.setDynamic(!0),s.needsUpdate=!0,s.array),n=l/t.width-.5,r=u/t.height-.5,o=c/t.width,g=h/t.height,a=(i[0]=n,i[1]=r+g,i[3]=n+o,i[4]=r+g,i[6]=n,i[7]=r,i[9]=n+o,i[10]=r,v.properties.get(S0),D0.uniforms.map.value=e,D0.blending=p||ge,D0.transparent=!!f,D0.uniforms.opacity.value=m=null==m?1:m,D0.needUpdate=!0,t.viewport.set(0,0,t.width,t.height),v.autoClear),s=v.getRenderTarget();v.autoClear=!1,v.setRenderTarget(t,d),v.render(S0,I0),v.setRenderTarget(s),v.autoClear=a}),q0.prototype.copyCubeMap=(R0=!1,G0=N0=O0=F0=null,U0=new ki,function(e,t,n,i,r,a,o,s,l){if(!(r>this.qualityManager.maxRenderTargetSize)){R0||((O0=new mh(-1,1,1,-1,0,200)).position.set(0,0,0),(F0=new Ps).add(O0),N0=new pa({uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:nm["copyCubeMap.vs"],fragmentShader:nm["copyCubeMap.fs"],depthWrite:!1,depthTest:!1,side:ve}),L0=new Ql(2,2,2),G0=new Z(L0,N0),F0.add(G0),R0=!0);var u=this.viewer.renderer.autoClear,c=this.viewer.renderer.getRenderTarget();this.viewer.renderer.autoClear=!1,N0.uniforms.tDiffuse.value=e,N0.blending=o||ge,N0.transparent=!!s,N0.uniforms.alpha.value=l=null==l?1:l,N0.needUpdate=!0;for(var h=0;h<6;h++)this.getCubeOrientationForCubeFace(h,U0),G0.rotation.copy(U0),G0.matrixWorldNeedsUpdate=!0,G0.updateMatrixWorld(),t.viewport.set(0,0,r,a),this.viewer.renderer.setRenderTarget(t,h),this.viewer.renderer.render(F0,O0);this.viewer.renderer.autoClear=u,this.viewer.renderer.setRenderTarget(c)}});function Y0(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}function K0(e,t){Y0.call(this),this.textureID=void 0!==t?t:"tDiffuse",e instanceof pa?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=ca.clone(e.uniforms),this.material=new pa({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,transparent:!0})),this.camera=new mh(-1,1,1,-1,0,1),this.scene=new Ps,this.quad=new Z(new Ba(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)}function Z0(e){return(iy=iy||{position:Fv.createFatLineMat({color:Oy,lineWidth:3}),target:Fv.createFatLineMat({color:Ny,lineWidth:3}),frustum:Fv.createFatLineMat({color:Oy,lineWidth:2}),aimAtTarget:new vl({color:Ny})})[e]}var $0,ey,ty,ny,iy,ry=function(){function t(){te(this,t);var e=document.createElement("canvas");this.canvas=e,this.context=e.getContext("2d")}return A(t,[{key:"changeImg",value:function(e){this.img!=e&&(this.canvas.width=e.width,this.canvas.height=e.height,this.context.drawImage(e,0,0),this.img=e)}},{key:"getDepth",value:function(e,t){var e=Math.round(e*(this.canvas.width-1)),t=Math.round(t*(this.canvas.height-1));if(!(e<0||t<0||e>=this.canvas.width||t>=this.canvas.height))return(e=this.context.getImageData(e,t,1,1).data)[1]+e[0]/256}},{key:"sample",value:function(e,t,n){if(e){var i=new THREE.Vector3;if((t=t||viewer.images360.currentPano)!=this.currentPano){if(!t.depthTex)return;this.changeImg(t.depthTex.image),this.currentPano=t}var r,a,o,s=t.position,e=e.dir||(new THREE.Vector3).subVectors(e.point,s).normalize(),l=e.clone().applyMatrix4(t.panoMatrix2Inverse).normalize(),l=ee.getUVfromDir(l),u=this.getDepth(l.x,l.y);return u?(i.copy(e).multiplyScalar(u).add(s),n||(n=this.getNearbyPoint(s,l,-1,0),o=this.getNearbyPoint(s,l,1,0),r=this.getNearbyPoint(s,l,0,-1),a=this.getNearbyPoint(s,l,0,1),o=this.planeFit(e,i,n,o,r,a)),{location:i,normal:o,distance:u}):.75r.inputHandler.hoveredElements[0].distance)){if("pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType){if(e.hoverViewport==r.mapViewer.viewports[0])return r.mapViewer.dispatchEvent(e);if(e.hoverViewport!=r.mainViewport)return}Potree.settings.dblToFocusPoint||a.flyToPanoClosestToMouse()}}),r.addEventListener("global_mousemove",function(e){!Potree.settings.unableNavigate&&Potree.settings.ifShowMarker&&e.hoverViewport==r.mainViewport&&a.updateClosestPano(e.intersect)}),a.addEventListener("markerHover",function(e){a.updateClosestPano(e.pano,e.hovered)}),Potree.settings.isOfficial||(a.domRoot=r.renderer.domElement.parentElement,(e=$("")).css({position:"absolute",right:"25%",bottom:"20px",zIndex:"10000",fontSize:"1em",color:"black",display:"none",background:"rgba(255,255,255,0.8)"}),e.on("click",function(){return a.unfocus()}),a.elUnfocus=e,a.domRoot.appendChild(e[0]),"merge"!=Potree.settings.editType&&((n=$("")).css({position:"absolute",right:"40%",bottom:"20px",zIndex:"10000",fontSize:"1em",color:"black",width:"100px",background:"rgba(255,255,255,0.8)"}),a.domRoot.appendChild(n[0]),n.on("click",function(e){var t=r.getObjVisiByReason(r.scene.pointclouds[0],"force");r.scene.pointclouds.forEach(function(e){r.updateVisible(e,"force",!t)}),n.val(t?"显示点云":"隐藏点云")})),(e=$("")).css({position:"absolute",right:"65%",bottom:"20px",zIndex:"10000",fontSize:"1em",color:"black",width:"100px",background:"rgba(255,255,255,0.8)"}),a.domRoot.appendChild(e[0]),e.on("click",function(e){"showPointCloud"==Potree.settings.displayMode&&0==a.panos.length||(Potree.settings.displayMode="showPointCloud"==Potree.settings.displayMode?"showPanos":"showPointCloud")}),a.elDisplayModel=e);var a,n,e,o="",s="",t=(Object.defineProperty(Potree.settings,"displayMode",{get:function(){return o},set:function(n){if(s=n,console.warn("Request setMode: "+n),n!=o){var e=Potree.config.displayMode[n],t=r.scene.getActiveCamera();if("showPanos"==n&&r.mainViewport.view.isFlying())r.mainViewport.view.addEventListener("flyingDone",function e(){s==n&&(Potree.settings.displayMode=n),r.mainViewport.view.removeEventListener("flyingDone",e)});else{if(a.isAtPano()&&!a.latestToPano)i=e.atPano;else{var i=e.transition;if("showPanos"==n)return 0==a.panos.length?void 0:(a.addEventListener("flyToPanoDone",function e(t){a.removeEventListener("flyToPanoDone",e),setTimeout(function(){s==n&&(Potree.settings.displayMode=n)},t.makeIt?1:50)}),void a.flyToPano({pano:a.findNearestPano()}))}if(i.showSkybox||i.showPoint&&i.pointUsePanoTex?a.tileDownloader.start():a.tileDownloader.stop(),i.showSkybox||i.pointUsePanoTex){e=function e(t){t.pano&&t.pano!=a.currentPano||(setTimeout(function(){s==n&&(Potree.settings.displayMode=n)},1),a.removeEventListener("loadedDepthImg",e))};if(!a.currentPano.depthTex&&a.currentPano.pointcloud.hasDepthTex)return a.addEventListener("loadedDepthImg",e),a.currentPano.loadDepthImg();if(a.checkAndWaitForPanoLoad(a.currentPano,a.basePanoSize,e))return}r.scene.pointclouds.forEach(function(e){r.updateVisible(e,"displayMode",i.showPoint,2)}),i.pointUsePanoTex?r.scene.pointclouds.forEach(function(e){e.material.setProjectedPanos(a.currentPano,a.currentPano,1)}):r.scene.pointclouds.forEach(function(e){e.material.stopProjectedPanos()}),r.updateVisible(a.cube,"showSkybox",i.showSkybox),a.cube.visible?a.setProjectedPanos({progress:1,ifSkybox:!0,ifPointcloud:!1,easeInOutRatio:0,pano0:a.currentPano,pano1:a.currentPano}):(a.smoothZoomTo(1),a.resetHighMap(),a.hideHighMap()),"showPanos"==(o=n)?(t.far=r.farWhenShowPano,Potree.settings.pointDensity="panorama",Potree.config.displayMode.showPanos.transition.pointUsePanoTex&&r.scene.pointclouds.forEach(function(e){e.material.pointSizeType="FIXED"}),a.updateCube(a.currentPano)):(t.limitFar&&(t.far=Potree.settings.cameraFar),Potree.settings.pointDensity=Potree.settings.UserPointDensity,Potree.config.displayMode.showPanos.transition.pointUsePanoTex&&r.scene.pointclouds.forEach(function(e){e.material.pointSizeType=Potree.config.material.pointSizeType})),t.updateProjectionMatrix(),a.elDisplayModel&&a.elDisplayModel.val("showPointCloud"==n?">>全景":">>点云"),a.dispatchEvent({type:"endChangeMode",mode:n}),console.log("setModeSuccess: "+n)}}}}),Potree.settings.displayMode="showPointCloud",null),i=(Object.defineProperty(G(a),"currentPano",{get:function(){return t},set:function(e){e!=t&&(t&&t.exit(),e&&e.enter(),t=e)}}),!0),l=(Object.defineProperty(Potree.settings,"ifShowMarker",{get:function(){return i},set:function(t){(t=!!t)!=i&&(a.panos.forEach(function(e){r.updateVisible(e,"ifShowMarker",t,1)}),i=t)}}),r.addEventListener("update",function(){a.update(r)}),{FORWARD:["W".charCodeAt(0),38],BACKWARD:["S".charCodeAt(0),40],LEFT:["A".charCodeAt(0),37],RIGHT:["D".charCodeAt(0),39]});return r.inputHandler.addEventListener("keydown",function(t){if("showPanos"==Potree.settings.displayMode)for(var e in l)if(l[e].some(function(e){return e==t.keyCode})){switch(e){case"FORWARD":a.flyLocalDirection(oy.FORWARD.clone());break;case"BACKWARD":a.flyLocalDirection(oy.BACK.clone());break;case"LEFT":a.flyLocalDirection(oy.LEFT.clone());break;case"RIGHT":a.flyLocalDirection(oy.RIGHT.clone())}break}}),a}return A(c,[{key:"updateDepthTex",value:function(e){this.currentPano==e&&e.depthTex&&this.cube.material.updateDepthTex(e)}},{key:"findNearestPano",value:function(t){t=t?(new Re).copy(t):this.position;var e=ag.sortByScore(this.panos,[c.filters.isEnabled()],[function(e){return-e.position.distanceTo(t)}]);return e&&e[0]&&e[0].item}},{key:"flyLocalDirection",value:function(e){var t=this.getDirection(e),n=1===e.y?.4:.75,e=1===Math.abs(e.x);return this.flyDirection(t,n,e,!0)}},{key:"getDirection",value:function(e){return e?(e=e||(new Re).copy(oy.FORWARD)).applyQuaternion(viewer.mainViewport.camera.quaternion):viewer.scene.view.direction}},{key:"position",get:function(){return this.viewer.scene.view.position.clone()}},{key:"visible",get:function(){return this._visible},set:function(e){this._visible!==e&&(this._visible=e,this.dispatchEvent({type:"visibility_changed",panos:this}))}},{key:"isAtPano",value:function(){return this.currentPano&&viewer.scene.view.position.equals(this.currentPano.position)}},{key:"updateProjectedPanos",value:function(){this.projectedPano0&&this.projectedPano1&&this.setProjectedPanos({pano0:this.projectedPano0,pano1:this.projectedPano1})}},{key:"setProjectedPanos",value:function(){var t=0=t.length?null:(i&&(i.candidates=t,i.pano=t[e].item),t[e].item)}},{key:"isNeighbour",value:function(o,s){var e,t,n,i,r,a,l,u;if(o&&s)return(e=this.neighbourMap[o.id])||(this.neighbourMap[o.id]=e={}),(t=this.neighbourMap[s.id])||(this.neighbourMap[s.id]=t={}),n=function(e,t,n){(new Re).subVectors(t.position,e.position).normalize();var i=[];n||i.push([t.position,e.position]),i.push([t.floorPosition.clone().add(new Re(0,0,.1)),e.position]);for(var r=0;ro.position.distanceTo(s.position))return!0}},(u=e[s.id]||t[o.id])||(o.depthTex||s.depthTex?null!=e[s.id]&&null!=t[o.id]||(o.depthTex,o.depthTex,null==e[s.id]&&o.depthTex&&((i=n(o,s))&&(u=!0),e[s.id]=!!i),!u&&null==t[o.id]&&s.depthTex&&((i=n(s,o,!u))&&(u=!0),t[o.id]=!!i)):(20 Cannot load texture for null pano.");var l=this.getTileDirection();if(!e.isLoaded(t))return a&&viewer.waitForLoad(e,function(){return e.isLoaded(t)}),e.loadTiledPano(t,l,null,o,s,null).done(function(e,t){n&&n(e,t)}.bind(this)).fail(function(e){i&&i(e)}.bind(this)).progress(function(e,t,n){r&&r(e,t,n)}.bind(this)),!0}},{key:"fitPanoTowardPoint",value:function(t){var n=this,i=t.point,r=t.target,e=t.require||[],a=t.rank||[],o=(t.force,t.getAll),s=t.bestDistance||0,l=t.dir,u=viewer.scene.getActiveCamera(),c=(r&&!l&&(l=(new Re).subVectors(r,i).normalize()),t.boundSphere&&(s=1t,r=!(this.flying&&this.nextPano&&this.nextPano!==this.currentPano),this.tileDownloader.tilePrioritizer.setZoomingActive(r=n&&r),this.panoRenderer.setZoomingActive(r,e,!0),i=function(e,t){a.panoRenderer.resetRenderStatus(e.id,!1,!0,a.qualityManager.getMaxNavPanoSize()),a.panoRenderer.clearAllQueuedUploadsForPano(e.id),a.panoRenderer.renderPanoTiles(e.id,null,!1,!1),e.setZoomed(t)},r&&(!e.zoomed||this.qualityManager.zoomLevelResolution&&"4k"!=this.qualityManager.zoomLevelResolution)?(e.zoomed||i(e,!0),"1k"==Potree.settings.navTileClass&&"1k"!=Potree.settings.tileClass&&this.zoomLevel<2?this.panoRenderer.enableHighQuality(function(){"4k"!=Potree.settings.tileClass&&i(e,!0)}.bind(this)):this.panoRenderer.enableUltraHighQualityMode(function(){this.qualityManager.useUltraHighResolutionPanos&&(Potree.settings.zoom.max=Potree.config.ultraHighQualityMaxZoom),i(e,!0)}.bind(this))):!n&&e.zoomed&&i(e,!1),r)&&"1k"==Potree.settings.navTileClass&&"4k"==Potree.settings.tileClass&&(r=function(e){a.qualityManager.updateMaximums(),a.panoRenderer.setupZoomRenderTarget()},this.qualityManager.zoomLevelResolution=2<=this.zoomLevel?"4k":this.zoomLevel>t?"2k":"1k",this.oldZoomLevel<2&&2<=this.zoomLevel?(r(),i(e,n)):this.oldZoomLevel<=t&&this.zoomLevel>t?r():2t&&this.zoomLevel<=t&&r(),this.oldZoomLevel=this.zoomLevel)}},{key:"addHighMapCube",value:function(){if("4k"==Potree.settings.tileClass&&2048==this.qualityManager.maxRenderTargetSize){for(var e=new Ru(1,1,1,1),t=new K,n=0;n<6;n++){for(var i=new K,r=0;r<8;r++)for(var a=0;a<8;a++){var o,s=new Z(e,new L({}));s.position.set(r-3.5,a-3.5,-4),s.material.opacity=.4,s.material.transparent=!0,Potree.settings.isTest&&(o=Math.random(),s.material.color=(new Me).setHSL(o,.6,.7)),s.visible=!1,i.add(s)}switch(n){case sy.GL_TEXTURE_CUBE_MAP_POSITIVE_X:i.rotation.set(0,Math.PI/2,0);break;case sy.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:i.rotation.set(0,-Math.PI/2,0);break;case sy.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:var l=(new X).setFromAxisAngle(new Re(0,1,0),Math.PI),u=(new X).setFromAxisAngle(new Re(1,0,0),Math.PI/2);i.quaternion.copy(l).multiply(u);break;case sy.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:l=(new X).setFromAxisAngle(new Re(0,1,0),Math.PI),u=(new X).setFromAxisAngle(new Re(1,0,0),-Math.PI/2);i.quaternion.copy(l).multiply(u);break;case sy.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:i.rotation.set(0,Math.PI,0);break;case sy.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:i.rotation.set(0,0,0)}i.scale.set(1,-1,1),t.add(i)}t.name="highMapCube",this.highMapCube=t,viewer.scene.scene.add(t);t.scale.set(.1,.1,.1),this.highMapCube.visible=!1,viewer.setObjectLayers(this.highMapCube,"sceneObjects")}}},{key:"isHighMapLoaded",value:function(e,t,n){return!!this.highMapCube.children[e].children[8*t+n].material.map}},{key:"updateHighMap",value:function(e,t,n,i){t=this.highMapCube.children[t].children[8*n+i];t.material.map=e,t.material.opacity=1,t.material.transparent=!1,t.visible=!0,t.material.needsUpdate=!0}},{key:"resetHighMap",value:function(){this.highMapCube&&(this.highMapCube.children.forEach(function(e){return e.children.forEach(function(e){var t;e.material.map&&(e.material.map.dispose(),e.material.map.loaded=!1,e.material.map.version=0,t=viewer.renderer.properties.get(e.material.map),viewer.renderer.getContext().deleteTexture(t.__webglTexture),e.material.map=null,e.material.needsUpdate=!0,e.visible=!1)})}),this.highMapCube.visible=!1)}},{key:"setHighMap",value:function(e){this.highMapCube&&(this.highMapCube.position.copy(e.position),this.highMapCube.quaternion.copy(ee.convertQuaternion.YupToZup(e.quaternion4dkk)),e=(new X).setFromRotationMatrix(e.pointcloud.rotateMatrix),this.highMapCube.quaternion.premultiply(e))}},{key:"showHighMap",value:function(){this.highMapCube&&(this.highMapCube.visible=!0)}},{key:"hideHighMap",value:function(){this.highMapCube&&(this.highMapCube.visible=!1)}},{key:"addPanoData",value:function(e,n){var i=this;0==(e=e.data?e.data:e).length&&console.error(n+" 没有漫游点"),e.forEach(function(e){e.id=i.panos.length;var t=new FA(e,i);t.addEventListener("dispose",function(e){i.closestPano==t&&(i.closestPano=null)}),i.panos.push(t),"pano"==Potree.settings.editType&&Potree.settings.datasetsPanos[n].panos.push(t)})}},{key:"loadDone",value:function(){viewer.setObjectLayers(this.node,"sceneObjects"),this.panos.forEach(function(e){e.label&&viewer.setObjectLayers(e.label,"bothMapAndScene")}),this.tileDownloader.setPanoData(this.panos,[]);var e=new Re(1,1,1);this.bound=ee.getBoundByPoints(this.panos.map(function(e){return e.position}),e),viewer.scene.pointclouds.forEach(function(e){return e.getPanosBound()}),viewer.scene.pointclouds.some(function(e){return 0==e.panos.length})&&(viewer.hasNoPanoDataset=!0)}},{key:"getPano",value:function(t){var n=1r||e.dot(i)>r}},inFloorDirection:function(t,n,i){return function(e){return e.floorPosition.clone().sub(t).setZ(0).normalize().dot(n)>i}},isNotBehindNormal:function(t,n){var i=new Re;return n=n.clone(),function(e){return 0")).css({position:"absolute",right:"80%",bottom:"20px",zIndex:"10000",fontSize:"1em",color:"black",background:"rgba(255,255,255,0.8)"}),i=!1,n.on("click",function(){i=!i,t.attachToMainViewer(i,"measure"),n.val(i?"map分离":"map绑定")}),e.appendChild(n[0])),t}return A(a,[{key:"waitLoadDone",value:function(t){var n=this;0==this.mapLayer.loadingInProgress?t():this.mapLayer.addEventListener("loadDone",function e(){t(),n.mapLayer.removeEventListener("loadDone",e)})}},{key:"addListener",value:function(e){var t=this;e.addEventListener("flyToPano",function(e){e=e.toPano;e.dontMoveMap||t.moveTo(e.pano.position.clone().setZ(Potree.config.map.cameraHeight),void 0,e.duration,null,e.easeName)})}},{key:"initProjection",value:function(){this.started=!0,this.mapLayer.initProjection()}},{key:"initScene",value:function(){var e=this.renderArea.clientWidth,t=this.renderArea.clientHeight,t=(this.camera=new mh(-e/2,e/2,t/2,-t/2,.01,1e4),this.camera.zoom=e/50,this.camera.up.set(0,0,1),this.view=new Dg,this.view.position.set(0,0,Potree.config.map.cameraHeight),this.view.lookAt(0,0,0),this.setViewLimit("standard"),new EA(this.view,this.camera,{left:0,bottom:0,width:1,height:1,name:"mapViewport"})),e=(t.axis=["x","y"],t.axisSign=[1,1],t.noPointcloud=!0,t.render=this.render.bind(this),this.viewports=[t],this.controls=new yA(this,this.viewports[0]),this.controls.setEnable(!0),this.scene=new Ps,this.inputHandler=new bA(this,this.scene),this.inputHandler.name="mapInputHandler",this.inputHandler.registerInteractiveScene(this.scene),this.viewports[0].interactiveScenes=this.inputHandler.interactiveScenes,new Z(my,new L({transparent:!0,opacity:.9,depthTest:!1,map:fy.load(Potree.resourcePath+"/textures/pic_location128.png")})));e.position.set(0,0,0),this.cursor=e,this.scene.add(e),viewer.setObjectLayers(this.scene,"mapObjects")}},{key:"setViewLimit",value:function(e){e=Potree.config.OrthoCameraLimit[e];e?(this.view.limitBound=(new Y).copy(e.posBound),this.camera.zoomLimit=$.extend({},e.zoom)):(this.view.limitBound=null,this.camera.zoomLimit=null)}},{key:"updateCursor",value:function(){var e=ee.getScaleForConstantSize({minSize:80,maxSize:200,nearBound:5,farBound:100,camera:this.camera,position:this.cursor.getWorldPosition(new Re),resolution:this.viewports[0].resolution});this.cursor.scale.set(e,e,e),this.cursor.position.copy(viewer.mainViewport.camera.position).setZ(0),this.cursor.rotation.z=viewer.mainViewport.view.yaw,this.needRender=!0}},{key:"addPanos",value:function(e){var i=this,r=new K;ny={default:new L({transparent:!0,opacity:.5,map:fy.load(Potree.resourcePath+"/textures/map_marker.png")}),selected:new L({transparent:!0,opacity:1,map:fy.load(Potree.resourcePath+"/textures/map_marker.png")})},e.images.panos.forEach(function(t){t.mapMarker=new Z(my,ny.default),t.mapMarker.position.copy(t.position).setZ(0),t.mapMarker.scale.set(1,1,1),t.mapMarker.name="mapMarker",r.add(t.mapMarker);function e(e){e.byMap||(t.mapMarker.material=ny.selected,e.byMainView||t.dispatchEvent({type:"hoverOn",byMap:!0}),i.needRender=!0)}function n(e){e.byMap||(t.mapMarker.material=ny.default,e.byMainView||t.dispatchEvent({type:"hoverOff",byMap:!0}),i.needRender=!0)}t.mapMarker.addEventListener("mouseover",e),t.mapMarker.addEventListener("mouseleave",n),t.addEventListener("hoverOn",e),t.addEventListener("hoverOff",n);t.mapMarker.addEventListener("click",function(e){viewer.images360.flyToPano(t)}),t.addEventListener("isVisible",function(e){viewer.updateVisible(t.mapMarker,"panoVisible",e.visible),i.needRender=!0}),t.addEventListener("rePos",function(e){t.mapMarker.position.copy(t.position).setZ(0)})}),this.scene.add(r),r.position.z=dy,this.panosGroup=r,viewer.setObjectLayers(r,"mapObjects"),this.initFitView()}},{key:"updateClosestPano",value:function(t){var e;viewer.images360.flying||(t=t&&t.orthoIntersect)&&(t=t.clone().setZ(0),e=[function(e){return e.position.clone().setZ(0).distanceTo(t)<20},cy.filters.isEnabled(),cy.filters.isVisible()],e=ag.find(viewer.images360.panos,e,[cy.sortFunctions.floorDisSquaredToPoint(t)]))&&e!=viewer.images360.currentPano&&viewer.images360.flyToPano(e)}},{key:"fitPanosToViewport",value:function(){var e=viewer.images360.bound.size.clone().multiplyScalar(1.1),t=(e.max(new Re(4,4,4)),viewer.images360.bound.center.clone());this.moveTo(t,e,0)}},{key:"fitToPointcloud",value:function(e){var t=1a.width)){t.x=t.x/a.width*2-1,t.y=2*-(t.y/a.width)+1;for(var e=new gd,n=(e.setFromCamera(t,a.camera),e.ray.origin.sub(a.camera.getWorldDirection(new Re)),e.intersectObjects(a.children)),i=1e3,r=0;r\n\t\t\t\t\n\t\t\t\t\tx\n\t\t\t\t\ty\n\t\t\t\t\tz\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t'),s=Potree.resourcePath+"/icons/copy.svg",t=q(e);try{for(t.s();!(r=t.n()).done;)!function(){var t=r.value,e=ie.addCommas(t.x.toFixed(3)),n=ie.addCommas(t.y.toFixed(3)),i=ie.addCommas(t.z.toFixed(3)),e=$("\n\t\t\t\t\n\t\t\t\t\t".concat(e,"\n\t\t\t\t\t").concat(n,"\n\t\t\t\t\t").concat(i,'\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t'));a.elCopy=e.find("img[name=copy]"),a.elCopy.click(function(){var e=t.toArray().map(function(e){return e.toFixed(3)}).join(", ");ie.clipboardCopy(e),a.viewer.postMessage("Copied value to clipboard:
'".concat(e,"'"),{duration:3e3})}),o.append(e)}()}catch(e){t.e(e)}finally{t.f()}return o}},{key:"createAttributesTable",value:function(){var e=$('
');this.measurement.points[0];return e}},{key:"update",value:function(){}}]),r}(),by=function(){y(i,wy);var n=C(i);function i(e,r,t){te(this,i),a=n.call(this,e,r,t);var a,e=Potree.resourcePath+"/icons/remove.svg";return a.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),a.elRemove=a.elContent.find("img[name=remove]"),a.elRemove.click(function(){a.viewer.scene.removeMeasurement(r)}),a.elMakeProfile=a.elContent.find("input[name=make_profile]"),a.elMakeProfile.click(function(){var e,t=new ff,n=(t.name=r.name,t.width=r.getTotalDistance()/50,q(r.points));try{for(n.s();!(e=n.n()).done;){var i=e.value;t.addMarker(i.position.clone())}}catch(e){n.e(e)}finally{n.f()}a.viewer.scene.addProfile(t)}),a.propertiesPanel.addVolatileListener(r,"marker_added",a._update),a.propertiesPanel.addVolatileListener(r,"marker_removed",a._update),a.propertiesPanel.addVolatileListener(r,"marker_moved",a._update),a.update(),a}return A(i,[{key:"update",value:function(){for(var e=this.elContent.find(".coordinates_table_container"),t=(e.empty(),e.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position}))),this.measurement.points.map(function(e){return e.position})),n=[],i=0;i\n\t\t\t\t\t".concat(0===o?"Distances: ":"",'\n\t\t\t\t\t').concat(s,"\n\t\t\t\t"));a.append(s)}e=$('\n\t\t\t\n\t\t\t\tTotal: '.concat(e,"\n\t\t\t"));a.append(e)}}]),i}(),xy=function(){y(a,wy);var r=C(a);function a(e,t,n){te(this,a),i=r.call(this,e,t,n);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return A(a,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container"),e=(e.empty(),e.append(this.createCoordinatesTable(this.measurement.points)),this.elContent.find(".attributes_table_container"));e.empty(),e.append(this.createAttributesTable())}}]),a}(),Ey=function(){y(a,wy);var r=C(a);function a(e,t,n){te(this,a),i=r.call(this,e,t,n);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\tArea: \n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return A(a,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container");e.empty(),e.append(this.createCoordinatesTable(this.measurement.points)),this.elContent.find("#measurement_area").html(this.measurement.area.value.toFixed(3))}}]),a}(),Cy=function(){y(a,wy);var r=C(a);function a(e,t,n){te(this,a),i=r.call(this,e,t,n);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
αβγ
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return A(a,[{key:"update",value:function(){for(var e=this.elContent.find(".coordinates_table_container"),t=(e.empty(),e.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position}))),[]),n=0;n\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return A(a,[{key:"update",value:function(){var e,t,n,i,r=this.elContent.find(".coordinates_table_container"),r=(r.empty(),r.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position}))),this.elContent.find("#infos_table"));3!==this.measurement.points.length?r.empty():(i=this.measurement.points[0].position,e=this.measurement.points[1].position,t=this.measurement.points[2].position,t=(e=Potree.Utils.computeCircleCenter(i,e,t)).distanceTo(i),i=2*Math.PI*t,e="".concat((n=function(e){return Potree.Utils.addCommas(e.toFixed(3))})(e.x)," ").concat(n(e.y)," ").concat(n(e.z)),t=n(t),n=n(i),i='style="width: 100%; padding: 5px;"',r.html("\n\t\t\t\n\t\t\t\tCenter: \n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t').concat(e,"\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\tRadius: \n\t\t\t\t").concat(t,"\n\t\t\t\n\t\t\t\n\t\t\t\tCircumference: \n\t\t\t\t").concat(n,"\n\t\t\t\n\t\t")))}}]),a}(),_y=function(){y(a,wy);var r=C(a);function a(e,t,n){te(this,a),i=r.call(this,e,t,n);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\tHeight:
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return A(a,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container");e.empty(),e.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position})));var e=this.measurement.points.slice().sort(function(e,t){return e.position.z-t.position.z}),t=e[0].position.clone(),e=e[e.length-1].position.clone(),t=t.z,e=(e=e.z-t).toFixed(3);this.elHeightLabel=this.elContent.find("#height_label"),this.elHeightLabel.html("Height: ".concat(e))}}]),a}(),My=function(){y(l,wy);var e,s=C(l);function l(e,t,n){te(this,l),i=s.call(this,e,t,n);var i,e=Potree.resourcePath+"/icons/copy.svg",n=Potree.resourcePath+"/icons/remove.svg",r=new Map([[df,"length"],[pf,"rx"]]).get(t.constructor),a=new Map([[df,"width"],[pf,"ry"]]).get(t.constructor),o=new Map([[df,"height"],[pf,"rz"]]).get(t.constructor);return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
αβγ
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
').concat(r,"").concat(a,"").concat(o,'
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t
\n\t\t\t\tVolume: \n\t\t\t\t\n\n\t\t\t\t\x3c!--\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • --\x3e\n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
  • \n\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t')),i.elDownloadButton=i.elContent.find("input[name=download_volume]"),i.propertiesPanel.viewer.server?i.elDownloadButton.click(function(){return i.download()}):i.elDownloadButton.hide(),i.elCopyRotation=i.elContent.find("img[name=copyRotation]"),i.elCopyRotation.click(function(){var e=i.measurement.rotation.toArray().slice(0,3).map(function(e){return e.toFixed(3)}).join(", ");ie.clipboardCopy(e),i.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),i.elCopyScale=i.elContent.find("img[name=copyScale]"),i.elCopyScale.click(function(){var e=i.measurement.scale.toArray().map(function(e){return e.toFixed(3)}).join(", ");ie.clipboardCopy(e),i.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeVolume(t)}),i.elContent.find("#volume_reset_orientation").click(function(){t.rotation.set(0,0,0)}),i.elContent.find("#volume_make_uniform").click(function(){var e=(t.scale.x+t.scale.y+t.scale.z)/3;t.scale.set(e,e,e)}),i.elCheckClip=i.elContent.find("#volume_clip"),i.elCheckClip.click(function(e){i.measurement.clip=e.target.checked}),i.elCheckShow=i.elContent.find("#volume_show"),i.elCheckShow.click(function(e){i.measurement.visible=e.target.checked}),i.propertiesPanel.addVolatileListener(t,"position_changed",i._update),i.propertiesPanel.addVolatileListener(t,"orientation_changed",i._update),i.propertiesPanel.addVolatileListener(t,"scale_changed",i._update),i.propertiesPanel.addVolatileListener(t,"clip_changed",i._update),i.update(),i}return A(l,[{key:"download",value:(e=d(V().mark(function e(){var t,n,i,r,a,o,s,l,u,c,h,d,p,f,m,v,g,A,y,w,b,x,E,C,B,_,M,T,S,I,D,P,k,L;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(m=this.measurement,A=[],m=m.matrixWorld,g=new Re(.5,0,0).applyMatrix4(m),o=new Re(-.5,0,0).applyMatrix4(m),l=new Re(0,.5,0).applyMatrix4(m),u=new Re(0,-.5,0).applyMatrix4(m),p=new Re(0,0,.5).applyMatrix4(m),m=new Re(0,0,-.5).applyMatrix4(m),v=(new Re).subVectors(o,g).normalize(),a=v.clone().multiplyScalar(-1),s=(new Re).subVectors(u,l).normalize(),h=s.clone().multiplyScalar(-1),d=(new Re).subVectors(m,p).normalize(),f=d.clone().multiplyScalar(-1),v=[(new $i).setFromNormalAndCoplanarPoint(v,g),(new $i).setFromNormalAndCoplanarPoint(a,o),(new $i).setFromNormalAndCoplanarPoint(s,l),(new $i).setFromNormalAndCoplanarPoint(h,u),(new $i).setFromNormalAndCoplanarPoint(d,p),(new $i).setFromNormalAndCoplanarPoint(f,m)],t=[],n=0,i=v;nERROR: '.concat(e,""))},b=function(e){y.html("".concat(e))},x=null,E="".concat(viewer.server,"/create_regions_filter?pointclouds=[").concat(A,"]®ions=[").concat(a,"]"),b("estimating results ..."),e.next=56,fetch(E);case 56:return E=e.sent,e.next=59,E.json();case 59:if((C=e.sent).handle){e.next=65;break}return w(C.message),e.abrupt("return");case 65:x=C.handle;case 66:B="".concat(viewer.server,"/check_regions_filter?handle=").concat(x),_=function(n){return new Promise(function(e,t){setTimeout(function(){e()},n)})},M=function(e){var t=e.progress,e=e.estimate,t=t["processed points"]/e.points,e=parseInt(100*t);b("progress: ".concat(e,"%"))},T=function(e){var t="downloads ready:
    ";t+="
      ";for(var n=0;nresult_').concat(n,".las \n")}var r="".concat(viewer.server,"/download_regions_filter_report?handle=").concat(x);t+='
    • report.json
    • \n'),b(t+="
    ")},S=function(e){e="Unexpected Response.
    status: ".concat(e.status,"
    message: ").concat(e.message);b(e)},I=function(e){e="ERROR: ".concat(e.message);throw w(e),new Error(e)},D=Date.now();case 73:return e.next=76,fetch(B);case 76:return k=e.sent,e.next=79,k.json();case 79:"ERROR"!==(P=e.sent).status?e.next=84:(I(P),e.next=94);break;case 84:"FILTERING"!==P.status?e.next=88:(M(P),e.next=94);break;case 88:if("FINISHED"===P.status)return T(P),e.abrupt("break",100);e.next=93;break;case 93:S(P);case 94:return k=(Date.now()-D)/1e3,L=k<10?100:1e3,e.next=98,_(L);case 98:e.next=73;break;case 100:case"end":return e.stop()}},e,this,[[23,41,44,47]])})),function(){return e.apply(this,arguments)})},{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container"),e=(e.empty(),e.append(this.createCoordinatesTable([this.measurement.position])),this.measurement.rotation.toVector3()),t=(e=(e=(e=e.toArray()).map(function(e){return 180*e/Math.PI})).map(function(e){return e.toFixed(1)+"°"}),this.elContent.find("#angle_cell_alpha")),n=this.elContent.find("#angle_cell_betta"),i=this.elContent.find("#angle_cell_gamma");t.html(e[0]),n.html(e[1]),i.html(e[2]);t=(t=this.measurement.scale.toArray()).map(function(e){return ie.addCommas(e.toFixed(2))}),n=this.elContent.find("#cell_length"),i=this.elContent.find("#cell_width"),e=this.elContent.find("#cell_height"),n.html(t[0]),i.html(t[1]),e.html(t[2]),n=this.elContent.find("#measurement_volume"),i=this.measurement.getVolume();n.html(ie.addCommas(i.toFixed(2))),this.elCheckClip.prop("checked",this.measurement.clip),this.elCheckShow.prop("checked",this.measurement.visible)}}]),l}(),Ty=function(){y(o,wy);var e,a=C(o);function o(e,i,t){te(this,o),n=a.call(this,e,i,t);var n,e=Potree.resourcePath+"/icons/remove.svg",r=(n.elContent=$('\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t
    \n\t\t\t\t\n\t\t\t\t\tWidth: \n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
    \n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
  • \n\n\t\t\t\t
    \n\n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t')),n.elRemove=n.elContent.find("img[name=remove]"),n.elRemove.click(function(){n.viewer.scene.removeProfile(i)}),n.elDownloadButton=n.elContent.find("input[name=download_profile]"),n.propertiesPanel.viewer.server?n.elDownloadButton.click(function(){return n.download()}):n.elDownloadButton.hide(),n.elContent.find("#sldProfileWidth"));r.spinner({min:0,max:1e7,step:.01,numberFormat:"n",start:function(){},spin:function(e,t){var n=r.spinner("value");i.setWidth(n)},change:function(e,t){var n=r.spinner("value");i.setWidth(n)},stop:function(e,t){var n=r.spinner("value");i.setWidth(n)},incremental:function(e){var t=r.spinner("value"),n=r.spinner("option","step");return Math.max(1,parseInt(.05*t/n))}}),r.spinner("value",i.getWidth()),r.spinner("widget").css("width","100%");return n.propertiesPanel.addVolatileListener(i,"width_changed",function(e){r.spinner("value")!==i.getWidth()&&r.spinner("value",i.getWidth())}),n.elContent.find("#show_2d_profile").click(function(){n.propertiesPanel.viewer.profileWindow.show(),n.propertiesPanel.viewer.profileWindowController.setProfile(i)}),n.propertiesPanel.addVolatileListener(i,"marker_added",n._update),n.propertiesPanel.addVolatileListener(i,"marker_removed",n._update),n.propertiesPanel.addVolatileListener(i,"marker_moved",n._update),n.update(),n}return A(o,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container");e.empty(),e.append(this.createCoordinatesTable(this.measurement.points))}},{key:"download",value:(e=d(V().mark(function e(){var t,n,i,r,a,o,s,l,u,c,h,d,p,f,m,v,g,A,y,w,b,x,E,C,B,_,M,T,S,I,D,P,k,O,N,G,U,z,H,Q,L,R,F;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:E=this.measurement,t=[],C=E.getSegments(),n=E.width,i=q(C);try{for(i.s();!(r=i.n()).done;){for(a=r.value,o=a.start.clone().multiply(new Re(1,1,0)),s=a.end.clone().multiply(new Re(1,1,0)),l=(new Re).addVectors(o,s).multiplyScalar(.5),u=(new Re).subVectors(s,o).normalize(),c=(new Re).subVectors(o,s).normalize(),h=new Re(0,0,1),d=(new Re).crossVectors(u,h),p=(new Re).crossVectors(c,h),console.log(p),f=d.clone().multiplyScalar(.5*n).add(l),m=p.clone().multiplyScalar(.5*n).add(l),v=[(new $i).setFromNormalAndCoplanarPoint(u,o),(new $i).setFromNormalAndCoplanarPoint(c,s),(new $i).setFromNormalAndCoplanarPoint(p,f),(new $i).setFromNormalAndCoplanarPoint(d,m)],g=[],A=0,y=v;AERROR: '.concat(e,""))},I=function(e){T.html("".concat(e))},D=null,P="".concat(viewer.server,"/create_regions_filter?pointclouds=[").concat(M,"]®ions=[").concat(E,"]"),I("estimating results ..."),e.next=42,fetch(P);case 42:return L=e.sent,e.next=45,L.json();case 45:if((k=e.sent).handle){e.next=51;break}return S(k.message),e.abrupt("return");case 51:D=k.handle;case 52:O="".concat(viewer.server,"/check_regions_filter?handle=").concat(D),N=function(n){return new Promise(function(e,t){setTimeout(function(){e()},n)})},G=function(e){var t=e.progress,e=e.estimate,t=t["processed points"]/e.points,e=parseInt(100*t);I("progress: ".concat(e,"%"))},U=function(e){var t="downloads ready:
    ";t+="
      ";for(var n=0;nresult_').concat(n,".las \n")}var r="".concat(viewer.server,"/download_regions_filter_report?handle=").concat(D);t+='
    • report.json
    • \n'),I(t+="
    ")},z=function(e){e="Unexpected Response.
    status: ".concat(e.status,"
    message: ").concat(e.message);I(e)},H=function(e){e="ERROR: ".concat(e.message);throw S(e),new Error(e)},Q=Date.now();case 59:return e.next=62,fetch(O);case 62:return L=e.sent,e.next=65,L.json();case 65:"ERROR"!==(R=e.sent).status?e.next=70:(H(R),e.next=80);break;case 70:"FILTERING"!==R.status?e.next=74:(G(R),e.next=80);break;case 74:if("FINISHED"===R.status)return U(R),e.abrupt("break",86);e.next=79;break;case 79:z(R);case 80:return F=(Date.now()-Q)/1e3,F=F<10?100:1e3,e.next=84,N(F);case 84:e.next=59;break;case 86:case"end":return e.stop()}},e,this,[[9,27,30,33]])})),function(){return e.apply(this,arguments)})}]),o}(),Sy=function(){function i(e,t){var n=this,t=(te(this,i),this.viewer=e,this.propertiesPanel=t,this._update=function(){n.update()},Potree.resourcePath+"/icons/copy.svg");this.elContent=$('\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
    position
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    target
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t
    \n\t\t')),this.elCopyPosition=this.elContent.find("img[name=copyPosition]"),this.elCopyPosition.click(function(){var e=n.viewer.scene.getActiveCamera().position.toArray().map(function(e){return e.toFixed(3)}).join(", ");ie.clipboardCopy(e),n.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),this.elCopyTarget=this.elContent.find("img[name=copyTarget]"),this.elCopyTarget.click(function(){var e=n.viewer.scene.view.getPivot().toArray().map(function(e){return e.toFixed(3)}).join(", ");ie.clipboardCopy(e),n.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),this.propertiesPanel.addVolatileListener(e,"camera_changed",this._update),this.update()}return A(i,[{key:"update",value:function(){var e=this.viewer.scene.getActiveCamera(),t=this.viewer.scene.view,e=e.position.toArray().map(function(e){return ie.addCommas(e.toFixed(3))}),e=(this.elContent.find("#camera_position_x").html(e[0]),this.elContent.find("#camera_position_y").html(e[1]),this.elContent.find("#camera_position_z").html(e[2]),t.getPivot().toArray().map(function(e){return ie.addCommas(e.toFixed(3))}));this.elContent.find("#camera_target_x").html(e[0]),this.elContent.find("#camera_target_y").html(e[1]),this.elContent.find("#camera_target_z").html(e[2])}}]),i}(),Iy=function(){function r(e,t,n){var i=this,e=(te(this,r),this.viewer=e,this.propertiesPanel=t,this.annotation=n,this._update=function(){i.update()},"".concat(Potree.resourcePath,"/icons/copy.svg"));this.elContent=$('\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t
    position
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\n\t\t\t
    \n\n\t\t\t\t
    Title
    \n\t\t\t\t
    \n\t\t\t\t\tAnnotation Title\n\t\t\t\t
    \n\n\t\t\t\t
    Description
    \n\t\t\t\t
    \n\t\t\t\t\tA longer description of this annotation. \n\t\t\t\t\t\tCan be multiple lines long. TODO: the user should be able\n\t\t\t\t\t\tto modify title and description. \n\t\t\t\t
    \n\n\t\t\t
    \n\n\t\t
    \n\t\t')),this.elCopyPosition=this.elContent.find("img[name=copyPosition]"),this.elCopyPosition.click(function(){var e=i.annotation.position.toArray().map(function(e){return e.toFixed(3)}).join(", ");ie.clipboardCopy(e),i.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),this.elTitle=this.elContent.find("#annotation_title").html(n.title),this.elDescription=this.elContent.find("#annotation_description").html(n.description),this.elTitle[0].addEventListener("input",function(){var e=i.elTitle.html();n.title=e},!1),this.elDescription[0].addEventListener("input",function(){var e=i.elDescription.html();n.description=e},!1),this.update()}return A(r,[{key:"update",value:function(){var e=this.annotation,t=this.elContent,n=this.elTitle,i=this.elDescription,r=e.position.toArray().map(function(e){return ie.addCommas(e.toFixed(3))});t.find("#annotation_position_x").html(r[0]),t.find("#annotation_position_y").html(r[1]),t.find("#annotation_position_z").html(r[2]),n.html(e.title),i.html(e.description)}}]),r}(),Dy=function(){function n(l,e,u){te(this,n),this.viewer=l,this.propertiesPanel=e,this.animation=u,this.elContent=$('\n\t\t\t
    \n\t\t\t\t\n\n\t\t\t\t\n\n\t\t\t\t\t\n\t\t\t\t\t\tDuration: \n\t\t\t\t\t\t\n\t\t\t\t\t\n\n\t\t\t\t\tTime:
    \n\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t'),this.elContent.find("input[name=play]").click(function(){u.play()});function t(){function o(e){var t=$('\n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t');t.find("input[name=add]").click(function(){u.createControlPoint(e),u.changeCallback()}),c.append(t)}c.empty();var s=0;o(s),u.posCurve.points.forEach(function(e){var t,n,i,r,a;t=s,n=$('\n\t\t\t\t\t
    \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tkeyframe\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t')),i=n.find("img[name=assign]"),r=n.find("img[name=move]"),a=n.find("img[name=delete]"),i.click(function(){u.posCurve.points[t].copy(l.scene.view.position),u.targetCurve.points[t].copy(l.scene.view.getPivot()),u.changeCallback()}),r.click(function(){l.scene.view.position.copy(u.posCurve.points[t]),l.scene.view.lookAt(u.targetCurve.points[t])}),a.click(function(){u.removeControlPoint(t),u.changeCallback()}),c.append(n),o(++s)})}this.elContent.find("#sldTime").slider({value:0,min:0,max:1,step:.001,slide:function(e,t){u.set(t.value),u.updateFrustum()}});var i=this.elContent.find("input[name=spnDuration]"),c=(i.spinner({min:0,max:300,step:.01,numberFormat:"n",start:function(){},spin:function(e,t){var n=i.spinner("value");u.setDuration(n)},change:function(e,t){var n=i.spinner("value");u.setDuration(n)},stop:function(e,t){var n=i.spinner("value");u.setDuration(n)},incremental:function(e){var t=i.spinner("value"),n=i.spinner("option","step");return Math.max(1,parseInt(.05*t/n))}}),i.spinner("value",u.getDuration()),i.spinner("widget").css("width","100%"),this.elContent.find("#animation_keyframes"));t(),u.addEventListener("controlpoint_added",t),u.addEventListener("controlpoint_removed",t)}return A(n,[{key:"update",value:function(){}}]),n}(),Py=function(){function n(e,t){te(this,n),this.container=e,this.viewer=t,this.object=null,this.cleanupTasks=[],this.scene=null}return A(n,[{key:"setScene",value:function(e){this.scene=e}},{key:"set",value:function(e){if(this.object!==e){this.object=e;var t,n=q(this.cleanupTasks);try{for(n.s();!(t=n.n()).done;)(0,t.value)()}catch(e){n.e(e)}finally{n.f()}this.cleanupTasks=[],this.container.empty(),e instanceof Zf?this.setPointCloud(e):e instanceof Gf||e instanceof ff||e instanceof hf?this.setMeasurement(e):e instanceof fa?this.setCamera(e):e instanceof zm?this.setAnnotation(e):e instanceof rv&&this.setCameraAnimation(e)}}},{key:"addVolatileListener",value:function(e,t,n){e.addEventListener(t,n),this.cleanupTasks.push(function(){e.removeEventListener(t,n)})}},{key:"setPointCloud",value:function(f){function e(e){s.html(m.size.toFixed(2)),o.slider({value:m.size})}function t(e){u.html(m.minSize.toFixed(2)),l.slider({value:m.minSize})}function n(){var e=Object.keys(hm)[m.shape];d.selectmenu().val(e).selectmenu("refresh")}function i(){var e=m.backfaceCulling;p.prop("checked",e)}function r(e){A.html(m.opacity.toFixed(2)),g.slider({value:m.opacity})}var a=this,m=f.material,v=$('\n\t\t\t
    \n\t\t\t\t
      \n\n\t\t\t\t
    • \n\t\t\t\t
      \n\t\t\t\t
    • \n\t\t\t\t
    • \n\t\t\t\t
      \n\t\t\t\t
    • \n\n\t\t\t\t\x3c!-- SIZE TYPE --\x3e\n\t\t\t\t
    • \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t\x3c!-- SHAPE --\x3e\n\t\t\t\t
    • \n\t\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t
    • \n\t\t\t\t\n\t\t\t\t
    • \n\t\t\t\t\n\t\t\t\t\x3c!-- OPACITY --\x3e\n\t\t\t\t
    • :
    • \n\n\t\t\t\t
      \n\t\t\t\t\tAttribute\n\t\t\t\t
      \n\n\t\t\t\t
    • \n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tAttribute Weights\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • RGB:
      \t
    • \n\t\t\t\t\t
    • Intensity:
      \t
    • \n\t\t\t\t\t
    • Elevation:
      \t
    • \n\t\t\t\t\t
    • Classification:
      \t
    • \n\t\t\t\t\t
    • Return Number:
      \t
    • \n\t\t\t\t\t
    • Source ID:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tRGB\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • Gamma:
      \t
    • \n\t\t\t\t\t
    • Brightness:
      \t
    • \n\t\t\t\t\t
    • Contrast:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tExtra Attribute\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • :
    • \n\n\t\t\t\t\t
    • Gamma:
    • \n\t\t\t\t\t
    • Brightness:
    • \n\t\t\t\t\t
    • Contrast:
    • \n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tMATCAP\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tColor\n\t\t\t\t\t
      \n\n\t\t\t\t\t\n\t\t\t\t
      \n\n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tElevation\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • :
      \t
    • \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    • \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\tGradient Scheme:\n\t\t\t\t\t\t
      \n\t\t\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tTransition\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • transition:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tIntensity\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • Range:
      \t
    • \n\t\t\t\t\t
    • Gamma:
      \t
    • \n\t\t\t\t\t
    • Brightness:
      \t
    • \n\t\t\t\t\t
    • Contrast:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tGPS Time\n\t\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tIndices\n\t\t\t\t\t
      \n\t\t\t\t
      \n\n\n\t\t\t\t
    \n\t\t\t
    \n\t\t'),o=(v.i18n(),this.container.append(v),v.find("#sldPointSize")),s=v.find("#lblPointSize"),l=(o.slider({value:m.size,min:0,max:3,step:.01,slide:function(e,t){m.size=t.value}}),this.addVolatileListener(m,"point_size_changed",e),e(),v.find("#sldMinPointSize")),u=v.find("#lblMinPointSize"),c=(l.slider({value:m.size,min:0,max:3,step:.01,slide:function(e,t){m.minSize=t.value}}),this.addVolatileListener(m,"point_size_changed",t),t(),Object.keys(cm)[m.pointSizeType]),h=v.find("#optPointSizing"),d=(h.selectmenu(),h.val(c).selectmenu("refresh"),h.selectmenu({change:function(e,t){m.pointSizeType=cm[t.item.value]}}),v.find("#optShape")),p=(d.selectmenu({change:function(e,t){t=t.item.value;m.shape=hm[t]}}),this.addVolatileListener(m,"point_shape_changed",n),n(),v.find("#set_backface_culling")),c=(p.click(function(){m.backfaceCulling=p.prop("checked")}),this.addVolatileListener(m,"backface_changed",i),i(),$("#materials_backface_container")),h=(c.css("display","none"),f.pcoGeometry.pointAttributes),g=(!!h.hasNormals&&h.hasNormals()&&c.css("display","block"),v.find("#sldOpacity")),A=v.find("#lblOpacity");g.slider({value:m.opacity,min:0,max:1,step:.001,slide:function(e,t){m.opacity=t.value}});this.addVolatileListener(m,"opacity_changed",r),r();var y,h=f.pcoGeometry.pointAttributes.attributes,h=((c=[]).push.apply(c,J(h.map(function(e){return e.name}))),c.indexOf("intensity")),w=(0<=h&&c.splice(h+1,0,"intensity gradient"),c.push("elevation","color","matcap","indices","level of detail","composite"),["POSITION_CARTESIAN","position"]),c=c.filter(function(e){return!w.includes(e)}),b=v.find("#optMaterial"),x=q(c);try{for(x.s();!(y=x.n()).done;){var E=y.value,C=$(""));b.append(C)}}catch(e){x.e(e)}finally{x.f()}function B(e,t){var n=b.selectmenu().val(),i=(m.activeAttributeName=n,f.getAttribute(n)),r=(!!(i="intensity gradient"===n?f.getAttribute("intensity"):i)&&["intensity","intensity gradient"].includes(i.name)?(f.material.intensityRange[0]===1/0&&(f.material.intensityRange=i.range),a=(r=N(i.range,2))[0],r=r[1],v.find("#sldIntensityRange").slider({range:!0,min:a,max:r,step:.01,values:[a,r],slide:function(e,t){var n=t.values[0],t=t.values[1];m.intensityRange=[n,t]}})):i&&(r=(a=N(i.range,2))[0],a=a[1],o=(o=m.getRange(i.name))||J(i.range),"number"==typeof r)&&"number"==typeof a&&v.find("#sldExtraRange").slider({range:!0,min:r,max:a,step:.01,values:o,slide:function(e,t){var t=N(t.values,2),n=t[0],t=t[1];m.setRange(i.name,[n,t])}}),$("#materials\\.composite_weight_container")),a=$("#materials\\.elevation_container"),o=$("#materials\\.rgb_container"),s=$("#materials\\.extra_container"),l=$("#materials\\.color_container"),u=$("#materials\\.intensity_container"),c=$("#materials\\.index_container"),h=$("#materials\\.transition_container"),d=$("#materials\\.gpstime_container"),p=$("#materials\\.matcap_container");c.css("display","none"),u.css("display","none"),a.css("display","none"),o.css("display","none"),s.css("display","none"),l.css("display","none"),r.css("display","none"),h.css("display","none"),p.css("display","none"),d.css("display","none"),"composite"===n?(r.css("display","block"),a.css("display","block"),o.css("display","block"),u.css("display","block")):"elevation"===n?a.css("display","block"):"RGB and Elevation"===n?(o.css("display","block"),a.css("display","block")):"rgba"===n?o.css("display","block"):"color"===n?l.css("display","block"):"intensity"===n||"intensity gradient"===n?u.css("display","block"):"indices"===n?c.css("display","block"):"matcap"===n?p.css("display","block"):"classification"!==n&&("gps-time"===n?d.css("display","block"):"number of returns"===n||"return number"===n||["source id","point source id"].includes(n)||s.css("display","block"))}function _(){b.val(m.activeAttributeName).selectmenu("refresh")}b.selectmenu({change:B});this.addVolatileListener(m,"point_color_type_changed",_),this.addVolatileListener(m,"active_attribute_changed",_),_(),B();var M,h=Object.keys(Potree.Gradients).map(function(e){return{name:e,values:tm[e]}}),T=v.find("#elevation_gradient_scheme_selection"),S=q(h);try{for(S.s();!(M=S.n()).done;)!function(){var e=M.value,t=$('\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t'),n=Potree.Utils.createSvgGradient(e.values);n.setAttributeNS(null,"class","button-icon"),t.append($(n)),t.click(function(){m.gradient=tm[e.name]}),T.append(t)}()}catch(e){S.e(e)}finally{S.f()}for(var c=[{name:"Normals",icon:"".concat(Potree.resourcePath,"/icons/matcap/check_normal+y.jpg")},{name:"Basic 1",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_1.jpg")},{name:"Basic 2",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_2.jpg")},{name:"Basic Dark",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_dark.jpg")},{name:"Basic Side",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_side.jpg")},{name:"Ceramic Dark",icon:"".concat(Potree.resourcePath,"/icons/matcap/ceramic_dark.jpg")},{name:"Ceramic Lightbulb",icon:"".concat(Potree.resourcePath,"/icons/matcap/ceramic_lightbulb.jpg")},{name:"Clay Brown",icon:"".concat(Potree.resourcePath,"/icons/matcap/clay_brown.jpg")},{name:"Clay Muddy",icon:"".concat(Potree.resourcePath,"/icons/matcap/clay_muddy.jpg")},{name:"Clay Studio",icon:"".concat(Potree.resourcePath,"/icons/matcap/clay_studio.jpg")},{name:"Resin",icon:"".concat(Potree.resourcePath,"/icons/matcap/resin.jpg")},{name:"Skin",icon:"".concat(Potree.resourcePath,"/icons/matcap/skin.jpg")},{name:"Jade",icon:"".concat(Potree.resourcePath,"/icons/matcap/jade.jpg")},{name:"Metal_ Anisotropic",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_anisotropic.jpg")},{name:"Metal Carpaint",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_carpaint.jpg")},{name:"Metal Lead",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_lead.jpg")},{name:"Metal Shiny",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_shiny.jpg")},{name:"Pearl",icon:"".concat(Potree.resourcePath,"/icons/matcap/pearl.jpg")},{name:"Toon",icon:"".concat(Potree.resourcePath,"/icons/matcap/toon.jpg")},{name:"Check Rim Light",icon:"".concat(Potree.resourcePath,"/icons/matcap/check_rim_light.jpg")},{name:"Check Rim Dark",icon:"".concat(Potree.resourcePath,"/icons/matcap/check_rim_dark.jpg")},{name:"Contours 1",icon:"".concat(Potree.resourcePath,"/icons/matcap/contours_1.jpg")},{name:"Contours 2",icon:"".concat(Potree.resourcePath,"/icons/matcap/contours_2.jpg")},{name:"Contours 3",icon:"".concat(Potree.resourcePath,"/icons/matcap/contours_3.jpg")},{name:"Reflection Check Horizontal",icon:"".concat(Potree.resourcePath,"/icons/matcap/reflection_check_horizontal.jpg")},{name:"Reflection Check Vertical",icon:"".concat(Potree.resourcePath,"/icons/matcap/reflection_check_vertical.jpg")}],F=v.find("#matcap_scheme_selection"),I=0,D=c;I\n\t\t\t\t'));t.click(function(){m.matcap=e.icon.substring(e.icon.lastIndexOf("/"))}),F.append(t)}();v.find("#sldRGBGamma").slider({value:m.rgbGamma,min:0,max:4,step:.01,slide:function(e,t){m.rgbGamma=t.value}}),v.find("#sldRGBContrast").slider({value:m.rgbContrast,min:-1,max:1,step:.01,slide:function(e,t){m.rgbContrast=t.value}}),v.find("#sldRGBBrightness").slider({value:m.rgbBrightness,min:-1,max:1,step:.01,slide:function(e,t){m.rgbBrightness=t.value}}),v.find("#sldExtraGamma").slider({value:m.extraGamma,min:0,max:4,step:.01,slide:function(e,t){m.extraGamma=t.value}}),v.find("#sldExtraBrightness").slider({value:m.extraBrightness,min:-1,max:1,step:.01,slide:function(e,t){m.extraBrightness=t.value}}),v.find("#sldExtraContrast").slider({value:m.extraContrast,min:-1,max:1,step:.01,slide:function(e,t){m.extraContrast=t.value}}),v.find("#sldHeightRange").slider({range:!0,min:0,max:1e3,step:.01,values:[0,1e3],slide:function(e,t){m.heightMin=t.values[0],m.heightMax=t.values[1]}}),v.find("#sldIntensityGamma").slider({value:m.intensityGamma,min:0,max:4,step:.01,slide:function(e,t){m.intensityGamma=t.value}}),v.find("#sldIntensityContrast").slider({value:m.intensityContrast,min:-1,max:1,step:.01,slide:function(e,t){m.intensityContrast=t.value}}),v.find("#sldIntensityBrightness").slider({value:m.intensityBrightness,min:-1,max:1,step:.01,slide:function(e,t){m.intensityBrightness=t.value}}),v.find("#sldWeightRGB").slider({value:m.weightRGB,min:0,max:1,step:.01,slide:function(e,t){m.weightRGB=t.value}}),v.find("#sldWeightIntensity").slider({value:m.weightIntensity,min:0,max:1,step:.01,slide:function(e,t){m.weightIntensity=t.value}}),v.find("#sldWeightElevation").slider({value:m.weightElevation,min:0,max:1,step:.01,slide:function(e,t){m.weightElevation=t.value}}),v.find("#sldWeightClassification").slider({value:m.weightClassification,min:0,max:1,step:.01,slide:function(e,t){m.weightClassification=t.value}}),v.find("#sldWeightReturnNumber").slider({value:m.weightReturnNumber,min:0,max:1,step:.01,slide:function(e,t){m.weightReturnNumber=t.value}}),v.find("#sldWeightSourceID").slider({value:m.weightSourceID,min:0,max:1,step:.01,slide:function(e,t){m.weightSourceID=t.value}}),v.find("#materials\\.color\\.picker").spectrum({flat:!0,showInput:!0,preferredFormat:"rgb",cancelText:"",chooseText:"Apply",color:"#".concat(m.color.getHexString()),move:function(e){e=e.toRgb(),e=(new Me).setRGB(e.r/255,e.g/255,e.b/255);m.color=e},change:function(e){e=e.toRgb(),e=(new Me).setRGB(e.r/255,e.g/255,e.b/255);m.color=e}}),this.addVolatileListener(m,"color_changed",function(){v.find("#materials\\.color\\.picker").spectrum("set","#".concat(m.color.getHexString()))});function P(){var e,t=f.getAttribute("position"),n=(t=t?(e=(n=t.range[0][2])-.2*(n=(t=t.range[1][2])-n),t+.2*n):(t=[f.pcoGeometry.tightBoundingBox,f.getBoundingBoxWorld()].find(function(e){return void 0!==e}),f.updateMatrixWorld(!0),n=(t=ie.computeTransformedBoundingBox(t,f.matrixWorld)).max.z-t.min.z,e=t.min.z-.2*n,t.max.z+.2*n),m.elevationRange);v.find("#lblHeightRange").html("".concat(n[0].toFixed(2)," to ").concat(n[1].toFixed(2))),v.find("#sldHeightRange").slider({min:e,max:t,values:n})}function k(){var e=m.activeAttributeName,t=f.getAttribute(e);null!=t&&"number"==typeof(e=null==(e=m.getRange(e))?t.range:e)[0]&&"number"==typeof e[1]&&(e?(t="".concat(e[0].toFixed(2)," to ").concat(e[1].toFixed(2)),v.find("#lblExtraRange").html(t)):v.find("could not deduce range"))}function L(){var e=m.intensityGamma,t=m.intensityContrast,n=m.intensityBrightness;O(),v.find("#lblIntensityGamma").html(e.toFixed(2)),v.find("#lblIntensityContrast").html(t.toFixed(2)),v.find("#lblIntensityBrightness").html(n.toFixed(2)),v.find("#sldIntensityGamma").slider({value:e}),v.find("#sldIntensityContrast").slider({value:t}),v.find("#sldIntensityBrightness").slider({value:n})}function R(){var e=m.rgbGamma,t=m.rgbContrast,n=m.rgbBrightness;v.find("#lblRGBGamma").html(e.toFixed(2)),v.find("#lblRGBContrast").html(t.toFixed(2)),v.find("#lblRGBBrightness").html(n.toFixed(2)),v.find("#sldRGBGamma").slider({value:e}),v.find("#sldRGBContrast").slider({value:t}),v.find("#sldRGBBrightness").slider({value:n})}var O=function(){var e=m.intensityRange;v.find("#lblIntensityRange").html("".concat(parseInt(e[0])," to ").concat(parseInt(e[1])))},h=(P(),v.find("#sldHeightRange").slider("option","min"),v.find("#sldHeightRange").slider("option","max"),v.find("#gradient_repeat_option")),c=(h.selectgroup({title:"Gradient"}),h.find("input").click(function(e){a.viewer.setElevationGradientRepeat(lm[e.target.value])}),Object.keys(lm).filter(function(e){return lm[e]===a.viewer.elevationGradientRepeat}));h.find("input[value=".concat(c,"]")).trigger("click");this.addVolatileListener(m,"material_property_changed",k),this.addVolatileListener(m,"material_property_changed",P),this.addVolatileListener(m,"material_property_changed",L),this.addVolatileListener(m,"material_property_changed",R),k(),P(),L(),R()}},{key:"setMeasurement",value:function(e){var t={DISTANCE:{panel:by},AREA:{panel:Ey},POINT:{panel:xy},ANGLE:{panel:Cy},HEIGHT:{panel:_y},PROFILE:{panel:Ty},VOLUME:{panel:My},CIRCLE:{panel:By},OTHER:{panel:xy}},n=new((n=e)instanceof Gf?!n.showDistances||n.showArea||n.showAngles?n.showDistances&&n.showArea&&!n.showAngles?t.AREA:1===n.maxMarkers?t.POINT:n.showDistances||n.showArea||!n.showAngles?n.showHeight?t.HEIGHT:n.showCircle?t.CIRCLE:t.OTHER:t.ANGLE:t.DISTANCE:n instanceof ff?t.PROFILE:n instanceof hf?t.VOLUME:void 0).panel(this.viewer,e,this);this.container.append(n.elContent)}},{key:"setCamera",value:function(e){var t=new Sy(this.viewer,this);this.container.append(t.elContent)}},{key:"setAnnotation",value:function(e){e=new Iy(this.viewer,this,e);this.container.append(e.elContent)}},{key:"setCameraAnimation",value:function(e){e=new Dy(this.viewer,this,e);this.container.append(e.elContent)}}]),n}(),ky=function(){y(a,zn);var r=C(a);function a(e,t){function n(){i.update()}var i;te(this,a),(i=r.call(this)).position=e,i.color="#"+new Me(t).getHexString(),i.svg=i.create(),i.visible_=!0;return viewer.addEventListener("camera_changed",n),i.addEventListener("dispose",function(){viewer.removeEventListener("camera_changed",n)}),i}return A(a,[{key:"create",value:function(){var o=this,e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg"),e=(t.setAttribute("width","2em"),t.setAttribute("height","2em"),t.setAttribute("position","absolute"),t.style.left="50px",t.style.top="50px",t.style.position="absolute",t.style.zIndex="10000",t.style.cursor="grab",t.style.transform="translate(-50%,-50%)",document.createElementNS(e,"circle"));e.setAttributeNS(null,"cx","1em"),e.setAttributeNS(null,"cy","1em"),e.setAttributeNS(null,"r","0.5em"),e.setAttributeNS(null,"style","fill: "+this.color+"; stroke: black; stroke-width: 0.2em;"),t.appendChild(e);function n(e){o.selectedElement=t,document.addEventListener("mousemove",r)}function i(e){o.selectedElement=null,document.removeEventListener("mousemove",r)}viewer.renderer.domElement.parentElement.appendChild(t);var r=function(e){var t,n,i,r,a;o.selectedElement&&(e.preventDefault(),n=viewer.renderer.domElement.getBoundingClientRect(),a=e.clientX-n.x,e=e.clientY-n.y,t=(n=viewer.renderer.getSize(new Le)).width,n=n.height,i=viewer.scene.getActiveCamera(),(r=o.position.clone().project(i)).x=(a/t-.5)/.5,r.y=(-(e-n)/n-.5)/.5,a=r.clone().unproject(i),o.position.set(a.x,a.y,a.z),o.update(),o.dispatchEvent({type:"dragged",position:o.position}))};return t.addEventListener("mousedown",n),t.addEventListener("mouseup",i),t.style.display=this.visible?"":"none",this.addEventListener("dispose",function(){t.removeEventListener("mousedown",n),t.removeEventListener("mouseup",i)}),t}},{key:"visible",get:function(){return this.visible_},set:function(e){(this.visible_=e)?this.update():this.svg.style.display="none"}},{key:"update",value:function(){if(this.visible){var e=viewer.scene.getActiveCamera(),e=Potree.Utils.getPos2d(this.position,e,viewer.renderArea,viewer.mainViewport);if(!e.trueSide)return this.svg.style.display="none";this.svg.style.left=e.posInViewport.x,this.svg.style.top=e.posInViewport.y,this.svg.style.display=""}}},{key:"dispose",value:function(){this.svg.remove(),this.dispatchEvent("dispose")}}]),a}(),Ly=(new Ba(1,1),function(){y(r,Jm);var i=C(r);function r(e){var t,n=1'),n.elRight=$(''),n.elDown=$(''),n.elLeft=$(''),n.elExit=$(''),n.elExit.click(function(){n.release()}),n.elUp.click(function(){var e=t.getFOV(),e=Math.tan(Be.degToRad(e/2));n.shear[1]+=.1*e}),n.elRight.click(function(){var e=t.getFOV(),e=Math.tan(Be.degToRad(e/2));n.shear[0]+=.1*e}),n.elDown.click(function(){var e=t.getFOV(),e=Math.tan(Be.degToRad(e/2));n.shear[1]-=.1*e}),n.elLeft.click(function(){var e=t.getFOV(),e=Math.tan(Be.degToRad(e/2));n.shear[0]-=.1*e}),n.scene=null,n.sceneControls=new Ps;return n.addEventListener("mousewheel",function(e){n.fovDelta+=-e.delta}),n}return A(i,[{key:"hasSomethingCaptured",value:function(){return null!==this.image}},{key:"capture",value:function(e){this.hasSomethingCaptured()||(this.image=e,this.originalFOV=this.viewer.getFOV(),this.originalControls=this.viewer.getControls(),this.viewer.setControls(this),this.viewer.scene.overrideCamera=this.shearCam,e=this.viewer.renderer.domElement,e=$(e.parentElement),this.shear=[0,0],e.append(this.elUp),e.append(this.elRight),e.append(this.elDown),e.append(this.elLeft),e.append(this.elExit))}},{key:"release",value:function(){this.image=null,this.viewer.scene.overrideCamera=null,this.elUp.detach(),this.elRight.detach(),this.elDown.detach(),this.elLeft.detach(),this.elExit.detach(),this.viewer.setFOV(this.originalFOV),this.viewer.setControls(this.originalControls)}},{key:"setScene",value:function(e){this.scene=e}},{key:"update",value:function(e){var t=this.viewer.getFOV(),n=t*(1+ +this.fovDelta/10),n=Math.max(this.fovMin,n),t=(n=Math.min(this.fovMax,n))/t,i=this.viewer.inputHandler.mouse,r=this.viewer.renderer.getSize(new Le),i=[i.x/r.x,(r.y-i.y)/r.y],r=r.x/r.y,a=2*Math.tan(Be.degToRad(n/2)),r=r*a,r=[this.shear[0]-.5*r,this.shear[0]+.5*r],a=[this.shear[1]-.5*a,this.shear[1]+.5*a],t=1-t,r=[(1-t)*this.shear[0]+t*((1-i[0])*r[0]+i[0]*r[1]),(1-t)*this.shear[1]+t*((1-i[1])*a[0]+i[1]*a[1])],t=(this.shear=r,this.viewer.setFOV(n),this.originalCam),i=this.shearCam,r=(t.fov=n,t.updateMatrixWorld(),t.updateProjectionMatrix(),i.copy(t),(a=i.rotation).set.apply(a,J(t.rotation.toArray())),i.updateMatrixWorld(),i.projectionMatrix.copy(t.projectionMatrix),N(this.shear,2)),n=r[0],a=r[1],t=(new _e).set(1,0,n,0,0,1,a,0,0,0,1,0,0,0,0,1),r=i.projectionMatrix;r.multiply(t),i.projectionMatrixInverse.copy(r).invert(),i.projectionMatrix.elements.reduce(function(e,t){return e+t},0);this.fovDelta*=0}}]),i}();var Qy,Vy,jy,Wy,Jy,qy,Xy,Yy,Ky,Zy,$y,ew,tw,nw,iw=new Ru(1,1),rw=new Hl,aw=(rw.vertices.push(new Re(-.5,-.5,0),new Re(.5,-.5,0),new Re(.5,.5,0),new Re(-.5,.5,0),new Re(-.5,-.5,0)),function(){function n(e){te(this,n),this.id=e,this.fov=1,this.position=new Re,this.rotation=new Re,this.width=0,this.height=0,this.fov=1;(e=new pa({uniforms:{tColor:{value:new Xn},uNear:{value:0},uOpacity:{value:1}},vertexShader:"\n\tuniform float uNear;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\t\n\tvoid main(){\n\t\tvDebug = vec4(0.0, 1.0, 0.0, 1.0);\n\t\tvec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);\n\t\t// make sure that this mesh is at least in front of the near plane\n\t\tmodelViewPosition.xyz += normalize(modelViewPosition.xyz) * uNear;\n\t\tgl_Position = projectionMatrix * modelViewPosition;\n\t\tvUV = uv;\n\t}\n\t",fragmentShader:"\n\tuniform sampler2D tColor;\n\tuniform float uOpacity;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\tvoid main(){\n\t\tvec4 color = texture2D(tColor, vUV);\n\t\tgl_FragColor = color;\n\t\tgl_FragColor.a = uOpacity;\n\t}\n\t",side:ve})).side=ve;var t=new vl({color:65280});this.mesh=new Z(iw,e),this.line=new xl(rw,t),this.texture=null,this.mesh.orientedImage=this}return A(n,[{key:"set",value:function(e,t,n,i){var t=t.map(Be.degToRad),r=((r=this.position).set.apply(r,J(e)),(r=this.mesh.position).set.apply(r,J(e)),(r=this.rotation).set.apply(r,J(t)),(e=this.mesh.rotation).set.apply(e,J(t)),N(n,2));this.width=r[0],this.height=r[1],this.mesh.scale.set(this.width/this.height,1,1),this.fov=i,this.updateTransform()}},{key:"updateTransform",value:function(){var e=this.mesh,t=this.line,n=this.fov,i=(e.updateMatrixWorld(),e.getWorldDirection()),n=Be.degToRad(n/2),n=-.5/Math.tan(n),i=i.clone().multiplyScalar(n);e.position.add(i),t.position.copy(e.position),t.scale.copy(e.scale),t.rotation.copy(e.rotation)}}]),n}()),ow=function(){y(n,Yf);var t=C(n);function n(){var e;return te(this,n),(e=t.call(this)).node=null,e.cameraParams=null,e.imageParams=null,e.images=null,e._visible=!0,e}return A(n,[{key:"visible",get:function(){return this._visible},set:function(e){if(this._visible!==e){var t,n=q(this.images);try{for(n.s();!(t=n.n()).done;){var i=t.value;i.mesh.visible=e,i.line.visible=e}}catch(e){n.e(e)}finally{n.f()}this._visible=e,this.dispatchEvent({type:"visibility_changed",images:this})}}}]),n}(),Tp=function(){function D(){te(this,D)}var i,t,n;return A(D,null,[{key:"loadCameraParams",value:(n=d(V().mark(function e(t){var n,i,r,a,o;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:return n=e.sent,e.next=5,n.text();case 5:return n=e.sent,r=new DOMParser,r=r.parseFromString(n,"application/xml"),o=parseInt(r.getElementsByTagName("width")[0].textContent),i=parseInt(r.getElementsByTagName("height")[0].textContent),r=parseFloat(r.getElementsByTagName("f")[0].textContent),a=i/2/r,a=2*Be.radToDeg(Math.atan(a)),o={path:t,width:o,height:i,f:r,fov:a},e.abrupt("return",o);case 15:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"loadImageParams",value:(t=d(V().mark(function e(t){var n,i,r,a,o,s,l;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:if((n=e.sent).ok){e.next=6;break}return console.error("failed to load ".concat(t)),e.abrupt("return");case 6:return e.next=8,n.text();case 8:i=e.sent,i=i.split(/\r?\n/),r=[],a=1;case 12:if(a\n\t\t'));return e.click(n),e}},{key:"init",value:function(){"merge"==Potree.settings.editType?(this.initMergeBar(),this.initToolbar(),this.initScene(),this.initNavigation()):(this.initAccordion(),this.initAppearance(),this.initToolbar(),this.initScene(),this.initNavigation(),this.initFilters(),this.initSettings(),"pano"!=Potree.settings.editType?(this.initAlignment(),this.initClipModel(),this.initSiteModel(),this.initParitcle(),this.initClippingModel()):this.initPanosEdit()),$("#potree_version_number").html(Potree.version.major+"."+Potree.version.minor+Potree.version.suffix)}},{key:"initAlignment",value:function(){function e(n,i){return function(){var e=$('#alignment li[name="selectPointCloud"] input:checked');Array.from(e).forEach(function(t){var e=viewer.scene.pointclouds.find(function(e){return e.name==t.name});n(e,i)})}}var t=viewer.modules.Alignment,n=$("#alignment"),i=n.find('[name="transform"] button');i.eq(0).on("click",e(t.rotate,10)),i.eq(1).on("click",e(t.rotate,1)),i.eq(2).on("click",e(t.rotate,.1)),i.eq(3).on("click",e(t.rotate,-10)),i.eq(4).on("click",e(t.rotate,-1)),i.eq(5).on("click",e(t.rotate,-.1)),i.eq(6).on("click",e(t.translate,new Re(-1,0,0))),i.eq(7).on("click",e(t.translate,new Re(1,0,0))),i.eq(8).on("click",e(t.translate,new Re(0,-1,0))),i.eq(9).on("click",e(t.translate,new Re(0,1,0))),i.eq(10).on("click",e(t.translate,new Re(0,0,-1))),i.eq(11).on("click",e(t.translate,new Re(0,0,1))),n.find("#startAlignment").on("click",function(){t.enter()}),n.find("#exitAlignment").on("click",function(){t.save(),t.leave()}),n.find("#rotTool").on("click",function(){t.switchHandle("rotate")}),n.find("#moveTool").on("click",function(){t.switchHandle("translate")})}},{key:"initMergeBar",value:function(){var e=$("#mergeModel"),t=(e.find("button"),viewer.modules.MergeEditor),r=!1;e.find('ul[name="model"] li button').on("click",function(e){var t,n,i;return r?console.log("还在加载",r):(t=$(e.target),n=t.parent().attr("name"),"select"==t.attr("name")?Potree.selectModel(n):void("添加"==t.text()?(i=Date.now(),Potree.addModel(n,function(){r=!1,t.text("删除");var e=Date.now();console.log("加载完毕",n,"用时",(e-i)/1e3,"s")}),r=n):(Potree.removeModel(n),t.text("添加"))))}),e.find('li button[name="splitScreen"]').on("click",function(e){e=$(e.target);"分屏"==e.text()?(e.text("恢复"),t.enterSplit()):(e.text("分屏"),t.leaveSplit())});e.find('li button[name="tag"]').on("click",function(e){$(e.target);viewer.tagTool.startInsertion()})}},{key:"initClippingModel",value:function(){var e=this,t=viewer.modules.clipping,n=$("#clipping"),i=n.find('[name="operation"] button[name="add"] '),r=n.find('[name="operation"] button[name="switchView"] '),a=n.find(' button[name="enter"] '),o=n.find(' button[name="exit"] '),s=n.find('[name="list"] ul ');a.on("click",function(){t.enter(),n.find("li[name=operation]").css("display","block"),n.find("li[name=list]").css("display","block")}),o.on("click",function(){t.leave(),n.find("li[name=operation]").css("display","none"),n.find("li[name=list]").css("display","none")}),r.on("click",function(){t.switchView("top"==t.activeViewName?"mainView":"top")}),n.find('[name="operation"] button[name="translation"] ').on("click",function(){t.setTranMode("translation")}),n.find('[name="operation"] button[name="rotation"] ').on("click",function(){t.setTranMode("rotation")}),n.find('[name="operation"] button[name="scale"] ').on("click",function(){t.setTranMode("scale")}),i.on("click",function(){var t=e.volumeTool.startInsertion({clip:!0,clipTask:Potree.ClipTask.SHOW_OUTSIDE}),n=$("
  • ");s.append(n),n.find("button[name=changeTask]").on("click",function(e){"不可见"==e.target.innerText?(t.clipTask=Potree.ClipTask.SHOW_INSIDE,e.target.innerText="可见"):(t.clipTask=Potree.ClipTask.SHOW_OUTSIDE,e.target.innerText="不可见"),t.update()}),n.find("button[name=chose]").on("click",function(e){viewer.transformObject(t)}),n.find("button[name=delete]").on("click",function(e){n.remove(),viewer.scene.removeVolume(t)})}),n.find("button[name=save]").on("click",function(e){t.saveClipData()})}},{key:"addAlignmentButton",value:function(e){var t=$('#alignment li[name="selectPointCloud"]>div'),e=$(' \n \n "));t.append(e)}},{key:"initClipModel",value:function(){var e=viewer.modules.Clip,t=$("#clipModel").find("button");t.eq(0).on("click",e.enter.bind(e)),t.eq(1).on("click",e.download.bind(e)),t.eq(2).on("click",e.leave.bind(e))}},{key:"initSiteModel",value:function(){var e=viewer.modules.SiteModel,t=$("#siteModel");t.find('button[name="start"] ').on("click",e.enter.bind(e)),t.find('button[name="exit"] ').on("click",e.leave.bind(e)),t.find('button[name="building"] ').on("click",e.startInsertion.bind(e,"building")),t.find('button[name="floor"] ').on("click",function(){e.addFloor(e.buildings[0],"top")}),t.find('button[name="room"] ').on("click",function(){e.startInsertion("room",e.buildings[0].buildChildren[0])}),t.find('button[name="digHole"] ').on("click",function(){e.selected&&e.startInsertion("hole",e.selected)}),t.find('button[name="selectBuilding"] ').on("click",function(){e.selectEntity(e.buildings[0])}),t.find('button[name="selectFloor"] ').on("click",function(){e.selectEntity(e.buildings[0].buildChildren[0])}),t.find('button[name="selectRoom"] ').on("click",function(){e.selectEntity(e.buildings[0].buildChildren[0].buildChildren[0])}),t.find('button[name="removeFirstBuilding"] ').on("click",function(){e.removeEntity(e.buildings[0])}),t.find('button[name="removeFirstFloor"] ').on("click",function(){e.removeEntity(e.buildings[0].buildChildren[0])}),t.find('button[name="removeFirstRoom"] ').on("click",function(){e.removeEntity(e.buildings[0].buildChildren[0].buildChildren[0])}),t.find('button[name="removeFirstHole"] ').on("click",function(){e.selected.removeHole(e.selected.holes[0])}),t.find('button[name="removeFirstMarker"] ').on("click",function(){e.selected.removeMarker(0)})}},{key:"initParitcle",value:function(){var e=viewer.modules.ParticleEditor,t=$("#particle");t.find('button[name="addFire"] ').on("click",function(){e.startInsertion("fire+smoke")}),t.find('button[name="addExplode"] ').on("click",function(){e.startInsertion("explode")})}},{key:"initPanosEdit",value:function(){var e=viewer.modules.PanoEditor,t=viewer.modules.Alignment,n=$("#panos");n.find('button[name="save"] ').on("click",function(){console.log("saveData",e.exportSavingData())}),n.find('button[name="translate"] ').on("click",function(){t.switchHandle("translate")}),n.find('button[name="rotate"] ').on("click",function(){t.switchHandle("rotate")}),n.find('button[name="topView"] ').on("click",function(){e.switchView("top")}),n.find('button[name="sideView"] ').on("click",function(){e.switchView("right")}),n.find('button[name="3DView"] ').on("click",function(){e.switchView("mainView")}),n.find('button[name="addLink"] ').on("click",function(){e.setLinkOperateState("addLink",!0)}),n.find('button[name="removeLink"] ').on("click",function(){e.setLinkOperateState("removeLink",!0)}),n.find('button[name="getCloser"] ').on("click",function(){e.setZoomInState(!0)})}},{key:"initToolbar",value:function(){var n=this,e=$("#tools"),e=(e.append(this.createToolIcon(Potree.resourcePath+"/icons/angle.png","[title]tt.angle_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showAngles:!0,showArea:!1,closed:!0,maxMarkers:3,minMarkers:3,measureType:"Angle"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/point.svg","[title]tt.point_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showAngles:!1,showCoordinates:!0,showEdges:!1,showArea:!1,closed:!0,maxMarkers:1,minMarkers:1,measureType:"Point"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]tt.distance_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!1,closed:!1,minMarkers:2,maxMarkers:2,measureType:"Distance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]MulDistance",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!1,closed:!1,minMarkers:2,measureType:"MulDistance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]Ver MulDistance",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({measureType:"Ver MulDistance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]Hor MulDistance",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({measureType:"Hor MulDistance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/height.svg","[title]tt.height_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showHeight:!0,showArea:!1,closed:!1,maxMarkers:2,minMarkers:2,measureType:"Ver Distance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/circle.svg","[title]tt.circle_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showHeight:!1,showArea:!1,showCircle:!0,showEdges:!1,closed:!1,maxMarkers:3,minMarkers:3,measureType:"Circle"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/azimuth.svg","Azimuth",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showHeight:!1,showArea:!1,showCircle:!1,showEdges:!1,showAzimuth:!0,closed:!1,maxMarkers:2,minMarkers:2,measureType:"Azimuth"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]tt.area_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:3,measureType:"Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]Hor Area",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:3,measureType:"Hor Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]Ver Area",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:3,measureType:"Ver Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]area_freedom_rect",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:4,maxMarkers:4,isRect:!0,measureType:"Rect Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]area_horizontal_rect",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:4,maxMarkers:4,isRect:!0,faceDirection:"horizontal",measureType:"Hor Rect Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]area_vertical_rect",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:4,maxMarkers:4,isRect:!0,faceDirection:"vertical",measureType:"Ver Rect Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/volume.svg","[title]tt.volume_measurement",function(){var t=n.volumeTool.startInsertion(),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/sphere_distances.svg","[title]tt.volume_measurement",function(){var t=n.volumeTool.startInsertion({type:mg}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/profile.svg","[title]tt.height_profile",function(){$("#menu_measurements").next().slideDown();var t=n.profileTool.startInsertion(),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/annotation.svg","[title]tt.annotation",function(){$("#menu_measurements").next().slideDown();var t=n.viewer.annotationTool.startInsertion(),e=$("#jstree_scene").jstree().get_json("annotations").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/reset_tools.svg","[title]tt.remove_all_measurement",function(){n.viewer.scene.removeAllMeasurements()})),$("#measurement_options_show")),t=(e.selectgroup({title:"Show/Hide labels"}),e.find("input").click(function(e){e="SHOW"===e.target.value;n.measuringTool.showLabels=e}),this.measuringTool.showLabels?"SHOW":"HIDE");e.find("input[value=".concat(t,"]")).trigger("click")}},{key:"initScene",value:function(){function t(e){var t=e.pointcloud,e="".concat(Potree.resourcePath,"/icons/cloud.svg"),n=w(b,t.name,e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function n(e){var e=e.measurement,t=ie.getMeasurementIcon(e);w(x,e.name,t,e)}function i(e){var t=e.volume,e=ie.getMeasurementIcon(t),n=w(x,t.name,e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function r(e){var e=e.profile,t=ie.getMeasurementIcon(e);w(x,e.name,t,e)}function e(e){var e=e.animation,t="".concat(Potree.resourcePath,"/icons/camera_animation.svg");w(E,"animation",t,e)}function a(e){var t=e.images,e="".concat(Potree.resourcePath,"/icons/picture.svg"),n=w(C,"images",e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function o(e){var t=e.images,e="".concat(Potree.resourcePath,"/icons/picture.svg"),n=w(C,"360° images",e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function s(e){var t,e=e.geopackage,n="".concat(Potree.resourcePath,"/icons/triangle.svg"),i=$("#jstree_scene"),r=q(e.node.children);try{for(r.s();!(t=r.n()).done;){var a=t.value,o=a.name,s=i.jstree("create_node","vectors",{text:o,icon:n,object:a,data:a},"last",!1,!1);i.jstree(a.visible?"check_node":"uncheck_node",s)}}catch(e){r.e(e)}finally{r.f()}}function l(t){var e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.measurement.uuid});y.jstree("delete_node",e.id)}var u,c=this,h=$("#menu_scene"),F=h.next().find("#scene_objects"),O=h.next().find("#scene_object_properties"),h=h.next().find("#scene_export"),d="".concat(Potree.resourcePath,"/icons/file_geojson.svg"),p="".concat(Potree.resourcePath,"/icons/file_dxf.svg"),f="".concat(Potree.resourcePath,"/icons/file_potree.svg"),m=(h.append('\n\t\t\t\tExport:
    \n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t')),h.find("img[name=geojson_export_button]").parent()),v=(m.click(function(e){var t=c.viewer.scene,t=[].concat(J(t.measurements),J(t.profiles),J(t.volumes));0')),w=(F.append(y),y.jstree({plugins:["checkbox","state"],core:{dblclick_toggle:!1,state:{checked:!0},check_callback:!0,expand_selected_onload:!0},checkbox:{keep_selected_style:!0,three_state:!1,whole_node:!1,tie_selection:!1}}),function(e,t,n,i){e=y.jstree("create_node",e,{text:t,icon:n,data:i},"last",!1,!1);return i.visible?y.jstree("check_node",e):y.jstree("uncheck_node",e),e}),b=y.jstree("create_node","#",{text:"Point Clouds",id:"pointclouds"},"last",!1,!1),x=y.jstree("create_node","#",{text:"Measurements",id:"measurements"},"last",!1,!1),d=y.jstree("create_node","#",{text:"Annotations",id:"annotations"},"last",!1,!1),E=y.jstree("create_node","#",{text:"Other",id:"other"},"last",!1,!1),p=y.jstree("create_node","#",{text:"Vectors",id:"vectors"},"last",!1,!1),C=y.jstree("create_node","#",{text:" Images",id:"images"},"last",!1,!1),N=(y.jstree("check_node",b),y.jstree("check_node",x),y.jstree("check_node",d),y.jstree("check_node",E),y.jstree("check_node",p),y.jstree("check_node",C),y.on("create_node.jstree",function(e,t){y.jstree("open_all")}),y.on("select_node.jstree",function(e,t){t=t.node.data;A.set(t),c.viewer.inputHandler.deselectAll(),t instanceof pg&&c.viewer.inputHandler.toggleSelection(t),$(c.viewer.renderer.domElement).focus()}),y.on("deselect_node.jstree",function(e,t){A.set(null)}),y.on("delete_node.jstree",function(e,t){A.set(null)}),y.on("dblclick",".jstree-anchor",function(e){var t,n,i=$.jstree.reference(e.target).get_node(e.target).data;e.target.classList.contains("jstree-checkbox")||(i instanceof Zf?(e=c.viewer.getBoundingBox([i]),(n=new K).boundingBox=e,c.viewer.zoomTo(n,1,500)):i instanceof eg?(e=i.points.map(function(e){return e.position}),0==(n=(new Y).setFromPoints(e)).getSize(new Re).length()&&(n.min=n.max.clone(),n.expandByVector(new Re(1,1,1))),(e=new K).boundingBox=n,c.viewer.zoomTo(e,2,500)):i instanceof ff?(n=i.points,0<(e=(new Y).setFromPoints(n)).getSize(new Re).length()&&((n=new K).boundingBox=e,c.viewer.zoomTo(n,1,500))):i instanceof pg?0<(e=i.boundingBox.clone().applyMatrix4(i.matrixWorld)).getSize(new Re).length()&&((n=new K).boundingBox=e,c.viewer.zoomTo(n,1,500)):i instanceof zm?i.moveHere(c.viewer.scene.getActiveCamera()):i instanceof Uf?(e=i.camera.getWorldDirection(new Re),i.camera instanceof mh?(e.multiplyScalar(i.camera.right),t=(new Re).addVectors(i.camera.position,e),c.viewer.setCameraMode(am.ORTHOGRAPHIC)):i.camera instanceof ma&&(e.multiplyScalar(c.viewer.scene.view.radius),t=(new Re).addVectors(i.camera.position,e),c.viewer.setCameraMode(am.PERSPECTIVE)),c.viewer.scene.view.position.copy(i.camera.position),c.viewer.scene.view.lookAt(t)):"SpotLight"===i.type?(n=0\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t')),e=r.find("input"),i=r.find("#".concat(i)),e=(e.click(function(e){c.viewer.setClassificationVisibility(t,e.target.checked)}),n.color.map(function(e){return 255*e}).join(", ")),e="rgb(".concat(e,")");i.spectrum({color:e,showInput:!0,preferredFormat:"rgb",cancelText:"",chooseText:"Apply",move:function(e){e=e.toRgb(),e=[e.r/255,e.g/255,e.b/255,1];n.color=e},change:function(e){e=e.toRgb(),e=[e.r/255,e.g/255,e.b/255,1];n.color=e}}),h.append(r)},n=function(){var e=$('\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t');e.find("input").click(function(e){c.viewer.toggleAllClassificationsVisibility()}),h.append(e)},i=function(){var e=$('\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t');e.find("input").click(function(){for(var e=c.viewer.classifications,t=0,n=Object.keys(e);t h3").each(function(){var e=$(this),t=$(this).next();t.hide(),e.click(function(){t.slideToggle()})}),[["EN","en"],["FR","fr"],["DE","de"],["JP","jp"],["ES","es"],["SE","se"],["ZH","zh"]]),o=$("#potree_languages"),e=0;e".concat(n,""));t.click(function(){return r.viewer.setLanguage(i)}),0===e&&t.css("margin-left","30px"),o.append(t),e"),e.append(this.createToolIcon(Potree.resourcePath+"/icons/left.svg","[title]tt.left_view_control",function(){n.viewer.setLeftView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/right.svg","[title]tt.right_view_control",function(){n.viewer.setRightView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/front.svg","[title]tt.front_view_control",function(){n.viewer.setFrontView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/back.svg","[title]tt.back_view_control",function(){n.viewer.setBackView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/top.svg","[title]tt.top_view_control",function(){n.viewer.setTopView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/bottom.svg","[title]tt.bottom_view_control",function(){n.viewer.setBottomView()})),$('\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t')),e=(e.append(a),a.selectgroup({title:"Camera Projection"}),a.find("input").click(function(e){n.viewer.setCameraMode(am[e.target.value])}),Object.keys(am).filter(function(e){return am[e]===n.viewer.scene.cameraMode})),o=(a.find("input[value=".concat(e,"]")).trigger("click"),new Le(1,1e4));i.slider({value:t(this.viewer.getMoveSpeed()),min:0,max:1,step:.01,slide:function(e,t){n.viewer.setMoveSpeed((t=t.value,Math.pow(t,4)*o.y+o.x))}}),this.viewer.addEventListener("move_speed_changed",function(e){r.html(n.viewer.getMoveSpeed().toFixed(1)),i.slider({value:t(n.viewer.getMoveSpeed())})}),r.html(this.viewer.getMoveSpeed().toFixed(1))}},{key:"initSettings",value:function(){var n=this,e=($("#sldMinNodeSize").slider({value:this.viewer.getMinNodeSize(),min:0,max:1e3,step:.01,slide:function(e,t){n.viewer.setMinNodeSize(t.value)}}),this.viewer.addEventListener("minnodesize_changed",function(e){$("#lblMinNodeSize").html(parseInt(n.viewer.getMinNodeSize())),$("#sldMinNodeSize").slider({value:n.viewer.getMinNodeSize()})}),$("#lblMinNodeSize").html(parseInt(this.viewer.getMinNodeSize())),$("#splat_quality_options")),t=(e.selectgroup({title:"Splat Quality"}),e.find("input").click(function(e){"standard"===e.target.value?n.viewer.useHQ=!1:"hq"===e.target.value&&(n.viewer.useHQ=!0)}),this.viewer.useHQ?"hq":"standard");e.find("input[value=".concat(t,"]")).trigger("click"),$("#show_bounding_box").click(function(){n.viewer.setShowBoundingBox($("#show_bounding_box").prop("checked"))}),$("#set_freeze").click(function(){n.viewer.setFreeze($("#set_freeze").prop("checked"))})}}]),t}(),Bw=function(){y(i,Yf);var n=C(i);function i(e){var t;return te(this,i),(t=n.call(this)).viewer=e,t.renderer=e.renderer,t.sg=new Hu(.1),t.sm=new sc,t.s=new Z(t.sg,t.sm),t}return A(i,[{key:"startInsertion",value:function(){function t(e){e.button===le.LEFT?s.finish():e.button===le.RIGHT&&s.cancel()}function n(e){viewer.scene.scene.remove(i.s),i.s.removeEventListener("drag",l),i.s.removeEventListener("drop",n)}var i=this,r=this.viewer.renderer.domElement,a=new zm({position:[589748.27,231444.54,753.675],title:"Annotation Title",description:"Annotation Description"}),o=(this.dispatchEvent({type:"start_inserting_annotation",annotation:a}),this.viewer.scene.annotations),s=(o.add(a),{cancel:null,finish:null}),l=(s.cancel=function(e){o.remove(a),r.removeEventListener("mouseup",t,!0)},s.finish=function(e){r.removeEventListener("mouseup",t,!0)},r.addEventListener("mouseup",t,!0),function(e){e=ie.getMousePointCloudIntersection(e.drag.end,e.viewer.scene.getActiveCamera(),e.viewer,e.viewer.scene.pointclouds,{pickClipped:!0});e&&(i.s.position.copy(e.location),a.position.copy(e.location))});return this.s.addEventListener("drag",l),this.s.addEventListener("drop",n),this.viewer.scene.scene.add(this.s),this.viewer.inputHandler.startDragging(this.s),a}},{key:"update",value:function(){}},{key:"render",value:function(){}}]),i}(),_w={priorityEvent:[{zoomInCloud:"zoom-in"},{hoverPano:"pointer"},{connectPano:"url({Potree.resourcePath}/images/connect.png),auto"},{disconnectPano:"url({Potree.resourcePath}/images/connect-dis.png),auto"},{hoverLine:"pointer"},{hoverTranHandle:"grab"},{movePointcloud:"move"},{polygon_isIntersectSelf:"not-allowed"},{polygon_AtWrongPlace:"not-allowed"},{markerMove:"grab"},{mapClipMove:"move"},{mapClipRotate:"url({Potree.resourcePath}/images/rotate-cursor.png),auto"},{rotatePointcloud:"url({Potree.resourcePath}/images/rotate-cursor.png),auto"},{siteModelFloorDrag:"row-resize"},{addSth:"cell"}],list:[],currentCursorIndex:null,init:function(e,t){var n=this;this.priorityEvent.forEach(function(e){for(var t in e)e[t]=ag.replaceAll(e[t],"{Potree.resourcePath}",Potree.resourcePath)}),this.domElements=t.map(function(e){return e.renderArea}),e.addEventListener("CursorChange",function(e){"add"==e.action?n.add(e.name):n.remove(e.name)})},add:function(t){var e=this.priorityEvent.find(function(e){return e[t]});e?this.list.includes(t)||(this.judge({addItem:e,name:t}),this.list.push(t)):console.error("CursorDeal 未定义优先级 name:"+t)},remove:function(e){e=this.list.indexOf(e);-1=r}).reduce(function(e,t){return t.fromBase(n)=r}).reduce(function(e,t){return t.toBase(n)n))return i=this.holes.concat(this.parentHoles).filter(function(e){return e!=t&&2i)&&(e.zMax=i),o&&(o.zMin=e.zMax,o.update(),o.dispatchEvent({type:"changeHeight"}))):(o=e.buildParent.buildChildren[a-1],e.zMin=Math.max(e1.zMin,n),i=e.zMax-.5,e.zMin>i?e.zMin=i:o&&(r=o.zMin+.5,e.zMinthis.times[n];)n++;return 0==n?this.values[0]:n==i?this.values[i-1]:(t=(e-this.times[n-1])/(this.times[n]-this.times[n-1]),this.values[0]instanceof Re?this.values[n-1].clone().lerp(this.values[n],t):this.values[n-1]+t*(this.values[n]-this.values[n-1]))}}},{key:"clone",value:function(){return ag.CloneClassObject(this)}}]),n}(),P1=function(){function t(){var e=0 0.5 ) \t\t\t\t\n vColor = vec4( customColor, customOpacity ); \n else\t\t\t\t\t\t\t\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\t\t\n \n vAngle = customAngle;\n\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n //gl_PointSize = customSize * ( 300.0 / length( mvPosition.xyz ) ); \n gl_Position = projectionMatrix * mvPosition;\n gl_PointSize = ( heightOfNearPlane * customSize ) / gl_Position.w;\n \n \n }\n",L1=(Object.freeze({CUBE:1,SPHERE:2}),new sa(1,1,1,1),new L({wireframe:!0,color:"#ffffff"}),{positions:[],positionStyle:"sphere",positionBase:new Re(0,0,0),positionSpread:new Re(1,1,0),radius:1,velocityStyle:"cube",velocityBase:new Re(0,0,.5),velocitySpread:new Re(1,1,.3),accelerationBase:.3,accelerationSpread:.6,speedBase:.1,speedSpread:.5,angleBase:0,angleSpread:360,angleVelocityBase:1,angleVelocitySpread:30,angleAccelerationBase:1,angleAccelerationSpread:5,sizeBase:0,sizeSpread:0,sizeTween:[[0,.3,1],[.3,1.4,6]],colorBase:new Re(0,1,.5),colorSpread:new Re(0,0,0),colorTween:new D1([.2,1],[new Re(0,0,.4),new Re(0,0,.1)]),opacityBase:.1,opacitySpread:.2,opacityTween:[[0,.1,.9,1],[.1,.4,.03,0]],strength:1,particleDeathAge:3,height:3}),R1=(new Z(new zu(.03,5,5),new L({color:"white",depthTest:!1})),function(){y(s,Pl);var o=C(s);function s(){var t,e,n=01",e);for(var t,n=[],i=[],r=[],a=[],o=[],s=[],l=[],u=[],c=0;cthis.particleDeathAge*t)&&(this.particleArray[c].velocity=this.randomVector3(this.velocityBase,this.velocitySpread),this.particleArray[c].lastChangeVage=this.particleArray[c].age),this.particleArray[c].update(e),this.particleArray[c].age>this.particleDeathAge&&(this.particleArray[c].alive=0,n.push(c),i.push((this.particleArray[c].age-this.particleDeathAge)%this.particleDeathAge)),r[3*c]=this.particleArray[c].position.x,r[3*c+1]=this.particleArray[c].position.y,r[3*c+2]=this.particleArray[c].position.z,a[3*c]=this.particleArray[c].color.r,a[3*c+1]=this.particleArray[c].color.g,a[3*c+2]=this.particleArray[c].color.b,o[c]=this.particleArray[c].alive,s[c]=this.particleArray[c].opacity,l[c]=this.particleArray[c].size,u[c]=this.particleArray[c].angle);if(this.geometry.setAttribute("position",new Q(new Float32Array(r),3)),this.geometry.setAttribute("customColor",new Q(new Float32Array(a),3)),this.geometry.setAttribute("customVisible",new Q(new Float32Array(o),1)),this.geometry.setAttribute("customOpacity",new Q(new Float32Array(s),1)),this.geometry.setAttribute("customSize",new Q(new Float32Array(l),1)),this.geometry.setAttribute("customAngle",new Q(new Float32Array(u),1)),this.geometry.attributes.customColor.needsUpdate=!0,this.geometry.attributes.customVisible.needsUpdate=!0,this.geometry.attributes.customOpacity.needsUpdate=!0,this.geometry.attributes.customSize.needsUpdate=!0,this.geometry.attributes.customAngle.needsUpdate=!0,this.emitterAgethis.particleCount&&(p=this.particleCount);for(c=d;c 0.5) {\n vColor = vec4(color, opacity);\n } else {\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n vAngle = angle;\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n \n gl_PointSize = ( heightOfNearPlane * size ) / gl_Position.w;\n }\n",fragmentShader:"\n uniform sampler2D u_sampler;\n varying vec4 vColor;\n varying float vAngle;\n void main() {\n gl_FragColor = vColor;\n float u = cos(vAngle);\n float v = sin(vAngle);\n vec2 uv = vec2(\n u * (gl_PointCoord.x - 0.5) + v * (gl_PointCoord.y - 0.5) + 0.5, \n u * (gl_PointCoord.y - 0.5) - v * (gl_PointCoord.x - 0.5) + 0.5\n );\n vec4 texture = texture2D(u_sampler, uv);\n gl_FragColor = gl_FragColor * texture;\n }\n",transparent:!0,alphaTest:.5,depthTest:this.blendMode==Ae,blending:this.blendMode})}},{key:"createParticles",value:function(){this.particles=[];for(var e=this.particleCount,t=new Float32Array(3*e),n=new Float32Array(3*e),i=new Float32Array(e),r=new Float32Array(e),a=new Float32Array(e),o=new Float32Array(e),s=0;s1",e);for(var t=this.particleDeathAge,n=this.particleSpaceTime,i=[],r=[],a=[],o=this.geometry.attributes.position.array,s=this.geometry.attributes.opacity.array,l=this.geometry.attributes.visible.array,u=this.geometry.attributes.color.array,c=this.geometry.attributes.angle.array,h=this.geometry.attributes.size.array,d=0;dt&&(f.alive=0,f.rebornCount>=this.recycleTimes?f.deadAge=f.age-t:(i.push(d),r.push(f.age-t),a.push(f.rebornCount+1))),o[3*d]=f.position.x,o[3*d+1]=f.position.y,o[3*d+2]=f.position.z,u[3*d]=f.color.r,u[3*d+1]=f.color.g,u[3*d+2]=f.color.b,l[d]=f.alive,s[d]=f.opacity,c[d]=f.angle,h[d]=f.size):f.rebornCount>=this.recycleTimes&&f.age>t&&(f.deadAge+=e),f.rebornCount>=this.recycleTimes&&f.age>t&&f.deadAge>=n&&(i.push(d),p=t*(this.recycleTimes+1)+n,r.push((f.deadAge-n)%p),a.push(0))}if(this.geometry.attributes.size.needsUpdate=!0,this.geometry.attributes.color.needsUpdate=!0,this.geometry.attributes.angle.needsUpdate=!0,this.geometry.attributes.visible.needsUpdate=!0,this.geometry.attributes.opacity.needsUpdate=!0,this.geometry.attributes.position.needsUpdate=!0,this.alive){if(this.agethis.particleCount&&(v=this.particleCount);for(var g=m;gthis.deathAge&&!this.loop&&(this.alive=!1)}}else viewer.updateVisible(this,"isInsideFrustum",!1)}}},{key:"setSize",value:function(e){e=e.viewport;this.screenHeight=e.resolution.y,this.setPerspective(this.fov,this.screenHeight)}},{key:"setFov",value:function(e){this.fov=e,this.setPerspective(this.fov,this.screenHeight)}},{key:"setPerspective",value:function(e,t){t=Math.abs(t/(2*Math.tan(Be.degToRad(.5*e))));this.material.uniforms.heightOfNearPlane.value=t}},{key:"updateGeometry",value:function(){this.computeParams(),this.reStart()}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.dispatchEvent("dispose")}}]),a}(),Q1={"fire+smoke":16777215,smoke:16777215,explode:16777215},V1={clipDistance:100,occlusionDistance:60,maxClipFactor:.5,backColor:"#777",useDepth:!0,transparent:!0},j1={bus:new zn,particleGroup:new K,curveGroup:new K,init:function(){this.particleGroup.name="particles",viewer.scene.scene.add(this.particleGroup),this.curveGroup.name="particles-curves",viewer.scene.scene.add(this.curveGroup)},addParticle:function(){var e,t=0t._taskLoad?-1:1});var n,e=r.workerPool[r.workerPool.length-1];return e._taskCosts[t]=i,e._taskLoad+=i,e})}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map(function(e){return e._taskLoad}))}},{key:"dispose",value:function(){for(var e=0;e>8&255,c>>16&255,c>>24&255)),n;h=!0,u=64,n.format=St}n.mipmapCount=1,131072&l[2]&&!1!==t&&(n.mipmapCount=Math.max(1,l[7]));r=l[28];if(n.isCubemap=!!(512&r),!n.isCubemap||1024&r&&2048&r&&4096&r&&8192&r&&16384&r&&32768&r){n.width=l[4],n.height=l[3];for(var d=l[1]+4,p=n.isCubemap?6:1,f=0;f>1,1),v=Math.max(v>>1,1)}}else console.error("THREE.DDSLoader.parse: Incomplete cubemap faces")}return n}});var Jb=function(){y(n,pa);var t=C(n);function n(){var e=0=2.0 are supported."));else{var s=new Nx(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l",n).replace("#include ",i).replace("#include ",r).replace("#include ",a).replace("#include ",o)},Object.defineProperties(G(t),{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){(s.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){(s.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete t.metalness,delete t.roughness,delete t.metalnessMap,delete t.roughnessMap,t.setValues(e),t}return A(u,[{key:"copy",value:function(e){return k(_(u.prototype),"copy",this).call(this,e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}]),u}(),wx=function(){function e(){te(this,e),this.name=Zb.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}return A(e,[{key:"getMaterialType",value:function(){return yx}},{key:"extendParams",value:function(e,t,n){var i,t=t.extensions[this.name],r=(e.color=new Me(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(i=t.diffuseFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.diffuseTexture&&r.push(n.assignTexture(e,"map",t.diffuseTexture,Ln)),e.emissive=new Me(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new Me(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(i=t.specularGlossinessTexture,r.push(n.assignTexture(e,"glossinessMap",i)),r.push(n.assignTexture(e,"specularMap",i,Ln))),Promise.all(r)}},{key:"createMaterial",value:function(e){var t=new yx(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=void 0===e.emissiveIntensity?1:e.emissiveIntensity,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=Fn,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t}}]),e}(),bx=A(function e(){te(this,e),this.name=Zb.KHR_MESH_QUANTIZATION}),xx=function(){y(a,pc);var r=C(a);function a(e,t,n,i){return te(this,a),r.call(this,e,t,n,i)}return A(a,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i,a=0;a!==i;a++)t[a]=n[r+a];return t}},{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=i-t,i=(n-t)/u,n=i*i,t=n*i,c=e*l,h=c-l,d=-2*t+3*n,p=t-n,f=1-d,m=p-n+i,v=0;v!==o;v++){var g=a[h+v+o],A=a[h+v+s]*u,y=a[c+v+o],w=a[c+v]*u;r[v]=f*g+m*A+d*y+p*w}return r}}]),a}(),Ex=new X,Cx=function(){y(r,xx);var e=C(r);function r(){return te(this,r),e.apply(this,arguments)}return A(r,[{key:"interpolate_",value:function(e,t,n,i){e=k(_(r.prototype),"interpolate_",this).call(this,e,t,n,i);return Ex.fromArray(e).normalize().toArray(e),e}}]),r}(),Bx={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},_x={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Mx={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Tx={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Sx={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ix={CUBICSPLINE:void 0,LINEAR:Sn,STEP:Tn},Dx="OPAQUE",Px="MASK",kx="BLEND";function Lx(e,t,n){for(var i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function Rx(e,t){void 0!==t.extras&&("object"===v(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Fx(e){for(var t="",n=Object.keys(e).sort(),i=0,r=n.length;ithis._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}},{key:"_getAvailableWorker",value:function(){var e;return 0i&&(n=Math.min(n,i/e.width)),e.width*n),e=e.height*n,n=["font-size:1px;","padding:".concat(Math.floor(e/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(e,"px;"),"background:url(".concat(r,");"),"background-size:".concat(i,"px ").concat(e,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),n]}function cC(e,t){var n,i=1=AC(e)}},{key:"_getLogFunction",value:function(e,t,n,i,r){if(this._shouldLog(e)){r=yC({logLevel:e,message:t,args:i,opts:r}),hC(n=n||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=dC();e=r.tag||r.message;if(r.once){if(vC[e])return mC;vC[e]=dC()}return t=function(e,t,n){{var i;"string"==typeof t&&(i=n.time?function(e,t){return t=Math.max((12*Math.PI)throw Error("radians");i*=Math.tan(t/2),t=i*n;return(new c).ortho({left:-t,right:t,bottom:-i,top:i,near:r,far:e})}},{key:"perspective",value:function(){var e=02*Math.PI)throw Error("radians");return n=this,t=t,i=i,r=r,e=e,t=1/Math.tan(t/2),n[0]=t/i,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,null!=e&&e!==1/0?(n[10]=(e+r)*(i=1/(r-e)),n[14]=2*e*r*i):(n[10]=-1,n[14]=-2*r),this.check()}},{key:"determinant",value:function(){return t=(e=this)[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],e=e[15],(t*o-n*a)*(h*e-d*m)-(t*s-i*a)*(c*e-d*f)+(t*l-r*a)*(c*m-h*f)+(n*s-i*o)*(u*e-d*p)-(n*l-r*o)*(u*m-h*p)+(i*l-r*s)*(u*f-c*p);var e,t,n,i,r,a,o,s,l,u,c,h,d,p,f,m}},{key:"getScale",value:function(){var e=0t[a=0]&&(a=1),n=((a=t[8]>t[3*a+a]?2:a)+1)%3,i=(a+2)%3,r=Math.sqrt(t[3*a+a]-t[3*n+n]-t[3*i+i]+1),e[a]=.5*r,e[3]=(t[3*n+i]-t[3*i+n])*(r=.5/r),e[n]=(t[3*n+a]+t[3*a+n])*r,e[i]=(t[3*i+a]+t[3*a+i])*r),e}var n_,i_,r_,a_=function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e},o_=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e},s_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},l_=function(e,t,n,i){var r=t[0],a=t[1],o=t[2],t=t[3];return e[0]=r+i*(n[0]-r),e[1]=a+i*(n[1]-a),e[2]=o+i*(n[2]-o),e[3]=t+i*(n[3]-t),e},u_=function(e){var t=e[0],n=e[1],i=e[2],e=e[3];return Math.hypot(t,n,i,e)},c_=function(e){var t=e[0],n=e[1],i=e[2],e=e[3];return t*t+n*n+i*i+e*e},h_=function(e,t){var n=t[0],i=t[1],r=t[2],t=t[3],a=n*n+i*i+r*r+t*t;return 0v_);return x_.scale([A,y,w]).to(n)}}(e,this,t)}},{key:"scaleToGeocentricSurface",value:function(e){var t=1=this.radii.z-t))return O_.set(0,0,e).to(n)}}],[{key:"WGS84",get:function(){return k_=k_||new i(6378137,6378137,6356752.314245179)}}]),i}(),z_=A(function e(t,n,i){te(this,e),l(this,"item",void 0),l(this,"previous",void 0),l(this,"next",void 0),this.item=t,this.previous=n,this.next=i}),H_=function(){function e(){te(this,e),l(this,"head",null),l(this,"tail",null),l(this,"_length",0)}return A(e,[{key:"length",get:function(){return this._length}},{key:"add",value:function(e){e=new z_(e,this.tail,null);return this.tail?this.tail.next=e:this.head=e,this.tail=e,++this._length,e}},{key:"remove",value:function(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}},{key:"splice",value:function(e,t){e!==t&&(this.remove(t),this._insert(e,t))}},{key:"_insert",value:function(e,t){var n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,++this._length}}]),e}();function Q_(e){return null!=e}var V_=function(){function e(){te(this,e),l(this,"_list",void 0),l(this,"_sentinel",void 0),l(this,"_trimTiles",void 0),this._list=new H_,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}return A(e,[{key:"reset",value:function(){this._list.splice(this._list.tail,this._sentinel)}},{key:"touch",value:function(e){e=e._cacheNode;Q_(e)&&this._list.splice(this._sentinel,e)}},{key:"add",value:function(e,t,n){Q_(t._cacheNode)||(t._cacheNode=this._list.add(t),n&&n(e,t))}},{key:"unloadTile",value:function(e,t,n){var i=t._cacheNode;Q_(i)&&(this._list.remove(i),t._cacheNode=void 0,n)&&n(e,t)}},{key:"unloadTiles",value:function(e,t){for(var n=this._trimTiles,i=(this._trimTiles=!1,this._list),r=1024*e.maximumMemoryUsage*1024,a=this._sentinel,o=i.head;o!==a&&(e.gpuMemoryUsageInBytes>r||n);){var s=o.item,o=o.next;this.unloadTile(e,s,t)}}},{key:"trim",value:function(){this._trimTiles=!0}}]),e}();var j_=Object.freeze({OUTSIDE:-1,INTERSECTING:0,INSIDE:1}),W_=(new B,new B,new B),J_=new B,q_=function(){function n(){var e=0this.radius&&(this.radius=e),this}},{key:"transform",value:function(e){this.center.transform(e);t=W_,i=(n=e)[0],r=e[1],a=e[2],o=e[4],s=e[5],l=e[6],u=e[8],c=e[9],n=e[10],t[0]=Math.hypot(i,r,a),t[1]=Math.hypot(o,s,l),t[2]=Math.hypot(u,c,n);var t,n,i,r,a,o,s,l,u,c,e=t;return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}},{key:"distanceSquaredTo",value:function(e){e=this.distanceTo(e);return e*e}},{key:"distanceTo",value:function(e){e=(e=W_.from(e)).subtract(this.center);return Math.max(0,e.len()-this.radius)}},{key:"intersectPlane",value:function(e){var t=this.center,n=this.radius,t=e.normal.dot(t)+e.distance;return t<-n?j_.OUTSIDE:tthis._array.length&&(this._array.length=e)}},{key:"values",get:function(){return this._array}},{key:"get",value:function(e){return Vx(e=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}},{key:"delete",value:function(e){var t=this._map.get(e);0<=t&&(this._array.splice(t,1),this._map.delete(e),this.length--)}},{key:"peek",value:function(){return this._array[this._length-1]}},{key:"push",value:function(e){var t;this._map.has(e)||(t=this.length++,this._array[t]=e,this._map.set(e,t))}},{key:"pop",value:function(){var e=this._array[--this.length];return this._map.delete(e),e}},{key:"reserve",value:function(e){Vx(0<=e),e>this._array.length&&(this._array.length=e)}},{key:"resize",value:function(e){Vx(0<=e),this.length=e}},{key:"trim",value:function(e){null==e&&(e=this.length),this._array.length=e}},{key:"reset",value:function(){this._array=[],this._map=new Map,this._length=0}},{key:"find",value:function(e){return this._map.has(e)}}]),t}(),eT={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:function(){},viewportTraversersMap:{},basePath:""},tT=function(){function t(e){te(this,t),l(this,"options",void 0),l(this,"root",void 0),l(this,"requestedTiles",void 0),l(this,"selectedTiles",void 0),l(this,"emptyTiles",void 0),l(this,"_traversalStack",void 0),l(this,"_emptyTraversalStack",void 0),l(this,"_frameNumber",void 0),this.options=g(g({},eT),e),this._traversalStack=new $M,this._emptyTraversalStack=new $M,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}}return A(t,[{key:"traverse",value:function(e,t,n){this.root=e,this.options=g(g({},this.options),n),this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}},{key:"reset",value:function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}},{key:"executeTraversal",value:function(e,t){var n=this._traversalStack;for(e._selectionDepth=1,n.push(e);0this.options.maximumScreenSpaceError}},{key:"updateTileVisibility",value:function(e,t){var n=[];if(this.options.viewportTraversersMap)for(var i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===t.viewport.id&&n.push(i);else n.push(t.viewport.id);e.updateVisibility(t,n)}},{key:"compareDistanceToCamera",value:function(e,t){return e._distanceToCamera-t._distanceToCamera}},{key:"anyChildrenVisible",value:function(e,t){var n,i=!1,r=q(e.children);try{for(r.s();!(n=r.n()).done;){var a=n.value;a.updateVisibility(t),i=i||a.isVisibleAndInRequestVolume}}catch(e){r.e(e)}finally{r.f()}return i}},{key:"executeEmptyTraversal",value:function(e,t){var n=!0,i=this._emptyTraversalStack;for(i.push(e);0")}}]),r}(Symbol.toStringTag);function zT(e,t,n){var i=function(e){switch(e.constructor){case Int8Array:return new ST;case Uint8Array:return new PT;case Int16Array:return new IT;case Uint16Array:return new kT;case Int32Array:return new DT;case Uint32Array:return new LT;case Float32Array:return new NT;case Float64Array:return new GT;default:throw new Error("array type not supported")}}(t.value),n=n||function(e){var t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new _T(e,new UT(t.size,new _T("value",i)),!1,n)}function HT(e,t,n){var i,r=VT(t.metadata),a=[],o=function(e){var t,n={};for(t in e){var i=e[t];n[i.name||"undefined"]=i}return n}(t.attributes);for(i in e){var s=QT(i,e[i],o[i]);a.push(s)}return n&&(t=QT("indices",n),a.push(t)),new ET(a,r)}function QT(e,t,n){return zT(e,t,n?VT(n.metadata):void 0)}function VT(e){var t,n=new Map;for(t in e)n.set("".concat(t,".string"),JSON.stringify(e[t]));return n}var jT={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},WT={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},JT=function(){function t(e){te(this,t),l(this,"draco",void 0),l(this,"decoder",void 0),l(this,"metadataQuerier",void 0),this.draco=e,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier}return A(t,[{key:"destroy",value:function(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}},{key:"parseSync",value:function(e){var t,n,i,r,a,o,s=1>5&63,i=31&e;return t[0]=(e>>11&31)<<3,t[1]=n<<2,t[2]=i<<3,t}(t[c]);u[3*c]=h[0],u[3*c+1]=h[1],u[3*c+2]=h[2]}return{type:iS.UNSIGNED_BYTE,value:u,size:3,normalized:!0}}return t&&t.length===3*a?{type:iS.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:iS.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}var SS=new B;function IS(e,t){if(!t)return null;if(e.isOctEncoded16P){for(var n=new Float32Array(3*e.pointsLength),i=0;i=3&&t.getUint16(0,AI)===65496&&t.getUint8(2)===255)for(var e=function(){for(var e=new Set([65499,65476,65484,65501,65534]),t=65504;t<65520;++t)e.add(t);var n=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:n}}(),n=e.tableMarkers,i=e.sofMarkers,r=2;r+9SD+ID),o=r.getUint32(a+0,FD),s=r.getUint32(a+4,FD),a+=ID,Vx(s===RD),ND(i,r,a,o),a=(a+=o)+GD(i,r,a,i.header.byteLength);case 2:s=u,o=l,r={},Vx((i=e).header.byteLength>SD+ID);for(var h=i,d=s,p=o,f=r;p+8<=h.header.byteLength;){var m=d.getUint32(p+0,FD),v=d.getUint32(p+4,FD);switch(p+=ID,v){case DD:ND(h,d,p,m);break;case PD:GD(h,d,p,m);break;case kD:f.strict||ND(h,d,p,m);break;case LD:f.strict||GD(h,d,p,m)}p+=CE(m,4)}return o+i.header.byteLength;default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}function ND(e,t,n,i){t=new Uint8Array(t.buffer,n,i),n=new TextDecoder("utf8").decode(t);e.json=JSON.parse(n),CE(i,4)}function GD(e,t,n,i){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:i,arrayBuffer:t.buffer}),CE(i,4)}function UD(){return(UD=d(V().mark(function e(o,s){var l,u,c,h,d,p,f=arguments;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:l=3>1&1,P=y>>2&1,w=(Math.pow(A,p)-1)/(A-1),y=pP(E.mortonIndex,y),w=w+y,b=pP(E.x,b),x=pP(E.y,x),E=pP(E.z,P),P=!1,C>t&1))}function pP(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function fP(e,t,n,i,r){var a=function(e){var t,n={};for(t in e)n["{".concat(t,"}")]=e[t];return n}({level:t,x:n,y:i,z:r});return e.replace(/{level}|{x}|{y}|{z}/gi,function(e){return a[e]})}function mP(e){if(!e.contentUrl)return zM.EMPTY;var t=e.contentUrl.split(".").pop();switch(t){case"pnts":return zM.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return zM.SCENEGRAPH;default:return t}}function vP(e){switch(e){case"REPLACE":case"replace":return UM.REPLACE;case"ADD":case"add":return UM.ADD;default:return e}}function gP(e,t){var n;return e?(e.content&&(n=e.content.uri||e.content.url,e.contentUrl="".concat(t.basePath,"/").concat(n)),e.id=e.contentUrl,e.lodMetricType=QM.GEOMETRIC_ERROR,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=mP(e),e.refine=vP(e.refine),e):null}function AP(){return(AP=d(V().mark(function e(t){var n,i,r,a,o,s,l,u,c,h;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.root){e.next=2;break}return e.abrupt("return",null);case 2:return n=t.basePath,o=t.root.extensions["3DTILES_implicit_tiling"],i=o.subdivisionScheme,r=o.maximumLevel,a=o.subtreeLevels,o=o.subtrees.uri,s=fP(o,0,0,0,0),s="".concat(n,"/").concat(s),e.next=9,eB(s,lP);case 9:return s=e.sent,h="".concat(n,"/").concat(t.root.content.uri),l=t.root.refine,u=t.root.geometricError,c=t.root.boundingVolume,h={contentUrlTemplate:h,subtreesUriTemplate:o,subdivisionScheme:i,subtreeLevels:a,maximumLevel:r,refine:l,basePath:n,lodMetricType:QM.GEOMETRIC_ERROR,rootLodMetricValue:u,rootBoundingVolume:c,getTileType:mP,getRefine:vP},e.next=17,function(){return yP.apply(this,arguments)}(t.root,s,h);case 17:return e.abrupt("return",e.sent);case 18:case"end":return e.stop()}},e)}))).apply(this,arguments)}function yP(){return(yP=d(V().mark(function e(t,n,i){var r,a;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:return t.lodMetricType=QM.GEOMETRIC_ERROR,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,e.next=7,cP(n,i);case 7:return a=e.sent,r=a.children,(a=a.contentUrl)&&(t.contentUrl=a,t.content={uri:a.replace("".concat(i.basePath,"/"),"")}),t.refine=vP(t.refine),t.type=mP(t),t.children=r,t.id=t.contentUrl,e.abrupt("return",t);case 16:case"end":return e.stop()}},e)}))).apply(this,arguments)}var wP="3DTILES_implicit_tiling",bP={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.1.4",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:function(e,t,n){return CP.apply(this,arguments)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};function xP(){return(xP=d(V().mark(function e(t,n,i){var r;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={content:{featureIds:null}},e.next=4,eP(t,0,n,i,r.content);case 4:return e.abrupt("return",r.content);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function EP(){return(EP=d(V().mark(function e(i,r,a){var o,s;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((s=JSON.parse((new TextDecoder).decode(i))).loader=r.loader||bP,s.url=a.url,s.basePath=kE(s.url),n=void 0,null!=(t=s)&&null!=(n=t.extensionsRequired)&&n.includes(wP)&&null!=t&&null!=(n=t.extensionsUsed)&&n.includes(wP))return e.next=7,function(){return AP.apply(this,arguments)}(s);e.next=10;break;case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=function(e){var t=e.basePath,e=gP(e.root,e),n=[];for(n.push(e);0=u.preloadTilesCount)&&(T=!0,H.loadingManager.itemEnd(H.url)),n}},N=function(){u.geoTransform!=NP.WGS84Cartesian&&(E.copy(C).invert(),E.premultiply(L),E.copy(L).multiply((new _e).copy(C).invert()),x.modelMatrix=new YB(E.toArray()))},O=function(e){var t;e.boundingVolume.halfAxes&&(e=e.boundingVolume.halfAxes,e=(new _e).extractRotation(RP(e)).premultiply((new _e).extractRotation(R)),(new ki).setFromRotationMatrix(e).equals(new ki)||(_=!0,t=new Re(C.elements[12],C.elements[13],C.elements[14]),C.extractRotation(e),C.setPosition(t),N()))},u=Object.assign(Object.assign({},zP),H.options),r=H.url,a=u.updateInterval,o=5,s={},u.cesiumIONToken)return s["cesium-ion"]={accessToken:u.cesiumIONToken},e.next=12,DP.preload(r,s);e.next=14;break;case 12:l=e.sent,s.fetch={headers:l.headers};case 14:return H.loadingManager&&H.loadingManager.itemStart(r),e.next=17,eB(r,bP,Object.assign({},s));case 17:return l=e.sent,c={},h={},d=[],p=new Cs,f=new Cs,u.debug||(f.visible=!1),m={pointSize:{type:"f",value:u.pointSize},gradient:{type:"t",value:GP},grayscale:{type:"t",value:UP},rootCenter:{type:"vec3",value:new Re},rootNormal:{type:"vec3",value:new Re},coloring:{type:"i",value:u.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new Le(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},v=new pa({uniforms:m,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:u.transparent,vertexColors:!0}),A=g=null,y=H.gltfLoader||new Yb,b=w=void 0,u.basisTranscoderPath&&((w=new Rb).detectSupport(H.renderer),w.setTranscoderPath(u.basisTranscoderPath+"/"),w.setWorkerLimit(1),y.setKTX2Loader(w)),u.dracoDecoderPath&&((b=new Ab).setDecoderPath(u.dracoDecoderPath+"/"),b.setWorkerLimit(u.maxConcurrency),y.setDRACOLoader(b)),U=new Jb({transparent:u.transparent}),B={maximumMemoryUsage:u.maximumMemoryUsage,maximumScreenSpaceError:u.maximumScreenSpaceError,viewDistanceScale:u.viewDistanceScale,skipLevelOfDetail:u.skipLevelOfDetail,updateTransforms:u.updateTransforms,throttleRequests:u.throttleRequests,maxRequests:u.maxRequests,maxDepth:u.maxDepth||50,contentLoader:function(i){return Qx(z,void 0,void 0,V().mark(function e(){var t,n;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=null,e.t0=i.type,e.next=e.t0===zM.POINTCLOUD?4:e.t0===zM.SCENEGRAPH||e.t0===zM.MESH?6:10;break;case 4:return t=function(e,t,n,i){var r={rtc_center:e.content.rtcCenter,points:e.content.attributes.positions,intensities:e.content.attributes.intensity,classifications:e.content.attributes.classification,rgb:null,rgba:null},a=e.content.attributes.colors;a&&3===a.size&&(r.rgb=a.value);a&&4===a.size&&(r.rgba=a.value);a=new j,a.setAttribute("position",new ne(r.points,3)),e=(new _e).fromArray(e.computedTransform).premultiply(i);r.rgba?a.setAttribute("color",new ne(r.rgba,4)):r.rgb&&a.setAttribute("color",new Er(r.rgb,3,!0));r.intensities&&a.setAttribute("intensity",new Q(r.intensities,1,!0));r.classifications&&a.setAttribute("classification",new Er(r.classifications,1,!1));i=new Pl(a,n.material||t);r.rtc_center&&(a=r.rtc_center,e.multiply((new _e).makeTranslation(a[0],a[1],a[2])));return i.applyMatrix4(e),i}(i,v,u,R),e.abrupt("break",10);case 6:return e.next=8,function(a,o,s,l,u){return Qx(this,void 0,void 0,V().mark(function e(){return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(t,n){var e=(new _e).makeRotationAxis(new Re(1,0,0),Math.PI/2),i="Z"!==(null==(i=o.tileset.asset)?void 0:i.gltfUpAxis),r=(new _e).fromArray(o.computedTransform).premultiply(u);i&&r.multiply(e),a.parse(o.content.gltfArrayBuffer,o.contentUrl?o.contentUrl.substr(0,o.contentUrl.lastIndexOf("/")+1):"",function(e){e=e.scenes[0];e.applyMatrix4(r),e.traverse(function(e){var t,n;"Mesh"==e.type&&(n=(t=(e=e).material).map,l.material?(e.material=l.material.clone(),t.dispose()):l.shading==OP.FlatTexture&&(e.material=s.clone(),t.dispose()),l.shading!=OP.ShadedNoTexture?"ShaderMaterial"==e.material.type?e.material.uniforms.map={value:n}:e.material.map=n:(n&&n.dispose(),e.material.map=null),l.shaderCallback&&(e.onBeforeRender=l.shaderCallback),e.material.wireframe=l.wireframe,l.computeNormals)&&e.geometry.computeVertexNormals()}),t(e)},function(e){n(new Error("error parsing gltf in tile ".concat(o.id,": ").concat(e)))})}));case 1:case"end":return e.stop()}},e)}))}(y,i,U,u,R);case 8:return t=e.sent,e.abrupt("break",10);case 10:t&&(t.visible=!1,c[i.id]=t,p.add(c[i.id]),u.debug&&(n=LP(i),f.add(n),h[i.id]=n),x.dispatchEvent({type:"tileLoaded",tileContent:t}));case 11:case"end":return e.stop()}},e)}))},onTileLoad:function(t){return Qx(z,void 0,void 0,V().mark(function e(){return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:x&&(!_&&(null==t?void 0:t.depth)<=o&&O(t),x._frameNumber++,G(x,c,A,g));case 1:case"end":return e.stop()}},e)}))},onTileUnload:function(e){d.push(e)},onTileError:function(e,t){console.error("Tile error",e.id,t)}},x=new wT(l,Object.assign(Object.assign({},B),{loadOptions:Object.assign(Object.assign({},s),{maxConcurrency:u.maxConcurrency,worker:u.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}})})),E=new _e,C=new _e,B=new Re,_=!1,x.root.boundingVolume?(x.root.header.boundingVolume.region&&(console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),u.geoTransform=NP.WGS84Cartesian),C.setPosition(x.root.boundingVolume.center[0],x.root.boundingVolume.center[1],x.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),u.debug&&(F=LP(x.root),f.add(F),h[x.root.id]=F),T=M=!1,m.rootCenter.value.copy(B),m.rootNormal.value.copy(new Re(0,0,1).normalize()),x.stats.get("Loader concurrency").count=u.maxConcurrency,x.stats.get("Maximum SSE").count=u.maximumScreenSpaceError,x.stats.get("Maximum mem usage").count=u.maximumMemoryUsage,D=I=null,P=new Re(1/(S=0),1/0,1/0),k=null,p.updateMatrixWorld(!0),L=(new _e).copy(p.matrixWorld),R=(new _e).copy(L).invert(),O(x.root),N(),u.debug&&(h[x.root.id].applyMatrix4(E),f.matrixWorld.copy(p.matrixWorld)),u.geoTransform==NP.Mercator?(t=x.cartographicCenter[1],n=x.cartographicCenter[0],i=void 0,i=2*Math.PI*6378137/2,n=n*i/180,t=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180),F=new Le(n,t*i/180),B.set(F.x,0,-F.y),p.position.copy(B),p.rotation.set(-Math.PI/2,0,0),p.updateMatrixWorld(!0)):u.geoTransform==NP.WGS84Cartesian&&(p.applyMatrix4(C),p.updateMatrixWorld(!0),B.copy(p.position)),e.abrupt("return",{model:p,runtime:{getTileset:function(){return x},getStats:function(){return x.stats},showTiles:function(e){f.visible=e},setWireframe:function(t){u.wireframe=t,p.traverse(function(e){e instanceof Z&&(e.material.wireframe=t)})},setDebug:function(e){u.debug=e,f.visible=e},setShading:function(e){u.shading=e},getTileBoxes:function(){return f},setViewDistanceScale:function(e){x.options.viewDistanceScale=e,x._frameNumber++,G(x,c,A,g)},setHideGround:function(e){m.hideGround.value=e},setPointCloudColoring:function(e){m.coloring.value=e},setElevationRange:function(e){m.elevationRange.value.set(e[0],e[1])},setMaxIntensity:function(e){m.maxIntensity.value=e},setIntensityContrast:function(e){m.intensityContrast.value=e},setPointAlpha:function(e){m.alpha.value=e},getLatLongHeightFromPosition:function(e){e=x.ellipsoid.cartesianToCartographic((new Re).copy(e).applyMatrix4((new _e).copy(E).invert()).toArray());return{lat:e[1],long:e[0],height:e[2]}},getPositionFromLatLongHeight:function(e){e=x.ellipsoid.cartographicToCartesian([e.long,e.lat,e.height]);return re(Re,J(e)).applyMatrix4(E)},getCameraFrustum:function(e){var t,e=kP(e).planes.map(function(e){return new fM(e.normal.toArray(),e.constant)}).map(function(e){return e=e,t=new Cs,n=new Ru(10,5),i=re(Re,J(e.projectPointOntoPlane([0,0,0]))),e=new Re(e.normal.x,e.normal.y,e.normal.z),r=(new Re).copy(i).add(e),n.lookAt(r),n.translate(i.x,i.y,i.z),r=new Jb({color:65535,side:ve}),n=new Z(n,r),r=new $d(e,i,5,16776960),t.add(r),t.add(n),t;var t,n,i,r}),n=new Cs,i=q(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;n.add(r)}}catch(e){i.e(e)}finally{i.f()}return n},update:function(e,t,n){g=n,A=t,S+=e,x&&a<=S&&(L.equals(p.matrixWorld)||(S=0,L.copy(p.matrixWorld),N(),e=(new Re).setFromMatrixPosition(L),m.rootCenter.value.copy(e),m.rootNormal.value.copy(new Re(0,0,1).applyMatrix4(L).normalize()),R.copy(L).invert(),u.debug&&(h[x.root.id].matrixWorld.copy(E),h[x.root.id].applyMatrix4(L))),null==I?I=(new _e).copy(n.matrixWorld):n.matrixWorld.equals(I)&&n.aspect==D||(S=0,x._frameNumber++,n.getWorldPosition(P),I.copy(n.matrixWorld),G(x,c,t,n)))},dispose:function(){for(M=!0,x._destroy();0","varying vec4 vPosition;","varying vec4 projTexCoord;","uniform sampler2D depthTexture;","uniform vec2 cameraNearFar;","void main() {","\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));","\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );","\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;","\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);","}"].join("\n")}):new L({color:"#000000"})},getEdgeDetectionMaterial:function(e){return new pa({uniforms:{edgeStrength:{value:e},maskTexture:{value:null},texSize:{value:new Le(10,10)},visibleEdgeColor:{value:new Re(1,1,1)},hiddenEdgeColor:{value:new Re(1,1,1)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D maskTexture;\n uniform float edgeStrength;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\t\t\t\t\n\t\t\t\tvoid main() { \n const float thickness = 1.0;\n vec2 invSize = thickness / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5; //检测边缘,\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) ) * edgeStrength;\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2); //检测深度值,是否被遮挡\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\t//gl_FragColor = vec4(0.0,1.0,0.0,1.0); \n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d); \n\t\t\t\t}"})},getSeperableBlurMaterial:function(e){return new pa({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new Le(.5,.5)},direction:{value:new Le(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"#include \t\t\t\tvarying vec2 vUv;\t\t\t\tuniform sampler2D colorTexture;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec2 direction;\t\t\t\tuniform float kernelRadius;\t\t\t\t\t\t\t\tfloat gaussianPdf(in float x, in float sigma) {\t\t\t\t\treturn 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\t\t\t\t}\t\t\t\tvoid main() {\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tfloat weightSum = gaussianPdf(0.0, kernelRadius);\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;\t\t\t\t\tvec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\t\t\t\t\tvec2 uvOffset = delta;\t\t\t\t\tfor( int i = 1; i <= MAX_RADIUS; i ++ ) {\t\t\t\t\t\tfloat w = gaussianPdf(uvOffset.x, kernelRadius);\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;\t\t\t\t\t\tdiffuseSum += ((sample1 + sample2) * w);\t\t\t\t\t\tweightSum += (2.0 * w);\t\t\t\t\t\tuvOffset += delta;\t\t\t\t\t}\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\t\t\t\t}"})},getOverlayMaterial:function(){return new pa({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv; \n\t\t\t\tuniform sampler2D edgeTexture1; \n\t\t\t\tuniform float edgeStrength; \n\t\t\t\t \n\t\t\t\tvoid main() { \n\t\t\t\t\tgl_FragColor = edgeStrength * texture2D(edgeTexture1, vUv); \n\t\t\t\t}",blending:ye,depthTest:!1,depthWrite:!1,transparent:!0})}}),JP.BlurDirectionX=new Le(1,0),JP.BlurDirectionY=new Le(0,1),2),$P=function(){y(i,zn);var n=C(i);function i(e){function t(e){var t,n;a.enabled&&(t=e.dragViewport)&&"OrthographicCamera"!=t.camera.type&&null===e.drag.object&&(t=e.isTouch?1==e.touches.length?"rotate":"scale-pan":e.buttons===Potree.defines.Buttons.LEFT?"rotate":"pan",void 0===e.drag.startHandled&&(e.drag.startHandled=!0,a.dispatchEvent({type:"start"})),(n=e.drag.pointerDelta.clone()).y*=-1,"rotate"==t?(a.yawDelta+=n.x*a.rotationSpeed,a.pitchDelta+=n.y*a.rotationSpeed):"pan"==t?(a.panDelta.x+=n.x,a.panDelta.y+=n.y):"scale-pan"==t&&(a.dollyEnd.subVectors(e.touches[0].pointer,e.touches[1].pointer),n=a.dollyEnd.length()/a.dollyStart.length(),a.dollyStart.copy(a.dollyEnd),a.radiusDelta=(1-n)*a.scene.view.radius,t=(new Le).addVectors(e.touches[0].pointer,e.touches[1].pointer).multiplyScalar(.5),(n=(new Le).subVectors(t,a.lastScalePointer)).y*=-1,a.panDelta.add(n),a.lastScalePointer=t.clone()),a.stopTweens())}te(this,i),(a=n.call(this)).viewer=e,a.renderer=e.renderer,a.scene=null,a.sceneControls=new Ps,a.rotationSpeed=3,a.fadeFactor=100,a.yawDelta=0,a.pitchDelta=0,a.panDelta=new Le(0,0),a.radiusDelta=0,a.doubleClockZoomEnabled=!0,a.tweens=[],a.dollyStart=new Le,a.dollyEnd=new Le,a.keys={FORWARD:["W".charCodeAt(0),38],BACKWARD:["S".charCodeAt(0),40],LEFT:["A".charCodeAt(0),37],RIGHT:["D".charCodeAt(0),39],UP:["Q".charCodeAt(0)],DOWN:["E".charCodeAt(0)]};var a,o=null;a.addEventListener("touchstart",function(e){o=e}),a.addEventListener("touchend",function(e){o=e}),a.addEventListener("touchmove",function(e){var t,n,i,r;a.enabled&&(2===e.touches.length&&2===o.touches.length?(t=e,r=(i=o).touches[0].pageX-i.touches[1].pageX,i=i.touches[0].pageY-i.touches[1].pageY,r=Math.sqrt(r*r+i*i),i=t.touches[0].pageX-t.touches[1].pageX,t=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(i*i+t*t),t=a.scene.view.radius+a.radiusDelta,a.radiusDelta=t/(i/r)-t,a.stopTweens()):3===e.touches.length&&3===o.touches.length&&(r=((i=o).touches[0].pageX+i.touches[1].pageX+i.touches[2].pageX)/3,t=(i.touches[0].pageY+i.touches[1].pageY+i.touches[2].pageY)/3,i=(e.touches[0].pageX+e.touches[1].pageX+e.touches[2].pageX)/3,n=(e.touches[0].pageY+e.touches[1].pageY+e.touches[2].pageY)/3,i=(i-r)/a.renderer.domElement.clientWidth,r=(n-t)/a.renderer.domElement.clientHeight,a.panDelta.x+=i,a.panDelta.y+=r,a.stopTweens()),o=e)}),a.viewer.addEventListener("global_drag",t),a.viewer.addEventListener("global_drop",function(e){a.enabled&&a.dispatchEvent({type:"end"})}),a.viewer.addEventListener("global_mousewheel",function(e){var t;!a.enabled||(t=a.scene.view.radius+a.radiusDelta)<.1&&0EXIT\n\t\t\t\t
    VR
    \n\t\t\t'},s=function(){o.element.innerHTML='\n\t\t\t\t
    ENTER
    \n\t\t\t\t
    VR
    \n\t\t\t'},t&&console.error('THREE.VRButton: The "options" parameter has been removed. Please set the reference space type via renderer.xr.setReferenceSpaceType() instead.'),o=new u,n=document.createElement("button"),o.element=n,"xr"in navigator)return o.element.id="VRButton",o.element.style.display="none",r(o.element),e.next=14,navigator.xr.isSessionSupported("immersive-vr");e.next=23;break;case 14:if(e.sent)return i(),e.abrupt("return",o);e.next=20;break;case 20:return e.abrupt("return",null);case 21:e.next=25;break;case 23:return!1===window.isSecureContext?console.log("WEBXR NEEDS HTTPS"):console.log("WEBXR not available"),e.abrupt("return",null);case 25:case"end":return e.stop()}},e)})),function(e,t){return n.apply(this,arguments)})}]),u}(),tk=new Tc,nk={},ik=new Map,Od=function(){y(v,xA);var r,n,m=C(v);function v(e,t){var i,n=2\n\t\t'),$(e).append(i.elMessages),i.paused,document.addEventListener("visibilitychange",function(e){i.dispatchEvent({type:"pageVisible",v:!document.hidden})});try{Potree.settings.isOfficial||(0===$(e).find("#potree_map").length&&(r=$('\n \n '),$(e).append(r)),0===$(e).find("#potree_description").length&&(a=$('
    '),$(e).append(a)),0===$(e).find("#potree_annotations").length&&(o=$('\n
    '),$(e).append(o)),0===$(e).find("#potree_quick_buttons").length&&(s=$('\n
    \n
    \n '),$(e).append(s)),qP)||"merge"==Potree.settings.editType||($(e).append($("
    ")),qP=$("
    "),$(e).append(qP),qP=qP[0]),i.pointCloudLoadedCallback=n.onPointCloudLoaded||function(){},i.server=null,i.fov=60,i.isFlipYZ=!1,i.useDEMCollisions=!1,i.generateDEM=!1,i.minNodeSize=30,i.edlStrength=1,i.edlRadius=1.4,i.edlOpacity=1,i.useEDL=!1,i.description="",i.classifications=im.DEFAULT,i.moveSpeed=1,i.lengthUnit=pm.METER,i.lengthUnitDisplay=pm.METER,i.showBoundingBox=!1,i.showAnnotations=!0,i.freeze=!1,i.elevationGradientRepeat=lm.CLAMP,i.filterReturnNumberRange=[0,7],i.filterNumberOfReturnsRange=[0,7],i.filterGPSTimeRange=[-1/0,1/0],i.filterPointSourceIDRange=[0,65535],i.potreeRenderer=null,i.edlRenderer=null,i.pRenderer=null,i.scene=null,i.sceneVR=null,i.overlay=null,i.overlayCamera=null,i.inputHandler=null,i.controls=null,i.clippingTool=null,i.transformationTool=null,i.navigationCube=null,i.compass=null,i.skybox=null,i.clock=new Qh,i.background=null,n.noDragAndDrop||i.initDragAndDrop(),"undefined"!=typeof Stats&&(i.stats=new Stats,i.stats.showPanel(0),document.body.appendChild(i.stats.dom)),i.overlay=new Ps,i.overlayCamera=new mh(0,1,1,0,-1e3,1e3),i.pRenderer=new iA(i.renderer);i.shadowTestCam=new ma(90,1,2.5,10),i.shadowTestCam.position.set(3.5,-2.8,8.561),i.shadowTestCam.lookAt(new Re(0,0,4.87));var r,a,o,s,l=new kg(i.renderer),u=(i.sceneVR=new Ps,i.setScene(l),i.composer=new WP(i.renderer),i.ssaaRenderPass=new jP(0,0),i.composer.addPass(i.ssaaRenderPass),i.outlinePass=new JP),c=(u.renderToScreen=!0,u.enabled=!1,i.composer.addPass(u),u.edgeStrength=4,u.edgeGlow=0,u.visibleEdgeColor=new Me("#09a1b3"),u.hiddenEdgeColor=new Me("#09a1b3"),i.mainViewport=new EA(i.scene.view,i.scene.cameraP,{left:0,bottom:0,width:1,height:1,name:"MainView"}),i.viewports=[i.mainViewport],Potree.settings.showCompass&&(i.compass=new xg(Potree.settings.compassDom,i.mainViewport)),i.magnifier=new ub(G(i)),i.reticule=new db(G(i)),i.scene.scene.add(i.magnifier),i.scene.scene.add(i.reticule),"pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType&&(i.mapViewer=new vy(qP)),i.inputHandler=new bA(G(i),i.scene.scene),i.clippingTool=new Pv(G(i)),i.transformationTool=new sg(G(i)),i.navigationCube=new gy(G(i)),i.navigationCube.visible=!1,i.createControls(),i.clippingTool.setScene(i.scene),function(e){1===i.scene.pointclouds.length&&(e=e.pointcloud.boundingBox.getSize(new Re).length(),i.setMoveSpeed(e/=2e3))}),h=function(e){i.inputHandler.deselect(e.volume)};i.addEventListener("scene_changed",function(e){i.inputHandler.setScene(e.scene),i.clippingTool.setScene(i.scene),e.scene.hasEventListener("pointcloud_added",c)||e.scene.addEventListener("pointcloud_added",c),e.scene.hasEventListener("volume_removed",c)||e.scene.addEventListener("volume_removed",h)}),i.scene.addEventListener("volume_removed",h),i.scene.addEventListener("pointcloud_added",c),i.setFOV(60),i.setEDLEnabled(!1),i.setEDLRadius(2.3),i.setEDLStrength(.008),i.setEDLOpacity(1),i.setPointBudget(1e6),i.setShowBoundingBox(!1),i.setFreeze(!1),i.setControls(i.fpControls),i.setBackground(new Me(Potree.config.background),1),i.scaleFactor=1,i.loadSettingsFromURL(),i.renderer.setAnimationLoop(i.loop.bind(G(i))),i.loadGUI=i.loadGUI.bind(G(i)),i.annotationTool=new Bw(G(i)),i.measuringTool=new ig(G(i)),i.volumeTool=new Sm(G(i)),i.tagTool=new bg(G(i)),_w.init(G(i),i.mapViewer?[G(i),i.mapViewer]:[G(i)]),("pano"==Potree.settings.editType?i.modules.PanoEditor:"merge"==Potree.settings.editType?i.modules.MergeEditor:(i.modules.SiteModel.init(),i.modules.ParticleEditor)).init(),i.modules.Alignment.init(),i.images360=new cy(G(i)),i.scene.scene.add(i.objs),nk={objLoader:new pb(tk),mtlLoader:new vb(tk),glbLoader:new Yb(void 0,i.renderer,Potree.settings.libsUrl)}}catch(e){i.onCrash(e)}var d="",p=(Object.defineProperty(Potree.settings,"pointDensity",{get:function(){return d},set:function(e){var t,n;e&&e!=d&&(t=Potree.config.pointDensity[e],n=(i.magnifier.visible?Potree.config.pointDensity.magnifier:t).pointBudget,viewer.setMinNodeSize(t.minNodeSize||Potree.config.minNodeSize),viewer.setPointBudget(n),d=e,i.setPointLevels())}}),""),f=(Object.defineProperty(Potree.settings,"UserPointDensity",{get:function(){return p},set:function(e){p!=e&&("showPointCloud"==Potree.settings.displayMode&&4!=i.viewports.length&&(Potree.settings.pointDensity=e),p=e)}}),Potree.settings.cameraFar);return Object.defineProperty(Potree.settings,"cameraFar",{get:function(){return f},set:function(e){e!=f&&("showPanos"!=Potree.settings.displayMode&&(i.mainViewport.camera.far=e,i.mainViewport.camera.updateProjectionMatrix()),f=e)}}),i.addEventListener("allLoaded",function(){setTimeout(i.testPointcloudsMaxLevel.bind(G(i)),1e3),i.scene.pointclouds.forEach(function(e){e.addEventListener("isVisible",function(e){"displayMode"!=e.reason&&i.updateModelBound("visibleChanged")})})}),"pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType&&(i.addEventListener("switchFloorplanSelect",function(e){var t;i.selectedFloorplan=e.pointcloud,i.updateFpVisiDatasets(),e.pointcloud?t=[e.pointcloud]:i.fpVisiDatasets.length&&(t=i.fpVisiDatasets),t&&i.mapViewer.fitToDatasets(t)}),i.modules.SiteModel.bus.addEventListener("FloorChange",function(e){i.updateFpVisiDatasets(),i.updatePanosVisibles(e.currentFloor)}),i.mapViewer.mapLayer.addEventListener("floorplanLoaded",function(){i.updateCadVisibles(i.fpVisiDatasets,!0)})),i.addEventListener("camera_changed",function(e){e.changeInfo.positionChanged&&(ik.clear(),i.updateDatasetAt())}),i}return A(v,[{key:"ifPointBlockedByIntersect",value:function(e,t){var n,i=ik.get(t||e);return i?n=i.ifShelter:(n=viewer.inputHandler.ifBlockedByIntersect(e,.3,!0),ik.set(t||e,{ifShelter:n})),n}},{key:"updateDatasetAt",value:function(n){function e(){var t=viewer.mainViewport.view.position,e=i.scene.pointclouds.filter(function(e){return(e.visible||e.unvisibleReasons&&1==e.unvisibleReasons.length&&"displayMode"==e.unvisibleReasons[0].reason)&&e.ifContainsPoint(t)});return ag.getDifferenceSet(e,i.atDatasets).length&&(i.atDatasets=e,"pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType&&i.updateFpVisiDatasets(),i.dispatchEvent({type:"pointcloudAtChange",pointclouds:e})),!(n=!1)}var i=this;n?e():ag.intervalTool.isWaiting("atWhichDataset",e,300)}},{key:"updatePanosVisibles",value:function(n){viewer.images360.panos.forEach(function(e){var t=n&&n.panos.includes(e);viewer.updateVisible(e,"buildingChange",t,2)})}},{key:"updateFpVisiDatasets",value:function(){var e,t=this,n=(this.modules.Clip,this.modules.SiteModel),i=this.modules.Alignment,r=n.currentFloor;this.selectedFloorplan?(e=[this.selectedFloorplan],this.updateCadVisibles(e)):n.editing||i.editing?(e=this.scene.pointclouds.filter(function(e){return t.getObjVisiByReason(e,"datasetSelection")}),this.updateCadVisibles(e)):(0==(n=r?this.findPointcloudsAtFloor(r):[]).length&&(n=this.atDatasets),this.updateCadVisibles(n))}},{key:"findPointcloudsAtFloor",value:function(i){var r=[],e=viewer.scene.pointclouds.filter(function(e){var t=0;if(e.belongToEntity&&(e.belongToEntity==i||e.belongToEntity.buildParent==i))return!0;if(e.panos.length){var n=e.panos.filter(function(e){return i.ifContainsPoint(e.position)}).length/e.panos.length;if(.5 \n\t\t\t\t\n\t\t\t\t

    Potree Encountered An Error

    \n\n\t\t\t\t

    \n\t\t\t\tThis may happen if your browser or graphics card is not supported.\n\t\t\t\t
    \n\t\t\t\tWe recommend to use \n\t\t\t\tChrome\n\t\t\t\tor \n\t\t\t\tFirefox.\n\t\t\t\t

    \n\n\t\t\t\t

    \n\t\t\t\tPlease also visit webglreport.com and \n\t\t\t\tcheck whether your system supports WebGL.\n\t\t\t\t

    \n\t\t\t\t

    \n\t\t\t\tIf you are already using one of the recommended browsers and WebGL is enabled, \n\t\t\t\tconsider filing an issue report at github,
    \n\t\t\t\tincluding your operating system, graphics card, browser and browser version, as well as the \n\t\t\t\terror message below.
    \n\t\t\t\tPlease do not report errors on unsupported browsers.\n\t\t\t\t

    \n\n\t\t\t\t
    \n\t\t\t\t\n\t\t\t')).find("#potree_error_console").html(e.stack),$(this.renderArea).append(t)),e}},{key:"setScene",value:function(e){var t,n=this;e!==this.scene&&(t=this.scene,this.scene=e,this.dispatchEvent({type:"scene_changed",oldScene:t,scene:e}),$(".annotation").detach(),this.scene.annotations.traverse(function(e){n.renderArea.appendChild(e.domElement[0])}),this.onAnnotationAdded||(this.onAnnotationAdded=function(e){e.annotation.traverse(function(e){$("#potree_annotation_container").append(e.domElement),e.scene=n.scene})}),t&&t.annotations.removeEventListener("annotation_added",this.onAnnotationAdded),this.scene.annotations.addEventListener("annotation_added",this.onAnnotationAdded))}},{key:"setControls",value:function(e){e!==this.controls&&(this.controls&&(this.controls.setEnable(!1),this.controls.moveSpeed=this.moveSpeed),(this.controls=e).moveSpeed&&this.setMoveSpeed(e.moveSpeed),this.controls.setEnable(!0))}},{key:"getControls",value:function(){return this.renderer.xr.isPresenting?this.vrControls:this.controls}},{key:"getMinNodeSize",value:function(){return this.minNodeSize}},{key:"setMinNodeSize",value:function(e){this.minNodeSize!==e&&(this.minNodeSize=e,this.dispatchEvent({type:"minnodesize_changed",viewer:this}))}},{key:"getBackground",value:function(){return this.background}},{key:"setBackground",value:function(e,t){"skybox"===e&&(t=t||Potree.resourcePath+"/textures/skybox/xingkong.jpg",this.skybox=ie.loadSkybox(t,this.skybox)),this.background=e,this.backgroundOpacity=1,this.dispatchEvent({type:"background_changed",viewer:this})}},{key:"setDescription",value:function(e){this.description=e,$("#potree_description").html(e)}},{key:"getDescription",value:function(){return this.description}},{key:"setShowBoundingBox",value:function(e){this.showBoundingBox!==e&&(this.showBoundingBox=e,this.dispatchEvent({type:"show_boundingbox_changed",viewer:this}))}},{key:"getShowBoundingBox",value:function(){return this.showBoundingBox}},{key:"setMoveSpeed",value:function(e){this.getMoveSpeed()!==e&&(this.mainViewport.setMoveSpeed(e),this.dispatchEvent({type:"move_speed_changed",viewer:this,speed:e}))}},{key:"getMoveSpeed",value:function(){return this.mainViewport.moveSpeed}},{key:"setWeightClassification",value:function(e){for(var t=0;t").load(new URL(Potree.scriptPath+"/profile.html").href,function(){$(document.body).append(t.children()),i.profileWindow=new Mm(i),i.profileWindowController=new Tm(i),$("#profile_window").draggable({handle:$("#profile_titlebar"),containment:$(document.body)}),$("#profile_window").resizable({containment:$(document.body),handles:"n, e, s, w"}),$(function(){i.guiLoaded=!0;var e,t=q(i.guiLoadTasks);try{for(t.s();!(e=t.n()).done;)(0,e.value)()}catch(e){t.e(e)}finally{t.f()}})}))})}),this.promiseGuiLoaded()}},{key:"setLanguage",value:function(e){i18n.setLng(e),$("body").i18n()}},{key:"setServer",value:function(e){this.server=e}},{key:"initDragAndDrop",value:function(){var c=this;function e(e){e.dataTransfer.dropEffect="copy",e.preventDefault()}var t=function(){var t=d(V().mark(function e(t){var n,i,r,a,o,s,l,u;return V().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:console.log(t),t.preventDefault(),n=q(t.dataTransfer.items),e.prev=3,n.s();case 5:if((a=n.n()).done)e.next=49;else{if(i=a.value,console.log(i),"file"!==i.kind)return e.abrupt("continue",47);e.next=10}break;case 10:if(r=i.getAsFile(),a=r.name.toLowerCase().endsWith(".json"),o=r.name.toLowerCase().endsWith(".gpkg"),a)return e.prev=14,e.next=17,r.text();e.next=28;break;case 17:l=e.sent,"Potree"===(l=JSON.parse(l)).type&&Potree.loadProject(viewer,l),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(14),console.error("failed to parse the dropped file as JSON"),console.error(e.t0);case 26:e.next=47;break;case 28:o?0e.collapseThreshold||e.boundingBox.containsPoint(s.scene.getActiveCamera().position),(e.expand=r)||-1<=a.z&&a.z<=1&&c.push(e),r;-1<=a.z&&a.z<=1&&c.push(e)}),new Set(this.visibleAnnotations)),t=0,n=c;tt?e.y/2/Math.tan(Be.degToRad(u.fov/2))+e.z/2:(o=lf.getHFOVForCamera(u,!0),e.x/2/Math.tan(o/2)+e.z/2),x=Math.max(.1,x),t=s.dontChangeCamDir?viewer.mainViewport.view.direction.negate():(new Re).subVectors(i,n).normalize(),s.dontLookUp&&t.z<0&&t.negate(),l.copy(n).add(t.multiplyScalar(x)),l}var h;if(this.images360.flying)this.images360.addEventListener("cameraMoveDone",function e(){r.focusOnObject(t,n,i,$.extend(s,{deferred:a})),r.images360.removeEventListener("cameraMoveDone",e)});else{if("measure"==n){if(o.copy(t.getCenter()),2Math.PI-b)&&(y>Math.PI/2&&d.negate(),b=(new Re).subVectors(u.position,o).normalize(),y=(new Re).addVectors(d,b).normalize(),d=(new Re).addVectors(b,y),e.copy(o.clone().add(d)))):console.error("measure 没有facePlane points点数还不为2?"),l=c(t.points,null,o,e),this.mapViewer&&(b=new Le(4,4),h=new Y,t.points.forEach(function(e){h.expandByPoint(e)}),(y=h.getSize(new Re).clone().multiplyScalar(2)).x=Math.max(b.x,y.x),y.y=Math.max(b.y,y.y),this.mapViewer.moveTo(o.clone(),y,i)),"showPointCloud"==Potree.settings.displayMode){var d=.3,p=r.inputHandler.ifBlockedByIntersect(l,null,!0,o);if(p){for(var f,m=0,v=0,g=0;g')[0]).setAttribute("crossOrigin","Anonymous"),e=new Ll(n),(i=this.videoPlane=new Z(new Ru(1,1,1,1),new L({color:"#ffffff",transparent:!0,depthTest:!1,opacity:.7,side:2,map:e}))).visible=!1,i.geometry.computeBoundingBox(),i.boundingBox=i.geometry.boundingBox.clone(),i.boundingBox.max.z=1,i.boundingBox.max.y=-.4,i.boundingBox.max.x=1,n.addEventListener("loadeddata",function(e){n.play(),console.log("video loadeddata")}),i.scale.set(1.08,1.92,1),this.addEventListener("global_mousedown",function e(){n.play(),t.removeEventListener("global_mousedown",e)}),r={9:{rotation:[-1.432978005954197,1.2296264545169697,3.0098547630197667],position:[6.532456676287381,-9.806373049095631,-.024205281024294284]},19:{rotation:[1.627167773445286,-1.172425902600188,.04682299709711613],position:[-9.558613948539932,-1.042301166581578,.08159683876743667]}},this.images360.addEventListener("flyToPano",function(e){var t;"showPanos"==Potree.settings.displayMode&&((t=r[e.toPano.pano.id])&&setTimeout(function(){i.visible=!0,i.position.fromArray(t.position),i.rotation.fromArray(t.rotation),n.src=Potree.resourcePath+"/video/".concat(Potree.settings.number,"/").concat(e.toPano.pano.id,".mp4"),n.play(),n.currentTime=0,Potree.settings.zoom.enabled=!1,Tg.start(Mg(i.material,"opacity",1),.4*e.toPano.duration,function(){},0,Cg.easeInOutQuad)},.6*e.toPano.duration),Tg.start(Mg(i.material,"opacity",0),.4*e.toPano.duration,function(){t||(i.visible=!1,n.pause(),Potree.settings.zoom.enabled=!0)},0,Cg.easeInOutQuad))}),this.images360.addEventListener("endChangeMode",function(e){"showPanos"==e.mode?(e=r[t.images360.currentPano.id])&&(i.visible=!0,i.position.fromArray(e.position),i.rotation.fromArray(e.rotation),i.material.opacity=0,n.src=Potree.resourcePath+"/video/".concat(Potree.settings.number,"/").concat(t.images360.currentPano.id,".mp4"),n.play(),n.currentTime=0,Potree.settings.zoom.enabled=!1,Tg.start(Mg(i.material,"opacity",1,function(e){console.log("fadeIn",e)}),300,function(){},0,Cg.easeInOutQuad)):(i.visible=!1,Potree.settings.zoom.enabled=!0)}),this.scene.scene.add(i))}},{key:"addVideo",value:function(){var a,e,o=this;"SS-t-P6zBR73Gke"==Potree.settings.number&&(a=new Ru(1,1,1,1),e=this.videoInfo=[{id:"40-2",url:"https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/10/0aabafee-36b8-455d-9c11-0780bf694786.mp4",rotation:[-1.494468618954883,-1.4987317433158989,-3.061254983446741],position:[19.801820617361624,2.884673619844108,-.03362305858221648],scale:[3.5741423153151763,2.8738725275578703,1]},{id:40,url:"https://laser-oss.4dkankan.com/testdata/SS-t-P6zBR73Gke/temp/poi/2022/05/09/7896d6ef-a2d6-4fd7-949c-768782a5b484.mp4",rotation:[-1.5487684197910518,.021848470169552752,-3.1387534893955236],position:[17.277316608096,2.0840432922115846,-.0931149415437065],scale:[2.0821757723834047,.6129478480765236,1],visibles:[40]}],e.forEach(function(e){var t=e;function n(){i.play(),o.removeEventListener("global_mousedown",n)}var i=$('')[0],e=(i.setAttribute("crossOrigin","Anonymous"),i.src=t.url||Potree.resourcePath+"/video/".concat(Potree.settings.number,"/").concat(t.id,".mp4"),new Ll(i)),r=o.videoPlane=new Z(a,new L({color:"#ffffff",transparent:!0,depthTest:!1,opacity:0,map:e}));r.position.fromArray(t.position),r.rotation.fromArray(t.rotation),t.scale&&r.scale.fromArray(t.scale),o.scene.scene.add(r),(t.plane=r).boundingBox=new Y(new Re(0,-.5,0),new Re(1,-.4,.2)),i.addEventListener("loadeddata",function(e){i.play(),t.visibles||(r.material.opacity=1),t.scale||r.scale.set(i.videoWidth/1e3,i.videoHeight/1e3,1),console.log("video loadeddata",t.id)}),t.visibles&&o.images360.addEventListener("flyToPano",function(e){t.visibles.includes(e.toPano.pano.id)?setTimeout(function(){r.visible=!0,i.currentTime=0,i.play(),i.paused&&o.addEventListener("global_mousedown",function e(){r.visible&&i.play(),o.removeEventListener("global_mousedown",e)}),Potree.settings.zoom.enabled=!1,Tg.start(Mg(r.material,"opacity",1),.4*e.toPano.duration,function(){},0,Cg.easeInOutQuad)},.6*e.toPano.duration):Tg.start(Mg(r.material,"opacity",0),.4*e.toPano.duration,function(){t||(r.visible=!1,i.pause(),Potree.settings.zoom.enabled=!0)},0,Cg.easeInOutQuad)}),o.addEventListener("global_mousedown",n),Potree.settings.isTest&&r.addEventListener("select",function(e){console.log(e)})}))}},{key:"addSprite",value:function(e){var t=new(null!=e.text?TextSprite:(t=texLoader.load(src),e.map=t,Sprite))(e);return t}}]),v}(),Vu=function(){y(n,Yf);var t=C(n);function n(e){te(this,n),(a=t.call(this)).viewer=e,a.renderer=e.renderer,a.scene=null,a.sceneControls=new Ps,a.rotationSpeed=5,a.fadeFactor=20,a.yawDelta=0,a.pitchDelta=0,a.panDelta=new Le(0,0),a.radiusDelta=0,a.doubleClockZoomEnabled=!0,a.tweens=[];var a,o=null;return a.addEventListener("touchstart",function(e){o=e}),a.addEventListener("touchend",function(e){o=e}),a.addEventListener("touchmove",function(e){var t,n,i,r;2===e.touches.length&&2===o.touches.length?(t=e,r=(i=o).touches[0].pageX-i.touches[1].pageX,i=i.touches[0].pageY-i.touches[1].pageY,r=Math.sqrt(r*r+i*i),i=t.touches[0].pageX-t.touches[1].pageX,t=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(i*i+t*t),t=a.scene.view.radius+a.radiusDelta,a.radiusDelta=t/(i/r)-t,a.stopTweens()):3===e.touches.length&&3===o.touches.length&&(r=((i=o).touches[0].pageX+i.touches[1].pageX+i.touches[2].pageX)/3,t=(i.touches[0].pageY+i.touches[1].pageY+i.touches[2].pageY)/3,i=(e.touches[0].pageX+e.touches[1].pageX+e.touches[2].pageX)/3,n=(e.touches[0].pageY+e.touches[1].pageY+e.touches[2].pageY)/3,i=(i-r)/a.renderer.domElement.clientWidth,r=(n-t)/a.renderer.domElement.clientHeight,a.panDelta.x+=i,a.panDelta.y+=r,a.stopTweens()),o=e}),a.addEventListener("drag",function(e){var t,n;null===e.drag.object&&(void 0===e.drag.startHandled&&(e.drag.startHandled=!0,a.dispatchEvent({type:"start"})),t=e.drag.lastDrag.x/a.renderer.domElement.clientWidth,n=e.drag.lastDrag.y/a.renderer.domElement.clientHeight,e.drag.mouse===um.LEFT?(a.yawDelta+=t*a.rotationSpeed,a.pitchDelta+=n*a.rotationSpeed,a.stopTweens()):e.drag.mouse===um.RIGHT&&(a.panDelta.x+=t,a.panDelta.y+=n,a.stopTweens()))}),a.addEventListener("drop",function(e){a.dispatchEvent({type:"end"})}),a.addEventListener("mousewheel",function(e){var t=a.scene.view.radius+a.radiusDelta;a.radiusDelta+=-e.delta*t*.1,a.stopTweens()}),a.addEventListener("dblclick",function(e){a.doubleClockZoomEnabled&&a.zoomToLocation(e.mouse)}),a}return A(n,[{key:"setScene",value:function(e){this.scene=e}},{key:"stop",value:function(){this.yawDelta=0,this.pitchDelta=0,this.radiusDelta=0,this.panDelta.set(0,0)}},{key:"zoomToLocation",value:function(e){var t,n,i,r,a,o,s,l,u=this,c=this.scene.getActiveCamera(),h=ie.getMousePointCloudIntersection(e,c,this.viewer,this.scene.pointclouds,{pickClipped:!0});null!==h&&(t=0,n=this.renderer.domElement,e=ie.mouseToRay(e,c,n.clientWidth,n.clientHeight),n=(c=h.pointcloud.nodesOnRay(h.pointcloud.visibleNodes,e))[c.length-1].getBoundingSphere(new gi).radius,t=Math.min(this.scene.view.radius,n),t=Math.max(.2,t),e=this.scene.view.direction.multiplyScalar(-1),c=(new Re).addVectors(h.location,e.multiplyScalar(t)),n=TWEEN.Easing.Quartic.Out,i={x:0},(r=new TWEEN.Tween(i).to({x:1},600)).easing(n),this.tweens.push(r),a=this.scene.view.position.clone(),o=c.clone(),s=this.scene.view.radius,l=c.distanceTo(h.location),r.onUpdate(function(){var e=i.x;u.scene.view.position.x=(1-e)*a.x+e*o.x,u.scene.view.position.y=(1-e)*a.y+e*o.y,u.scene.view.position.z=(1-e)*a.z+e*o.z,u.scene.view.radius=(1-e)*s+e*l,u.viewer.setMoveSpeed(u.scene.view.radius)}),r.onComplete(function(){u.tweens=u.tweens.filter(function(e){return e!==r})}),r.start())}},{key:"stopTweens",value:function(){this.tweens.forEach(function(e){return e.stop()}),this.tweens=[]}},{key:"update",value:function(e){var t=this.scene.view,n=Math.min(1,this.fadeFactor*e),i=t.yaw,r=t.pitch,a=t.getPivot(),n=(i-=n*this.yawDelta,r-=n*this.pitchDelta,t.yaw=i,t.pitch=r,this.scene.view.direction.multiplyScalar(-t.radius)),i=(new Re).addVectors(a,n);t.position.copy(i);r=Math.min(1,this.fadeFactor*e)*t.radius*3,a=-this.panDelta.x*r,n=this.panDelta.y*r,t.pan(a,n),i=Math.min(1,this.fadeFactor*e),r=t.radius+i*this.radiusDelta,a=t.direction.multiplyScalar(-r),n=(new Re).addVectors(t.getPivot(),a),t.radius=r,t.position.copy(n),i=t.radius,this.viewer.setMoveSpeed(i),a=Math.min(1,this.fadeFactor*e),r=Math.max(0,1-this.fadeFactor*e);this.yawDelta*=r,this.pitchDelta*=r,this.panDelta.multiplyScalar(r),this.radiusDelta-=a*this.radiusDelta}}]),n}(),Yd=function(){y(n,Yf);var t=C(n);function n(e){var r;te(this,n),(r=t.call(this)).viewer=e,r.renderer=e.renderer,r.scene=null,r.sceneControls=new Ps,r.rotationSpeed=200,r.moveSpeed=10,r.lockElevation=!1,r.keys={FORWARD:["W".charCodeAt(0),38],BACKWARD:["S".charCodeAt(0),40],LEFT:["A".charCodeAt(0),37],RIGHT:["D".charCodeAt(0),39],UP:["R".charCodeAt(0),33],DOWN:["F".charCodeAt(0),34]},r.fadeFactor=50,r.yawDelta=0,r.pitchDelta=0,r.translationDelta=new Re(0,0,0),r.translationWorldDelta=new Re(0,0,0),r.tweens=[];return r.addEventListener("drag",function(e){var t,n,i;null===e.drag.object&&(void 0===e.drag.startHandled&&(e.drag.startHandled=!0,r.dispatchEvent({type:"start"})),t=r.viewer.getMoveSpeed(),n=e.drag.lastDrag.x/r.renderer.domElement.clientWidth,i=e.drag.lastDrag.y/r.renderer.domElement.clientHeight,e.drag.mouse===um.LEFT?(r.yawDelta+=n*r.rotationSpeed,r.pitchDelta+=i*r.rotationSpeed):e.drag.mouse===um.RIGHT&&(r.translationDelta.x-=n*t*100,r.translationDelta.z+=i*t*100))}),r.addEventListener("drop",function(e){r.dispatchEvent({type:"end"})}),r.addEventListener("mousewheel",function(e){var t=r.viewer.getMoveSpeed();e.delta<0?t*=.9:0\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t')),r=i.find("label"),a=i.find("input");a.change(function(){o.find("label").removeClass("ui-state-active"),o.find("label").addClass("ui-state-default"),a.is(":checked")&&r.addClass("ui-state-active")}),l.push(i)}),XP('\n\t\t\t\t
    \n\t\t\t\t\t'.concat(t,'\n\t\t\t\t\t\n\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t'))),n=e.find("span"),i=0,r=l;ir.bottomRange.max||e.btmHeight