!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(le){"use strict";function i(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 X(e){return(X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)} function l(e,t,n,i,r,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)} s.done?t(l):Promise.resolve(l).then(i,r)} function r(s){return function(){var e=this,o=arguments;return new Promise(function(t,n){var i=s.apply(e,o);function r(e){l(i,t,n,r,a,"next",e)} function a(e){l(i,t,n,r,a,"throw",e)} r(void 0)})}} function O(e,t){if(!(e instanceof t)) throw new TypeError("Cannot call a class as a function")} function o(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}},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.")} var r,a=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){o=!0,r=e},f:function(){try{a||null==n.return||n.return()}finally{if(o) throw r}}}} function _(e,t){e=(e=window.navigator.userAgent.match(e))?e[1].split(t):[];return{major:parseInt(e[0])||0,minor:parseInt(e[1])||0,patch:parseInt(e[2])||0}} var A={isFullscreen:function(){return document.fullscreenElement||document.mozFullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement},supportsFullscreen:function(){return document.fullscreenEnabled||document.mozFullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled},isPointerLocked:function(){return document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement},requestFullscreen:function(e,t){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen&&e.msRequestFullscreen(),t&&$(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",A.requestPointerLock)},requestPointerLock:function(){var e;if(document.fullscreenElement) e=document.fullscreenElement();else if(document.mozFullscreenElement) e=document.mozFullscreenElement();else if(document.mozFullScreenElement) e=document.mozFullScreenElement();else{if(!document.webkitFullscreenElement) return;e=document.webkitFullscreenElement()} e.requestPointerLock=e.requestPointerLock||e.mozRequestPointerLock||e.webkitRequestPointerLock,e.requestPointerLock(),$(document).off("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",this)},exitPointerLock:function(){document.exitPointerLock=document.exitPointerLock||document.mozExitPointerLock||document.webkitExitPointerLock,document.exitPointerLock()},exitFullscreen:function(){document.exitFullscreen?document.exitFullscreen():document.msExitFullscreen?document.msExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()},details:function(){var e=navigator.userAgent.match("(Firefox|Chrome|Safari)/([\\d]+)");return e?{name:e[1],version:parseInt(e[2]),platform:navigator.platform}:{}},is:function(e){return this.details()&&this.details().name===e},inIframe:function(){return window.parent!==window},aspectRatio:function(e){e=(e=e||$("#player")).width()/e.height();return isFinite(e)?e:0},userAgent:function(){return window.navigator.userAgent},isMobile:function(){var e=navigator.userAgent||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|android|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge|maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))},isLandscape:function(){return this.isMobile&&1>8&255]+pn[e>>16&255]+pn[e>>24&255]+"-"+pn[255&t]+pn[t>>8&255]+"-"+pn[t>>16&15|64]+pn[t>>24&255]+"-"+pn[63&n|128]+pn[n>>8&255]+"-"+pn[n>>16&255]+pn[n>>24&255]+pn[255&i]+pn[i>>8&255]+pn[i>>16&255]+pn[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((vn=16807*(vn=void 0!==e?e%2147483647:vn)%2147483647)-1)/2147483646},degToRad:function(e){return e*gn.DEG2RAD},radToDeg:function(e){return e*gn.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),d=a((t-i)/2),h=o((t-i)/2),p=a((i-t)/2),f=o((i-t)/2);switch(r){case"XYX":e.set(s*c,l*d,l*h,s*u);break;case"YZY":e.set(l*h,s*c,l*d,s*u);break;case"ZXZ":e.set(l*d,l*h,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)}}},yn=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(gn.clamp(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);if(0===n) return this;n=Math.min(1,t/n);return this.slerp(e,n),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,a=e._w,o=t._x,s=t._y,e=t._z,t=t._w;return this._x=n*t+a*o+i*e-r*s,this._y=i*t+a*s+r*o-n*e,this._z=r*t+a*e+n*s-i*o,this._w=a*t-n*o-i*s-r*e,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0===t) return this;if(1===t) return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),1<=o) return this._w=a,this._x=n,this._y=i,this._z=r,this;e=1-o*o;if(e<=Number.EPSILON){var s=1-t;return this._w=s*a+t*this._w,this._x=s*n+t*this._x,this._y=s*i+t*this._y,this._z=s*r+t*this._z,this.normalize(),this._onChangeCallback(),this} s=Math.sqrt(e),e=Math.atan2(s,o),o=Math.sin((1-t)*e)/s,s=Math.sin(t*e)/s;return this._w=a*o+this._w*s,this._x=n*o+this._x*s,this._y=i*o+this._y*s,this._z=r*o+this._z*s,this._onChangeCallback(),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&&(a=Math.sqrt(a),i=Math.atan2(a,i*r),n=Math.sin(n*i)/a,o=Math.sin(o*i)/a),s=s*n+d*(r=o*r),l=l*n+h*r,u=u*n+p*r,c=c*n+f*r,n===1-o&&(s*=o=1/Math.sqrt(s*s+l*l+u*u+c*c),l*=o,u*=o,c*=o)),e[t]=s,e[t+1]=l,e[t+2]=u,e[t+3]=c}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],u=n[i+3],c=r[a],n=r[a+1],i=r[a+2],a=r[a+3];return e[t]=o*a+u*c+s*i-l*n,e[t+1]=s*a+u*n+l*c-o*i,e[t+2]=l*a+u*i+o*n-s*c,e[t+3]=u*a-o*c-s*n-l*i,e}}]),r}(),Cn=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 Cn),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,Rn),Rn.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(Hn),Vn.subVectors(this.max,Hn),In.subVectors(e.a,Hn),On.subVectors(e.b,Hn),zn.subVectors(e.c,Hn),Nn.subVectors(On,In),Un.subVectors(zn,On),Gn.subVectors(In,zn),!!Bn([0,-Nn.z,Nn.y,0,-Un.z,Un.y,0,-Gn.z,Gn.y,Nn.z,0,-Nn.x,Un.z,0,-Un.x,Gn.z,0,-Gn.x,-Nn.y,Nn.x,0,-Un.y,Un.x,0,-Gn.y,Gn.x,0],In,On,zn,Vn)&&(!!Bn([1,0,0,0,1,0,0,0,1],In,On,zn,Vn)&&(jn.crossVectors(Nn,Un),Bn([jn.x,jn.y,jn.z],In,On,zn,Vn))))}},{key:"clampPoint",value:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Cn),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return Rn.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(Rn).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()||(Ln[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ln[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ln[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ln[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ln[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ln[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ln[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ln[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ln)),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 Bn(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){Wn.fromArray(e,a);var s=r.x*Math.abs(Wn.x)+r.y*Math.abs(Wn.y)+r.z*Math.abs(Wn.z),l=t.dot(Wn),u=n.dot(Wn),c=i.dot(Wn);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s) return!1} return!0} var Ln=[new Cn,new Cn,new Cn,new Cn,new Cn,new Cn,new Cn,new Cn],Rn=new Cn,Fn=new kn,In=new Cn,On=new Cn,zn=new Cn,Nn=new Cn,Un=new Cn,Gn=new Cn,Hn=new Cn,Vn=new Cn,jn=new Cn,Wn=new Cn,Xn=new kn,qn=function(){function n(e,t){O(this,n),this.center=void 0!==e?e:new Cn,this.radius=void 0!==t?t:-1} return h(n,[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){var n=this.center;void 0!==t?n.copy(t):Xn.setFromPoints(e).getCenter(n);for(var i=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 kn),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}(),Jn=new Cn,Yn=new Cn,Zn=new Cn,Qn=new Cn,Kn=new Cn,$n=new Cn,ei=new Cn,ti=function(){function n(e,t){O(this,n),this.origin=void 0!==e?e:new Cn,this.direction=void 0!==t?t:new Cn(0,0,-1)} return h(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 Cn),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,Jn)),this}},{key:"closestPointToPoint",value:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Cn),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=Jn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Jn.copy(this.direction).multiplyScalar(t).add(this.origin),Jn.distanceToSquared(e))}},{key:"distanceSqToSegment",value:function(e,t,n,i){Yn.copy(e).add(t).multiplyScalar(.5),Zn.copy(t).sub(e).normalize(),Qn.copy(this.origin).sub(Yn);var r,a,o=.5*e.distanceTo(t),s=-this.direction.dot(Zn),l=Qn.dot(this.direction),u=-Qn.dot(Zn),c=Qn.lengthSq(),e=Math.abs(1-s*s);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=gn.euclideanModulo(e,1),t=gn.clamp(t,0,1),n=gn.clamp(n,0,1),0===t?this.r=this.g=this.b=n:(this.r=Xi(t=2*n-(n=n<=.5?n*(1+t):n+t-n*t),n,e+1/3),this.g=Xi(t,n,e),this.b=Xi(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=l[1],r=l[2];switch(i){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(r)) 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(r)) 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(r)){var a=parseFloat(n[1])/360,o=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100;return e(n[4]),this.setHSL(a,o,s)}}}else if(l=/^\#([A-Fa-f\d]+)$/.exec(t)){var i=l[1],l=i.length;if(3===l) return this.r=parseInt(i.charAt(0)+i.charAt(0),16)/255,this.g=parseInt(i.charAt(1)+i.charAt(1),16)/255,this.b=parseInt(i.charAt(2)+i.charAt(2),16)/255,this;if(6===l) return this.r=parseInt(i.charAt(0)+i.charAt(1),16)/255,this.g=parseInt(i.charAt(2)+i.charAt(3),16)/255,this.b=parseInt(i.charAt(4)+i.charAt(5),16)/255,this} return t&&0t&&(t=e[n]);return t} var mr={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function vr(e,t){return new mr[e](t)} var gr=1,yr=new ni,wr=new Si,br=new Cn,xr=new kn,Er=new kn,_r=new Cn;function Mr(){Object.defineProperty(this,"id",{value:gr+=2}),this.uuid=gn.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={}} Mr.prototype=Object.assign(Object.create(hn.prototype),{constructor:Mr,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){return Array.isArray(e)?this.index=new(65535n.far?null:{distance:s,point:Gr.clone(),object:e}} function jr(e,t,n,i,r,a,o,s,l,u,c,d){Cr.fromBufferAttribute(r,u),Pr.fromBufferAttribute(r,c),Dr.fromBufferAttribute(r,d);var h=e.morphTargetInfluences;if(t.morphTargets&&a&&h){Rr.set(0,0,0),Fr.set(0,0,0),Ir.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 Wr(5,5,5),r=new Qr({name:"CubemapFromEquirect",uniforms:Xr(n),vertexShader:i,fragmentShader:r,side:J,blending:Z});r.uniforms.tEquirect.value=t;a=new Hr(a,r),r=t.minFilter;return t.minFilter===Ne&&(t.minFilter=Oe),new ea(1,10,this).update(e,a),t.minFilter=r,a.geometry.dispose(),a.material.dispose(),this},na.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)},((ia.prototype=Object.create(En.prototype)).constructor=ia).prototype.isDataTexture=!0;var ra=new qn,aa=new Cn,oa=function(){function o(e,t,n,i,r,a){O(this,o),this.planes=[void 0!==e?e:new ki,void 0!==t?t:new ki,void 0!==n?n:new ki,void 0!==i?i:new ki,void 0!==r?r:new ki,void 0!==a?a:new ki]} return h(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,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],u=n[6],c=n[7],d=n[8],h=n[9],p=n[10],f=n[11],m=n[12],v=n[13],e=n[14],n=n[15];return t[0].setComponents(o-i,c-s,f-d,n-m).normalize(),t[1].setComponents(o+i,c+s,f+d,n+m).normalize(),t[2].setComponents(o+r,c+l,f+h,n+v).normalize(),t[3].setComponents(o-r,c-l,f-h,n-v).normalize(),t[4].setComponents(o-a,c-u,f-p,n-e).normalize(),t[5].setComponents(o+a,c+u,f+p,n+e).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),ra.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ra)}},{key:"intersectsSprite",value:function(e){return ra.center.set(0,0,0),ra.radius=.7071067811865476,ra.applyMatrix4(e.matrixWorld),this.intersectsSphere(ra)}},{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}"},da={common:{diffuse:{value:new Yi(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 yn(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 Yi(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 Yi(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new wn}},sprite:{diffuse:{value:new Yi(15658734)},opacity:{value:1},center:{value:new yn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new wn}}},ha={basic:{uniforms:qr([da.common,da.specularmap,da.envmap,da.aomap,da.lightmap,da.fog]),vertexShader:ca.meshbasic_vert,fragmentShader:ca.meshbasic_frag},lambert:{uniforms:qr([da.common,da.specularmap,da.envmap,da.aomap,da.lightmap,da.emissivemap,da.fog,da.lights,{emissive:{value:new Yi(0)}}]),vertexShader:ca.meshlambert_vert,fragmentShader:ca.meshlambert_frag},phong:{uniforms:qr([da.common,da.specularmap,da.envmap,da.aomap,da.lightmap,da.emissivemap,da.bumpmap,da.normalmap,da.displacementmap,da.fog,da.lights,{emissive:{value:new Yi(0)},specular:{value:new Yi(1118481)},shininess:{value:30}}]),vertexShader:ca.meshphong_vert,fragmentShader:ca.meshphong_frag},standard:{uniforms:qr([da.common,da.envmap,da.aomap,da.lightmap,da.emissivemap,da.bumpmap,da.normalmap,da.displacementmap,da.roughnessmap,da.metalnessmap,da.fog,da.lights,{emissive:{value:new Yi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ca.meshphysical_vert,fragmentShader:ca.meshphysical_frag},toon:{uniforms:qr([da.common,da.aomap,da.lightmap,da.emissivemap,da.bumpmap,da.normalmap,da.displacementmap,da.gradientmap,da.fog,da.lights,{emissive:{value:new Yi(0)}}]),vertexShader:ca.meshtoon_vert,fragmentShader:ca.meshtoon_frag},matcap:{uniforms:qr([da.common,da.bumpmap,da.normalmap,da.displacementmap,da.fog,{matcap:{value:null}}]),vertexShader:ca.meshmatcap_vert,fragmentShader:ca.meshmatcap_frag},points:{uniforms:qr([da.points,da.fog]),vertexShader:ca.points_vert,fragmentShader:ca.points_frag},dashed:{uniforms:qr([da.common,da.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ca.linedashed_vert,fragmentShader:ca.linedashed_frag},depth:{uniforms:qr([da.common,da.displacementmap]),vertexShader:ca.depth_vert,fragmentShader:ca.depth_frag},normal:{uniforms:qr([da.common,da.bumpmap,da.normalmap,da.displacementmap,{opacity:{value:1}}]),vertexShader:ca.normal_vert,fragmentShader:ca.normal_frag},sprite:{uniforms:qr([da.sprite,da.fog]),vertexShader:ca.sprite_vert,fragmentShader:ca.sprite_frag},background:{uniforms:{uvTransform:{value:new wn},t2D:{value:null}},vertexShader:ca.background_vert,fragmentShader:ca.background_frag},cube:{uniforms:qr([da.envmap,{opacity:{value:1}}]),vertexShader:ca.cube_vert,fragmentShader:ca.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ca.equirect_vert,fragmentShader:ca.equirect_frag},distanceRGBA:{uniforms:qr([da.common,da.displacementmap,{referencePosition:{value:new Cn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ca.distanceRGBA_vert,fragmentShader:ca.distanceRGBA_frag},shadow:{uniforms:qr([da.lights,da.fog,{color:{value:new Yi(0)},opacity:{value:1}}]),vertexShader:ca.shadow_vert,fragmentShader:ca.shadow_frag}};function pa(a,o,n,s,i){var l,u,c=new Yi(0),d=0,h=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 Lo(e){return e.replace(Bo,Ro)} function Ro(e,t){var n=ca[t];if(void 0===n) throw new Error("Can not resolve #include <"+t+">");return Lo(n)} var Fo=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Io=/#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 Oo(e){return e.replace(Io,No).replace(Fo,zo)} function zo(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),No(0,t,n,i)} function No(e,t,n,i){for(var r="",a=parseInt(t);a=a.get(e).length?(t=new Ko(i,r),a.get(e).push(t)):t=a.get(e)[n],t},dispose:function(){a=new WeakMap}}} function es(e){Ki.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 ts(e){Ki.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Cn,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)} ((es.prototype=Object.create(Ki.prototype)).constructor=es).prototype.isMeshDepthMaterial=!0,es.prototype.copy=function(e){return Ki.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},((ts.prototype=Object.create(Ki.prototype)).constructor=ts).prototype.isMeshDistanceMaterial=!0,ts.prototype.copy=function(e){return Ki.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 ns="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}",is="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function rs(g,y,w){var b=new oa,x=new yn,E=new yn,_=new Mn,r=[],a=[],h={},p={0:J,1:q,2:Y},M=new Qr({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new yn},radius:{value:4}},vertexShader:is,fragmentShader:ns}),A=M.clone();A.defines.HORIZONTAL_PASS=1;var e=new Mr;e.setAttribute("position",new nr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var T=new Hr(e,M),S=this;function f(e,t,n){var i=e<<0|t<<1|n<<2,n=r[i];return void 0===n&&(n=new es({depthPacking:on,morphTargets:e,skinning:t}),r[i]=n),n} function m(e,t,n){var i=e<<0|t<<1|n<<2,n=a[i];return void 0===n&&(n=new ts({morphTargets:e,skinning:t}),a[i]=n),n} function C(e,t,n,i,r,a,o){var s,l,u=null,c=f,d=e.customDepthMaterial;return!0===i.isPointLight&&(c=m,d=e.customDistanceMaterial),u=void 0===d?(!(s=!1)===n.morphTargets&&(s=t.morphAttributes&&t.morphAttributes.position&&0w||x.y>w)&&(x.x>w&&(E.x=Math.floor(w/p.x),x.x=E.x*p.x,d.mapSize.x=E.x),x.y>w&&(E.y=Math.floor(w/p.y),x.y=E.y*p.y,d.mapSize.y=E.y)),null!==d.map||d.isPointLightShadow||this.type!==D||(d.map=new An(x.x,x.y,h={minFilter:Oe,magFilter:Oe,format:et}),d.map.texture.name=c.name+".shadowMap",d.mapPass=new An(x.x,x.y,h),d.camera.updateProjectionMatrix()),null===d.map&&(d.map=new An(x.x,x.y,{minFilter:Re,magFilter:Re,format:et}),d.map.texture.name=c.name+".shadowMap",d.camera.updateProjectionMatrix()),g.setRenderTarget(d.map),g.clear();for(var f=d.getViewportCount(),m=0;mi||e.height>i?i/Math.max(e.width,e.height):r)<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){i=t?gn.floorPowerOfTwo:Math.floor,t=i(r*e.width),r=i(r*e.height);void 0===a&&(a=l(t,r));n=n?l(t,r):a;return n.width=t,n.height=r,n.getContext("2d").drawImage(e,0,0,t,r),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+t+"x"+r+")."),n} return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e} return e} function T(e){return gn.isPowerOfTwo(e.width)&&gn.isPowerOfTwo(e.height)} function S(e,t){return e.generateMipmaps&&t&&e.minFilter!==Re&&e.minFilter!==Oe} function C(e,t,n,i){b.generateMipmap(e),u.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!==b[e]) return b[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)),6408===t&&(5126===n&&(e=34836),5131===n&&(e=34842),5121===n&&(e=32856)),33325!==e&&33326!==e&&34842!==e&&34836!==e||i.get("EXT_color_buffer_float"),e} function d(e){return e===Re||e===Fe||e===Ie?9728:9729} function h(e){var t,n=e.target;n.removeEventListener("dispose",h),t=n,void 0!==(e=u.get(t)).__webglInit&&(b.deleteTexture(e.__webglTexture),u.remove(t)),n.isVideoTexture&&o.delete(n),c.memory.textures--} function p(e){e=e.target;e.removeEventListener("dispose",p),function(e){var t=u.get(e),n=u.get(e.texture);if(e){if(void 0!==n.__webglTexture&&b.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget) for(var i=0;i<6;i++) b.deleteFramebuffer(t.__webglFramebuffer[i]),t.__webglDepthbuffer&&b.deleteRenderbuffer(t.__webglDepthbuffer[i]);else b.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&b.deleteRenderbuffer(t.__webglDepthbuffer),t.__webglMultisampledFramebuffer&&b.deleteFramebuffer(t.__webglMultisampledFramebuffer),t.__webglColorRenderbuffer&&b.deleteRenderbuffer(t.__webglColorRenderbuffer),t.__webglDepthRenderbuffer&&b.deleteRenderbuffer(t.__webglDepthRenderbuffer);u.remove(e.texture),u.remove(e)}}(e),c.memory.textures--} var f=0;function m(e,t){var n,i=u.get(e);if(e.isVideoTexture&&(r=e,n=c.render.frame,o.get(r)!==n&&(o.set(r,n),r.update())),0e.far||t.push({distance:r,point:_s.clone(),uv:Hi.getUV(_s,Ps,Ds,ks,Bs,Ls,Rs,new yn),face:null,object:this}))},copy:function(e){return Si.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}});var Os=new Cn,zs=new Cn;function Ns(){Si.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0} Ns.prototype=Object.assign(Object.create(Si.prototype),{constructor:Ns,isLOD:!0,copy:function(e){Si.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:v,point:l.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this}))} else for(var g,y=0,w=d.count-1;ye.far||t.push({distance:g,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}))}else if(n.isGeometry) for(var b,x=n.vertices,E=x.length,_=0;_e.far||t.push({distance:b,point:l.clone().applyMatrix4(this.matrixWorld),index:_,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:i,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o}))} function wl(t,e,n,i,r,a,o,s,l){En.call(this,t,e,n,i,r,a,o,s,l),this.format=void 0!==o?o:$e,this.minFilter=void 0!==a?a:Oe,this.magFilter=void 0!==r?r:Oe,this.generateMipmaps=!1;var u=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){u.needsUpdate=!0,t.requestVideoFrameCallback(e)})} function bl(e,t,n,i,r,a,o,s,l,u,c,d){En.call(this,null,a,o,s,l,u,i,r,c,d),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1} function xl(e,t,n,i,r,a,o,s,l){En.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0} function El(e,t,n,i,r,a,o,s,l,u){if((u=void 0!==u?u:rt)!==rt&&u!==at) throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");En.call(this,null,i,r,a,o,s,u,n=void 0===(n=void 0===n&&u===rt?Ve:n)&&u===at?Qe:n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:Re,this.minFilter=void 0!==s?s:Re,this.flipY=!1,this.generateMipmaps=!1} gl.prototype=Object.assign(Object.create(Si.prototype),{constructor:gl,isPoints:!0,copy:function(e){return Si.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(),ml.copy(n.boundingSphere),ml.applyMatrix4(i),ml.radius+=r,!1!==e.ray.intersectsSphere(ml)){pl.copy(i).invert(),fl.copy(e.ray).applyMatrix4(pl);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)}}),((bl.prototype=Object.create(En.prototype)).constructor=bl).prototype.isCompressedTexture=!0,((xl.prototype=Object.create(En.prototype)).constructor=xl).prototype.isCanvasTexture=!0,((El.prototype=Object.create(En.prototype)).constructor=El).prototype.isDepthTexture=!0;var _l=0,Ml=new ni,Al=new Si,Tl=new Cn;function Sl(){Object.defineProperty(this,"id",{value:_l+=2}),this.uuid=gn.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} Sl.prototype=Object.assign(Object.create(hn.prototype),{constructor:Sl,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&&Yl(an.x||i.x===n.x&&function(e,t){return Zl(e.prev,e,t.prev)<0&&Zl(t.next,e,e.next)<0}(n,i)))&&(n=i,h=l)),i=i.next,i!==u;);return n}(e,t))&&(e=nu(t,e),Wl(t,t.next),Wl(e,e.next))}(l[r],n),n=Wl(n,n.next);return n}(e,t,c,n)),e.length>80*n){for(var h=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,d=Jl(s,l,t,n,i),h=Jl(u,c,t,n,i),p=e.prevZ,f=e.nextZ;for(;p&&p.z>=d&&f&&f.z<=h;){if(p!==e.prev&&p!==e.next&&Yl(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Zl(p.prev,p,p.next)) return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Yl(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=Zl(f.prev,f,f.next)) return!1;f=f.nextZ} for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&Yl(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=Zl(p.prev,p,p.next)) return!1;p=p.prevZ} for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&Yl(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=Zl(f.prev,f,f.next)) return!1;f=f.nextZ} return!0}(e,i,r,a):function(e){var t=e.prev,n=e,i=e.next;if(0<=Zl(t,n,i)) return!1;var r=e.next.next;for(;r!==e.prev;){if(Yl(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&0<=Zl(r.prev,r,r.next)) return!1;r=r.next} return!0}(e)) t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),ru(e),e=l.next,u=l.next;else if((e=l)===u){o?1===o?Xl(e=function(e,t,n){var i=e;do{var r=i.prev,a=i.next.next}while(!Ql(r,a)&&Kl(r,i,i.next,a)&&tu(r,a)&&tu(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),ru(i),ru(i.next),i=e=a),i=i.next,i!==e);return Wl(i)}(Wl(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=o.next.next;s!==o.prev;){if(o.i!==s.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&&Kl(n,n.next,e,t)) return!0}while(n=n.next,n!==e);return!1}(e,t)&&(tu(e,t)&&tu(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)&&(Zl(e.prev,e,t.prev)||Zl(e,t.prev,t))||Ql(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 eu(e){return 0Number.EPSILON){var l=Math.sqrt(s),u=Math.sqrt(a*a+o*o),c=t.x-r/l,d=t.y+i/l,l=((n.x-o/u-c)*o-(n.y+a/u-d)*a)/(i*o-r*a),d=(u=c+i*l-e.x)*u+(c=d+r*l-e.y)*c;if(d<=2) return new yn(u,c);l=Math.sqrt(d/2)}else{d=!1;i>Number.EPSILON?a>Number.EPSILON&&(d=!0):i<-Number.EPSILON?a<-Number.EPSILON&&(d=!0):Math.sign(r)===Math.sign(o)&&(d=!0),l=d?(u=-r,c=i,Math.sqrt(s)):(u=i,c=r,Math.sqrt(s/2))} return new yn(u/l,c/l)} for(var B=[],L=0,R=M.length,F=R-1,I=L+1;La.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g=t.times[u]?Qu.arraySlice(t.values,l=u*a+r,l+a-r):(a=a-(l=r),(r=t.createInterpolant()).evaluate(y),Qu.arraySlice(r.resultBuffer,l,a)),"quaternion"===n&&(new Sn).fromArray(c).normalize().conjugate().toArray(c);for(var d=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=Qu.arraySlice(i,a,o),this.values=Qu.arraySlice(this.values,a*n,o*n)),this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=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(gn.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(gn.clamp(r[0].dot(r[e]),-1,1));m/=e,0n.length-2?n.length-1:r+1],r=n[r>n.length-3?n.length-1:r+2];return t.set(Lc(a,o.x,e.x,i.x,r.x),Lc(a,o.y,e.y,i.y,r.y)),t},Hc.prototype.copy=function(e){Mc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var r=n[i]-t,a=this.curves[i],o=a.getLength();return a.getPointAt(0===o?0:1-r/o)} i++} return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length) return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;nNumber.EPSILON){if(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{l=u*(e.x-o.x)-l*(e.y-o.y);if(0==l) return 1;l<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}(A.p,h[S].p)||(x!==S&&y.push({froms:x,tos:S,hole:M}),T?(T=!1,d[S].push(A)):g=!0);T&&d[x].push(A)} 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*(t=Math.floor(r/n)),a+=Math.abs(t),(i=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 yn),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 yn),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return hh.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}(),fh=new Cn,mh=new Cn,vh=function(){function n(e,t){O(this,n),this.start=void 0!==e?e:new Cn,this.end=void 0!==t?t:new Cn} return h(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 Cn),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 Cn),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 Cn),this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){fh.subVectors(e,this.start),mh.subVectors(this.end,this.start);e=mh.dot(mh),e=mh.dot(fh)/e;return e=t?gn.clamp(e,0,1):e}},{key:"closestPointToPoint",value:function(e,t,n){t=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Cn),this.delta(n).multiplyScalar(t).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 gh(e){Si.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} ((gh.prototype=Object.create(Si.prototype)).constructor=gh).prototype.isImmediateRenderObject=!0;var yh=new Cn,wh=function(){y(u,Si);var l=w(u);function u(e,t){var n;O(this,u),(n=l.call(this)).light=e,n.light.updateMatrixWorld(),n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n.color=t;for(var e=new Mr,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 dr(i,3));t=new tl({fog:!1,toneMapped:!1});return n.cone=new cl(e,t),n.add(n.cone),n.update(),n} return h(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),yh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(yh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}]),u}(),bh=new Cn,xh=new ni,Eh=new ni,_h=function(){y(d,cl);var c=w(d);function d(e){O(this,d);for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i>16&32768,i=t>>12&2047,e=t>>23&255;return e<103?n:142>114-e)+(i>>113-e&1):(n|=e-112<<10|i>>1,n+=1&i)}},qh=Math.pow(2,8),Jh=[.125,.215,.35,.446,.526,.582],Yh=5+Jh.length,Zh=(H(Jd={},rn,0),H(Jd,an,1),H(Jd,3002,2),H(Jd,3004,3),H(Jd,3005,4),H(Jd,3006,5),H(Jd,3007,6),Jd),Qh=new ed,Yd=rp(),Kh=Yd._lodPlanes,$h=Yd._sizeLods,ep=Yd._sigmas,tp=new Yi,np=null,Zd=(1+Math.sqrt(5))/2,Jd=1/Zd,ip=[new Cn(1,1,1),new Cn(-1,1,1),new Cn(1,1,-1),new Cn(-1,1,-1),new Cn(0,Zd,Jd),new Cn(0,Zd,-Jd),new Cn(Jd,0,Zd),new Cn(-Jd,0,Zd),new Cn(Zd,Jd,0),new Cn(-Zd,Jd,0)],Yd=function(){function i(e){var t,n;O(this,i),this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=(t=20,n=new Float32Array(t),e=new Cn(0,1,0),new Gu({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:e},inputEncoding:{value:Zh[rn]},outputEncoding:{value:Zh[rn]}},vertexShader:up(),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(cp(),"\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:Z,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)} return h(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:Z,depthTest:!1,depthWrite:!1})} function lp(){return new Gu({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Zh[rn]},outputEncoding:{value:Zh[rn]}},vertexShader:up(),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(cp(),"\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:Z,depthTest:!1,depthWrite:!1})} function up(){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 cp(){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 dp(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new gl(e,t)} function hp(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Bc.call(this,e),this.type="catmullrom",this.closed=!0} function pp(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Bc.call(this,e),this.type="catmullrom"} function fp(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Bc.call(this,e),this.type="catmullrom"} Mc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Mc.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(jc.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 Sl,n=0,i=e.length;na.factor)&&(a={line:e,factor:n})}),a.line)}}]),r}(),Ep=0,_p=function(){function a(t){var n=this;if(O(this,a),t.points[0]!=t.points[1]){if(this.points=t.points,this.type=t.type||"line","line"==this.type){var e=gp.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"+Ep++:t.id,this.ids=[this.id],t.dontWriteToPoint||this.points.forEach(function(e){e.lines.push(n)}),t.isChild||gp.push(this),this.searchTime=0} this.children=[],this.parents=[],this.match=[]}} return h(a,[{key:"getAngleInfo",value:function(){var e,t=(e=this.points,(t={}).angle=e[1].clone().sub(e[0]).angle(),Up.closeTo(t.angle,2*Math.PI)?t.angle-=2*Math.PI:(t.angle>Math.PI||Up.closeTo(t.angle,Math.PI))&&(t.angle-=Math.PI,t.reverse=!0),t);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)});if(i) return{point:i,type:"joint"};t=Up.isLineIntersect(e.points,this.points,!1,t);return t?{point:t,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=this,n=new a({points:[e,this.points[0]],dontWriteToPoint:!0,hasntsure:!0}),i=new a({points:[e,this.points[1]],dontWriteToPoint:!0,hasntsure:!0});if(n.points&&i.points){if(!(this.checkIfParent(n)||this.checkIfParent(i)||n.checkIfParent(this)||i.checkIfParent(this))){var e=function(e){t.children.push(e),e.parents.push(t),gp.includes(e)||gp.push(e),e.writeToPoint()};e(n),e(i);e=this.points[0].lines.indexOf(this);return-1Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e},getFOVDotThreshold:function(e){return Math.cos(gn.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){if(t.equals(n)) return t.clone();var r=e.clone().sub(t),a=t.clone().sub(n),e=a.length(),r=r.dot(a)/e,e=t.clone().add(a.multiplyScalar(r/e));return e=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(d,p)&&s<=Math.max(d,p)&&l>=Math.min(h,f)&&l<=Math.max(h,f)) return{atLine:!0};l=e.x?n+r:r,r=n;return((n=1/o*(r-e.x)+e.y) 0\n\tuniform mat4 clipBoxes[num_clipboxes];\n#endif\n\n#if defined(num_clipspheres) && num_clipspheres > 0\n\tuniform mat4 uClipSpheres[num_clipspheres];\n#endif\n\n#if defined(num_clippolygons) && num_clippolygons > 0\n\tuniform int uClipPolygonVCount[num_clippolygons];\n\tuniform vec3 uClipPolygonVertices[num_clippolygons * 8];\n\tuniform mat4 uClipPolygonWVP[num_clippolygons];\n#endif\n\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\tpointSize = size * 10.0; //加个乘数\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#if defined(num_clippolygons) && num_clippolygons > 0\nbool pointInClipPolygon(vec3 point, int polyIdx) {\n\n\tmat4 wvp = uClipPolygonWVP[polyIdx];\n\t//vec4 screenClipPos = uClipPolygonVP[polyIdx] * modelMatrix * vec4(point, 1.0);\n\t//screenClipPos.xy = screenClipPos.xy / screenClipPos.w * 0.5 + 0.5;\n\n\tvec4 pointNDC = wvp * vec4(point, 1.0);\n\tpointNDC.xy = pointNDC.xy / pointNDC.w;\n\n\tint j = uClipPolygonVCount[polyIdx] - 1;\n\tbool c = false;\n\tfor(int i = 0; i < 8; i++) {\n\t\tif(i == uClipPolygonVCount[polyIdx]) {\n\t\t\tbreak;\n\t\t}\n\n\t\t//vec4 verti = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + i], 1);\n\t\t//vec4 vertj = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + j], 1);\n\n\t\t//verti.xy = verti.xy / verti.w;\n\t\t//vertj.xy = vertj.xy / vertj.w;\n\n\t\t//verti.xy = verti.xy / verti.w * 0.5 + 0.5;\n\t\t//vertj.xy = vertj.xy / vertj.w * 0.5 + 0.5;\n\n\t\tvec3 verti = uClipPolygonVertices[polyIdx * 8 + i];\n\t\tvec3 vertj = uClipPolygonVertices[polyIdx * 8 + j];\n\n\t\tif( ((verti.y > pointNDC.y) != (vertj.y > pointNDC.y)) && \n\t\t\t(pointNDC.x < (vertj.x-verti.x) * (pointNDC.y-verti.y) / (vertj.y-verti.y) + verti.x) ) {\n\t\t\tc = !c;\n\t\t}\n\t\tj = i;\n\t}\n\n\treturn c;\n}\n#endif\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\tint clipVolumesCount = 0;\n\tint insideCount = 0;\n\n\t#if defined(num_clipboxes) && num_clipboxes > 0\n\t\tfor(int i = 0; i < num_clipboxes; i++){\n\t\t\tvec4 clipPosition = clipBoxes[i] * modelMatrix * vec4( position, 1.0 );\n\t\t\tbool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;\n\t\t\tinside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;\n\n\t\t\tinsideCount = insideCount + (inside ? 1 : 0);\n\t\t\tclipVolumesCount++;\n\t\t}\t\n\t#endif\n\n\t#if defined(num_clippolygons) && num_clippolygons > 0\n\t\tfor(int i = 0; i < num_clippolygons; i++) {\n\t\t\tbool inside = pointInClipPolygon(position, i);\n\n\t\t\tinsideCount = insideCount + (inside ? 1 : 0);\n\t\t\tclipVolumesCount++;\n\t\t}\n\t#endif\n\n\tbool insideAny = insideCount > 0;\n\tbool insideAll = (clipVolumesCount > 0) && (clipVolumesCount == insideCount);\n\n\tif(clipMethod == CLIPMETHOD_INSIDE_ANY){\n\t\tif(insideAny && clipTask == CLIPTASK_HIGHLIGHT){\n\t\t\tvColor.r += 0.5;\n\t\t}else if(!insideAny && clipTask == CLIPTASK_SHOW_INSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}else if(insideAny && clipTask == CLIPTASK_SHOW_OUTSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}\n\t}else if(clipMethod == CLIPMETHOD_INSIDE_ALL){\n\t\tif(insideAll && clipTask == CLIPTASK_HIGHLIGHT){\n\t\t\tvColor.r += 0.5;\n\t\t}else if(!insideAll && clipTask == CLIPTASK_SHOW_INSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}else if(insideAll && clipTask == CLIPTASK_SHOW_OUTSIDE){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n\t\t}\n\t}\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 /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n vOpacity *= 0.2; \n vOpacity = clamp(vOpacity, 0.0001, 0.1); \n } */ \n #else\n vOpacity = uOpacity;\n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n /*if(filtered_by_normal){//垂直朝相机时降低透明度 \n vOpacity *= 0.3; \n vOpacity = clamp(vOpacity, 0.0001, 0.1); \n }*/ \n \n vOpacity *= max(0.1, (1.0 - normalZ));\n #endif\n\t \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.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.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.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 \n //if(depth == 0.0 && res == 0.0){ //test\n // discard;\n //}\n \n float shade = exp(-res * 300.0 * edlStrength); //自然常数e为底的指数函数\n\n gl_FragColor = vec4(cEDL.rgb * shade, opacity); \n \n //const vec3 outlineColor = vec3(1.0,0.0,0.0);//test -outline\n //gl_FragColor = vec4(mix(cEDL.rgb, outlineColor, -res), opacity );\n }else{//加 不改颜色的情况 \n gl_FragColor = vec4(cEDL.rgb, opacity);\n } \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 \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 alpha;\nuniform sampler2D tDiffuse;\n\n\nvoid main() {\n vec4 texColor = texture2D(tDiffuse, vUv);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n}\n"},Vp=document.createElement("canvas"),jp=function(){var i=Vp.getContext("webgl")||Vp.getContext("experimental-webgl");if(null===i) return null;var e=i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.HIGH_FLOAT),t=i.getShaderPrecisionFormat(i.VERTEX_SHADER,i.MEDIUM_FLOAT),n=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT),r=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.MEDIUM_FLOAT),n=0'),e.className&&t.elem.addClass(e.className),t.elem.find("a").html(t.text),$("#potree_labels").append(t.elem),t.pos2d=new Cn,t.dom=e.dom||viewer.renderArea,t.camera=e.camera||viewer.scene.getActiveCamera();function n(e){t.update(e)} return viewer.addEventListener("camera_changed",n),t.addEventListener("dispose",function(){viewer.removeEventListener("camera_changed",n),t.dispose()}),t} return h(r,[{key:"update",value:function(){var e;this.position&&!this.elem.hasClass("unvisible")&&((e=Jf.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}(),ef=new kn,tf=new Cn,nf=function(){y(n,ud);var t=w(n);function n(){var e;O(this,n),(e=t.call(this)).isLineSegmentsGeometry=!0,e.type="LineSegmentsGeometry";return e.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),e.setAttribute("position",new dr([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),e.setAttribute("uv",new dr([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2)),e} return h(n,[{key:"applyMatrix4",value:function(e){var t=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==t&&(t.applyMatrix4(e),n.applyMatrix4(e),t.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}},{key:"setPositions",value:function(e){e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var t=new ah(t,6,1);return this.setAttribute("instanceStart",new xs(t,3,0)),this.setAttribute("instanceEnd",new xs(t,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}},{key:"setColors",value:function(e){e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));var t=new ah(t,6,1);return this.setAttribute("instanceColorStart",new xs(t,3,0)),this.setAttribute("instanceColorEnd",new xs(t,3,3)),this}},{key:"fromWireframeGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromEdgesGeometry",value:function(e){return this.setPositions(e.attributes.position.array),this}},{key:"fromMesh",value:function(e){return this.fromWireframeGeometry(new zu(e.geometry)),this}},{key:"fromLineSegments",value:function(e){e=e.geometry;return this.setPositions(e.attributes.position.array),this}},{key:"computeBoundingBox",value:function(){null===this.boundingBox&&(this.boundingBox=new kn);var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;void 0!==e&&void 0!==t&&(this.boundingBox.setFromBufferAttribute(e),ef.setFromBufferAttribute(t),this.boundingBox.union(ef))}},{key:"computeBoundingSphere",value:function(){null===this.boundingSphere&&(this.boundingSphere=new qn),null===this.boundingBox&&this.computeBoundingBox();var e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(void 0!==e&&void 0!==t){var n=this.boundingSphere.center;this.boundingBox.getCenter(n);for(var i=0,r=0,a=e.count;r\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\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;\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\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"};var rf,af,of,sf,lf=function(){y(r,Qr);var i=w(r);function r(e){var n;O(this,r),(n=i.call(this,{type:"LineMaterial",uniforms:Jr.clone(ha.line.uniforms),vertexShader:ha.line.vertexShader,fragmentShader:ha.line.fragmentShader,clipping:!0})).isLineMaterial=!0,n.lineWidth_=0,n.supportExtDepth=e.supportExtDepth,n.depthTestWhenPick=!1,e.color&&(n.color=new Yi(e.color)),e.backColor&&(n.uniforms.backColor.value=new Yi(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);function t(e){var t=e.viewport,e=t.offset||new yn;n.uniforms.resolution.value.copy(t.resolution2),n.uniforms.viewportOffset.value.copy(e),n.lineWidth=n.lineWidth_} 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 h(r,[{key:"updateDepthParams",value:function(){var e,t;this.useDepth&&(t=(e=(0u&&hf.z>u||(df.z>u?(c=df.z-hf.z,c=(df.z-u)/c,df.lerp(hf,c)):hf.z>u&&(d=hf.z-df.z,h=(hf.z-u)/d,hf.lerp(df,h)),df.applyMatrix4(i),hf.applyMatrix4(i),df.multiplyScalar(1/df.w),hf.multiplyScalar(1/hf.w),df.x*=r.x/2,df.y*=r.y/2,hf.x*=r.x/2,hf.y*=r.y/2,vf.start.copy(df),vf.start.z=0,vf.end.copy(hf),vf.end.z=0,d=vf.closestPointToPointParameter(ff,!0),vf.at(d,gf),d=-1<=(h=gn.lerp(df.z,hf.z,d))&&h<=1,h=ff.distanceTo(gf)<.5*sf,d&&h&&(vf.start.fromBufferAttribute(s,p),vf.end.fromBufferAttribute(l,p),vf.start.applyMatrix4(a),vf.end.applyMatrix4(a),d=new Cn,h=new Cn,rf.distanceSqToSegment(vf.start,vf.end,h,d),n.push({point:h,pointOnLine:d,distance:rf.origin.distanceTo(h),object:e,face:null,faceIndex:p,uv:null,uv2:null})))}(this,i,t)))}}]),i}(),Mf=function(){y(r,nf);var t=w(r);function r(){var e;return O(this,r),(e=t.call(this)).isLineGeometry=!0,e.type="LineGeometry",e} return h(r,[{key:"setPositions",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;iMath.abs(c.z)?o.setZ(u[0].z):(o.setX(u[0].x),o.setY(u[0].y)));else{this.cannotConfirmNormal=!0;for(var c,d,h=this.isRect?1:r-2,p=0;pPotree.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)} if(e.button!=C.RIGHT&&(this.isIntersectSelf&&this.isNew||this.isAtWrongPlace&&this.isNew||!e.isAtDomElement&&this.isNew||e.hoverViewport!=viewer.mainViewport&&this.unableDragAtMap||!kf(this.points,this.points.length))) return this.continueDrag(null,e);var t=this.markers.indexOf(e.drag.object);return-1!==t&&(this.dispatchEvent({type:"marker_dropped",index:t}),2i.count&&(i={id:n,count:r[n]});this.datasetId=0");return n.setText(e),n.setPos(t),void n.setVisible(!0)} for(var r,o,s,l=function(e,t,n,i){var r=(new Cn).addVectors(t,n).multiplyScalar(.5);e.setPos(r),i=null==i?t.distanceTo(n):i;n=viewer.unitConvert.convert(i,"distance",3,a.unitSystem,.1,!0);return e.setText(n),i},u=this.points.length-1,c=0;c<=u;c++){var d,h,p=this.points[c],f=this.points[uthis.points[1].z?(r=this.points[0],this.points[1]):(r=this.points[1],this.points[0]),s=new Cn(r.x,r.y,o.z),n=r.distanceTo(s)/o.distanceTo(s),n=Math.atan(n),this.shouldShowHorVerGuide=Vf=this.points.length) return 0;var 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];return this.getAngleBetweenLines(n,t,e)}},{key:"getCenter",value:function(){return 3<=this.points.length?this.center.clone():2==this.points.length?this.points[0].clone().add(this.points[1]).multiplyScalar(.5):this.points[0].clone()}},{key:"createGuideLine",value:function(){var e=Sf.createFatLine([],{material:this.getLineMat("guide")});e.visible=!1,this.guideLine=e,this.add(e)}},{key:"createHorVerGuideLine",value:function(){var e=Sf.createFatLine([],{material:this.getLineMat("guide")});e.visible=!1,this.verGuideEdge=e;e=Sf.createFatLine([],{material:this.getLineMat("guide")});e.visible=!1,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 Jp($.extend(t?Gf:Hf,{sizeInfo:Uf,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(){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 Jp($.extend(Gf,{sizeInfo:Uf,name:"areaLabel_"}));return t.addEventListener("mouseover",function(){e.setSelected(!0,"areaLabel")}),t.addEventListener("mouseleave",function(){e.setSelected(!1,"areaLabel")}),t.addEventListener("click",function(){viewer.focusOnObject(e,"measure")}),viewer.setObjectLayers(t,"measure"),t.visible=!1,t}},{key:"getMarkerMaterial",value:function(e){return Bf||(Bf={default:new Wp($.extend({},Of,{transparent:!0,opacity:1,map:Rf.load(Potree.resourcePath+"/textures/pic_point_s32.png"),useDepth:!0})),select:new $i({transparent:!0,opacity:1,depthTest:!1,map:Rf.load(Potree.resourcePath+"/textures/pic_point32.png")})},m.markerMats=Bf),Bf[e]}},{key:"getLineMat",value:function(e){return(m.lineMats=!m.lineMats?{edgeDefault:Sf.createFatLineMat({color:T.measure.default.color,lineWidth:T.measure.lineWidth,useDepth:!0,dashWithDepth:!0,dashed:!0,dashSize:.04,gapSize:.04,transparent:!0,opacity:T.measure.default.opacity,depthTestWhenPick:!0}),edgeSelect:Sf.createFatLineMat({color:T.measure.highlight.color,dashSize:.5,gapSize:.2,lineWidth:T.measure.lineWidth,transparent:!0,opacity:T.measure.highlight.opacity}),guide:Sf.createFatLineMat({color:T.measure.guide.color,dashSize:.1,gapSize:.02,dashed:!0,lineWidth:T.measure.lineWidth})}:m.lineMats)[e]}},{key:"createAreaPlane",value:function(){return Lf||(Lf={default:new Wp($.extend({},zf,{color:If,side:Y,opacity:.2,transparent:!0,useDepth:!0})),selected:new $i({color:If,side:Y,opacity:.3,transparent:!0})},m.planeMats=Lf),b(v(m.prototype),"createAreaPlane",this).call(this,Lf.default)}},{key:"raycast",value:function(e,t){for(var n=0;n=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;l\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.moveHere(n.scene.getActiveCamera()),n.dispatchEvent({type:"click",target:g(n)}),viewer.renderer.domElement.focus()},n.elTitle.click(n.clickTitle),n.actions=n.actions.map(function(e){return e instanceof Zf?e:new Zf(e)});var t,i=ue(n.actions);try{for(i.s();!(t=i.n()).done;) t.value.pairWith(g(n))}catch(e){i.e(e)}finally{i.f()} var r,a=ue(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 h(s,[{key:"installHandles",value:function(o){var i,r,a,s,l,u,c,d,e,h=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();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));n=e.y-t.y,t=e.x-t.x;0e;){var t=this.getLRUItem();t&&this.disposeSubtree(t)}}},{key:"disposeSubtree",value:function(e){var t=[e];e.traverse(function(e){e.loaded&&t.push(e)});for(var n=0,i=t;n=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=r(regeneratorRuntime.mark(function e(){var l,t,u,c=this;return regeneratorRuntime.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 n=N(e.split("-").map(function(e){return parseInt(e,10)}),4),i=n[0],r=n[1],a=n[2],o=n[3],s=N(t.split("-").map(function(e){return parseInt(e,10)}),4),e=s[0],n=s[1],t=s[2],s=s[3];return i>1)+"-"+(r>>1)+"-"+(a>>1)];a&&(a.hasChildren=!0,s=a.key.step(o,s,t),(t=new Potree.PointCloudEptGeometryNode(c.ept,s.b,s.d,s.x,s.y,s.z)).level=n,t.numPoints=u[e],a.addChild(t),l[s.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;a=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(e){var t=this;if(t.level%t.pcoGeometry.hierarchyStepSize==0){var n=t.pcoGeometry.octreeDir+"/"+t.getHierarchyPath()+"/"+t.name+".hrc";n+="?m="+t.pcoGeometry.timeStamp;var i=Gp.createXMLHttpRequest();i.open("GET",n,!0),i.responseType="arraybuffer",i.overrideMimeType("text/plain; charset=x-user-defined"),i.onreadystatechange=function(){var e;4===i.readyState&&(200===i.status||0===i.status?(e=i.response,function(e,t){performance.now();var n=new DataView(t),i=[],r=n.getUint8(0),a=n.getUint32(1,!0);e.numPoints=a,i.push({children:r,numPoints:a,name:e.name});for(var o=[],s=5;0>8,n[4*l+2]=a[l]%256);var u=u.geometryNode.density;"number"==typeof u?(u=Math.log2(u)/2-1.5,n[4*o+3]=10*(10+u)):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 qn),i=!1,r=0;r1/0)) for(var s=o.geometryNode.buffer,l=s.offset("position"),u=s.stride,c=new DataView(s.data),d=(new ni).multiplyMatrices(r,o.sceneNode.matrixWorld),h=new Mn,p=0;pPotree.pointBudget))&&!(i.get(_)+x.getNumPoints()>_.pointBudget))&&A<=C;C=_.material.clipBoxes;if(0Potree.pointBudget) break;if(S){n+=x.getNumPoints();S=i.get(_);i.set(_,S+x.getNumPoints()),_.numVisibleNodes++,_.numVisiblePoints+=x.getNumPoints(),!x.isGeometryNode()||E&&!E.isTreeNode()||(x.isLoaded()&&p<2?(x=_.toTreeNode(x,E),p++):(s.push({pointcloud:_,node:x}),o.push(x))),x.isTreeNode()&&(le.lru.touch(x.geometryNode),x.sceneNode.visible=!0,x.sceneNode.material=_.material,a.push(x),_.visibleNodes.push(x),void 0===x._transformVersion&&(x._transformVersion=-1),E=v.get(_),x._transformVersion!==E.number&&(x.sceneNode.updateMatrix(),x.sceneNode.matrixWorld.multiplyMatrices(_.matrixWorld,x.sceneNode.matrix),x._transformVersion=E.number),_.showBoundingBox&&!x.boundingBoxNode&&x.getBoundingBox?((E=new Hm(x.getBoundingBox())).matrixAutoUpdate=!1,_.boundingBoxNodes.push(E),x.boundingBoxNode=E,x.boundingBoxNode.matrix.copy(_.matrixWorld)):_.showBoundingBox?(x.boundingBoxNode.visible=!0,x.boundingBoxNode.matrix.copy(_.matrixWorld)):!_.showBoundingBox&&x.boundingBoxNode&&(x.boundingBoxNode.visible=!1));for(var $=x.getChildren(),ee=0;ee<$.length;ee++){var te=$[ee],ne=0;if(e.isPerspectiveCamera){var ie=te.getBoundingSphere(),re=ie.center,ae=T.x-re.x,oe=T.y-re.y,re=T.z-re.z,oe=Math.sqrt(ae*ae+oe*oe+re*re),re=ie.radius,ie=e.fov*Math.PI/180,ie=re*(.5*f/(Math.tan(ie/2)*oe));if(ie<_.minimumNodePixelSize) continue;ne=ie,oe-re<0&&(ne=Number.MAX_VALUE)}else re=te.getBoundingBox(),ne=(te.getBoundingSphere().center.distanceTo(T),re.max.clone().sub(re.min).length());h.push({pointcloud:b.pointcloud,node:te,parent:x,weight:ne})}}} !function(){var e,t=ue(r.filter(function(e){return e.generateDEM&&e.dem instanceof Potree.DEM}));try{for(t.s();!(e=t.n()).done;){var n=e.value,i=n.visibleNodes.filter(function(e){return e.getLevel()<=4});n.dem.update(i)}}catch(e){t.e(e)}finally{t.f()}}();for(var se=0;seT.vbos.get(S).version&&H.updateBuffer(E);else T=H.createBuffer(E),H.buffers.set(E,T);if(V.bindVertexArray(T.vao),void 0===Xm[j.activeAttributeName]&&Object.keys(E.attributes).includes(j.activeAttributeName)){var C,P=Xm.aExtra.location;for(C in E.attributes){E.attributes[C];var D=T.vbos.get(C);V.bindBuffer(V.ARRAY_BUFFER,D.handle),V.disableVertexAttribArray(P)} var k=j.activeAttributeName,M=E.attributes[k],A=T.vbos.get(k);void 0!==M&&void 0!==A&&(B=H.glTypeMapping.get(M.array.constructor),L=M.normalized,V.bindBuffer(V.ARRAY_BUFFER,A.handle),V.vertexAttribPointer(P,M.itemSize,B,L,0,0),V.enableVertexAttribArray(P));var A=N.pcoGeometry.pointAttributes.attributes.find(function(e){return e.name===k}),M=(M=j.getRange(k))||A.range,B=A.initialRange,L=B[1]-B[0],A=M=M||[0,1],M=L/(A[1]-A[0]),L=-(A[0]-B[0])/L,M=Number.isNaN(M)?1:M,L=Number.isNaN(L)?0:L;G.setUniform1f("uExtraScale",M),G.setUniform1f("uExtraOffset",L)}else for(var R in E.attributes){var F,I,O=E.attributes[R],z=T.vbos.get(R);void 0!==Xm[R]&&(F=Xm[R].location,I=H.glTypeMapping.get(O.array.constructor),R=O.normalized,V.bindBuffer(V.ARRAY_BUFFER,z.handle),V.vertexAttribPointer(F,O.itemSize,I,R,0,0),V.enableVertexAttribArray(F))} L=T.numElements;V.drawArrays(V.POINTS,0,L),Z++})()}catch(e){r.e(e)}finally{r.f()} V.bindVertexArray(null),le.measureTimings&&(performance.mark("renderNodes-end"),performance.measure("render.renderNodes","renderNodes-start","renderNodes-end"))}},{key:"renderOctree",value:function(e,t,n,i){var r=4this.maxDepth) return e.abrupt("continue",10);e.next=9;break;case 9:a.loaded?(n.push(a),le.lru.touch(a),this.highestLevelServed=Math.max(a.getLevel(),this.highestLevelServed),o=a.pcoGeometry,o=o?o.hierarchyStepSize:1,(0===a.getLevel()||a.level%o==0&&a.hasChildren)&&this.traverse(a)):(a.load(),this.priorityQueue.push(r));case 10:i++,e.next=4;break;case 13:if(!(0e.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}(),ch=function(){function e(){O(this,e),this.workers={}} return h(e,[{key:"getWorker",value:function(e){var t;return this.workers[e]||(this.workers[e]=[]),0===this.workers[e].length&&(t=new Worker(e),this.workers[e].push(t)),this.workers[e].pop()}},{key:"returnWorker",value:function(e,t){this.workers[e].push(t)}}]),e}();function $m(e){var t,n=e.material,i=[],r=ue(n.ranges);try{for(r.s();!(t=r.n()).done;){var a=N(t.value,2),o=a[0],s=a[1];i.push({name:o,value:s})}}catch(e){r.e(e)}finally{r.f()}"number"==typeof n.elevationRange[0]&&i.push({name:"elevationRange",value:n.elevationRange}),"number"==typeof n.intensityRange[0]&&i.push({name:"intensityRange",value:n.intensityRange});var l=Object.entries(Potree.PointSizeType).find(function(e){return e[1]===n.pointSizeType})[0],l={activeAttributeName:n.activeAttributeName,ranges:i,size:n.size,minSize:n.minSize,pointSizeType:l,matcap:n.matcap};return{name:e.name,url:e.pcoGeometry.url,position:e.position.toArray(),rotation:e.rotation.toArray(),scale:e.scale.toArray(),material:l}} function ev(e){return{uuid:e.uuid,name:e.name,points:e.points.map(function(e){return e.toArray()}),height:e.height,width:e.width}} function tv(e){return{uuid:e.uuid,type:e.constructor.name,name:e.name,position:e.position.toArray(),rotation:e.rotation.toArray(),scale:e.scale.toArray(),visible:e.visible,clip:e.clip}} function nv(e){var t=e.controlPoints.map(function(e){return{position:e.position.toArray(),target:e.target.toArray()}});return{uuid:e.uuid,name:e.name,duration:e.duration,t:e.t,curveType:e.curveType,visible:e.visible,controlPoints:t}} function iv(e){return{uuid:e.uuid,name:e.name,measureType:e.measureType,points:e.points.map(function(e){return e.toArray()})}} function rv(e){return{cameraParamsPath:e.cameraParamsPath,imageParamsPath:e.imageParamsPath}} function av(e){return{path:e.path}} function ov(e){var i=new Map;e.scene.annotations.traverseDescendants(function(e){var t,n=(n={uuid:(t=e).uuid,title:t.title.toString(),description:t.description,position:t.position.toArray(),offset:t.offset.toArray(),children:[]},t.cameraPosition&&(n.cameraPosition=t.cameraPosition.toArray()),t.cameraTarget&&(n.cameraTarget=t.cameraTarget.toArray()),void 0!==t.radius&&(n.radius=t.radius),n);i.set(e,n)});var t,n=ue(i);try{for(n.s();!(t=n.n()).done;){var r,a=N(t.value,2),o=a[0],s=a[1],l=ue(o.children);try{for(l.s();!(r=l.n()).done;){var u=r.value,c=i.get(u);s.children.push(c)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){n.e(e)}finally{n.f()} return e.scene.annotations.children.map(function(e){return i.get(e)})} function sv(e){return(lv=lv||{position:Sf.createFatLineMat({color:yv,lineWidth:3}),target:Sf.createFatLineMat({color:wv,lineWidth:3}),frustum:Sf.createFatLineMat({color:yv,lineWidth:2}),aimAtTarget:new tl({color:wv})})[e]} var lv,uv=function(){y(a,hn);var r=w(a);function a(e,t){var n;O(this,a),(n=r.call(this)).position=e,n.color="#"+new Yi(t).getHexString(),n.svg=n.create(),n.visible_=!0;function i(){n.update()} return viewer.addEventListener("camera_changed",i),n.addEventListener("dispose",function(){viewer.removeEventListener("camera_changed",i)}),n} return h(a,[{key:"create",value:function(){var o=this,e="http://www.w3.org/2000/svg",t=document.createElementNS(e,"svg");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%)";e=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),viewer.renderer.domElement.parentElement.appendChild(t);function n(e){o.selectedElement=t,document.addEventListener("mousemove",r)} function i(e){o.selectedElement=null,document.removeEventListener("mousemove",r)} var r=function(e){var t,n,i,r,a;o.selectedElement&&(e.preventDefault(),a=viewer.renderer.domElement.getBoundingClientRect(),t=e.clientX-a.x,n=e.clientY-a.y,i=(r=viewer.renderer.getSize(new yn)).width,e=r.height,a=viewer.scene.getActiveCamera(),(r=o.position.clone().project(a)).x=(t/i-.5)/.5,r.y=(-(n-e)/e-.5)/.5,a=r.clone().unproject(a),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}(),cv=(new ua(1,1),function(){y(r,qp);var i=w(r);function r(e){var t,n=1=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;this.funcs=this.funcs.filter(function(e){return e.running});var t=this.funcs.length;0\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);var a=new qf(this.viewer.scene.getActiveCamera().clone());this.dispatchEvent({type:"start_inserting_clipping_volume"}),this.viewer.scene.addPolygonClipVolume(a),this.sceneMarker.add(a);function i(i){i.button===C.LEFT?(a.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)}),a.markers.length>t.maxPolygonVertices&&o.callback(),t.viewer.inputHandler.startDragging(a.markers[a.markers.length-1])):i.button===C.RIGHT&&o.callback(i)} var o={callback:null};return o.callback=function(e){r.remove(),3=s.maxMarkers?u({finish:!0}):(t=s.addMarker({point:s.points[n-1].clone()}),r.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===C.RIGHT&&(e.pressDistance\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 h(n,[{key:"setMessage",value:function(e){this.elContainer.empty(),"string"==typeof e?this.elContainer.append($("".concat(e,""))):this.elContainer.append(e)}}]),n}(),pu=function(){function t(e){O(this,t),this.potreeRenderer=e,this.threeRenderer=this.potreeRenderer.threeRenderer,this.target=new An(2048,2048,{minFilter:Oe,magFilter:Oe,format:et,type:Xe}),this.target.depthTexture=new El,this.target.depthTexture.type=We,this.threeRenderer.setClearColor(16711680,1);e=this.threeRenderer.getRenderTarget();this.threeRenderer.setRenderTarget(this.target),this.threeRenderer.setRenderTarget(e)} return h(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;this.camera=new $r(t,n,.1,i),this.camera.up.set(0,0,1),this.camera.position.copy(e.position);e=(new Cn).subVectors(e.position,e.getWorldDirection(new Cn));this.camera.lookAt(e),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}(),qv=function(){y(o,hn);var a=w(o);function o(e){var t;O(this,o),(t=a.call(this)).viewer=e,t.renderer=e.renderer,t.addEventListener("start_inserting_profile",function(e){t.viewer.dispatchEvent({type:"cancel_insertions"})}),t.scene=new gs,t.scene.name="scene_profile",t.light=new $c(16777215,1),t.scene.add(t.light),t.viewer.inputHandler.registerInteractiveScene(t.scene),t.onRemove=function(e){return t.scene.remove(e.profile)},t.onAdd=function(e){return t.scene.add(e.profile)};var n,i=ue(e.scene.profiles);try{for(i.s();!(n=i.n()).done;){var r=n.value;t.onAdd({profile:r})}}catch(e){i.e(e)}finally{i.f()} return e.addEventListener("update",t.update.bind(g(t))),e.addEventListener("render.pass.perspective_overlay",t.render.bind(g(t))),e.addEventListener("scene_changed",t.onSceneChange.bind(g(t))),e.scene.addEventListener("profile_added",t.onAdd),e.scene.addEventListener("profile_removed",t.onRemove),t} return h(o,[{key:"onSceneChange",value:function(e){e.oldScene&&(e.oldScene.removeEventListeners("profile_added",this.onAdd),e.oldScene.removeEventListeners("profile_removed",this.onRemove)),e.scene.addEventListener("profile_added",this.onAdd),e.scene.addEventListener("profile_removed",this.onRemove)}},{key:"startInsertion",value:function(){var r=this,e=0');$(e.parentElement).append(x),x.css("right","10px"),x.css("bottom","10px");function E(e){w.importance=0,$(x).remove(),w.viewer.inputHandler.deselectAll(),w.viewer.inputHandler.toggleSelection(b);var t=e.viewer.scene.getActiveCamera(),n=e.viewer.renderer.getSize(new yn),i=(new yn).addVectors(e.drag.end,e.drag.start).multiplyScalar(.5),r=new Cn(0,0,.5);Jf.convertScreenPositionToNDC(r,i,n.width,n.height);var a=Jf.mouseToRay(r,t,n.width,n.height);w.removeEventListener("drag",_),w.removeEventListener("drop",E);var o,s,l,u=[],c=[],d=ue(w.viewer.scene.pointclouds);try{for(d.s();!(o=d.n()).done;){var h,p,f,m,v,g,y=o.value;y.visible&&((h=t.clone()).left=-b.scale.x/2,h.right=+b.scale.x/2,h.top=+b.scale.y/2,h.bottom=-b.scale.y/2,h.near=-b.scale.z/2,h.far=+b.scale.z/2,h.rotation.copy(b.rotation),h.position.copy(b.position),h.updateMatrix(),h.updateMatrixWorld(),h.updateProjectionMatrix(),h.matrixWorldInverse.copy(h.matrixWorld).invert(),p=new ti(h.getWorldPosition(new Cn),h.getWorldDirection(new Cn)),f=new ti(p.origin.clone().add(p.direction.clone().multiplyScalar(b.scale.z)),p.direction.clone().multiplyScalar(-1)),(new yn).subVectors(e.drag.end,e.drag.start),m={width:16,height:16,pickWindowSize:16,all:!0,pickClipped:!0,pointSizeType:am.FIXED,pointSize:1},v=y.pick(viewer,null,h,p,m),h.rotateX(Math.PI),h.updateMatrix(),h.updateMatrixWorld(),h.updateProjectionMatrix(),h.matrixWorldInverse.copy(h.matrixWorld).invert(),g=y.pick(viewer,null,h,f,m),v&&u.push.apply(u,Q(v)),g&&c.push.apply(c,Q(g)))}}catch(e){d.e(e)}finally{d.f()} (0"))}}]),e}(),$v=function(){function t(e){O(this,t),this.viewer=e,this.edlMaterial=null,this.rtEDLs=new Map,this.gl=e.renderer.getContext(),e.addEventListener("resize",this.resize.bind(this)),this.initEDL(e)} return h(t,[{key:"initEDL",value:function(e){null==this.edlMaterial&&(this.edlMaterial=new _v,this.edlMaterial.depthTest=!0,this.edlMaterial.depthWrite=!0,this.edlMaterial.transparent=!0)}},{key:"resize",value:function(e){jp.EXT_DEPTH.isSupported()&&(e=e.viewport,this.getRtEDL(e).setSize(e.resolution2.x,e.resolution2.y))}},{key:"clearTargets",value:function(){var e=0t?(n=l.y,(i.resolution.y-c.y)/n):(n=l.x,(i.resolution.x-c.x)/n)),a.zoom=u*e+o*(1-e),a.updateProjectionMatrix())},Easing:n})}},{key:"zoomOrthoCamera",value:function(n,i,e,t,r){var a=this,o=n.zoom,s=new Cn(e.x,e.y,.5);gv.start(function(e){var t=s.clone().unproject(n);n.zoom=i*e+o*(1-e),n.updateProjectionMatrix();e=s.clone().unproject(n),t=(new Cn).subVectors(e,t);n.position.sub(t),a.position.copy(n.position),r&&r()},t,null,0,pv.easeInOutSine,null,"zoomInView")}}]),n}(),ig=function(){y(i,Si);var n=w(i);function i(e){var t;return O(this,i),(t=n.call(this)).getArrow(),t.createArrows(),t} return h(i,[{key:"getArrow",value:function(){var e=new Si,t=Sf.createLine([new Cn,new Cn(0,0,2)]),n=new Hr(new Cl(.3,.3,4));n.position.set(0,0,9);var i=new Hr(new kl(0,.6,2,12,1,!1));i.position.set(0,0,12),i.rotation.set(Math.PI/2,0,0),e.add(n),e.add(t),e.add(i),this.arrowGroup=e}},{key:"createArrows",value:function(){var r=this;new $i({color:"#00d7df",side:2,transparent:!0,opacity:.8,depthWrite:!1});Object.keys(Potree.config.axis).forEach(function(e){var t=Potree.config.axis[e].color,n=r.arrowGroup.clone();n.children.forEach(function(e){e.material=e.material.clone(),e.material.color.set(t)});var i=r.createLabel(e,t);i.position.set(0,0,16),n.add(i),"y"==e?n.rotation.x=-Math.PI/2:"x"==e&&(n.rotation.y=Math.PI/2),r.add(n)})}},{key:"createLabel",value:function(e,t){var n=document.createElement("canvas"),i=n.getContext("2d");n.width=256,n.height=256;i.fillStyle=t,i.font="normal 120px 微软雅黑";t=i.measureText(e).width;i.clearRect(0,0,n.width,n.height),i.fillText(e,(n.width-t)/2,(n.height+120)/2);n=new En(n);n.needsUpdate=!0,n.minFilter=Re,n.magFilter=Re;n=new Fs(new Es({map:n}));return n.renderOrder=1,n.scale.set(3,3,3),n}}]),i}(),rg=function(){y(n,hn);var t=w(n);function n(){var e;return O(this,n),(e=t.call(this)).annotations=new Kf,e.scene=new gs,e.scenePointCloud=new gs,e.cameraP=new $r(e.fov,1,Potree.config.view.near,Potree.config.view.near),e.cameraO=new ed(-1,1,1,-1,Potree.config.view.near,Potree.settings.cameraFar),e.cameraP.limitFar=!0,e.cameraVR=new $r,e.cameraBG=new Kr,e.cameraScreenSpace=new ed(-1,1,1,-1,.1,10),e.cameraMode=em.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 ng,e.directionalLight=null,e.initialize(),e.axisArrow=new ig,e.scene.add(e.axisArrow),Potree.settings.isDebug||(e.axisArrow.visible=!1),viewer.setObjectLayers(e.axisArrow,"bothMapAndScene"),e.tags=new Si,e.scene.add(e.tags),e} return h(n,[{key:"estimateHeightAt",value:function(e){var t,n=null,i=1/0,r=ue(this.pointclouds);try{for(r.s();!(t=r.n()).done;){var a=t.value;if(void 0!==a.root.geometryNode){var o=null,s=1/0,l=e.clone().sub(a.position);l.z=0;for(var u=new ti(l,new Cn(0,0,1)),c=[a.root];0Math.abs(e.z)?wg.setVector(mg,-e.y,e.x,0):wg.setVector(mg,0,-e.z,e.y)):wg.cross(e,t,mg),this._x=mg.x,this._y=mg.y,this._z=mg.z,this._w=vg,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,a=e._w,o=t._x,s=t._y,e=t._z,t=t._w;return this._x=n*t+a*o+i*e-r*s,this._y=i*t+a*s+r*o-n*e,this._z=r*t+a*e+n*s-i*o,this._w=a*t-n*o-i*s-r*e,this}},wg.convertWorkshopVector=function(e){return new wg.Vector3(-e.x,e.y,e.z)},wg.convertWorkshopQuaternion=function(e){return new wg.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new wg.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},wg.convertWorkshopOrthoZoom=function(e){return-1===e?-1:e*($("#player").width()/$("#player").height())},wg.convertWorkshopPanoramaQuaternion=function(e){return new wg.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new wg.Quaternion).setFromAxisAngle(new wg.Vector3(0,1,0),270*wg.RADIANS_PER_DEGREE))},wg.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},wg.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},wg.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},wg.setVector=function(e,t,n,i){e.x=t,e.y=n,e.z=i},wg.copyVector=function(e,t){t.x=e.x,t.y=e.y,t.z=e.z},wg.addVector=function(e,t){e.x+=t.x,e.y+=t.y,e.z+=t.z},wg.subVector=function(e,t){e.x-=t.x,e.y-=t.y,e.z-=t.z},wg.applyQuaternionToVector=function(e,t){var n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,s=e.z,l=e.w,u=l*n+o*r-s*i,c=l*i+s*n-a*r,e=l*r+a*i-o*n,r=-a*n-o*i-s*r;t.x=u*l+r* -a+c* -s-e* -o,t.y=c*l+r* -o+e* -a-u* -s,t.z=e*l+r* -s+u* -o-c* -a},wg.angleBetweenVectors=function(e,t){return Math.acos(wg.dot(e,t))};var bg,xg,Eg,_g,Mg,Ag,Tg,Sg,Cg,Pg,Dg,kg,Bg,Lg,Rg={clampVFOV:function(e,t,n,i){return te.pointer.x&&(h*=-1),m.yawDelta+=h),m.pointerDragStart.copy(e.pointer),r.matrixWorld=p)} if(a.includes("pan")){if(!m.canMovePos(t)) return;if("OrthographicCamera"==r.type){var l,u=Jf.getOrthoCameraMoveVec(e.drag.pointerDelta,r),c=window.viewer.modules.Alignment,d=window.viewer.modules.MergeEditor,h=c.handleState,p=e.buttons===rm.LEFT&&t.alignment&&h&&t.alignment[h];if("pano"==Potree.settings.editType){c=window.viewer.modules.PanoEditor;if(p&&c.selectedPano&&(c.selectedGroup&&c.checkIfAllLinked({group:c.selectedGroup})?(c.dispatchEvent("needToDisConnect"),console.warn("选中的漫游点连通了整个数据集,不允许移动")):("translate"==h&&(e.drag.intersectStart.pointclouds&&Fm.getMixedSet(c.selectedClouds,e.drag.intersectStart.pointclouds).length||c.selectedPano.hovered)||"rotate"==h)&&(l=c.selectedClouds)),!l&&e.buttons===rm.LEFT&&t.rotateSide) return c.rotateSideCamera(-e.drag.pointerDelta.x)}else if("merge"==Potree.settings.editType){if(e.buttons===rm.LEFT&&t.rotateSide) return d.rotateSideCamera(-e.drag.pointerDelta.x)}else l=p&&e.drag.intersectStart.pointcloud&&[e.drag.intersectStart.pointcloud];l?m.dispatchEvent({type:"transformPointcloud",intersect:e.intersect.orthoIntersect,intersectStart:e.drag.intersectStart.orthoIntersect,moveVec:u,pointclouds:l,camera:r}):m.translationWorldDelta.add(u.negate())}else e.drag.intersectStart?(null==e.drag.z&&(n=e.drag.intersectStart.location.clone().project(r),e.drag.z=n.z,e.drag.projectionMatrixInverse=r.projectionMatrixInverse.clone(),i=new Cn(m.pointerDragStart.x,m.pointerDragStart.y,e.drag.z),e.drag.translateStartPos=i.clone().unproject(r)),n=r.projectionMatrixInverse,r.projectionMatrixInverse=e.drag.projectionMatrixInverse,i=new Cn(e.pointer.x,e.pointer.y,e.drag.z).clone().unproject(r).clone().sub(e.drag.translateStartPos),r.projectionMatrixInverse=n,m.translationWorldDelta.copy(i.negate())):(i=t.lastIntersect?t.lastIntersect.location||t.lastIntersect:f.bound.center,t=r.position.distanceTo(i),i=Rg.getHFOVForCamera(r,!0),i=t*Math.tan(i/2),m.translationDelta.x-=e.drag.pointerDelta.x*i,m.translationDelta.z-=e.drag.pointerDelta.y*i);m.useAttenuation=!1} a.includes("scale")&&(m.dollyEnd.subVectors(e.touches[0].pointer,e.touches[1].pointer),a=m.dollyEnd.length()/m.dollyStart.length(),e=(new yn).addVectors(e.touches[0].pointer,e.touches[1].pointer).multiplyScalar(.5),v({pointer:e,scale:a,camera:r}),m.dollyStart.copy(m.dollyEnd))}}},v=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 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 \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,vWorldPosition0.xyz);\n }\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.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(vWorldPosition0, depthMap0, cameraHeight0, eyePos);\n }\n vec2 depth1 = getDepth(vWorldPosition1, 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 "},Ug=function(){y(r,Gu);var i=w(r);function r(){O(this,r);function t(e){var e=(t=e.viewport).offset||new Vector2,t=t.resolution2;n.uniforms.viewport.value.set(e.x,e.y,t.x,t.y)} var n=i.call(this,{fragmentShader:Ng.fragmentShader,vertexShader:Ng.vertexShader,uniforms:Jr.clone(Ng.uniforms),side:Y,name:"ModelTextureMaterial",defines:{}}),e=viewer.mainViewport;return t({viewport:e}),viewer.addEventListener("resize",function(e){t(e)}),viewer.addEventListener("camera_changed",function(e){n.uniforms.inverseProjectionMatrix.value.copy(e.camera.projectionMatrixInverse)}),n} return h(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;Fm.addOrRemoveDefine(this,"hasDepthTex",e?"add":"remove")}}]),r}(),Gg={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,d=2*(i/l)-1+c,h=2*((r=l-1-r)/l)-1+c;switch(a=a||Gg.LocationOnTile.Center){case Gg.LocationOnTile.UpperLeft:d-=c,h+=c,d+=o*u;break;case Gg.LocationOnTile.UpperRight:d+=c,h+=c,h-=o*u;break;case Gg.LocationOnTile.LowerRight:d+=c,h-=c,d-=o*u;break;case Gg.LocationOnTile.LowerLeft:d-=c,h-=c,h+=o*u;break;case Gg.LocationOnTile.Center:} switch(n){case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X:wg.setVector(s,-1,h,-d);break;case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:wg.setVector(s,1,h,d);break;case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:wg.setVector(s,-d,1,-h);break;case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:wg.setVector(s,-d,-1,h);break;case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:wg.setVector(s,-d,h,1);break;case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:wg.setVector(s,d,h,-1)} wg.normalize(s)},getFaceForTile:function(e,t){var n=Gg.TILE_SIZE;ethis.images360.qualityManager.maxNavPanoSize?this.images360.panoRenderer.zoomRenderTarget.texture:(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];t||(this.resolutionPromise[this.id]=t={});var n=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:gm.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:gm.LoadComplete,size:e.panoSize,count:e.totalTiles}))}},{key:"onTileRenderFail",value:function(e){e.id===this.id&&this.dispatchEvent({type:gm.LoadFailed})}},{key:"onUploadAttemptedForAllTiles",value:function(e){var t;e.id===this.id&&(t=this.images360.qualityManager.getPanoSize(cm.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 Jp(Object.assign({},qg,{text:this.id})),this.images360.node.add(this.label),this.floorPosition&&this.label.position.copy(this.floorPosition)}},{key:"createTextLabel2",value:function(){this.label2=new Jp(Object.assign({},{backgroundColor:{r:255,g:255,b:255,a:0},textColor:{r:255,g:255,b:255,a:1},textBorderColor:{r:30,g:30,b:30,a:1},textBorderThick:3,dontFixOrient:!0,renderOrder:10,fontsize:30},{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}();Qg.prototype.loadTiledPano=(Vg={},jg={},Wg={},function(t,n,i,r,a,o){var s=this,l=n.datasetsLocal.find(function(e){return e.datasetId==s.pointcloud.dataset_id}).direction;null!=r||(r=!0),null!=a||(a=!0);var u,c=this.getWaitDeferred(t),d=c.deferred,h=null,p=null;return i&&("number"==typeof i?h=i:(h=i.hFov,p=i.vFov)),this.isLoaded(t)?d.resolve(t):(c.active||(c.active=!0,u=this.id+":"+t,Vg[u]=Vg[u]||[],Wg[u]=null,i&&(Gg.matchingTilesInDirection(this,t,l,h,p,i=[]),Wg[u]=i,Vg[u].forEach(function(t){var e=Wg[u].find(function(e){return t.faceTileIndex==e.faceTileIndex&&t.face==e.face});e&&(e.loaded=!0)}),Wg[u].some(function(e){return!e.loaded})||(d.resolve(t),this.resetWaitDeferred(t),Wg[u]=null)),jg[this.id]||(jg[this.id]=!0,this.addEventListener(gm.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(gm.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(gm.TileLoaded,function(e){var t=e.index,n=e.count,i=e.size,r=this.id+":"+i;Vg[r]=Vg[r]||[];var e=Gg.getTileLocation(i,t,{}),a=e.faceTileIndex,o=e.face;Vg[r].push({faceTileIndex:a,face:o});e=this.getWaitDeferred(i).deferred;e&&"pending"===e.state()&&(e.notify(i,t,n),Wg[r]&&((t=Wg[r].find(function(e){return e.faceTileIndex==a&&e.face==o}))&&(t.loaded=!0),Wg[r].some(function(e){return!e.loaded})||(this.onPanoRendered(this.id,i,n,!0),e.resolve(i,n),this.resetWaitDeferred(i),Wg[r]=null)))}.bind(this)))),this.images360.tileDownloader.clearForceQueue(),this.images360.tileDownloader.forceQueueTilesForPano(this,t,l,h,p,o),this.tiledPanoRenderTarget=this.images360.panoRenderer.activateTiledPano(this,this.images360.qualityManager.getMaxNavPanoSize(),r),this.images360.panoRenderer.renderPanoTiles(this.id,n,a)),d.promise()});var Kg=function(){function i(e,t,n){O(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=A.isMobile()?2048:4096,this.init()} return h(i,[{key:"init",value:function(e){this.buildPanoSizeClassMap(this.devicePixelDensity,this.deviceScreenSize,this.clientBandwidth),this.ultraHighSize=this.getPanoSize(cm.ULTRAHIGH),this.highSize=this.getPanoSize(cm.HIGH),this.standardSize=this.getPanoSize(cm.STANDARD),this.baseSize=this.getPanoSize(cm.BASE),T.tiling.maxZoomPanoQuality&&this.ultraHighSize<=T.tiling.maxZoomPanoQuality&&(T.tiling.allowUltraHighResolution=!0),this.highQualityThreshold=A.valueFromHash("threshold2k",T.windowHeightHighQualityThreshold),this.updateMaximums()}},{key:"updateFromModel",value:function(e){this.updateUltraHighResolutionSettings(e)}},{key:"updateUltraHighResolutionSettings",value:function(e){T.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=T.tiling.maxNavPanoQuality||this.detectMaxNavPanoSize(),this.maxZoomPanoSize=T.tiling.maxZoomPanoQuality||this.detectMaxZoomPanoSize(),this.maxZoomPanoSizet.panoSize?1:t.panoSize>e.panoSize?-1:-(a-n)} var n0,i0,r0,a0,o0,s0,l0,u0=function(){function u(e,t,n,i,r){O(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 Cn(0,0,0),new Cn(0,0,-1),new Cn(0,0,-1))} return h(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=[ly.filters.inPanoDirection(e.position,i,u.DIRECTION_SCORE_STRICTNESS),ly.filters.not(e)],i=[ly.scoreFunctions.distanceSquared(e),ly.scoreFunctions.direction(e.position,i)],o=Fm.sortByScore(t,a,i);if(o) for(var s=0;s=Gg.TILE_SIZE?Gg.TILE_SIZE:n;e.face=Gg.getFaceForTile(n,i),e.cubeFace=Gg.mapFaceToCubemapFace(e.face),e.pano=t,e.panoSize=n,e.tileSize=r,e.tileIndex=i,e.totalTiles=Gg.getTileCountForSize(n),e.status=vm.None,e.image=null,Gg.getTileLocation(e.panoSize,e.tileIndex,e),Gg.getTileVector(e.panoSize,e.tileSize,e.cubeFace,e.tileX,e.tileY,Gg.LocationOnTile.Center,0,e.direction)}},{key:"getTiles",value:function(e,t){return(Potree.settings.isLocal2?"".concat(Potree.settings.urls.prefix3,"/scene_view_data/").concat(t,"/images/"):"".concat(Potree.settings.urls.prefix3,"/images/images").concat(t,"/")).concat(e)}},{key:"loadImage",value:function(e,t,n,i){f0.loadImage(e,t).then(function(e){n(e)}).fail(i)}}]),n}();function x0(e,t){this.tree=e,this.parent=t,this.children=[],this.id=++M0} function E0(e){e.root=function e(t,n,i){if(i>t.levels) return null;var r=new x0(t,n);t.allNodes.push(r);for(var a=0;a<_0;a++) r.children[a]=e(t,r,i+1);return r}(e,null,0)} b0.prototype.forceQueueTilesForPano=(m0=[],v0=[],function(e,t,n,i,r,a){m0.length=0;for(var o=this.getTileDownloadDescriptors(e,t),s=0;sthis.qualityManager.getMaxNavPanoSize()&&(t=this.qualityManager.getMaxNavPanoSize()),r&&t===r.size||(r&&this.deactiveDescripor(r.renderTarget),(r=this.activeDescripor(t))||(t=this.initTiledPano(t,!1),(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),this.updateActivePanos(e,n?0:1),r.renderTarget}},{key:"deactivateTiledPano",value:function(e){var t=this.getActiveRenderTargetDescriptor(e.id);this.isRenderTargetDescriptorValid(t)&&(this.deactiveDescripor(t.renderTarget),this.setActiveRenderTargetDescriptor(e.id,null));e=this.getUploadQueueForPano(e.id);this.clearUploadQueue(e),this.updateActivePanos()}},{key:"getActivePanoCount",value:function(){return this.activePanos.length}},{key:"resetRenderStatus",value:function(e,r,a,t){var n=null;t&&(n=A0.getLevelCountForSize(Gg.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!");t=e[t];return t||console.error("PanoRenderer.getTileTree() -> Tree not yet initialized!"),t}},{key:"initTiledPano",value:function(e,t){var n=this.viewer.renderer,i=new na(e,{stencilBuffer:!1}),e=new ta([]);e.image=[null,null,null,null,null,null],e.flipY=!0,e.format=et,t?(e.generateMipmaps=!0,e.magFilter=Oe,e.minFilter=G):(e.generateMipmaps=!1,e.magFilter=Oe,e.minFilter=Oe),n.setRenderTarget(i),n.setRenderTarget(null);e=n.properties.get(e);return e.__image__webglTextureCube=e.__webglTexture,i}},{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?u0.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===A0.getLevelCountForSize(Gg.TILE_SIZE,e.panoSize)}},{key:"getTopUploadQueue",value:function(){for(var e,t,n=$0;n<=ey;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;;){this.forceQueue.slice(0);if(t<=i||e<=n) break;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,(n=this.qualityManager.getMaxZoomPanoSize())>this.qualityManager.maxRenderTargetSize||(T0[n]?this.zoomRenderTarget=T0[n]:(this.zoomRenderTarget=this.initTiledPano(n,!1),T0[n]=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)}),ty.prototype.updateActivePanos=(S0=[],function(e,t){for(var n=S0.length=0;n=S0.length&&S0.push(e),this.activePanos.length=0,this.activePanos.push.apply(this.activePanos,S0)}),ty.prototype.renderPanoTiles=(C0=[],function(e,t,n,i){this.zoomRenderTarget&&this.zoomRenderTarget.width===this.qualityManager.getMaxZoomPanoSize()||this.zoomPanoRenderingDisabled||this.setupZoomRenderTarget(),t=t||this.direction||pm.FORWARD;var r=this.getActiveRenderTargetDescriptor(e);this.isRenderTargetDescriptorValid(r)||console.error("PanoRenderer.renderPanoTiles() -> Cannot render to a pano that is not activated.");for(var a=0;athis.qualityManager.maxRenderTargetSize?(b=this.initSizedTexture2D(a,Be),w=this.viewer.images360.isHighMapLoaded(e.cubeFace,u,c)):b=B0[a],this.uploadTexture2D(r,b,0,0,a,a),o>this.qualityManager.maxRenderTargetSize?w||this.viewer.images360.updateHighMap(b,e.cubeFace,u,c):1===L0||2===L0?(c=1===L0?this.overlayTilesBasic:this.overlayTilesEnhanced,this.renderToCubeMap(b,v,a,a,0,0,a,a,d,g,t,t,e.cubeFace),this.renderToCubeMap(c[o],v,a,a,0,0,a,a,d,g,t,t,e.cubeFace,K,!0,.5)):this.renderToCubeMap(b,v,a,a,0,0,a,a,d,g,t,t,e.cubeFace),y()):p?y():(R0[i+":"+o+":"+s]=!0,this.setUploaded(e,!1)),e.uploadAttempted||(f.uploadAttempts++,this.dispatchEvent({type:dm.TileUploadAttempted,id:i,panoSize:o,tileIndex:s,totalTiles:l})),e.uploadAttempted=!0,f.uploadAttempts===l&&this.dispatchEvent({type:dm.UploadAttemptedForAllTiles,id:i,panoSize:o,totalTiles:l}),h}),ty.prototype.renderToCubeMap=(F0=!1,U0=N0=z0=O0=I0=null,function(e,t,n,i,r,a,o,s,l,u,c,d,h,p,f,m){var v=this.viewer.renderer;F0||((O0=new ed(-.5,.5,.5,-.5,-200,200)).position.z=150,(I0=new gs).add(O0),z0=new Qr({uniforms:{tDiffuse:{type:"scene",value:null},alpha:{type:"startYinTile",value:1}},vertexShader:Hp["basicTextured.vs"],fragmentShader:Hp["basicTextured.fs"],depthWrite:!1,depthTest:!1,side:Y}),N0=new ua(1,1),(U0=new Hr(N0,z0)).position.z=0,I0.add(U0),F0=!0);var g=N0.getAttribute("uv");g.setDynamic(!0),g.needsUpdate=!0;g=g.array,r/=n,a/=i,n=o/n,i=s/i;g[0]=r,g[1]=a+i,g[2]=r+n,g[3]=a+i,g[4]=r,g[5]=a,g[6]=r+n,g[7]=a;a=N0.getAttribute("position");a.setDynamic(!0),a.needsUpdate=!0;a=a.array,l=l/t.width-.5,u=u/t.height-.5,c/=t.width,d/=t.height;a[0]=l,a[1]=u+d,a[3]=l+c,a[4]=u+d,a[6]=l,a[7]=u,a[9]=l+c,a[10]=u,v.properties.get(I0),z0.uniforms.tDiffuse.value=e,z0.blending=p||Z,z0.transparent=!!f,z0.uniforms.alpha.value=m=null==m?1:m,z0.needUpdate=!0,t.viewport.set(0,0,t.width,t.height);f=v.autoClear,m=v.getRenderTarget();v.autoClear=!1,v.setRenderTarget(t,h),v.render(I0,O0),v.setRenderTarget(m),v.autoClear=f}),ty.prototype.copyCubeMap=(H0=!1,X0=W0=j0=V0=null,q0=new ci,function(e,t,n,i,r,a,o,s,l){if(!(r>this.qualityManager.maxRenderTargetSize)){H0||((j0=new ed(-1,1,1,-1,0,200)).position.set(0,0,0),(V0=new gs).add(j0),W0=new Qr({uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:Hp["copyCubeMap.vs"],fragmentShader:Hp["copyCubeMap.fs"],depthWrite:!1,depthTest:!1,side:Y}),G0=new Cl(2,2,2),X0=new Hr(G0,W0),V0.add(X0),H0=!0);var u=this.viewer.renderer.autoClear,c=this.viewer.renderer.getRenderTarget();this.viewer.renderer.autoClear=!1,W0.uniforms.tDiffuse.value=e,W0.blending=o||Z,W0.transparent=!!s,W0.uniforms.alpha.value=l=null==l?1:l,W0.needUpdate=!0;for(var d=0;d<6;d++) this.getCubeOrientationForCubeFace(d,q0),X0.rotation.copy(q0),X0.matrixWorldNeedsUpdate=!0,X0.updateMatrixWorld(),t.viewport.set(0,0,r,a),this.viewer.renderer.setRenderTarget(t,d),this.viewer.renderer.render(V0,j0);this.viewer.renderer.autoClear=u,this.viewer.renderer.setRenderTarget(c)}});var iy,ry,ay,oy=function(){function t(){O(this,t);var e=document.createElement("canvas");this.canvas=e,this.context=e.getContext("2d")} return h(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){e=Math.round(e*(this.canvas.width-1)),t=Math.round(t*(this.canvas.height-1));if(!(e<0||t<0||e>=this.width||t>=this.height)){t=this.context.getImageData(e,t,1,1).data;return t[1]+t[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=t.position,o=e.dir||(new THREE.Vector3).subVectors(e.point,a).normalize(),s=o.clone().applyMatrix4(t.panoMatrix2Inverse).normalize(),l=Up.getUVfromDir(s);if(u=this.getDepth(l.x,l.y)) return i.copy(o).multiplyScalar(u).add(a),n||(e=this.getNearbyPoint(a,l,-1,0),s=this.getNearbyPoint(a,l,1,0),n=this.getNearbyPoint(a,l,0,-1),r=this.getNearbyPoint(a,l,0,1),r=this.planeFit(o,i,e,s,n,r)),{location:i,normal:r,distance:u};if(.75a.inputHandler.hoveredElements[0].distance)){if("pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType){if(e.hoverViewport==a.mapViewer.viewports[0]) return a.mapViewer.dispatchEvent(e);if(e.hoverViewport!=a.mainViewport) return} Potree.settings.dblToFocusPoint||o.flyToPanoClosestToMouse()}}),a.addEventListener("global_mousemove",function(e){!Potree.settings.unableNavigate&&Potree.settings.ifShowMarker&&e.hoverViewport==a.mainViewport&&o.updateClosestPano(e.intersect)}),o.addEventListener("markerHover",function(e){o.updateClosestPano(e.pano,e.hovered)}),Potree.settings.isOfficial||(o.domRoot=a.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 o.unfocus()}),o.elUnfocus=e,o.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)"}),o.domRoot.appendChild(n[0]),n.on("click",function(e){var t=a.getObjVisiByReason(a.scene.pointclouds[0],"force");a.scene.pointclouds.forEach(function(e){a.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)"}),o.domRoot.appendChild(e[0]),e.on("click",function(e){"showPointCloud"==Potree.settings.displayMode&&0==o.panos.length||(Potree.settings.displayMode="showPointCloud"==Potree.settings.displayMode?"showPanos":"showPointCloud")}),o.elDisplayModel=e);var s="",l="";Object.defineProperty(Potree.settings,"displayMode",{get:function(){return s},set:function(t){if(l=t,console.warn("Request setMode: "+t),t!=s){var n,e=Potree.config.displayMode[t],i=a.scene.getActiveCamera();if("showPanos"==t&&a.mainViewport.view.isFlying()) a.mainViewport.view.addEventListener("flyingDone",function e(){l==t&&(Potree.settings.displayMode=t),a.mainViewport.view.removeEventListener("flyingDone",e)});else{if(o.isAtPano()) n=o.flying?e.transition:e.atPano;else if(n=e.atPano,"showPanos"==t){if(0==o.panos.length) return;var r=function e(){o.removeEventListener("flyToPanoDone",e),l==t&&(Potree.settings.displayMode=t)};return o.flyToPano({pano:o.findNearestPano()}),void o.addEventListener("flyToPanoDone",r)} if(n.showSkybox||n.showPoint&&n.pointUsePanoTex?o.tileDownloader.start():o.tileDownloader.stop(),n.showSkybox||n.pointUsePanoTex){r=function e(){setTimeout(function(){l==t&&(Potree.settings.displayMode=t)},1),o.removeEventListener("loadedDepthImg",e)};if(!o.currentPano.depthTex&&o.currentPano.pointcloud.hasDepthTex) return o.addEventListener("loadedDepthImg",r),o.currentPano.loadDepthImg();if(o.checkAndWaitForPanoLoad(o.currentPano,o.basePanoSize,r)) return} a.scene.pointclouds.forEach(function(e){a.updateVisible(e,"displayMode",n.showPoint,2)}),n.pointUsePanoTex?a.scene.pointclouds.forEach(function(e){e.material.setProjectedPanos(o.currentPano,o.currentPano,1)}):a.scene.pointclouds.forEach(function(e){e.material.stopProjectedPanos()}),a.updateVisible(o.cube,"showSkybox",n.showSkybox),o.cube.visible?o.setProjectedPanos({progress:1,ifSkybox:!0,ifPointcloud:!1,easeInOutRatio:0,pano0:o.currentPano,pano1:o.currentPano}):(o.smoothZoomTo(1),o.resetHighMap(),o.hideHighMap()),"showPanos"==(s=t)?(i.far=a.farWhenShowPano,Potree.settings.pointDensity="panorama",Potree.config.displayMode.showPanos.transition.pointUsePanoTex&&a.scene.pointclouds.forEach(function(e){e.material.pointSizeType="FIXED"}),o.updateCube(o.currentPano)):(i.limitFar&&(i.far=Potree.settings.cameraFar),Potree.settings.pointDensity=Potree.settings.UserPointDensity,Potree.config.displayMode.showPanos.transition.pointUsePanoTex&&a.scene.pointclouds.forEach(function(e){e.material.pointSizeType=Potree.config.material.pointSizeType})),i.updateProjectionMatrix(),o.elDisplayModel&&o.elDisplayModel.val("showPointCloud"==t?">>全景":">>点云"),o.dispatchEvent({type:"endChangeMode",mode:t}),console.log("setModeSuccess: "+t)}}}}),Potree.settings.displayMode="showPointCloud";var t=null;Object.defineProperty(g(o),"currentPano",{get:function(){return t},set:function(e){e!=t&&(t&&t.exit(),e&&e.enter(),t=e)}});var i=!0;Object.defineProperty(Potree.settings,"ifShowMarker",{get:function(){return i},set:function(t){(t=!!t)!=i&&(o.panos.forEach(function(e){a.updateVisible(e,"ifShowMarker",t,1)}),i=t)}}),a.addEventListener("update",function(){o.update(a)});var r={FORWARD:["W".charCodeAt(0),38],BACKWARD:["S".charCodeAt(0),40],LEFT:["A".charCodeAt(0),37],RIGHT:["D".charCodeAt(0),39]};return a.inputHandler.addEventListener("keydown",function(t){if("showPanos"==Potree.settings.displayMode) for(var e in r) if(r[e].some(function(e){return e==t.keyCode})){switch(e){case"FORWARD":o.flyLocalDirection(pm.FORWARD.clone());break;case"BACKWARD":o.flyLocalDirection(pm.BACK.clone());break;case"LEFT":o.flyLocalDirection(pm.LEFT.clone());break;case"RIGHT":o.flyLocalDirection(pm.RIGHT.clone())} break}}),o} return h(c,[{key:"updateDepthTex",value:function(e){this.currentPano==e&&e.depthTex&&this.cube.material.updateDepthTex(e)}},{key:"findNearestPano",value:function(t){t=t?(new Cn).copy(t):this.position;var e=Fm.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)}},{key:"getDirection",value:function(e){return e?(e=e||(new Cn).copy(pm.FORWARD)).applyQuaternion(viewer.scene.getActiveCamera().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{let panoBound=new THREE.Box3;panoBound.expandByPoint(pano.position);panoBound.expandByVector(new Cn(10,10,10));return pano.pointcloud.bound.clone().union(panoBound)};if(this.cube.geometry.dispose(),i){if(n.pointcloud!=i.pointcloud) if(100=n.length?null:(i&&(i.candidates=n,i.pano=n[e].item),n[e].item)}},{key:"isNeighbour",value:function(e,t){if(e&&t){var n=this.neighbourMap[e.id];n||(this.neighbourMap[e.id]=n={});var i=this.neighbourMap[t.id];i||(this.neighbourMap[t.id]=i={});var r,a,o,s,l,u=n[t.id];return null==u&&(u=!0,e.depthTex,e.depthTex||t.depthTex?(s=e.depthTex?e:t,a=e.depthTex?t:e,o=(new Cn).subVectors(a.position,s.position).normalize(),(l=viewer.images360.depthSampler.sample({dir:o},s,!0))&&l.distance+.1<=e.position.distanceTo(t.position)&&(u=!1)):(u=!viewer.inputHandler.ifBlockedByIntersect(t.position,.1,!0,e.position),console.log("使用点云判断"),u&&(r=(new Cn).subVectors(t.position,e.position).normalize(),a=t.position.distanceTo(e.position),o=Rg.getHFOVForCamera(viewer.mainViewport.camera,!0),s=Math.cos(gn.degToRad(10)),l=Math.cos(gn.degToRad(80)),this.getDirection().dot(r) Cannot load texture for null pano.");var l=this.getTileDirection();if(!e.isLoaded(t)){a&&viewer.waitForLoad(e,function(){return e.isLoaded(t)});return 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 i,r=t.point,a=t.target,e=t.require||[],n=t.rank||[],o=(t.force,t.getAll),s=t.bestDistance||0,l=viewer.scene.getActiveCamera();a&&(i=(new Cn).subVectors(a,r).normalize()),t.boundSphere&&(s=1i,i=!(this.flying&&this.nextPano&&this.nextPano!==this.currentPano),this.tileDownloader.tilePrioritizer.setZoomingActive(i=t&&i),this.panoRenderer.setZoomingActive(i,e,!0),n=function(e,t){r.panoRenderer.resetRenderStatus(e.id,!1,!0,r.qualityManager.getMaxNavPanoSize()),r.panoRenderer.clearAllQueuedUploadsForPano(e.id),r.panoRenderer.renderPanoTiles(e.id,null,!1,!1),e.setZoomed(t)},i&&(!e.zoomed||this.qualityManager.zoomLevelResolution&&"4k"!=this.qualityManager.zoomLevelResolution)?(e.zoomed||n(e,!0),"1k"==Potree.settings.navTileClass&&"1k"!=Potree.settings.tileClass&&this.zoomLevel<2?this.panoRenderer.enableHighQuality(function(){"4k"!=Potree.settings.tileClass&&n(e,!0)}.bind(this)):this.panoRenderer.enableUltraHighQualityMode(function(){this.qualityManager.useUltraHighResolutionPanos&&(Potree.settings.zoom.max=Potree.config.ultraHighQualityMaxZoom),n(e,!0)}.bind(this))):!t&&e.zoomed&&n(e,!1),i&&"1k"==Potree.settings.navTileClass&&"4k"==Potree.settings.tileClass&&(i=function(e){r.qualityManager.updateMaximums(),r.panoRenderer.setupZoomRenderTarget()},this.qualityManager.zoomLevelResolution=2<=this.zoomLevel?"4k":1.1Potree.settings.zoom.activationThreshold?i():2Potree.settings.zoom.activationThreshold&&this.zoomLevel<=Potree.settings.zoom.activationThreshold&&i(),this.oldZoomLevel=this.zoomLevel))}},{key:"addHighMapCube",value:function(){if("4k"==Potree.settings.tileClass&&2048==this.qualityManager.maxRenderTargetSize){for(var e=new bu(1,1,1,1),t=new Si,n=0;n<6;n++){for(var i=new Si,r=0;r<8;r++) for(var a=0;a<8;a++){var o,s=new Hr(e,new $i({}));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 Yi).setHSL(o,.5,.9)),s.visible=!1,i.add(s)} switch(n){case um.GL_TEXTURE_CUBE_MAP_POSITIVE_X:i.rotation.set(0,Math.PI/2,0);break;case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:i.rotation.set(0,-Math.PI/2,0);break;case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:var l=(new Sn).setFromAxisAngle(new Cn(0,1,0),Math.PI),u=(new Sn).setFromAxisAngle(new Cn(1,0,0),Math.PI/2);i.quaternion.copy(l).multiply(u);break;case um.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:l=(new Sn).setFromAxisAngle(new Cn(0,1,0),Math.PI),u=(new Sn).setFromAxisAngle(new Cn(1,0,0),-Math.PI/2);i.quaternion.copy(l).multiply(u);break;case um.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:i.rotation.set(0,Math.PI,0);break;case um.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),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){i=this.highMapCube.children[t].children[8*n+i];i.material.map=e,i.material.opacity=1,i.material.transparent=!1,i.visible=!0,i.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(Up.convertQuaternion.YupToZup(e.quaternion4dkk)),e=(new Sn).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 Qg(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 Cn(1,1,1);this.bound=Up.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 Cn;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 h(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,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;this.camera=new ed(-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 ng,this.view.position.set(0,0,Potree.config.map.cameraHeight),this.view.lookAt(0,0,0),this.setViewLimit("standard");e=new Ig(this.view,this.camera,{left:0,bottom:0,width:1,height:1,name:"mapViewport"});e.axis=["x","y"],e.axisSign=[1,1],e.noPointcloud=!0,e.render=this.render.bind(this),this.viewports=[e],this.controls=new Fg(this,this.viewports[0]),this.controls.setEnable(!0),this.scene=new gs,this.inputHandler=new Og(this,this.scene),this.inputHandler.name="mapInputHandler",this.inputHandler.registerInteractiveScene(this.scene),this.viewports[0].interactiveScenes=this.inputHandler.interactiveScenes;e=new Hr(py,new $i({transparent:!0,opacity:.9,depthTest:!1,map:hy.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 kn).copy(e.posBound),this.camera.zoomLimit=$.extend({},e.zoom)):(this.view.limitBound=null,this.camera.zoomLimit=null)}},{key:"updateCursor",value:function(){var e=Up.getScaleForConstantSize({minSize:80,maxSize:200,nearBound:5,farBound:100,camera:this.camera,position:this.cursor.getWorldPosition(new Cn),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 Si;uy={default:new $i({transparent:!0,opacity:.5,map:hy.load(Potree.resourcePath+"/textures/map_marker.png")}),selected:new $i({transparent:!0,opacity:1,map:hy.load(Potree.resourcePath+"/textures/map_marker.png")})},e.images.panos.forEach(function(t){t.mapMarker=new Hr(py,uy.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=uy.selected,e.byMainView||t.dispatchEvent({type:"hoverOn",byMap:!0}),i.needRender=!0)} function n(e){e.byMap||(t.mapMarker.material=uy.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=cy,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},ly.filters.isEnabled(),ly.filters.isVisible()],(e=Fm.find(viewer.images360.panos,e,[ly.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);e.max(new Cn(4,4,4));var t=viewer.images360.bound.center.clone();this.moveTo(t,e,0)}},{key:"fitToPointcloud",value:function(e){var t=1=this.batchSize){for(var a=0,o=Object.keys(this.currentBatch.geometry.attributes);a",c=0,d=Object.keys(o);c\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(h[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(h[2],"\n\t\t\t\t\t\t\t\t")):"rgba"===p?u+="\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t".concat(p,"\n\t\t\t\t\t\t\t\t\t").concat(f.join(", "),"\n\t\t\t\t\t\t\t\t"):"normal"!==p&&(u+="mileage"===p?"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t".concat(p,"\n\t\t\t\t\t\t\t\t\t").concat(f.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(p,"\n\t\t\t\t\t\t\t\t\t").concat(v(f),"\n\t\t\t\t\t\t\t\t"))} l.html(u+=""),g.selectedPoint=o}else{g.viewer.scene.scene.add(g.viewerPickSphere);l=g.viewer.scene.scene.children.indexOf(g.viewerPickSphere);0<=l&&g.viewer.scene.scene.children.splice(l,1),g.viewer.removeEventListener("update",y)} g.render()} g.mouse.copy(n)}});function e(e){g.autoFit=!1;var t=0;void 0!==e.wheelDelta?t=e.wheelDelta:void 0!==e.detail&&(t=-e.detail),e=Math.sign(t),t=[g.scaleX.invert(g.mouse.x),g.scaleY.invert(g.mouse.y)],0(new Date).getTime())){this.scheduledRecomputeTime=(new Date).getTime()+100,this.scheduledRecomputeTime=null,this.reset();var i,t=ue(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}(),Ey=function(){function o(){O(this,o)} return h(o,null,[{key:"measurementToFeatures",value:function(e){var t,n=e.points.map(function(e){return e.position.toArray()}),i=[];return 1===n.length?(t={type:"Feature",geometry:{type:"Point",coordinates:n[0]},properties:{name:e.name}},i.push(t)):1\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=ue(e);try{for(t.s();!(r=t.n()).done;) !function(){var t=r.value,e=Jf.addCommas(t.x.toFixed(3)),n=Jf.addCommas(t.y.toFixed(3)),i=Jf.addCommas(t.z.toFixed(3)),i=$("\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=i.find("img[name=copy]"),a.elCopy.click(function(){var e=t.toArray().map(function(e){return e.toFixed(3)}).join(", ");Jf.clipboardCopy(e),a.viewer.postMessage("Copied value to clipboard:
'".concat(e,"'"),{duration:3e3})}),o.append(i)}()}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}(),Ay=function(){y(i,My);var n=w(i);function i(e,r,t){O(this,i);var a=n.call(this,e,r,t),t=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=new Kp;e.name=r.name,e.width=r.getTotalDistance()/50;var t,n=ue(r.points);try{for(n.s();!(t=n.n()).done;){var i=t.value;e.addMarker(i.position.clone())}}catch(e){n.e(e)}finally{n.f()} a.viewer.scene.addProfile(e)}),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 h(i,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container");e.empty(),e.append(this.createCoordinatesTable(this.measurement.points));for(var t=this.measurement.points,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}(),Ty=function(){y(a,My);var r=w(a);function a(e,t,n){O(this,a);var i=r.call(this,e,t,n),n=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 h(a,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container");e.empty(),e.append(this.createCoordinatesTable(this.measurement.points));e=this.elContent.find(".attributes_table_container");e.empty(),e.append(this.createAttributesTable())}}]),a}(),Sy=function(){y(a,My);var r=w(a);function a(e,t,n){O(this,a);var i=r.call(this,e,t,n),n=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 h(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,My);var r=w(a);function a(e,t,n){O(this,a);var i=r.call(this,e,t,n),n=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 h(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})));for(var t=[],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 h(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 t,n,i,r,a=this.elContent.find("#infos_table");3===this.measurement.points.length?(t=this.measurement.points[0].position,i=this.measurement.points[1].position,r=this.measurement.points[2].position,e=(n=Potree.Utils.computeCircleCenter(t,i,r)).distanceTo(t),i=2*Math.PI*e,t="".concat((r=function(e){return Potree.Utils.addCommas(e.toFixed(3))})(n.x)," ").concat(r(n.y)," ").concat(r(n.z)),n=r(e),e=r(i),r='style="width: 100%; padding: 5px;"',a.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(t,"\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\tRadius: \n\t\t\t\t").concat(n,"\n\t\t\t\n\t\t\t\n\t\t\t\tCircumference: \n\t\t\t\t").concat(e,"\n\t\t\t\n\t\t"))):a.empty()}}]),a}(),Dy=function(){y(a,My);var r=w(a);function a(e,t,n){O(this,a);var i=r.call(this,e,t,n),n=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 h(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 t=this.measurement.points.slice().sort(function(e,t){return e.position.z-t.position.z}),e=t[0].position.clone(),t=t[t.length-1].position.clone(),e=e.z,e=(e=t.z-e).toFixed(3);this.elHeightLabel=this.elContent.find("#height_label"),this.elHeightLabel.html("Height: ".concat(e))}}]),a}(),ky=function(){y(l,My);var e,s=w(l);function l(e,t,n){O(this,l);var i=s.call(this,e,t,n),r=Potree.resourcePath+"/icons/copy.svg",a=Potree.resourcePath+"/icons/remove.svg",o=new Map([[Zp,"length"],[Qp,"rx"]]).get(t.constructor),e=new Map([[Zp,"width"],[Qp,"ry"]]).get(t.constructor),n=new Map([[Zp,"height"],[Qp,"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(o,"").concat(e,"").concat(n,'
\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(", ");Jf.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(", ");Jf.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 h(l,[{key:"download",value:(e=r(regeneratorRuntime.mark(function e(){var t,n,i,r,a,o,s,l,u,c,d,h,p,f,m,v,g,y,w,b,x,E,_,M,A,T,S,C,P,D,k,B,L,R;return regeneratorRuntime.wrap(function(e){for(;;) switch(e.prev=e.next){case 0:for(u=this.measurement,w=[],v=u.matrixWorld,t=new Cn(.5,0,0).applyMatrix4(v),n=new Cn(-.5,0,0).applyMatrix4(v),i=new Cn(0,.5,0).applyMatrix4(v),r=new Cn(0,-.5,0).applyMatrix4(v),m=new Cn(0,0,.5).applyMatrix4(v),f=new Cn(0,0,-.5).applyMatrix4(v),a=(new Cn).subVectors(n,t).normalize(),o=a.clone().multiplyScalar(-1),s=(new Cn).subVectors(r,i).normalize(),l=s.clone().multiplyScalar(-1),u=(new Cn).subVectors(f,m).normalize(),v=u.clone().multiplyScalar(-1),m=[(new ki).setFromNormalAndCoplanarPoint(a,t),(new ki).setFromNormalAndCoplanarPoint(o,n),(new ki).setFromNormalAndCoplanarPoint(s,i),(new ki).setFromNormalAndCoplanarPoint(l,r),(new ki).setFromNormalAndCoplanarPoint(u,m),(new ki).setFromNormalAndCoplanarPoint(v,f)],c=[],d=0,h=m;dERROR: '.concat(e,""))},E=function(e){b.html("".concat(e))},_=null,M="".concat(viewer.server,"/create_regions_filter?pointclouds=[").concat(M,"]®ions=[").concat(f,"]"),E("estimating results ..."),e.next=56,fetch(M);case 56:return M=e.sent,e.next=59,M.json();case 59:if((A=e.sent).handle){e.next=65;break} return x(A.message),e.abrupt("return");case 65:_=A.handle;case 66:T="".concat(viewer.server,"/check_regions_filter?handle=").concat(_),S=function(n){return new Promise(function(e,t){setTimeout(function(){e()},n)})},C=function(e){var t=e.progress,e=e.estimate,e=t["processed points"]/e.points,e=parseInt(100*e);E("progress: ".concat(e,"%"))},P=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(_);t+='
    • report.json
    • \n'),E(t+="
    ")},D=function(e){e="Unexpected Response.
    status: ".concat(e.status,"
    message: ").concat(e.message);E(e)},k=function(e){e="ERROR: ".concat(e.message);throw x(e),new Error(e)},B=Date.now();case 73:return e.next=76,fetch(T);case 76:return R=e.sent,e.next=79,R.json();case 79:if("ERROR"!==(L=e.sent).status){e.next=84;break} k(L),e.next=94;break;case 84:if("FILTERING"!==L.status){e.next=88;break} C(L),e.next=94;break;case 88:if("FINISHED"===L.status) return P(L),e.abrupt("break",100);e.next=93;break;case 93:D(L);case 94:return R=(Date.now()-B)/1e3,R=R<10?100:1e3,e.next=98,S(R);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.empty(),e.append(this.createCoordinatesTable([this.measurement.position]));var t=this.measurement.rotation.toVector3();t=(t=(t=t.toArray()).map(function(e){return 180*e/Math.PI})).map(function(e){return e.toFixed(1)+"°"});var n=this.elContent.find("#angle_cell_alpha"),i=this.elContent.find("#angle_cell_betta"),e=this.elContent.find("#angle_cell_gamma");n.html(t[0]),i.html(t[1]),e.html(t[2]);n=(n=this.measurement.scale.toArray()).map(function(e){return Jf.addCommas(e.toFixed(2))}),i=this.elContent.find("#cell_length"),e=this.elContent.find("#cell_width"),t=this.elContent.find("#cell_height");i.html(n[0]),e.html(n[1]),t.html(n[2]);t=this.elContent.find("#measurement_volume"),n=this.measurement.getVolume();t.html(Jf.addCommas(n.toFixed(2))),this.elCheckClip.prop("checked",this.measurement.clip),this.elCheckShow.prop("checked",this.measurement.visible)}}]),l}(),By=function(){y(o,My);var e,a=w(o);function o(e,i,t){O(this,o);var n=a.call(this,e,i,t),t=Potree.resourcePath+"/icons/remove.svg";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();var r=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 h(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=r(regeneratorRuntime.mark(function e(){var t,n,i,r,a,o,s,l,u,c,d,h,p,f,m,v,g,y,w,b,x,E,_,M,A,T,S,C,P,D,k,B,L,R,F,I,O,z,N,U,G,H,V;return regeneratorRuntime.wrap(function(e){for(;;) switch(e.prev=e.next){case 0:A=this.measurement,t=[],C=A.getSegments(),n=A.width,i=ue(C);try{for(i.s();!(r=i.n()).done;){for(a=r.value,o=a.start.clone().multiply(new Cn(1,1,0)),s=a.end.clone().multiply(new Cn(1,1,0)),l=(new Cn).addVectors(o,s).multiplyScalar(.5),u=(new Cn).subVectors(s,o).normalize(),c=(new Cn).subVectors(o,s).normalize(),d=new Cn(0,0,1),h=(new Cn).crossVectors(u,d),p=(new Cn).crossVectors(c,d),console.log(p),f=h.clone().multiplyScalar(.5*n).add(l),m=p.clone().multiplyScalar(.5*n).add(l),v=[(new ki).setFromNormalAndCoplanarPoint(u,o),(new ki).setFromNormalAndCoplanarPoint(c,s),(new ki).setFromNormalAndCoplanarPoint(p,f),(new ki).setFromNormalAndCoplanarPoint(h,m)],g=[],y=0,w=v;yERROR: '.concat(e,""))},k=function(e){P.html("".concat(e))},B=null,L="".concat(viewer.server,"/create_regions_filter?pointclouds=[").concat(L,"]®ions=[").concat(_,"]"),k("estimating results ..."),e.next=42,fetch(L);case 42:return L=e.sent,e.next=45,L.json();case 45:if((R=e.sent).handle){e.next=51;break} return D(R.message),e.abrupt("return");case 51:B=R.handle;case 52:F="".concat(viewer.server,"/check_regions_filter?handle=").concat(B),I=function(n){return new Promise(function(e,t){setTimeout(function(){e()},n)})},O=function(e){var t=e.progress,e=e.estimate,e=t["processed points"]/e.points,e=parseInt(100*e);k("progress: ".concat(e,"%"))},z=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(B);t+='
    • report.json
    • \n'),k(t+="
    ")},N=function(e){e="Unexpected Response.
    status: ".concat(e.status,"
    message: ").concat(e.message);k(e)},U=function(e){e="ERROR: ".concat(e.message);throw D(e),new Error(e)},G=Date.now();case 59:return e.next=62,fetch(F);case 62:return V=e.sent,e.next=65,V.json();case 65:if("ERROR"!==(H=e.sent).status){e.next=70;break} U(H),e.next=80;break;case 70:if("FILTERING"!==H.status){e.next=74;break} O(H),e.next=80;break;case 74:if("FINISHED"===H.status) return z(H),e.abrupt("break",86);e.next=79;break;case 79:N(H);case 80:return V=(Date.now()-G)/1e3,V=V<10?100:1e3,e.next=84,I(V);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}(),Ly=function(){function i(e,t){var n=this;O(this,i),this.viewer=e,this.propertiesPanel=t,this._update=function(){n.update()};t=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(", ");Jf.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(", ");Jf.clipboardCopy(e),n.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),this.propertiesPanel.addVolatileListener(e,"camera_changed",this._update),this.update()} return h(i,[{key:"update",value:function(){var e=this.viewer.scene.getActiveCamera(),t=this.viewer.scene.view,e=e.position.toArray().map(function(e){return Jf.addCommas(e.toFixed(3))});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=t.getPivot().toArray().map(function(e){return Jf.addCommas(e.toFixed(3))});this.elContent.find("#camera_target_x").html(t[0]),this.elContent.find("#camera_target_y").html(t[1]),this.elContent.find("#camera_target_z").html(t[2])}}]),i}(),Ry=function(){function r(e,t,n){var i=this;O(this,r),this.viewer=e,this.propertiesPanel=t,this.annotation=n,this._update=function(){i.update()};t="".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(", ");Jf.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 h(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 Jf.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}(),Fy=function(){function n(l,e,u){O(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()}),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]");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%");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)})} var c=this.elContent.find("#animation_keyframes");t(),u.addEventListener("controlpoint_added",t),u.addEventListener("controlpoint_removed",t)} return h(n,[{key:"update",value:function(){}}]),n}(),Iy=function(){function n(e,t){O(this,n),this.container=e,this.viewer=t,this.object=null,this.cleanupTasks=[],this.scene=null} return h(n,[{key:"setScene",value:function(e){this.scene=e}},{key:"set",value:function(e){if(this.object!==e){this.object=e;var t,n=ue(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 xm?this.setPointCloud(e):e instanceof Wf||e instanceof Kp||e instanceof Yp?this.setMeasurement(e):e instanceof Kr?this.setCamera(e):e instanceof Kf?this.setAnnotation(e):e instanceof bv&&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){var t=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');v.i18n(),this.container.append(v);var n=v.find("#sldPointSize"),i=v.find("#lblPointSize");n.slider({value:m.size,min:0,max:3,step:.01,slide:function(e,t){m.size=t.value}});function e(e){i.html(m.size.toFixed(2)),n.slider({value:m.size})} this.addVolatileListener(m,"point_size_changed",e),e();var r=v.find("#sldMinPointSize"),a=v.find("#lblMinPointSize");r.slider({value:m.size,min:0,max:3,step:.01,slide:function(e,t){m.minSize=t.value}});function o(e){a.html(m.minSize.toFixed(2)),r.slider({value:m.minSize})} this.addVolatileListener(m,"point_size_changed",o),o();var s=Object.keys(am)[m.pointSizeType],l=v.find("#optPointSizing");l.selectmenu(),l.val(s).selectmenu("refresh"),l.selectmenu({change:function(e,t){m.pointSizeType=am[t.item.value]}});var u=v.find("#optShape");u.selectmenu({change:function(e,t){t=t.item.value;m.shape=om[t]}});function c(){var e=Object.keys(om)[m.shape];u.selectmenu().val(e).selectmenu("refresh")} this.addVolatileListener(m,"point_shape_changed",c),c();var d=v.find("#set_backface_culling");d.click(function(){m.backfaceCulling=d.prop("checked")});function h(){var e=m.backfaceCulling;d.prop("checked",e)} this.addVolatileListener(m,"backface_changed",h),h();s=$("#materials_backface_container");s.css("display","none");l=f.pcoGeometry.pointAttributes;!!l.hasNormals&&l.hasNormals()&&s.css("display","block");var p=v.find("#sldOpacity"),g=v.find("#lblOpacity");p.slider({value:m.opacity,min:0,max:1,step:.001,slide:function(e,t){m.opacity=t.value}});function y(e){g.html(m.opacity.toFixed(2)),p.slider({value:m.opacity})} this.addVolatileListener(m,"opacity_changed",y),y();l=f.pcoGeometry.pointAttributes.attributes;(s=[]).push.apply(s,Q(l.map(function(e){return e.name})));l=s.indexOf("intensity");0<=l&&s.splice(l+1,0,"intensity gradient"),s.push("elevation","color","matcap","indices","level of detail","composite");var w,b=["POSITION_CARTESIAN","position"],s=s.filter(function(e){return!b.includes(e)}),x=v.find("#optMaterial"),E=ue(s);try{for(E.s();!(w=E.n()).done;){var _=w.value,M=$(""));x.append(M)}}catch(e){E.e(e)}finally{E.f()} function A(e,t){var n=x.selectmenu().val();m.activeAttributeName=n;var i=f.getAttribute(n);!!(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),l=(s=N(i.range,2))[0],u=s[1],v.find("#sldIntensityRange").slider({range:!0,min:l,max:u,step:.01,values:[l,u],slide:function(e,t){var n=t.values[0],t=t.values[1];m.intensityRange=[n,t]}})):i&&(d=(c=N(i.range,2))[0],h=c[1],p=(p=m.getRange(i.name))||Q(i.range),"number"==typeof d&&"number"==typeof h&&v.find("#sldExtraRange").slider({range:!0,min:d,max:h,step:.01,values:p,slide:function(e,t){var n=N(t.values,2),t=n[0],n=n[1];m.setRange(i.name,[t,n])}}));var r=$("#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"),d=$("#materials\\.transition_container"),h=$("#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"),d.css("display","none"),p.css("display","none"),h.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?h.css("display","block"):"number of returns"===n||"return number"===n||["source id","point source id"].includes(n)||s.css("display","block"))} x.selectmenu({change:A});function T(){x.val(m.activeAttributeName).selectmenu("refresh")} this.addVolatileListener(m,"point_color_type_changed",T),this.addVolatileListener(m,"active_attribute_changed",T),T(),A();var S,l=Object.keys(Potree.Gradients).map(function(e){return{name:e,values:km[e]}}),C=v.find("#elevation_gradient_scheme_selection"),P=ue(l);try{for(P.s();!(S=P.n()).done;) !function(){var e=S.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=km[e.name]}),C.append(t)}()}catch(e){P.e(e)}finally{P.f()} for(var s=[{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")}],D=v.find("#matcap_scheme_selection"),k=0,B=s;k\n\t\t\t\t'));t.click(function(){m.matcap=e.icon.substring(e.icon.lastIndexOf("/"))}),D.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 Yi).setRGB(e.r/255,e.g/255,e.b/255);m.color=e},change:function(e){e=e.toRgb(),e=(new Yi).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 L(){var e,t,n,i=f.getAttribute("position");n=i?(t=(t=i.range[0][2])-.2*(i=(e=i.range[1][2])-t),e+.2*i):(n=[f.pcoGeometry.tightBoundingBox,f.getBoundingBoxWorld()].find(function(e){return void 0!==e}),f.updateMatrixWorld(!0),r=(n=Jf.computeTransformedBoundingBox(n,f.matrixWorld)).max.z-n.min.z,t=n.min.z-.2*r,n.max.z+.2*r);var r=m.elevationRange;v.find("#lblHeightRange").html("".concat(r[0].toFixed(2)," to ").concat(r[1].toFixed(2))),v.find("#sldHeightRange").slider({min:t,max:n,values:r})} function R(){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?(e="".concat(e[0].toFixed(2)," to ").concat(e[1].toFixed(2)),v.find("#lblExtraRange").html(e)):v.find("could not deduce range"))} var F=function(){var e=m.intensityRange;v.find("#lblIntensityRange").html("".concat(parseInt(e[0])," to ").concat(parseInt(e[1])))};L(),v.find("#sldHeightRange").slider("option","min"),v.find("#sldHeightRange").slider("option","max");l=v.find("#gradient_repeat_option");l.selectgroup({title:"Gradient"}),l.find("input").click(function(e){t.viewer.setElevationGradientRepeat(im[e.target.value])});s=Object.keys(im).filter(function(e){return im[e]===t.viewer.elevationGradientRepeat});l.find("input[value=".concat(s,"]")).trigger("click");function I(){var e=m.intensityGamma,t=m.intensityContrast,n=m.intensityBrightness;F(),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 O(){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})} this.addVolatileListener(m,"material_property_changed",R),this.addVolatileListener(m,"material_property_changed",L),this.addVolatileListener(m,"material_property_changed",I),this.addVolatileListener(m,"material_property_changed",O),R(),L(),I(),O()}},{key:"setMeasurement",value:function(e){var t,n={DISTANCE:{panel:Ay},AREA:{panel:Sy},POINT:{panel:Ty},ANGLE:{panel:Cy},HEIGHT:{panel:Dy},PROFILE:{panel:By},VOLUME:{panel:ky},CIRCLE:{panel:Py},OTHER:{panel:Ty}},e=new((t=e)instanceof Wf?!t.showDistances||t.showArea||t.showAngles?t.showDistances&&t.showArea&&!t.showAngles?n.AREA:1===t.maxMarkers?n.POINT:t.showDistances||t.showArea||!t.showAngles?t.showHeight?n.HEIGHT:t.showCircle?n.CIRCLE:n.OTHER:n.ANGLE:n.DISTANCE:t instanceof Kp?n.PROFILE:t instanceof Yp?n.VOLUME:void 0).panel(this.viewer,e,this);this.container.append(e.elContent)}},{key:"setCamera",value:function(e){var t=new Ly(this.viewer,this);this.container.append(t.elContent)}},{key:"setAnnotation",value:function(e){e=new Ry(this.viewer,this,e);this.container.append(e.elContent)}},{key:"setCameraAnimation",value:function(e){e=new Fy(this.viewer,this,e);this.container.append(e.elContent)}}]),n}();function Oy(e){return function(e){for(var t=(e=(e+="").split("."))[0],e=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(gn.degToRad(e/2));n.shear[1]+=.1*e}),n.elRight.click(function(){var e=t.getFOV(),e=Math.tan(gn.degToRad(e/2));n.shear[0]+=.1*e}),n.elDown.click(function(){var e=t.getFOV(),e=Math.tan(gn.degToRad(e/2));n.shear[1]-=.1*e}),n.elLeft.click(function(){var e=t.getFOV(),e=Math.tan(gn.degToRad(e/2));n.shear[0]-=.1*e}),n.scene=null,n.sceneControls=new gs;return n.addEventListener("mousewheel",function(e){n.fovDelta+=-e.delta}),n} return h(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),i=(n=Math.min(this.fovMax,n))/t,r=this.viewer.inputHandler.mouse,a=this.viewer.renderer.getSize(new yn),t=[r.x/a.x,(a.y-r.y)/a.y],r=a.x/a.y,a=2*Math.tan(gn.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],i=1-i,t=[(1-i)*this.shear[0]+i*((1-t[0])*r[0]+t[0]*r[1]),(1-i)*this.shear[1]+i*((1-t[1])*a[0]+t[1]*a[1])];this.shear=t,this.viewer.setFOV(n);a=this.originalCam,t=this.shearCam;a.fov=n,a.updateMatrixWorld(),a.updateProjectionMatrix(),t.copy(a),(n=t.rotation).set.apply(n,Q(a.rotation.toArray())),t.updateMatrixWorld(),t.projectionMatrix.copy(a.projectionMatrix);n=N(this.shear,2),a=n[0],n=n[1],a=(new ni).set(1,0,a,0,0,1,n,0,0,0,1,0,0,0,0,1),n=t.projectionMatrix;n.multiply(a),t.projectionMatrixInverse.copy(n).invert();t.projectionMatrix.elements.reduce(function(e,t){return e+t},0);this.fovDelta*=0}}]),i}();var Uy=new bu(1,1),Gy=new Sl;Gy.vertices.push(new Cn(-.5,-.5,0),new Cn(.5,-.5,0),new Cn(.5,.5,0),new Cn(-.5,.5,0),new Cn(-.5,-.5,0));var Hy,Vy,jy,Wy,Xy,qy,Jy,Yy,Zy,Qy,Ky,$y,ew,tw,nw=function(){function n(e){O(this,n),this.id=e,this.fov=1,this.position=new Cn,this.rotation=new Cn,this.width=0,this.height=0,this.fov=1;var e=((t=new Qr({uniforms:{tColor:{value:new En},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:Y})).side=Y,t),t=new tl({color:65280});this.mesh=new Hr(Uy,e),this.line=new sl(Gy,t),this.texture=null,this.mesh.orientedImage=this} return h(n,[{key:"set",value:function(e,t,n,i){var r=t.map(gn.degToRad);(t=this.position).set.apply(t,Q(e)),(t=this.mesh.position).set.apply(t,Q(e)),(e=this.rotation).set.apply(e,Q(r)),(e=this.mesh.rotation).set.apply(e,Q(r));n=N(n,2);this.width=n[0],this.height=n[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;e.updateMatrixWorld();var i=e.getWorldDirection(),n=gn.degToRad(n/2),n=-.5/Math.tan(n),n=i.clone().multiplyScalar(n);e.position.add(n),t.position.copy(e.position),t.scale.copy(e.scale),t.rotation.copy(e.rotation)}}]),n}(),iw=function(){y(n,hn);var t=w(n);function n(){var e;return O(this,n),(e=t.call(this)).node=null,e.cameraParams=null,e.imageParams=null,e.images=null,e._visible=!0,e} return h(n,[{key:"visible",get:function(){return this._visible},set:function(e){if(this._visible!==e){var t,n=ue(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}(),pd=function(){function k(){O(this,k)} var i,t,n;return h(k,null,[{key:"loadCameraParams",value:(n=r(regeneratorRuntime.mark(function e(t){var n,i,r,a;return regeneratorRuntime.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 r=e.sent,i=new DOMParser,a=i.parseFromString(r,"application/xml"),n=parseInt(a.getElementsByTagName("width")[0].textContent),i=parseInt(a.getElementsByTagName("height")[0].textContent),r=parseFloat(a.getElementsByTagName("f")[0].textContent),a=i/2/r,a=2*gn.radToDeg(Math.atan(a)),a={path:t,width:n,height:i,f:r,fov:a},e.abrupt("return",a);case 15:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"loadImageParams",value:(t=r(regeneratorRuntime.mark(function e(t){var n,i,r,a,o,s,l;return regeneratorRuntime.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:l=e.sent,i=l.split(/\r?\n/),r=[],a=1;case 12:if(!(a\n\t\t'));return t.click(n),t}},{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.initClippingTool(),this.initSettings(),"pano"!=Potree.settings.editType?(this.initAlignment(),this.initClipModel(),this.initSiteModel(),this.initParitcle()):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 Cn(-1,0,0))),i.eq(7).on("click",e(t.translate,new Cn(1,0,0))),i.eq(8).on("click",e(t.translate,new Cn(0,-1,0))),i.eq(9).on("click",e(t.translate,new Cn(0,1,0))),i.eq(10).on("click",e(t.translate,new Cn(0,0,-1))),i.eq(11).on("click",e(t.translate,new Cn(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){if(r) return console.log("还在加载",r);var t,n=$(e.target),i=n.parent().attr("name");if("select"==n.attr("name")) return Potree.selectModel(i);"添加"==n.text()?(t=Date.now(),Potree.addModel(i,function(){r=!1,n.text("删除");var e=Date.now();console.log("加载完毕",i,"用时",(e-t)/1e3,"s")}),r=i):(Potree.removeModel(i),n.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:"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.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/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]tt.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]tt.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]tt.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]tt.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]tt.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:Qp}),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()}));var t=$("#measurement_options_show");t.selectgroup({title:"Show/Hide labels"}),t.find("input").click(function(e){e="SHOW"===e.target.value;n.measuringTool.showLabels=e});e=this.measuringTool.showLabels?"SHOW":"HIDE";t.find("input[value=".concat(e,"]")).trigger("click")}},{key:"initScene",value:function(){var u=this,e=$("#menu_scene"),t=e.next().find("#scene_objects"),n=e.next().find("#scene_object_properties"),i=e.next().find("#scene_export"),r="".concat(Potree.resourcePath,"/icons/file_geojson.svg"),a="".concat(Potree.resourcePath,"/icons/file_dxf.svg"),e="".concat(Potree.resourcePath,"/icons/file_potree.svg");i.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'));var o=i.find("img[name=geojson_export_button]").parent();o.click(function(e){var t=u.viewer.scene,t=[].concat(Q(t.measurements),Q(t.profiles),Q(t.volumes));0');t.append(d),d.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}});var h=function(e,t,n,i){n=d.jstree("create_node",e,{text:t,icon:n,data:i},"last",!1,!1);return i.visible?d.jstree("check_node",n):d.jstree("uncheck_node",n),n},p=d.jstree("create_node","#",{text:"Point Clouds",id:"pointclouds"},"last",!1,!1),f=d.jstree("create_node","#",{text:"Measurements",id:"measurements"},"last",!1,!1),n=d.jstree("create_node","#",{text:"Annotations",id:"annotations"},"last",!1,!1),m=d.jstree("create_node","#",{text:"Other",id:"other"},"last",!1,!1),t=d.jstree("create_node","#",{text:"Vectors",id:"vectors"},"last",!1,!1),v=d.jstree("create_node","#",{text:" Images",id:"images"},"last",!1,!1);d.jstree("check_node",p),d.jstree("check_node",f),d.jstree("check_node",n),d.jstree("check_node",m),d.jstree("check_node",t),d.jstree("check_node",v),d.on("create_node.jstree",function(e,t){d.jstree("open_all")}),d.on("select_node.jstree",function(e,t){t=t.node.data;c.set(t),u.viewer.inputHandler.deselectAll(),t instanceof Yp&&u.viewer.inputHandler.toggleSelection(t),$(u.viewer.renderer.domElement).focus()}),d.on("deselect_node.jstree",function(e,t){c.set(null)}),d.on("delete_node.jstree",function(e,t){c.set(null)}),d.on("dblclick",".jstree-anchor",function(e){var t,n,i,r,a,o,s,l=$.jstree.reference(e.target).get_node(e.target).data;e.target.classList.contains("jstree-checkbox")||(l instanceof xm?(e=u.viewer.getBoundingBox([l]),(t=new Si).boundingBox=e,u.viewer.zoomTo(t,1,500)):l instanceof Wf?(n=l.points.map(function(e){return e.position}),0==(t=(new kn).setFromPoints(n)).getSize(new Cn).length()&&(t.min=t.max.clone(),t.expandByVector(new Cn(1,1,1))),(n=new Si).boundingBox=t,u.viewer.zoomTo(n,2,500)):l instanceof Kp?(n=l.points,0<(n=(new kn).setFromPoints(n)).getSize(new Cn).length()&&((i=new Si).boundingBox=n,u.viewer.zoomTo(i,1,500))):l instanceof Yp?0<(i=l.boundingBox.clone().applyMatrix4(l.matrixWorld)).getSize(new Cn).length()&&((r=new Si).boundingBox=i,u.viewer.zoomTo(r,1,500)):l instanceof Kf?l.moveHere(u.viewer.scene.getActiveCamera()):l instanceof qf?(r=l.camera.getWorldDirection(new Cn),l.camera instanceof ed?(r.multiplyScalar(l.camera.right),a=(new Cn).addVectors(l.camera.position,r),u.viewer.setCameraMode(em.ORTHOGRAPHIC)):l.camera instanceof $r&&(r.multiplyScalar(u.viewer.scene.view.radius),a=(new Cn).addVectors(l.camera.position,r),u.viewer.setCameraMode(em.PERSPECTIVE)),u.viewer.scene.view.position.copy(l.camera.position),u.viewer.scene.view.lookAt(a)):"SpotLight"===l.type?(o=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.click(function(e){c.viewer.setClassificationVisibility(t,e.target.checked)});e=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}}),d.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()}),d.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()})});for(var a=[["EN","en"],["FR","fr"],["DE","de"],["JP","jp"],["ES","es"],["SE","se"],["ZH","zh"]],o=$("#potree_languages"),e=0;e".concat(n,""));n.click(function(){return r.viewer.setLanguage(i)}),0===e&&n.css("margin-left","30px"),o.append(n),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()}));var r=$('\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t');e.append(r),r.selectgroup({title:"Camera Projection"}),r.find("input").click(function(e){n.viewer.setCameraMode(em[e.target.value])});e=Object.keys(em).filter(function(e){return em[e]===n.viewer.scene.cameraMode});r.find("input[value=".concat(e,"]")).trigger("click");function a(e){return Math.pow((e-o.x)/o.y,.25)} var o=new yn(1,1e4);t.slider({value:a(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){i.html(n.viewer.getMoveSpeed().toFixed(1)),t.slider({value:a(n.viewer.getMoveSpeed())})}),i.html(this.viewer.getMoveSpeed().toFixed(1))}},{key:"initSettings",value:function(){var n=this;$("#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()));var e=$("#splat_quality_options");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)});var t=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}(),_w=function(){y(i,hn);var n=w(i);function i(e){var t;return O(this,i),(t=n.call(this)).viewer=e,t.renderer=e.renderer,t.sg=new Su(.1),t.sm=new Xu,t.s=new Hr(t.sg,t.sm),t} return h(i,[{key:"startInsertion",value:function(){var n=this,t=this.viewer.renderer.domElement,i=new Kf({position:[589748.27,231444.54,753.675],title:"Annotation Title",description:"Annotation Description",radius:1,cameraPosition:[589748.27,231444.54,753.675]});this.dispatchEvent({type:"start_inserting_annotation",annotation:i});var r=this.viewer.scene.annotations;r.add(i);function a(e){e.button===C.LEFT?o.finish():e.button===C.RIGHT&&o.cancel()} var o={cancel:null,finish:null};o.cancel=function(e){r.remove(i),t.removeEventListener("mouseup",a,!0)},o.finish=function(e){t.removeEventListener("mouseup",a,!0)},t.addEventListener("mouseup",a,!0);function s(e){viewer.scene.scene.remove(n.s),n.s.removeEventListener("drag",l),n.s.removeEventListener("drop",s)} var l=function(e){var t=e.viewer.scene.getActiveCamera(),e=e.viewer.inputHandler.intersectPoint;e&&(n.s.position.copy(e.location),i.position.copy(e.location),i.cameraTarget.copy(e.location),i.cameraPosition.copy(t.position))};return this.s.addEventListener("drag",l),this.s.addEventListener("drop",s),this.viewer.scene.scene.add(this.s),this.viewer.inputHandler.startDragging(this.s),i}},{key:"update",value:function(){}},{key:"render",value:function(){}}]),i}(),Mw=15,Aw=new bu(1,1),Tw=new _c,Sw=new tl({color:"#ffffff"}),Cw=function(){y(i,Si);var n=w(i);function i(e){var t;return O(this,i),(t=n.call(this)).lineLength=null!=e.lineLength?e.lineLength:.6,t.position.copy(e.position),t.normal=null!=e.normal?e.normal:new Cn(0,0,-1),t.root=e.root,t.build(),t} return h(i,[{key:"build",value:function(){bw=bw||new $i({transparent:!0,map:Tw.load(Potree.resourcePath+"/textures/spot_default.png")});var e=this.normal.clone().multiplyScalar(this.lineLength);this.line=Sf.createLine([new Cn(0,0,0),e],{mat:Sw});var t=new Si;this.spot=new Hr(Aw,bw),this.spot.scale.set(.4,.4,.4),this.titleLabel=new Jp({root:t,text:"1",sizeInfo:{width2d:200},textColor:{r:255,g:255,b:255,a:1},backgroundColor:{r:0,g:0,b:0,a:.8},borderRadius:6,fontsize:13,fontWeight:"",renderOrder:Mw,pickOrder:Mw}),this.spot.renderOrder=Mw,this.titleLabel.position.set(0,.4,0),this.titleLabel.sprite.material.depthTest=this.titleLabel.sprite.material.depthWrite=!0,t.position.copy(e),t.add(this.spot),t.add(this.titleLabel),this.add(t),this.add(this.line),viewer.scene.tags.add(this)}},{key:"updateMatrixWorld",value:function(e){this.updateMatrix(),this.matrixWorld.multiplyMatrices(this.root.matrixWorld,this.matrix);for(var t=this.children,n=0,i=t.length;na.width)){t.x=t.x/a.width*2-1,t.y=2* -(t.y/a.width)+1;e=new sh;e.setFromCamera(t,a.camera),e.ray.origin.sub(a.camera.getWorldDirection(new Cn));for(var n=e.intersectObjects(a.children),i=1e3,r=0;rt._taskLoad?-1:1});var 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;d=!0,r=64,n.format=et} n.mipmapCount=1,131072&u[2]&&!1!==t&&(n.mipmapCount=Math.max(1,u[7]));t=u[28];if(n.isCubemap=!!(512&t),n.isCubemap&&(!(1024&t)||!(2048&t)||!(4096&t)||!(8192&t)||!(16384&t)||!(32768&t))) return console.error("THREE.DDSLoader.parse: Incomplete cubemap faces"),n;n.width=u[4],n.height=u[3];for(var h=u[1]+4,p=n.isCubemap?6:1,f=0;f>1,1),y=Math.max(y>>1,1);return n}});var Qw=function(){function e(e,t,n){mc.call(this,e),this.dracoLoader=new Iw,this.ktx2Loader=new Ww,this.meshoptDecoder=Zw,this.ddsLoader=new Yw,this.dracoLoader.setDecoderPath(n+"three.js/loaders/draco/"),this.ktx2Loader.setTranscoderPath(n+"three.js/loaders/ktx/").detectSupport(t),this.pluginCallbacks=[],this.register(function(e){return new r(e)}),this.register(function(e){return new o(e)}),this.register(function(e){return new s(e)}),this.register(function(e){return new a(e)}),this.register(function(e){return new i(e)}),this.register(function(e){return new l(e)})} function n(){var n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}} e.prototype=Object.assign(Object.create(mc.prototype),{constructor:e,load:function(n,i,e,t){var r=this,a=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:ld.extractUrlBase(n);this.manager.itemStart(n);function o(e){t?t(e):console.error(e),r.manager.itemError(n),r.manager.itemEnd(n)} var s=new gc(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(n,function(e,t){console.log("数据加载成功",n.split("/").pop()," ,total: "+t);!function(){try{r.parse(e,a,function(e){i(e,t),r.manager.itemEnd(n)},o)}catch(e){o(e)}}()},e,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},setKTX2Loader:function(e){return this.ktx2Loader=e,this},setMeshoptDecoder:function(e){return this.meshoptDecoder=e,this},register:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this},unregister:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this},parse:function(e,t,n,i){var r,a={},o={};if("string"==typeof e) r=e;else if(ld.decodeText(new Uint8Array(e,0,4))===v){try{a[p.KHR_BINARY_GLTF]=new g(e)}catch(e){return void(i&&i(e))} r=a[p.KHR_BINARY_GLTF].content}else r=ld.decodeText(new Uint8Array(e));var s=JSON.parse(r);if(void 0===s.asset||s.asset.version[0]<2) i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var l=new V(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.unlitMat=this.unlitMat,l.fileLoader.setRequestHeader(this.requestHeader);for(var u=0;u",n).replace("#include ",i).replace("#include ",r).replace("#include ",a).replace("#include ",o)},Object.defineProperties(this,{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 this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)} function b(){return{name:p.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,specularGlossinessParams:["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"],getMaterialType:function(){return d},extendParams:function(e,t,n){var i=t.extensions[this.name];e.color=new Yi(1,1,1),e.opacity=1;var r=[];return Array.isArray(i.diffuseFactor)&&(t=i.diffuseFactor,e.color.fromArray(t),e.opacity=t[3]),void 0!==i.diffuseTexture&&r.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new Yi(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Yi(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture&&(i=i.specularGlossinessTexture,r.push(n.assignTexture(e,"glossinessMap",i)),r.push(n.assignTexture(e,"specularMap",i))),Promise.all(r)},createMaterial:function(e){var t=new d(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=1,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=sn,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.refractionRatio=.98,t}}} function x(){this.name=p.KHR_MESH_QUANTIZATION} function T(e,t,n,i){Ku.call(this,e,t,n,i)} y.prototype.decodePrimitive=function(e,t){var n,i=this.json,r=this.dracoLoader,a=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,s={},l={},u={};for(n in o){var c=L[n]||n.toLowerCase();s[c]=o[n]} for(n in e.attributes){var d,h,c=L[n]||n.toLowerCase();void 0!==o[n]&&(d=i.accessors[e.attributes[n]],h=D[d.componentType],u[c]=h,l[c]=!0===d.normalized)} return t.getDependency("bufferView",a).then(function(e){return new Promise(function(i){r.decodeDracoFile(e,function(e){for(var t in e.attributes){var n=e.attributes[t],t=l[t];void 0!==t&&(n.normalized=t)} i(e)},s,u)})})},w.prototype.extendTexture=function(e,t){return e=e.clone(),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),void 0!==t.texCoord&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e},((d.prototype=Object.create(Hu.prototype)).constructor=d).prototype.copy=function(e){return Hu.prototype.copy.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},((T.prototype=Object.create(Ku.prototype)).constructor=T).prototype.beforeStart_=T.prototype.copySampleValue_=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},T.prototype.afterEnd_=T.prototype.copySampleValue_,T.prototype.interpolate_=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,d=c-l,h=-2*t+3*n,p=t-n,f=1-h,m=p-n+i,v=0;v!==o;v++){var g=a[d+v+o],y=a[d+v+s]*u,w=a[c+v+o],b=a[c+v]*u;r[v]=f*g+m*y+h*w+p*b} return r};var E=0,_=1,M=2,A=3,S=4,C=5,P=6,D={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},h={9728:Re,9729:Oe,9984:Fe,9985:ze,9986:Ie,9987:Ne},k={33071:Be,33648:Le,10497:ke},B={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},L={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},R={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},F={CUBICSPLINE:void 0,LINEAR:$t,STEP:Kt},I="OPAQUE",O="MASK",z="BLEND";function N(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)} function U(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 G(e,t){void 0!==t.extras&&("object"===X(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))} function H(e){for(var t="",n=Object.keys(e).sort(),i=0,r=n.length;ithis.gamepadIndices.button&&(t=e.buttons[this.gamepadIndices.button],this.values.button=t.value,this.values.button=this.values.button<0?0:this.values.button,this.values.button=1Kw.ButtonTouchThreshold)&&(this.values.state=Kw.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.xAxis&&e.axes.length>this.gamepadIndices.xAxis&&(this.values.xAxis=e.axes[this.gamepadIndices.xAxis],this.values.xAxis=this.values.xAxis<-1?-1:this.values.xAxis,this.values.xAxis=1Kw.AxisTouchThreshold&&(this.values.state=Kw.ComponentState.TOUCHED)),void 0!==this.gamepadIndices.yAxis&&e.axes.length>this.gamepadIndices.yAxis&&(this.values.yAxis=e.axes[this.gamepadIndices.yAxis],this.values.yAxis=this.values.yAxis<-1?-1:this.values.yAxis,this.values.yAxis=1Kw.AxisTouchThreshold&&(this.values.state=Kw.ComponentState.TOUCHED)),Object.values(this.visualResponses).forEach(function(e){e.updateFromComponent(n.values)})}}]),t}(),o1=function(){function r(e,t,n){var i=this;if(O(this,r),!e) throw new Error("No xrInputSource supplied");if(!t) throw new Error("No profile supplied");this.xrInputSource=e,this.assetUrl=n,this.id=t.profileId,this.layoutDescription=t.layouts[e.handedness],this.components={},Object.keys(this.layoutDescription.components).forEach(function(e){var t=i.layoutDescription.components[e];i.components[e]=new a1(e,t)}),this.updateFromGamepad()} return h(r,[{key:"gripSpace",get:function(){return this.xrInputSource.gripSpace}},{key:"targetRaySpace",get:function(){return this.xrInputSource.targetRaySpace}},{key:"data",get:function(){var t=[];return Object.values(this.components).forEach(function(e){t.push(e.data)}),t}},{key:"updateFromGamepad",value:function(){var t=this;Object.values(this.components).forEach(function(e){e.updateFromGamepad(t.xrInputSource.gamepad)})}}]),r}();function s1(){Si.call(this),this.motionController=null,this.envMap=null} function l1(t,e){var n,r;n=t.motionController,r=e,Object.values(n.components).forEach(function(e){var t=e.type,n=e.touchPointNodeName,i=e.visualResponses;t===Kw.ComponentType.TOUCHPAD&&(e.touchPointNode=r.getObjectByName(n),e.touchPointNode?(n=new Hr(new Tu(.001),new $i({color:255})),e.touchPointNode.add(n)):console.warn("Could not find touch dot, ".concat(e.touchPointNodeName,", in touchpad component ").concat(e.id))),Object.values(i).forEach(function(e){var t=e.valueNodeName,n=e.minNodeName,i=e.maxNodeName;if(e.valueNodeProperty===Kw.VisualResponseProperty.TRANSFORM){if(e.minNode=r.getObjectByName(n),e.maxNode=r.getObjectByName(i),!e.minNode) return void console.warn("Could not find ".concat(n," in the model"));if(!e.maxNode) return void console.warn("Could not find ".concat(i," in the model"))} e.valueNode=r.getObjectByName(t),e.valueNode||console.warn("Could not find ".concat(t," in the model"))})}),t.envMap&&e.traverse(function(e){e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)}),t.add(e)} s1.prototype=Object.assign(Object.create(Si.prototype),{constructor:s1,setEnvironmentMap:function(e){var t=this;return this.envMap==e||(this.envMap=e,this.traverse(function(e){e.isMesh&&(e.material.envMap=t.envMap,e.material.needsUpdate=!0)})),this},updateMatrixWorld:function(e){Si.prototype.updateMatrixWorld.call(this,e),this.motionController&&(this.motionController.updateFromGamepad(),Object.values(this.motionController.components).forEach(function(e){Object.values(e.visualResponses).forEach(function(e){var t=e.valueNode,n=e.minNode,i=e.maxNode,r=e.value,e=e.valueNodeProperty;t&&(e===Kw.VisualResponseProperty.VISIBILITY?t.visible=r:e===Kw.VisualResponseProperty.TRANSFORM&&(Sn.slerp(n.quaternion,i.quaternion,t.quaternion,r),t.position.lerpVectors(n.position,i.position,r)))})}))}});var u1=(c1.prototype={constructor:c1,createControllerModel:function(e){var i=this,r=new s1,a=null;return e.addEventListener("connected",function(e){var n=e.data;"tracked-pointer"===n.targetRayMode&&n.gamepad&&!function(){return n1.apply(this,arguments)}(n,i.path,"generic-trigger").then(function(e){var t=e.profile,e=e.assetPath;r.motionController=new o1(n,t,e);e=i._assetCache[r.motionController.assetUrl];if(e) a=e.scene.clone(),l1(r,a);else{if(!i.gltfLoader) throw new Error("GLTFLoader not set.");i.gltfLoader.setPath(""),i.gltfLoader.load(r.motionController.assetUrl,function(e){i._assetCache[r.motionController.assetUrl]=e,a=e.scene.clone(),l1(r,a)},null,function(){throw new Error("Asset ".concat(r.motionController.assetUrl," missing or malformed."))})}}).catch(function(e){console.warn(e)})}),e.addEventListener("disconnected",function(){r.motionController=null,r.remove(a),a=null}),r}},c1);function c1(){this.gltfLoader=0n)){n=this.holes.concat(this.parentHoles).filter(function(e){return e!=t&&2i&&(e.zMax=i)),a&&(a.zMin=e.zMax,a.update(),a.dispatchEvent({type:"changeHeight"}))):(a=e.buildParent.buildChildren[o-1],e.zMin=Math.max(U1.zMin,n),i=e.zMax-.5,e.zMin>i?e.zMin=i:a&&(r=a.zMin+.5,e.zMin=r}).reduce(function(e,t){return t.fromBase(n)=r}).reduce(function(e,t){return t.toBase(n)this.times[t];) t++;if(0==t) return this.values[0];if(t==n) return this.values[n-1];var i=(e-this.times[t-1])/(this.times[t]-this.times[t-1]);return this.values[0]instanceof Cn?this.values[t-1].clone().lerp(this.values[t],i):this.values[t-1]+i*(this.values[t]-this.values[t-1])}}},{key:"clone",value:function(){return Fm.CloneClassObject(this)}}]),n}(),wb=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",xb=(Object.freeze({CUBE:1,SPHERE:2}),new Wr(1,1,1,1),new $i({wireframe:!0,color:"#ffffff"}),{positions:[],positionStyle:"sphere",positionBase:new Cn(0,0,0),positionSpread:new Cn(1,1,0),radius:1,velocityStyle:"cube",velocityBase:new Cn(0,0,.5),velocitySpread:new Cn(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 Cn(0,1,.5),colorSpread:new Cn(0,0,0),colorTween:new yb([.2,1],[new Cn(0,0,.4),new Cn(0,0,.1)]),opacityBase:.1,opacitySpread:.2,opacityTween:[[0,.1,.9,1],[.1,.4,.03,0]],strength:1,particleDeathAge:3,height:3}),Eb=(new Hr(new Tu(.03,5,5),new $i({color:"white",depthTest:!1})),function(){y(s,gl);var o=w(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 nr(new Float32Array(r),3)),this.geometry.setAttribute("customColor",new nr(new Float32Array(a),3)),this.geometry.setAttribute("customVisible",new nr(new Float32Array(o),1)),this.geometry.setAttribute("customOpacity",new nr(new Float32Array(s),1)),this.geometry.setAttribute("customSize",new nr(new Float32Array(l),1)),this.geometry.setAttribute("customAngle",new nr(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=h;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==K,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,d=this.geometry.attributes.size.array,h=0;ht&&(f.alive=0,f.rebornCount>=this.recycleTimes?f.deadAge=f.age-t:(i.push(h),r.push(f.age-t),a.push(f.rebornCount+1))),o[3*h]=f.position.x,o[3*h+1]=f.position.y,o[3*h+2]=f.position.z,u[3*h]=f.color.r,u[3*h+1]=f.color.g,u[3*h+2]=f.color.b,l[h]=f.alive,s[h]=f.opacity,c[h]=f.angle,d[h]=f.size):f.rebornCount>=this.recycleTimes&&f.age>t&&(f.deadAge+=e),f.rebornCount>=this.recycleTimes&&f.age>t&&f.deadAge>=n&&(i.push(h),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){e=Math.abs(t/(2*Math.tan(gn.degToRad(.5*e))));this.material.uniforms.heightOfNearPlane.value=e}},{key:"updateGeometry",value:function(){this.computeParams(),this.reStart()}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.dispatchEvent("dispose")}}]),a}(),Db={"fire+smoke":16777215,smoke:16777215,explode:16777215},kb={clipDistance:100,occlusionDistance:60,maxClipFactor:.5,backColor:"#777",useDepth:!0,transparent:!0},Bb={bus:new Dh,particleGroup:new Si,curveGroup:new Si,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=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")})},getEdgeDetectionMaterial:function(e){return new Qr({uniforms:{thickness:{value:e},maskTexture:{value:null},texSize:{value:new yn(10,10)},visibleEdgeColor:{value:new Cn(1,1,1)},hiddenEdgeColor:{value:new Cn(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;\t\t\t\tuniform sampler2D maskTexture; uniform float thickness;\t\t\t\tuniform vec2 texSize;\t\t\t\tuniform vec3 visibleEdgeColor;\t\t\t\tuniform vec3 hiddenEdgeColor;\t\t\t\t\t\t\t\tvoid main() {\n\t\t\t\t\tvec2 invSize = 1.0 / texSize;\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5;\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\t\t\t\t\tfloat d = length( vec2(diff1, diff2) ) * thickness;\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\t\t\t\t\tfloat visibilityFactor = min(a1, a2);\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\t\t\t\t\tgl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\t\t\t\t}"})},getSeperableBlurMaterial:function(e){return new Qr({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new yn(.5,.5)},direction:{value:new yn(.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 Qr({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:ee,depthTest:!1,depthWrite:!1,transparent:!0})}}),hx.BlurDirectionX=new yn(1,0),hx.BlurDirectionY=new yn(0,1);var px,fx=function(){y(n,Qr);var t=w(n);function n(){var e=0\n\t\t'),$(e).append(n.elMessages),n.paused,document.addEventListener("visibilitychange",function(e){n.dispatchEvent({type:"pageVisible",v:!document.hidden})});try{Potree.settings.isOfficial||(0===$(e).find("#potree_map").length&&(i=$('\n \n '),$(e).append(i)),0===$(e).find("#potree_description").length&&(r=$('
    '),$(e).append(r)),0===$(e).find("#potree_annotations").length&&(a=$('\n
    '),$(e).append(a)),0===$(e).find("#potree_quick_buttons").length&&(o=$('\n
    \n
    \n '),$(e).append(o)),px||"merge"==Potree.settings.editType||($(e).append($("
    ")),px=$("
    "),$(e).append(px),px=px[0])),n.pointCloudLoadedCallback=s.onPointCloudLoaded||function(){},n.server=null,n.fov=60,n.isFlipYZ=!1,n.useDEMCollisions=!1,n.generateDEM=!1,n.minNodeSize=30,n.edlStrength=1,n.edlRadius=1.4,n.edlOpacity=1,n.useEDL=!1,n.description="",n.classifications=Bm.DEFAULT,n.moveSpeed=10,n.lengthUnit=lm.METER,n.lengthUnitDisplay=lm.METER,n.showBoundingBox=!1,n.showAnnotations=!0,n.freeze=!1,n.clipTask=tm.HIGHLIGHT,n.clipMethod=nm.INSIDE_ANY,n.elevationGradientRepeat=im.CLAMP,n.filterReturnNumberRange=[0,7],n.filterNumberOfReturnsRange=[0,7],n.filterGPSTimeRange=[-1/0,1/0],n.filterPointSourceIDRange=[0,65535],n.potreeRenderer=null,n.edlRenderer=null,n.pRenderer=null,n.scene=null,n.sceneVR=null,n.overlay=null,n.overlayCamera=null,n.inputHandler=null,n.controls=null,n.clippingTool=null,n.transformationTool=null,n.navigationCube=null,n.compass=null,n.skybox=null,n.clock=new Cd,n.background=null,s.noDragAndDrop||n.initDragAndDrop(),"undefined"!=typeof Stats&&(n.stats=new Stats,n.stats.showPanel(0),document.body.appendChild(n.stats.dom)),n.renderer.domElement.addEventListener("webglcontextlost",function(e){console.log(e),n.postMessage("WebGL context lost. ☹");e=n.renderer.getContext().getError();console.log(e),n.dispatchEvent({type:"webglError",msg:"webglcontextlost"})},!1),n.overlay=new gs,n.overlayCamera=new ed(0,1,1,0,-1e3,1e3),n.pRenderer=new Zm(n.renderer);n.shadowTestCam=new $r(90,1,2.5,10),n.shadowTestCam.position.set(3.5,-2.8,8.561),n.shadowTestCam.lookAt(new Cn(0,0,4.87));var l=new rg(n.renderer);n.sceneVR=new gs,n.setScene(l),n.composer=new ux(n.renderer),n.ssaaRenderPass=new sx(0,0),n.composer.addPass(n.ssaaRenderPass);var u=n.outlinePass=new hx;u.renderToScreen=!0,u.enabled=!1,n.composer.addPass(u),u.edgeStrength=10,u.edgeGlow=0,u.visibleEdgeColor=new Yi("#09a1b3"),u.hiddenEdgeColor=new Yi("#09a1b3"),n.mainViewport=new Ig(n.scene.view,n.scene.cameraP,{left:0,bottom:0,width:1,height:1,name:"MainView"}),n.viewports=[n.mainViewport],n.compass=new Kv(g(n)),n.magnifier=new ab(g(n)),n.reticule=new sb(g(n)),n.scene.scene.add(n.magnifier),n.scene.scene.add(n.reticule),"pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType&&(n.mapViewer=new fy(px)),n.inputHandler=new Og(g(n),n.scene.scene),n.clippingTool=new jv(g(n)),n.transformationTool=new Zv(g(n)),n.navigationCube=new Dw(g(n)),n.navigationCube.visible=!1,n.createControls(),n.clippingTool.setScene(n.scene);var c=function(e){1===n.scene.pointclouds.length&&(e=e.pointcloud.boundingBox.getSize(new Cn).length(),n.setMoveSpeed(e/=2e3))},d=function(e){n.inputHandler.deselect(e.volume)};n.addEventListener("scene_changed",function(e){n.inputHandler.setScene(e.scene),n.clippingTool.setScene(n.scene),e.scene.hasEventListener("pointcloud_added",c)||e.scene.addEventListener("pointcloud_added",c),e.scene.hasEventListener("volume_removed",c)||e.scene.addEventListener("volume_removed",d)}),n.scene.addEventListener("volume_removed",d),n.scene.addEventListener("pointcloud_added",c),n.setFOV(60),n.setEDLEnabled(!1),n.setEDLRadius(1.4),n.setEDLStrength(.4),n.setEDLOpacity(1),n.setClipTask(tm.HIGHLIGHT),n.setClipMethod(nm.INSIDE_ANY),n.setPointBudget(1e6),n.setShowBoundingBox(!1),n.setFreeze(!1),n.setControls(n.fpControls),n.setBackground(new Yi(Potree.config.background),1),n.scaleFactor=1,n.loadSettingsFromURL(),n.renderer.setAnimationLoop(n.loop.bind(g(n))),n.loadGUI=n.loadGUI.bind(g(n)),n.annotationTool=new _w(g(n)),n.measuringTool=new Wv(g(n)),n.profileTool=new qv(g(n)),n.volumeTool=new Qv(g(n)),n.tagTool=new Pw(g(n)),y1.init(g(n),n.mapViewer?[g(n),n.mapViewer]:[g(n)]),"pano"==Potree.settings.editType?n.modules.PanoEditor.init():"merge"==Potree.settings.editType?n.modules.MergeEditor.init():(n.modules.SiteModel.init(),n.modules.ParticleEditor.init()),n.modules.Alignment.init(),n.images360=new ly(g(n)),n.scene.scene.add(n.objs),vx={objLoader:new tx(mx),mtlLoader:new rx(mx),glbLoader:new Qw(void 0,n.renderer,Potree.settings.libsUrl)}}catch(e){n.onCrash(e)} var h="";Object.defineProperty(Potree.settings,"pointDensity",{get:function(){return h},set:function(e){var t;e&&e!=h&&(t=Potree.config.pointDensity[e],t=(n.magnifier.visible?Potree.config.pointDensity.magnifier:t).pointBudget,viewer.setPointBudget(t),h=e,n.setPointLevels())}});var p="";Object.defineProperty(Potree.settings,"UserPointDensity",{get:function(){return p},set:function(e){p!=e&&("showPointCloud"==Potree.settings.displayMode&&4!=n.viewports.length&&(Potree.settings.pointDensity=e),p=e)}});var f=Potree.settings.cameraFar;return Object.defineProperty(Potree.settings,"cameraFar",{get:function(){return f},set:function(e){e!=f&&("showPanos"!=Potree.settings.displayMode&&(n.mainViewport.camera.far=e,n.mainViewport.camera.updateProjectionMatrix()),f=e)}}),n.addEventListener("allLoaded",function(){setTimeout(n.testPointcloudsMaxLevel.bind(g(n)),2e3)}),"pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType&&(n.addEventListener("switchFloorplanSelect",function(e){var t;n.selectedFloorplan=e.pointcloud,n.updateFpVisiDatasets(),e.pointcloud?t=[e.pointcloud]:n.fpVisiDatasets.length&&(t=n.fpVisiDatasets),t&&n.mapViewer.fitToDatasets(t)}),n.modules.SiteModel.bus.addEventListener("FloorChange",function(){n.updateFpVisiDatasets()}),n.mapViewer.mapLayer.addEventListener("floorplanLoaded",function(){n.updateCadVisibles(n.fpVisiDatasets,!0)})),n.addEventListener("camera_changed",function(e){e.changeInfo.positionChanged&&(gx.clear(),n.updateDatasetAt())}),n} return h(v,[{key:"ifPointBlockedByIntersect",value:function(e,t){var n,i=gx.get(t||e);return i?n=i.ifShelter:(n=viewer.inputHandler.ifBlockedByIntersect(e,.3,!0),gx.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.ifContainsPoint(t)});return Fm.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():Fm.intervalTool.isWaiting("atWhichDataset",e,500)}},{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,n=this,i=(this.modules.Clip,this.modules.SiteModel),r=this.modules.Alignment,a=i.currentFloor;this.selectedFloorplan?(e=[this.selectedFloorplan],this.updateCadVisibles(e)):(i.editing||r.editing?(t=this.scene.pointclouds.filter(function(e){return n.getObjVisiByReason(e,"datasetSelection")}),this.updateCadVisibles(t)):(0==(t=a?this.findPointcloudsAtFloor(a):[]).length&&(t=this.atDatasets),this.updateCadVisibles(t)),this.updatePanosVisibles(a))}},{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){this.background!==e&&("skybox"===e&&(this.skybox=Jf.loadSkybox(new URL(Potree.resourcePath+"/textures/skybox2/").href)),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 by(i),i.profileWindowController=new xy(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=ue(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=r(regeneratorRuntime.mark(function e(t){var n,i,r,a,o,s,l,u;return regeneratorRuntime.wrap(function(e){for(;;)
    switch(e.prev=e.next){case 0:console.log(t),t.preventDefault(),n=ue(t.dataTransfer.items),e.prev=3,n.s();case 5:if((a=n.n()).done){e.next=49;break}
    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:if(!o){e.next=47;break}
    if(0e.collapseThreshold||e.boundingBox.containsPoint(s.scene.getActiveCamera().position);return(e.expand=o)||-1<=a.z&&a.z<=1&&c.push(e),o}
    -1<=a.z&&a.z<=1&&c.push(e)});for(var e=new Set(this.visibleAnnotations),t=0,n=c;tt?e.y/2/Math.tan(gn.degToRad(g.fov/2))+e.z/2:(t=Rg.getHFOVForCamera(g,!0),e.x/2/Math.tan(t/2)+e.z/2),E=Math.max(.1,E),i=(new Cn).subVectors(i,n).normalize(),s.dontLookUp&&i.z<0&&i.negate(),h.copy(n).add(i.multiplyScalar(E)),h}
    var r,a,o,l,p,f,m,v,g=viewer.scene.getActiveCamera(),y=g.position.clone();if(this.images360.flying)
    return this.images360.addEventListener("cameraMoveDone",function e(){c.focusOnObject(u,t,n,$.extend(s,{deferred:i})),c.images360.removeEventListener("cameraMoveDone",e)}),{promise:i.promise()};if("measure"==t){if(d.copy(u.getCenter()),u.facePlane?(u.facePlane&&(l=u.facePlane.normal.clone()),r=this.scene.view.direction.angleTo(l),(a=gn.degToRad(60))Math.PI-p)&&(l>Math.PI/2&&o.negate(),v=(new Cn).subVectors(g.position,d).normalize(),f=(new Cn).addVectors(o,v).normalize(),v=(new Cn).addVectors(v,f),y.copy(d.clone().add(v)))):console.error("measure 没有facePlane points点数还不为2?"),h=e(u.points,null,d,y),this.mapViewer&&(f=new yn(4,4),m=new kn,u.points.forEach(function(e){m.expandByPoint(e)}),(v=m.getSize(new Cn).clone().multiplyScalar(2)).x=Math.max(f.x,v.x),v.y=Math.max(f.y,v.y),this.mapViewer.moveTo(d.clone(),v,n)),"showPointCloud"==Potree.settings.displayMode){var w=.3;!function(){var t=c.inputHandler.ifBlockedByIntersect(h,null,!0,d);if(t){for(var e,n=0,i=0,r=0;r')[0]).setAttribute("crossOrigin","Anonymous"),e=new wl(n),(i=this.videoPlane=new Hr(new bu(1,1,1,1),new $i({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,gv.start(vv(i.material,"opacity",1),.4*e.toPano.duration,function(){},0,pv.easeInOutQuad)},.6*e.toPano.duration),gv.start(vv(i.material,"opacity",0),.4*e.toPano.duration,function(){t||(i.visible=!1,n.pause(),Potree.settings.zoom.enabled=!0)},0,pv.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,gv.start(vv(i.material,"opacity",1,function(e){console.log("fadeIn",e)}),300,function(){},0,pv.easeInOutQuad)):(i.visible=!1,Potree.settings.zoom.enabled=!0)}),this.scene.scene.add(i))}},{key:"addVideo",value:function(){var r,e,a=this;"SS-t-P6zBR73Gke"==Potree.settings.number&&(r=new bu(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){!function(t){var n=$('')[0];n.setAttribute("crossOrigin","Anonymous"),n.src=t.url||Potree.resourcePath+"/video/".concat(Potree.settings.number,"/").concat(t.id,".mp4");var e=new wl(n),i=a.videoPlane=new Hr(r,new $i({color:"#ffffff",transparent:!0,depthTest:!1,opacity:0,map:e}));i.position.fromArray(t.position),i.rotation.fromArray(t.rotation),t.scale&&i.scale.fromArray(t.scale),a.scene.scene.add(i),(t.plane=i).boundingBox=new kn(new Cn(0,-.5,0),new Cn(1,-.4,.2)),n.addEventListener("loadeddata",function(e){n.play(),t.visibles||(i.material.opacity=1),t.scale||i.scale.set(n.videoWidth/1e3,n.videoHeight/1e3,1),console.log("video loadeddata",t.id)}),t.visibles&&a.images360.addEventListener("flyToPano",function(e){t.visibles.includes(e.toPano.pano.id)?setTimeout(function(){i.visible=!0,n.currentTime=0,n.play(),n.paused&&a.addEventListener("global_mousedown",function e(){i.visible&&n.play(),a.removeEventListener("global_mousedown",e)}),Potree.settings.zoom.enabled=!1,gv.start(vv(i.material,"opacity",1),.4*e.toPano.duration,function(){},0,pv.easeInOutQuad)},.6*e.toPano.duration):gv.start(vv(i.material,"opacity",0),.4*e.toPano.duration,function(){t||(i.visible=!1,n.pause(),Potree.settings.zoom.enabled=!0)},0,pv.easeInOutQuad)}),a.addEventListener("global_mousedown",function e(){n.play(),a.removeEventListener("global_mousedown",e)}),Potree.settings.isTest&&i.addEventListener("select",function(e){console.log(e)})}(e)}))}}]),v}();ed.prototype.zoomTo=function(e){(e.geometry||e.boundingBox)&&this.updateProjectionMatrix()},$r.prototype.zoomTo=function(e,t){var n,i;(e.geometry||e.boundingSphere||e.boundingBox)&&(e.geometry&&null===e.geometry.boundingSphere&&e.geometry.computeBoundingSphere(),e.updateMatrixWorld(),i=t||1,t=(n=(n=e.boundingSphere||(e.geometry&&e.geometry.boundingSphere?e.geometry.boundingSphere:e.boundingBox.getBoundingSphere(new qn))).clone().applyMatrix4(e.matrixWorld)).radius,e=this.fov*Math.PI/180,this.aspect<1&&(e*=this.aspect),i=Math.abs(t/Math.sin(e/2))*i,i=this.getWorldDirection(new Cn).multiplyScalar(-i),this.position.copy(n.center.clone().add(i)))},ti.prototype.distanceToPlaneWithNegative=function(e){var t=e.normal.dot(this.direction);return 0===t?0===e.distanceToPoint(this.origin)?0:null:-(this.origin.dot(e.normal)+e.constant)/t};rh=new ch,Ou=new xu;le.scriptPath="",document.currentScript&&document.currentScript.src?le.scriptPath=new URL(document.currentScript.src+"/..").href:("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("potree.js",document.baseURI).href,le.scriptPath=new URL(("undefined"==typeof document?new(require("url").URL)("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("potree.js",document.baseURI).href)+"/..").href),"/"===le.scriptPath.slice(-1)&&(le.scriptPath=le.scriptPath.slice(0,-1));var yx,Dl=le.scriptPath+"/resources";function wx(e,t,n){return bx.apply(this,arguments)}
    function bx(){return(bx=r(regeneratorRuntime.mark(function e(t,n,i){var r;return regeneratorRuntime.wrap(function(e){for(;;)
    switch(e.prev=e.next){case 0:if(!Potree.fileServer){e.next=4;break}
    Potree.fileServer.get(t).then(function(e){n&&n(e)}).catch(i),e.next=20;break;case 4:return e.prev=4,e.next=7,fetch(t);case 7:return r=e.sent,e.next=10,r.text();case 10:return r=e.sent,(r=JSON.parse(r)).data&&(r=r.data),n&&n(r),e.abrupt("return",r);case 17:e.prev=17,e.t0=e.catch(4),i&&i(e.t0);case 20:case"end":return e.stop()}},e,null,[[4,17]])}))).apply(this,arguments)}
    function xx(){return(xx=r(regeneratorRuntime.mark(function e(t,n,i){var r;return regeneratorRuntime.wrap(function(e){for(;;)
    switch(e.prev=e.next){case 0:return n=n||Potree.settings.number,r=(Potree.fileServer?"/laser/dataset/":"".concat(Potree.settings.urls.prefix4,"laser/dataset/")).concat(n,"/getDataSet"),e.abrupt("return",wx(r,t,i));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}
    function Ex(){return(Ex=r(regeneratorRuntime.mark(function e(t,n){var i,r,a=this;return regeneratorRuntime.wrap(function(e){for(;;)
    switch(e.prev=e.next){case 0:if(Potree.settings.floorplanEnable||n||!Potree.fileServer){e.next=2;break}
    return e.abrupt("return");case 2:i="all"==t?viewer.scene.pointclouds.map(function(e){return e.dataset_id}):[t],r=function(t,e,n){e==Potree.settings.floorplanType[t]&&((e=viewer.mapViewer.mapLayer.maps.find(function(e){return e.name=="floorplan_"+t}))&&viewer.mapViewer.mapLayer.removeMap(e),n=viewer.mapViewer.mapLayer.addMapEntity(n.data||n,t),e&&(n.visibleReasons=e.visibleReasons,n.unvisibleReasons=e.unvisibleReasons),0)},i.forEach(function(e){var t=Potree.settings.floorplanType[e];if(t){var n=Potree.fileServer?"/laser/tiledMap/".concat(Potree.settings.number,"/tiledMap/").concat(t,"/").concat(e):"".concat(Potree.settings.urls.prefix2,"/indoor/").concat(Potree.settings.number,"/api/tiled_maps");return Potree.settings.floorplanRequests[e]=!0,wx(n,r.bind(a,e,t))}});case 6:case"end":return e.stop()}},e)}))).apply(this,arguments)}
    function _x(){return(_x=r(regeneratorRuntime.mark(function e(t,n){var i;return regeneratorRuntime.wrap(function(e){for(;;)
    switch(e.prev=e.next){case 0:return i="?datasetId=".concat(t),i=Potree.fileServer?"/laser/filter/".concat(Potree.settings.number,"/query")+i:"".concat(Potree.settings.urls.prefix4,"laser/filter/").concat(Potree.settings.number,"/query")+i,e.abrupt("return",wx(i,n));case 3:case"end":return e.stop()}},e)}))).apply(this,arguments)}
    function Mx(){return(Mx=r(regeneratorRuntime.mark(function e(t){var n;return regeneratorRuntime.wrap(function(e){for(;;)
    switch(e.prev=e.next){case 0:return Potree.fileServer||(n="".concat(Potree.scriptPath,"/data/panoEdit/vision_edit.txt")),e.abrupt("return",wx(n,t));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}
    (yx=jQuery).fn.extend({selectgroup:function(){var e=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=t.find("label"),a=t.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(t)});for(var e=yx('\n\t\t\t\t
    \n\t\t\t\t\t'.concat(e,'\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;ii.bottomRange.max||e.btmHeight