!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t((e=e||self).Potree={},e.THREE$2)}(this,function(W,Le){"use strict";function u(e,t){this.v=e,this.k=t}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n=e.length?{done:!0}:{done:!1,value:e[a++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Y(e,t,n){return(t=L(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var i=P(e,t);if(i)return(i=Object.getOwnPropertyDescriptor(i,t)).get?i.get.call(arguments.length<3?e:n):i.value}).apply(null,arguments)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}function y(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(y=function(){return!!e})()}function w(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function E(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function C(t,e){var n,i=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)),i}function g(t){for(var e=1;e>8&255]+jn[e>>16&255]+jn[e>>24&255]+"-"+jn[255&t]+jn[t>>8&255]+"-"+jn[t>>16&15|64]+jn[t>>24&255]+"-"+jn[63&n|128]+jn[n>>8&255]+"-"+jn[n>>16&255]+jn[n>>24&255]+jn[255&i]+jn[i>>8&255]+jn[i>>16&255]+jn[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((qn=16807*(qn=void 0!==e?e%2147483647:qn)%2147483647)-1)/2147483646},degToRad:function(e){return e*Be.DEG2RAD},radToDeg:function(e){return e*Be.RAD2DEG},isPowerOfTwo:function(e){return 0==(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){var a=Math.cos,o=Math.sin,s=a(n/2),l=o(n/2),u=a((t+i)/2),c=o((t+i)/2),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)}}},Re=function(){return A(function e(){var t=0Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=n,this.normalize()}},{key:"angleTo",value:function(e){return 2*Math.acos(Math.abs(Be.clamp(this.dot(e),-1,1)))}},{key:"rotateTowards",value:function(e,t){var n=this.angleTo(e);return 0!==n&&(t=Math.min(1,t/n),this.slerp(e,t)),this}},{key:"identity",value:function(){return this.set(0,0,0,1)}},{key:"invert",value:function(){return this.conjugate()}},{key:"conjugate",value:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}},{key:"dot",value:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}},{key:"lengthSq",value:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}},{key:"length",value:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}},{key:"normalize",value:function(){var e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(this._x=this._x*(e=1/e),this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}},{key:"multiply",value:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}},{key:"premultiply",value:function(e){return this.multiplyQuaternions(e,this)}},{key:"multiplyQuaternions",value:function(e,t){var n=e._x,i=e._y,r=e._z,e=e._w,a=t._x,o=t._y,s=t._z,t=t._w;return this._x=n*t+e*a+i*s-r*o,this._y=i*t+e*o+r*a-n*s,this._z=r*t+e*s+n*o-i*a,this._w=e*t-n*a-i*o-r*s,this._onChangeCallback(),this}},{key:"slerp",value:function(e,t){if(0!==t){if(1===t)return this.copy(e);var n,i=this._x,r=this._y,a=this._z,o=this._w,s=o*e._w+i*e._x+r*e._y+a*e._z;s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),1<=s?(this._w=o,this._x=i,this._y=r,this._z=a):((e=1-s*s)<=Number.EPSILON?(this._w=(n=1-t)*o+t*this._w,this._x=n*i+t*this._x,this._y=n*r+t*this._y,this._z=n*a+t*this._z,this.normalize()):(n=Math.sqrt(e),e=Math.atan2(n,s),s=Math.sin((1-t)*e)/n,t=Math.sin(t*e)/n,this._w=o*s+this._w*t,this._x=i*s+this._x*t,this._y=r*s+this._y*t,this._z=a*s+this._z*t),this._onChangeCallback())}return this}},{key:"equals",value:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}},{key:"fromArray",value:function(e){var t=1Number.EPSILON&&(u=Math.sqrt(u),l=Math.atan2(u,l*s),a=Math.sin(a*l)/u,o=Math.sin(o*l)/u),c=c*a+i*(l=o*s),d=d*a+p*l,h=h*a+f*l,n=n*a+r*l,a===1-o&&(c*=u=1/Math.sqrt(c*c+d*d+h*h+n*n),d*=u,h*=u,n*=u)),e[t]=c,e[t+1]=d,e[t+2]=h,e[t+3]=n}},{key:"multiplyQuaternionsFlat",value:function(e,t,n,i,r,a){var o=n[i],s=n[i+1],l=n[i+2],n=n[i+3],i=r[a],u=r[a+1],c=r[a+2],r=r[a+3];return e[t]=o*r+n*i+s*c-l*u,e[t+1]=s*r+n*u+l*i-o*c,e[t+2]=l*r+n*c+o*u-s*i,e[t+3]=n*r-o*i-s*u-l*c,e}}])}(),Oe=function(){return A(function e(){var t=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 Oe),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,li),li.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(vi),gi.subVectors(this.max,vi),ci.subVectors(e.a,vi),di.subVectors(e.b,vi),hi.subVectors(e.c,vi),pi.subVectors(di,ci),fi.subVectors(hi,di),mi.subVectors(ci,hi),!!oi([0,-pi.z,pi.y,0,-fi.z,fi.y,0,-mi.z,mi.y,pi.z,0,-pi.x,fi.z,0,-fi.x,mi.z,0,-mi.x,-pi.y,pi.x,0,-fi.y,fi.x,0,-mi.y,mi.x,0],ci,di,hi,gi))&&!!oi([1,0,0,0,1,0,0,0,1],ci,di,hi,gi)&&(Ai.crossVectors(pi,fi),oi([Ai.x,Ai.y,Ai.z],ci,di,hi,gi))}},{key:"clampPoint",value:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new Oe),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return li.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(li).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()||(si[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),si[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),si[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),si[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),si[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),si[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),si[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),si[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(si)),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)}}])}();function oi(e,t,n,i,r){for(var a=0,o=e.length-3;a<=o;a+=3){yi.fromArray(e,a);var s=r.x*Math.abs(yi.x)+r.y*Math.abs(yi.y)+r.z*Math.abs(yi.z),l=t.dot(yi),u=n.dot(yi),c=i.dot(yi);if(Math.max(-Math.max(l,u,c),Math.min(l,u,c))>s)return!1}return!0}var si=[new Oe,new Oe,new Oe,new Oe,new Oe,new Oe,new Oe,new Oe],li=new Oe,ui=new K,ci=new Oe,di=new Oe,hi=new Oe,pi=new Oe,fi=new Oe,mi=new Oe,vi=new Oe,gi=new Oe,Ai=new Oe,yi=new Oe,wi=new K,bi=function(){return A(function e(t,n){ue(this,e),this.center=void 0!==t?t:new Oe,this.radius=void 0!==n?n:-1},[{key:"set",value:function(e,t){return this.center.copy(e),this.radius=t,this}},{key:"setFromPoints",value:function(e,t){for(var n=this.center,i=(void 0!==t?n.copy(t):wi.setFromPoints(e).getCenter(n),0),r=0,a=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}},{key:"getBoundingBox",value:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new K),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}}])}(),xi=new Oe,Ei=new Oe,Ci=new Oe,Bi=new Oe,Mi=new Oe,Si=new Oe,Ti=new Oe,_i=function(){return A(function e(t,n){ue(this,e),this.origin=void 0!==t?t:new Oe,this.direction=void 0!==n?n:new Oe(0,0,-1)},[{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 Oe),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,xi)),this}},{key:"closestPointToPoint",value:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new Oe),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=xi.subVectors(e,this.origin).dot(this.direction);return(t<0?this.origin:(xi.copy(this.direction).multiplyScalar(t).add(this.origin),xi)).distanceToSquared(e)}},{key:"distanceSqToSegment",value:function(e,t,n,i){Ei.copy(e).add(t).multiplyScalar(.5),Ci.copy(t).sub(e).normalize(),Bi.copy(this.origin).sub(Ei);var r,a,o,e=.5*e.distanceTo(t),t=-this.direction.dot(Ci),s=Bi.dot(this.direction),l=-Bi.dot(Ci),u=Bi.lengthSq(),c=Math.abs(1-t*t);return c=0>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this}},{key:"setRGB",value:function(e,t,n){return this.r=e,this.g=t,this.b=n,this}},{key:"setHSL",value:function(e,t,n){return e=Be.euclideanModulo(e,1),t=Be.clamp(t,0,1),n=Be.clamp(n,0,1),0===t?this.r=this.g=this.b=n:(this.r=Ar(t=2*n-(n=n<=.5?n*(1+t):n+t-n*t),n,e+1/3),this.g=Ar(t,n,e),this.b=Ar(t,n,e-1/3)),this}},{key:"setStyle",value:function(t){function e(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}if(l=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(t)){var n,i,r,a,o=l[1],s=l[2];switch(o){case"rgb":case"rgba":if(n=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(n[1],10))/255,this.g=Math.min(255,parseInt(n[2],10))/255,this.b=Math.min(255,parseInt(n[3],10))/255,e(n[4]),this;if(n=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(n[1],10))/100,this.g=Math.min(100,parseInt(n[2],10))/100,this.b=Math.min(100,parseInt(n[3],10))/100,e(n[4]),this;break;case"hsl":case"hsla":if(n=/^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i=parseFloat(n[1])/360,r=parseInt(n[2],10)/100,a=parseInt(n[3],10)/100,e(n[4]),this.setHSL(i,r,a)}}else if(l=/^\#([A-Fa-f\d]+)$/.exec(t)){var o=l[1],l=o.length;if(3===l)return this.r=parseInt(o.charAt(0)+o.charAt(0),16)/255,this.g=parseInt(o.charAt(1)+o.charAt(1),16)/255,this.b=parseInt(o.charAt(2)+o.charAt(2),16)/255,this;if(6===l)return this.r=parseInt(o.charAt(0)+o.charAt(1),16)/255,this.g=parseInt(o.charAt(2)+o.charAt(3),16)/255,this.b=parseInt(o.charAt(4)+o.charAt(5),16)/255,this}return t&&0t&&(t=e[n]);return t}var Or={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:"undefined"!=typeof Uint8ClampedArray?Uint8ClampedArray:Uint8Array,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ur(e,t){return new Or[e](t)}var Nr=1,zr=new Me,Gr=new Z,Hr=new Oe,Vr=new K,Qr=new K,jr=new Oe;function V(){Object.defineProperty(this,"id",{value:Nr+=2}),this.uuid=Be.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}V.prototype=Object.assign(Object.create(Qn.prototype),{constructor:V,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){return Array.isArray(e)?this.index=new(65535n.far?null:{distance:r,point:la.clone(),object:e}}function ca(e,t,n,i,r,a,o,s,l,u,c,d){Yr.fromBufferAttribute(r,u),Xr.fromBufferAttribute(r,c),Kr.fromBufferAttribute(r,d);var h=e.morphTargetInfluences;if(t.morphTargets&&a&&h){ta.set(0,0,0),na.set(0,0,0),ia.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 da(5,5,5),n=new ga({name:"CubemapFromEquirect",uniforms:ha(n),vertexShader:i,fragmentShader:r,side:me,blending:ge}),i=(n.uniforms.tEquirect.value=t,new Q(a,n)),r=t.minFilter;return t.minFilter===vt&&(t.minFilter=N),new wa(1,10,this).update(e,i),t.minFilter=r,i.geometry.dispose(),i.material.dispose(),this},xa.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)},((Ea.prototype=Object.create(Zn.prototype)).constructor=Ea).prototype.isDataTexture=!0;var Ca=new bi,Ba=new Oe,Ma=function(){return A(function e(t,n,i,r,a,o){ue(this,e),this.planes=[void 0!==t?t:new ir,void 0!==n?n:new ir,void 0!==i?i:new ir,void 0!==r?r:new ir,void 0!==a?a:new ir,void 0!==o?o:new ir]},[{key:"set",value:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this}},{key:"clone",value:function(){return(new this.constructor).copy(this)}},{key:"copy",value:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this}},{key:"setFromProjectionMatrix",value:function(e){var t=this.planes,e=e.elements,n=e[0],i=e[1],r=e[2],a=e[3],o=e[4],s=e[5],l=e[6],u=e[7],c=e[8],d=e[9],h=e[10],p=e[11],f=e[12],m=e[13],v=e[14],e=e[15];return t[0].setComponents(a-n,u-o,p-c,e-f).normalize(),t[1].setComponents(a+n,u+o,p+c,e+f).normalize(),t[2].setComponents(a+i,u+s,p+d,e+m).normalize(),t[3].setComponents(a-i,u-s,p-d,e-m).normalize(),t[4].setComponents(a-r,u-l,p-h,e-v).normalize(),t[5].setComponents(a+r,u+l,p+h,e+v).normalize(),this}},{key:"intersectsObject",value:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ca.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ca)}},{key:"intersectsSprite",value:function(e){return Ca.center.set(0,0,0),Ca.radius=.7071067811865476,Ca.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ca)}},{key:"intersectsSphere",value:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++)if(t[r].distanceToPoint(n) 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor.xyz *= color.xyz;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_maxMipLevel 8.0\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_maxTileSize 256.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tfloat texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );\n\t\tvec2 f = fract( uv );\n\t\tuv += 0.5 - f;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tif ( mipInt < cubeUV_maxMipLevel ) {\n\t\t\tuv.y += 2.0 * cubeUV_maxTileSize;\n\t\t}\n\t\tuv.y += filterInt * 2.0 * cubeUV_minTileSize;\n\t\tuv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );\n\t\tuv *= texelSize;\n\t\tvec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x += texelSize;\n\t\tvec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.y += texelSize;\n\t\tvec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tuv.x -= texelSize;\n\t\tvec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;\n\t\tvec3 tm = mix( tl, tr, f.x );\n\t\tvec3 bm = mix( bl, br, f.x );\n\t\treturn mix( tm, bm, f.y );\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifndef ENVMAP_TYPE_CUBE_UV\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( -viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn texture2D( gradientMap, coord ).rgb;\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\treflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;\nmaterial.specularRoughness = min( material.specularRoughness, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat specularRoughness;\n\tvec3 specularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifndef USE_MORPHNORMALS\n\t\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\t\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, mapN );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tmat3 tsn = mat3( S, T, N );\n\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmissionmap_fragment:"#ifdef USE_TRANSMISSIONMAP\n\ttotalTransmission *= texture2D( transmissionMap, vUv ).r;\n#endif",transmissionmap_pars_fragment:"#ifdef USE_TRANSMISSIONMAP\n\tuniform sampler2D transmissionMap;\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"#include \nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include \n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\n\t\tvec4 lightMapTexel= texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSMISSION\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSMISSION\n\tuniform float transmission;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#ifdef TRANSMISSION\n\t\tfloat totalTransmission = transmission;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSMISSION\n\t\tdiffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},D={common:{diffuse:{value:new Se(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Yn},uv2Transform:{value:new Yn},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 Re(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 Se(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 Se(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Yn}},sprite:{diffuse:{value:new Se(15658734)},opacity:{value:1},center:{value:new Re(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Yn}}},Da={basic:{uniforms:pa([D.common,D.specularmap,D.envmap,D.aomap,D.lightmap,D.fog]),vertexShader:Pa.meshbasic_vert,fragmentShader:Pa.meshbasic_frag},lambert:{uniforms:pa([D.common,D.specularmap,D.envmap,D.aomap,D.lightmap,D.emissivemap,D.fog,D.lights,{emissive:{value:new Se(0)}}]),vertexShader:Pa.meshlambert_vert,fragmentShader:Pa.meshlambert_frag},phong:{uniforms:pa([D.common,D.specularmap,D.envmap,D.aomap,D.lightmap,D.emissivemap,D.bumpmap,D.normalmap,D.displacementmap,D.fog,D.lights,{emissive:{value:new Se(0)},specular:{value:new Se(1118481)},shininess:{value:30}}]),vertexShader:Pa.meshphong_vert,fragmentShader:Pa.meshphong_frag},standard:{uniforms:pa([D.common,D.envmap,D.aomap,D.lightmap,D.emissivemap,D.bumpmap,D.normalmap,D.displacementmap,D.roughnessmap,D.metalnessmap,D.fog,D.lights,{emissive:{value:new Se(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Pa.meshphysical_vert,fragmentShader:Pa.meshphysical_frag},toon:{uniforms:pa([D.common,D.aomap,D.lightmap,D.emissivemap,D.bumpmap,D.normalmap,D.displacementmap,D.gradientmap,D.fog,D.lights,{emissive:{value:new Se(0)}}]),vertexShader:Pa.meshtoon_vert,fragmentShader:Pa.meshtoon_frag},matcap:{uniforms:pa([D.common,D.bumpmap,D.normalmap,D.displacementmap,D.fog,{matcap:{value:null}}]),vertexShader:Pa.meshmatcap_vert,fragmentShader:Pa.meshmatcap_frag},points:{uniforms:pa([D.points,D.fog]),vertexShader:Pa.points_vert,fragmentShader:Pa.points_frag},dashed:{uniforms:pa([D.common,D.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Pa.linedashed_vert,fragmentShader:Pa.linedashed_frag},depth:{uniforms:pa([D.common,D.displacementmap]),vertexShader:Pa.depth_vert,fragmentShader:Pa.depth_frag},normal:{uniforms:pa([D.common,D.bumpmap,D.normalmap,D.displacementmap,{opacity:{value:1}}]),vertexShader:Pa.normal_vert,fragmentShader:Pa.normal_frag},sprite:{uniforms:pa([D.sprite,D.fog]),vertexShader:Pa.sprite_vert,fragmentShader:Pa.sprite_frag},background:{uniforms:{uvTransform:{value:new Yn},t2D:{value:null}},vertexShader:Pa.background_vert,fragmentShader:Pa.background_frag},cube:{uniforms:pa([D.envmap,{opacity:{value:1}}]),vertexShader:Pa.cube_vert,fragmentShader:Pa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Pa.equirect_vert,fragmentShader:Pa.equirect_frag},distanceRGBA:{uniforms:pa([D.common,D.displacementmap,{referencePosition:{value:new Oe},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Pa.distanceRGBA_vert,fragmentShader:Pa.distanceRGBA_frag},shadow:{uniforms:pa([D.lights,D.fog,{color:{value:new Se(0)},opacity:{value:1}}]),vertexShader:Pa.shadow_vert,fragmentShader:Pa.shadow_frag}};function Ia(a,o,n,s,i){var l,u,c=new Se(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 Zo(e){return e.replace(Ko,$o)}function $o(e,t){var n=Pa[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return Zo(n)}var es=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,ts=/#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 ns(e){return e.replace(ts,rs).replace(es,is)}function is(e,t,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),rs(0,t,n,i)}function rs(e,t,n,i){for(var r="",a=parseInt(t);a=a.get(e).length?(t=new gs(i,r),a.get(e).push(t)):t=a.get(e)[n],t},dispose:function(){a=new WeakMap}}}function ys(e){Er.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 ws(e){Er.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new Oe,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)}((ys.prototype=Object.create(Er.prototype)).constructor=ys).prototype.isMeshDepthMaterial=!0,ys.prototype.copy=function(e){return Er.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},((ws.prototype=Object.create(Er.prototype)).constructor=ws).prototype.isMeshDistanceMaterial=!0,ws.prototype.copy=function(e){return Er.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 bs="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}",xs="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";function Es(g,A,y){var w=new Ma,b=new Re,x=new Re,E=new ei,r=[],a=[],d={},h={0:me,1:fe,2:ve},C=new ga({defines:{SAMPLE_RATE:.25,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new Re},radius:{value:4}},vertexShader:xs,fragmentShader:bs}),B=C.clone(),e=(B.defines.HORIZONTAL_PASS=1,new V),M=(e.setAttribute("position",new H(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3)),new Q(e,C)),S=this;function p(e,t,n){var n=e<<0|t<<1|n<<2,i=r[n];return void 0===i&&(i=new ys({depthPacking:Un,morphTargets:e,skinning:t}),r[n]=i),i}function f(e,t,n){var n=e<<0|t<<1|n<<2,i=a[n];return void 0===i&&(i=new ws({morphTargets:e,skinning:t}),a[n]=i),i}function T(e,t,n,i,r,a,o){var s,l=null,u=p,c=e.customDepthMaterial;return!0===i.isPointLight&&(u=f,c=e.customDistanceMaterial),l=void 0===c?(!(s=!1)===n.morphTargets&&(s=t.morphAttributes&&t.morphAttributes.position&&0y||b.y>y)&&(b.x>y&&(x.x=Math.floor(y/p.x),b.x=x.x*p.x,h.mapSize.x=x.x),b.y>y)&&(x.y=Math.floor(y/p.y),b.y=x.y*p.y,h.mapSize.y=x.y),null!==h.map||h.isPointLightShadow||this.type!==pe||(h.map=new ti(b.x,b.y,p={minFilter:N,magFilter:N,format:It}),h.map.texture.name=d.name+".shadowMap",h.mapPass=new ti(b.x,b.y,p),h.camera.updateProjectionMatrix()),null===h.map&&(h.map=new ti(b.x,b.y,{minFilter:ht,magFilter:ht,format:It}),h.map.texture.name=d.name+".shadowMap",h.camera.updateProjectionMatrix()),g.setRenderTarget(h.map),g.clear(),h.getViewportCount()),m=0;mi||e.height>i?i/Math.max(e.width,e.height):r)<1||!0===t?"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?(t=(i=t?Be.floorPowerOfTwo:Math.floor)(r*e.width),i=i(r*e.height),void 0===a&&(a=s(t,i)),(r=n?s(t,i):a).width=t,r.height=i,r.getContext("2d").drawImage(e,0,0,t,i),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+t+"x"+i+")."),r):("data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e):e}function _(e){return Be.isPowerOfTwo(e.width)&&Be.isPowerOfTwo(e.height)}function P(e,t){return e.generateMipmaps&&t&&e.minFilter!==ht&&e.minFilter!==N}function D(e,t,n,i){x.generateMipmap(e),C.get(t).__maxMipLevel=Math.log(Math.max(n,i))*Math.LOG2E}function I(e,t,n){if(!1===M)return t;if(null!==e){if(void 0!==x[e])return x[e];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+e+"'")}e=t;return 6403===t&&(5126===n&&(e=33326),5131===n&&(e=33325),5121===n)&&(e=33321),6407===t&&(5126===n&&(e=34837),5131===n&&(e=34843),5121===n)&&(e=32849),33325!==(e=6408===t&&(5126===n&&(e=34836),5131===n&&(e=34842),5121===n)?32856:e)&&33326!==e&&34842!==e&&34836!==e||i.get("EXT_color_buffer_float"),e}function l(e){return e===ht||e===pt||e===ft?9728:9729}function c(e){var t,n,e=e.target;e.removeEventListener("dispose",c),t=e,void 0!==(n=C.get(t)).__webglInit&&(x.deleteTexture(n.__webglTexture),C.remove(t)),e.isVideoTexture&&o.delete(e),u.memory.textures--}function d(e){var e=e.target,t=(e.removeEventListener("dispose",d),C.get(e)),n=C.get(e.texture);if(e){if(void 0!==n.__webglTexture&&x.deleteTexture(n.__webglTexture),e.depthTexture&&e.depthTexture.dispose(),e.isWebGLCubeRenderTarget)for(var i=0;i<6;i++)x.deleteFramebuffer(t.__webglFramebuffer[i]),t.__webglDepthbuffer&&x.deleteRenderbuffer(t.__webglDepthbuffer[i]);else x.deleteFramebuffer(t.__webglFramebuffer),t.__webglDepthbuffer&&x.deleteRenderbuffer(t.__webglDepthbuffer),t.__webglMultisampledFramebuffer&&x.deleteFramebuffer(t.__webglMultisampledFramebuffer),t.__webglColorRenderbuffer&&x.deleteRenderbuffer(t.__webglColorRenderbuffer),t.__webglDepthRenderbuffer&&x.deleteRenderbuffer(t.__webglDepthRenderbuffer);C.remove(e.texture),C.remove(e)}u.memory.textures--}var h=0;function p(e,t){var n,i=C.get(e);if(e.isVideoTexture&&(n=e,r=u.render.frame,o.get(n)!==r)&&(o.set(n,r),n.update()),0e.far||t.push({distance:r,point:Hs.clone(),uv:fr.getUV(Hs,qs,Ys,Xs,Ks,Zs,$s,new Re),face:null,object:this})},copy:function(e){return Z.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}});var nl=new Oe,il=new Oe;function rl(){Z.call(this),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}rl.prototype=Object.assign(Object.create(Z.prototype),{constructor:rl,isLOD:!0,copy:function(e){Z.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n=t[n].distance;n++)t[n-1].object.visible=!1,t[n].object.visible=!0;for(this._currentLevel=n-1;ne.far||t.push({distance:m,point:l.clone().applyMatrix4(this.matrixWorld),index:p,face:null,faceIndex:null,object:this})}else for(var g,A=0,y=d.count-1;Ae.far||t.push({distance:g,point:l.clone().applyMatrix4(this.matrixWorld),index:A,face:null,faceIndex:null,object:this})}else if(n.isGeometry)for(var w,b=n.vertices,x=b.length,E=0;Ee.far||t.push({distance:w,point:l.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}},updateMorphTargets:function(){var e=this.geometry;if(e.isBufferGeometry){var t=e.morphAttributes,n=Object.keys(t);if(0r.far||a.push({distance:e,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,object:o}))}function Ul(t,e,n,i,r,a,o,s,l){Zn.call(this,t,e,n,i,r,a,o,s,l),this.format=void 0!==o?o:Dt,this.minFilter=void 0!==a?a:N,this.magFilter=void 0!==r?r:N,this.generateMipmaps=!1;var u=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function e(){u.needsUpdate=!0,t.requestVideoFrameCallback(e)})}function Nl(e,t,n,i,r,a,o,s,l,u,c,d){Zn.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 zl(e,t,n,i,r,a,o,s,l){Zn.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function Gl(e,t,n,i,r,a,o,s,l,u){if((u=void 0!==u?u:Ft)!==Ft&&u!==Ot)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");Zn.call(this,null,i,r,a,o,s,u,n=void 0===(n=void 0===n&&u===Ft?bt:n)&&u===Ot?_t:n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:ht,this.minFilter=void 0!==s?s:ht,this.flipY=!1,this.generateMipmaps=!1}Fl.prototype=Object.assign(Object.create(Z.prototype),{constructor:Fl,isPoints:!0,copy:function(e){return Z.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(),Rl.copy(n.boundingSphere),Rl.applyMatrix4(i),Rl.radius+=r,!1!==e.ray.intersectsSphere(Rl)){Il.copy(i).invert(),kl.copy(e.ray).applyMatrix4(Il);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)}}),((Nl.prototype=Object.create(Zn.prototype)).constructor=Nl).prototype.isCompressedTexture=!0,((zl.prototype=Object.create(Zn.prototype)).constructor=zl).prototype.isCanvasTexture=!0,((Gl.prototype=Object.create(Zn.prototype)).constructor=Gl).prototype.isDepthTexture=!0;var Hl=0,Vl=new Me,Ql=new Z,jl=new Oe;function Wl(){Object.defineProperty(this,"id",{value:Hl+=2}),this.uuid=Be.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Wl.prototype=Object.assign(Object.create(Qn.prototype),{constructor:Wl,isGeometry:!0,applyMatrix4:function(e){for(var t=(new Yn).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&&fu(an.x||i.x===n.x&&function(e,t){return mu(e.prev,e,t.prev)<0&&mu(t.next,e,e.next)<0}(n,i)))&&(n=i,h=l),(i=i.next)!==u;);}return n}(e,t))&&(e=bu(t,e),cu(t,t.next),cu(e,e.next))}(l[r],n),n=cu(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=pu(s,l,t,n,i),h=pu(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&&fu(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=mu(p.prev,p,p.next))return;if(p=p.prevZ,f!==e.prev&&f!==e.next&&fu(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=mu(f.prev,f,f.next))return;f=f.nextZ}for(;p&&p.z>=d;){if(p!==e.prev&&p!==e.next&&fu(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&0<=mu(p.prev,p,p.next))return;p=p.prevZ}for(;f&&f.z<=h;){if(f!==e.prev&&f!==e.next&&fu(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&0<=mu(f.prev,f,f.next))return;f=f.nextZ}return 1}(e,i,r,a):function(e){var t=e.prev,n=e,i=e.next;if(0<=mu(t,n,i))return;var r=e.next.next;for(;r!==e.prev;){if(fu(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&0<=mu(r.prev,r,r.next))return;r=r.next}return 1}(e))t.push(x.i/n),t.push(e.i/n),t.push(E.i/n),Eu(e),e=E.next,C=E.next;else if((e=E)===C){o?1===o?du(e=function(e,t,n){var i=e;do{var r=i.prev,a=i.next.next}while(!vu(r,a)&&gu(r,i,i.next,a)&&wu(r,a)&&wu(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),Eu(i),Eu(i.next),i=e=a),i=i.next,i!==e);return cu(i)}(cu(e),t,n),t,n,i,r,a,2):2===o&&function(e,t,n,i,r,a){var o=e;do{for(var s,l=o.next.next;l!==o.prev;){if(o.i!==l.i&&function(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&gu(n,n.next,e,t))return 1}while(n=n.next,n!==e);return}(e,t)&&(wu(e,t)&&wu(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)&&(mu(e.prev,e,t.prev)||mu(e,t.prev,t))||vu(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 yu(e){return 0Number.EPSILON){var l=Math.sqrt(s),u=Math.sqrt(a*a+o*o),c=t.x-r/l,t=t.y+i/l,l=((n.x-o/u-c)*o-(n.y+a/u-t)*a)/(i*o-r*a),n=(u=c+i*l-e.x)*u+(c=t+r*l-e.y)*c;if(n<=2)return new Re(u,c);l=Math.sqrt(n/2)}else{t=!1;i>Number.EPSILON?a>Number.EPSILON&&(t=!0):i<-Number.EPSILON?a<-Number.EPSILON&&(t=!0):Math.sign(r)===Math.sign(o)&&(t=!0),l=t?(u=-r,c=i,Math.sqrt(s)):(u=i,c=r,Math.sqrt(s/2))}return new Re(u/l,c/l)}for(var E=[],C=0,B=y.length,M=B-1,S=C+1;Ca.tracks[v].times[0]&&(m=a.tracks[v].times[0]);for(var g=0;g=t.times[u]?mc.arraySlice(t.values,r=u*o+a,r+o-a):(r=o-(u=a),(o=t.createInterpolant()).evaluate(g),mc.arraySlice(o.resultBuffer,u,r)),"quaternion"===n&&(new ii).fromArray(i).normalize().conjugate().toArray(i),e.times.length),d=0;d>>1;et;)--o;return++o,0===a&&o===r||(o<=a&&(a=(o=Math.max(o,1))-1),n=this.getValueSize(),this.times=mc.arraySlice(i,a,o),this.values=mc.arraySlice(this.values,a*n,o*n)),this},validate:function(){for(var e=!0,t=this.getValueSize(),n=(t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1),this.times),i=this.values,r=n.length,a=(0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1),null),o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&sNumber.EPSILON&&(o.normalize(),p=Math.acos(Be.clamp(i[f-1].dot(i[f]),-1,1)),r[f].applyMatrix4(s.makeRotationAxis(o,p))),a[f].crossVectors(i[f],r[f]);if(!0===t){var m=Math.acos(Be.clamp(r[0].dot(r[e]),-1,1));m/=e,0n.length-2?n.length-1:i+1],n=n[i>n.length-3?n.length-1:i+2];return t.set(Kc(e,r.x,a.x,o.x,n.x),Kc(e,r.y,a.y,o.y,n.y)),t},od.prototype.copy=function(e){Hc.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=r)return t=a[o]-r,i=(n=this.curves[o]).getLength(),n.getPointAt(0===i?0:1-t/i);o++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;nNumber.EPSILON){if(u<0&&(o=t[a],l=-l,s=t[r],u=-u),!(e.ys.y))if(e.y===o.y){if(e.x===o.x)return 1}else{u=u*(e.x-o.x)-l*(e.y-o.y);if(0==u)return 1;u<0||(i=!i)}}else if(e.y===o.y&&(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x))return 1}return i}(B.p,h[S].p)||(b!==S&&A.push({froms:b,tos:S,hole:C}),M?(M=!1,d[S].push(B)):g=!0);M&&d[b].push(B)}0t.parameterPositions[1])&&(this.stopFading(),0===n)&&(this.enabled=!1),this._effectiveWeight=i}},{key:"_updateTimeScale",value:function(e){var t,n=0;return this.paused||(n=this.timeScale,null!==(t=this._timeScaleInterpolant)&&(n*=t.evaluate(e)[0],e>t.parameterPositions[1])&&(this.stopWarping(),0===n?this.paused=!0:this.timeScale=n)),this._effectiveTimeScale=n}},{key:"_updateTime",value:function(e){var t,n=this._clip.duration,i=this.loop,r=this.time+e,a=this._loopCount,o=2202===i;if(0===e)return-1!==a&&o&&1==(1&a)?n-r:r;if(2200===i){-1===a&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n<=r)r=n;else{if(!(r<0)){this.time=r;break e}r=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else if(-1===a&&(0<=e?this._setEndings(!(a=0),0===this.repetitions,o):this._setEndings(0===this.repetitions,!0,o)),n<=r||r<0?(r-=n*(i=Math.floor(r/n)),a+=Math.abs(i),(t=this.repetitions-a)<=0?(this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r=0this.max.x||e.ythis.max.y)}},{key:"containsBox",value:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}},{key:"getParameter",value:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Re),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}},{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 Re),t.copy(e).clamp(this.min,this.max)}},{key:"distanceToPoint",value:function(e){return Ch.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)}}])}(),Mh=new Oe,Sh=new Oe,Th=function(){return A(function e(t,n){ue(this,e),this.start=void 0!==t?t:new Oe,this.end=void 0!==n?n:new Oe},[{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 Oe),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 Oe),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 Oe),this.delta(t).multiplyScalar(e).add(this.start)}},{key:"closestPointToPointParameter",value:function(e,t){Mh.subVectors(e,this.start),Sh.subVectors(this.end,this.start);e=Sh.dot(Sh),e=Sh.dot(Mh)/e;return e=t?Be.clamp(e,0,1):e}},{key:"closestPointToPoint",value:function(e,t,n){e=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new Oe),this.delta(n).multiplyScalar(e).add(this.start)}},{key:"applyMatrix4",value:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}},{key:"equals",value:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}])}();function _h(e){Z.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}((_h.prototype=Object.create(Z.prototype)).constructor=_h).prototype.isImmediateRenderObject=!0;var Ph=new Oe,uh=function(){function l(e,t){ue(this,l),(n=le(this,l)).light=e,n.light.updateMatrixWorld(),n.matrix=e.matrixWorld,n.matrixAutoUpdate=!1,n.color=t;for(var n,e=new V,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 ee(i,3));t=new wl({fog:!1,toneMapped:!1});return n.cone=new _l(e,t),n.add(n.cone),n.update(),n}return v(l,Z),A(l,[{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),Ph.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ph),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}])}(),Dh=new Oe,Ih=new Me,kh=new Me,Rh=function(){function u(e){ue(this,u);for(var t=function e(t){var n=[];t&&t.isBone&&n.push(t);for(var i=0;i>16&32768,n=e>>12&2047,i=e>>23&255;if(!(i<103)){if(142>114-i)+(n>>113-i&1);t=(t|(i-112<<10|n>>1))+(1&n)}return t}},lp=Math.pow(2,8),up=[.125,.215,.35,.446,.526,.582],cp=5+up.length,dp=Y(Y(Y(Y(Y(Y(Y({},Fn,0),On,1),3002,2),3004,3),3005,4),3006,5),3007,6),hp=new Ad,pp=bp(),fp=pp._lodPlanes,mp=pp._sizeLods,vp=pp._sigmas,gp=new Se,Ap=null,pp=(1+Math.sqrt(5))/2,yp=1/pp,wp=[new Oe(1,1,1),new Oe(-1,1,1),new Oe(1,1,-1),new Oe(-1,1,-1),new Oe(0,pp,yp),new Oe(0,pp,-yp),new Oe(yp,0,pp),new Oe(-yp,0,pp),new Oe(pp,yp,0),new Oe(-pp,yp,0)],pp=function(){return A(function e(t){var n,i;ue(this,e),this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=(t=20,n=new Float32Array(t),i=new Oe(0,1,0),new ac({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:i},inputEncoding:{value:dp[Fn]},outputEncoding:{value:dp[Fn]}},vertexShader:Mp(),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(Sp(),"\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:ge,depthTest:!1,depthWrite:!1})),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)},[{key:"fromScene",value:function(e){var t=1\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tvec2 f = fract( uv / texelSize - 0.5 );\n\t\t\t\tuv -= f * texelSize;\n\t\t\t\tvec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x += texelSize.x;\n\t\t\t\tvec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.y += texelSize.y;\n\t\t\t\tvec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\t\t\t\tuv.x -= texelSize.x;\n\t\t\t\tvec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;\n\n\t\t\t\tvec3 tm = mix( tl, tr, f.x );\n\t\t\t\tvec3 bm = mix( bl, br, f.x );\n\t\t\t\tgl_FragColor.rgb = mix( tm, bm, f.y );\n\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:ge,depthTest:!1,depthWrite:!1})}function Bp(){return new ac({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:dp[Fn]},outputEncoding:{value:dp[Fn]}},vertexShader:Mp(),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(Sp(),"\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;\n\t\t\t\tgl_FragColor = linearToOutputTexel( gl_FragColor );\n\n\t\t\t}\n\t\t"),blending:ge,depthTest:!1,depthWrite:!1})}function Mp(){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 Sp(){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"}var Tp=2;function _p(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Fl(e,t)}function Pp(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Xc.call(this,e),this.type="catmullrom",this.closed=!0}function Dp(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Xc.call(this,e),this.type="catmullrom"}function Ip(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Xc.call(this,e),this.type="catmullrom"}Hc.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Hc.prototype),(e.prototype.constructor=e).prototype.getPoint=t,e},Object.assign(ld.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 Wl,n=0,i=e.length;na.factor)&&(a={line:e,factor:n})}),a.line)}}])}(),Gp=0,Hp=function(){function a(t){var n=this;if(ue(this,a),t.points[0]!=t.points[1]){if(this.points=t.points,this.type=t.type||"line","line"==this.type){var e=Fp.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"+Gp++:t.id,this.ids=[this.id],t.dontWriteToPoint||this.points.forEach(function(e){e.lines.push(n)}),t.isChild||Fp.push(this),this.searchTime=0}this.children=[],this.parents=[],this.match=[]}}return A(a,[{key:"getAngleInfo",value:function(){t=this.points,(e={}).angle=t[1].clone().sub(t[0]).angle(),te.closeTo(e.angle,2*Math.PI)?e.angle-=2*Math.PI:(e.angle>Math.PI||te.closeTo(e.angle,Math.PI))&&(e.angle-=Math.PI,e.reverse=!0);var e,t=e;this.angle=t.angle,this.reverse=t.reverse}},{key:"getIntersectWithLine",value:function(e,t){var n=this,i=e.points.find(function(e){return n.points.includes(e)});return i?{point:i,type:"joint"}:(i=te.isLineIntersect(e.points,this.points,!1,t))?{point:i,type:"intersect"}:void 0}},{key:"writeToPoint",value:function(){var t=this;this.points.forEach(function(e){e.lines.includes(t)||e.lines.push(t)})}},{key:"checkIfParent",value:function(t){return this==t||this.parents.find(function(e){return e.checkIfParent(t)})}},{key:"splitByPoint",value:function(e){var t,n=this,i=new a({points:[e,this.points[0]],dontWriteToPoint:!0,hasntsure:!0}),e=new a({points:[e,this.points[1]],dontWriteToPoint:!0,hasntsure:!0});if(i.points&&e.points){if(!(this.checkIfParent(i)||this.checkIfParent(e)||i.checkIfParent(this)||e.checkIfParent(this)))return(t=function(e){n.children.push(e),e.parents.push(n),Fp.includes(e)||Fp.push(e),e.writeToPoint()})(i),t(e),-1<(t=this.points[0].lines.indexOf(this))&&this.points[0].lines.splice(t,1),-1<(t=this.points[1].lines.indexOf(this))&&this.points[1].lines.splice(t,1),[i,e];console.warn("splitByPoint 发现parent和children一样")}else console.warn("splitByPoint 线有点相同")}},{key:"splitByPoints",value:function(n){var i=this,r=((n=n.map(function(e){return{dis:e.distanceTo(i.points[0]),point:e}})).sort(function(e,t){return e.dis-t.dis}),[]),e=(n.forEach(function(e,t){e=new a({points:[e.point,0==t?i.points[0]:n[t-1].point],group:i.group,dontWriteToPoint:!0,hasntsure:!0});r.push(e)}),new a({points:[n[n.length-1].point,this.points[1]],group:this.group,dontWriteToPoint:!0,hasntsure:!0}));r.push(e),r.find(function(e){return!e.points||i.checkIfParent(e)||e.checkIfParent(i)})?console.error("splitByPoints return"):(r.forEach(function(e){i.children.push(e),e.parents.push(i),Fp.includes(e)||Fp.push(e),e.writeToPoint(),e.writeToPoint()}),-1<(e=this.points[0].lines.indexOf(this))&&this.points[0].lines.splice(e,1),-1<(e=this.points[1].lines.indexOf(this))&&this.points[1].lines.splice(e,1))}},{key:"getAllSlices",value:function(){function t(e){0==e.children.length?n.push(e):e.children.forEach(t)}var n=[];return t(this),n}},{key:"getVector",value:function(){return this.points[1].clone().sub(this.points[0])}},{key:"getLength",value:function(){return this.points[0].distanceTo(this.points[1])}},{key:"getCenter",value:function(){return this.points[1].clone().add(this.points[0]).multiplyScalar(.5)}}])}(),Vp=function(t,n){var e=t.filter(function(e){return!n.includes(e)}),i=n.filter(function(e){return!t.includes(e)});return e.concat(i)};function Qp(t,n){return Fp.find(function(e){return e.points.includes(t)&&e.points.includes(n)})}function jp(e,t){if(e instanceof Jp&&(e=e.points),t instanceof Jp&&(t=t.points),e.length!=t.length)return!1;if(e.lines&&t.lines){if(0==Vp(e.lines,t.lines).length)return!0}else if(qp(e,t))return!0}var Wp=0,Jp=A(function e(t){ue(this,e),this.id=Wp++,this.type=t.type||"normal",this.points=t.points,this.lines=t.lines,Op.push(this),this.child=[],this.parent=[],this.smallNeibours=[];t=te.getArea(this.points);this.area=Math.abs(t),this.isClockwise=t<0}),qp=function(e,t){for(var n,i,r=[],a=0,o=e.length;a=e.duration&&!e.cycling?(t=e.easing(1,0,1,1),e.func(t,1e3*n),e.done&&e.done(),e.running=!1):(t=e.easing(e.current%e.duration/e.duration,0,1,1),e.func(t,1e3*n)&&(e.done&&e.done(),e.running=!1)))});var e=this.funcs.length,t=(this.funcs=this.funcs.filter(function(e){return e.running}),this.funcs.length);0s-1&&!Kp[e].some(function(e){return 0s)&&Kp[e].splice(0,1),o&&e&&t&&console.log(e,t," ,dur:",l.toFixed(3))):t=i,t}),batchHandling:{lists:[],getSlice:function(e,n,t){var i=t.stopWhenAllUsed,r=t.min,a=t.max,o=t.durBound1,s=t.durBound2,l=t.useEquals,t=t.maxUseCount;if(0==n.length||!(t=null==t?j.getBestCount(e,void 0===r?5:r,void 0===a?100:a,o,s):t))return{list:[]};this.lists[e]||(this.lists[e]={list:[]});var u=this.lists[e].list.filter(function(t){return n.some(function(e){return l?t.item.equals(e):t.item==e})}),r=(this.lists[e].list=u,n.forEach(function(t){u.some(function(e){return l?e.item.equals(t):e.item==t})||u.push({item:t,count:0})}),u.filter(function(e){return 0==e.count})),c=[];return r.slice(0,t).forEach(function(e){c.push(e.item),e.count++}),r.length>t||(i||(a=Math.min(n.length,t),u.slice(0,a-c.length).forEach(function(e){c.push(e.item),e.count++})),u.forEach(function(e){return e.count--})),{list:c}}},getRootWindow:function(){var e=window;try{for(;e.parent!=e&&e.parent.Potree;)e=e.parent;if(window!=e)return e}catch(e){console.log("getRootWindow 跨域")}},watch:function(e,t,n){var i=n;Object.defineProperty(e,t,{get:function(){return i},set:function(e){console.warn("watch:",t,e),i=e}})},imgAddLabel:function(e,t){var n=2Math.PI)&&(on?(n=u.y,(i.resolution.y-d.y)/n):(n=u.x,(i.resolution.x-d.x)/n)),a.zoom=o.zoom=c*e+s*(1-e),o.updateProjectionMatrix(),h)&&h(e,t)},Easing:n}))}},{key:"zoomOrthoCamera",value:function(n,i,e,t,r){var a=this,o=n.zoom,s=new Oe(e.x,e.y,.5);df.start(function(e){var t=s.clone().unproject(n),e=(a.zoom=n.zoom=i*e+o*(1-e),n.updateProjectionMatrix(),s.clone().unproject(n)),e=(new Oe).subVectors(e,t);n.position.sub(e),a.position.copy(n.position),r&&r()},t,null,0,of.easeInOutSine,null,"zoomInView")}},{key:"tranCamera",value:function(e,n,t,i){var r=this,a=(e.camera=n.midCamera,n.midCamera.projectionMatrix.copy(n.startCamera.projectionMatrix),n.onUpdate),o=(n.onUpdate=function(e,t){cf(n.midCamera.projectionMatrix,n.endCamera.projectionMatrix)(e),a&&a(e,t)},n.callback);n.callback=function(){e.camera=n.endCamera,viewer.scene.measurements.forEach(function(e){Potree.Utils.updateVisible(e,"tranCamera",!0)}),r.applyToCamera(e.camera),viewer.dispatchEvent({type:"camera_changed",viewport:viewer.mainViewport,changeInfo:{}}),o&&o()},n.camera=n.endCamera,"OrthographicCamera"==n.camera.type?this.moveOrthoCamera(e,n,t,i):this.setView(Object.assign(n,{duration:t}))}}])}(),te={getBaseLog:function(e,t){return Math.log(t)/Math.log(e)},convertVector:{ZupToYup:function(e){return new Oe(e.x,e.z,-e.y)},YupToZup:function(e){return new Oe(e.x,-e.z,e.y)}},convertQuaternion:{ZupToYup:function(e){var t=new Oi(-Math.PI/2,0,0),t=(new ii).setFromEuler(t);return e.clone().premultiply(t)},YupToZup:function(e){var t=new Oi(Math.PI/2,0,0),t=(new ii).setFromEuler(t);return e.clone().premultiply(t)}},convertVisionQuaternion:function(e){return new ii(e.x,e.z,-e.y,e.w).multiply((new ii).setFromAxisAngle(new Oe(0,1,0),Be.degToRad(90)))},invertVisionQuaternion:function(e){e=e.clone().multiply((new ii).setFromAxisAngle(new Oe(0,1,0),Be.degToRad(-90)));return new ii(e.x,-e.z,e.y,e.w)},getVec2Angle:function(e,t){return Math.acos(Be.clamp(this.getVec2Cos(e,t),-1,1))},getVec2Cos:function(e,t){return e.dot(t)/e.length()/t.length()},getAngle:function(e,t){var n=2Math.PI?e-2*Math.PI:e<-Math.PI?e+2*Math.PI:e},getFOVDotThreshold:function(e){return Math.cos(Be.degToRad(e/2))},transform2DForwardVectorByCubeFace:function(e,t,n,i){switch(e){case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_X:n.set(1,t.y,t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:n.set(-1,t.y,-t.x);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:n.set(-t.x,1,-t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:n.set(-t.x,-1,t.y);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:n.set(-t.x,t.y,1);break;case GLCubeFaces.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:n.set(t.x,t.y,-1)}i&&n.normalize()},getFootPoint:function(e,t,n,i){var r,a;return t.equals(n)?t.clone():(e=e.clone().sub(t),r=(a=t.clone().sub(n)).length(),e=e.dot(a)/r,a=t.clone().add(a.multiplyScalar(e/r)),i&&0a.max.x||n.ya.max.y)return!1;for(var o=!1,s=n.x,l=n.y,u=0,c=e.length-1;u=Math.min(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,n=t;return((r=1/o*(n-e.x)+e.y)=t[i-1])return n[i-1];for(var r=0;++rMath.abs(e.z)?Bf.setVector(yf,-e.y,e.x,0):Bf.setVector(yf,0,-e.z,e.y)):Bf.cross(e,t,yf),this._x=yf.x,this._y=yf.y,this._z=yf.z,this._w=wf,this.normalize()},multiply:function(e){return this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,e=e._w,a=t._x,o=t._y,s=t._z,t=t._w;return this._x=n*t+e*a+i*s-r*o,this._y=i*t+e*o+r*a-n*s,this._z=r*t+e*s+n*o-i*a,this._w=e*t-n*a-i*o-r*s,this}},Bf.convertWorkshopVector=function(e){return new Bf.Vector3(-e.x,e.y,e.z)},Bf.convertWorkshopQuaternion=function(e){return new Bf.Quaternion(-e.x,e.y,e.z,-e.w).multiply(new Bf.Quaternion(Math.sqrt(2)/2,Math.sqrt(2)/2,0,0))},Bf.convertWorkshopOrthoZoom=function(e){return-1===e?-1:e*($("#player").width()/$("#player").height())},Bf.convertWorkshopPanoramaQuaternion=function(e){return new Bf.Quaternion(e.x,-e.y,-e.z,e.w).normalize().multiply((new Bf.Quaternion).setFromAxisAngle(new Bf.Vector3(0,1,0),270*Bf.RADIANS_PER_DEGREE))},Bf.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},Bf.dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},Bf.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},Bf.setVector=function(e,t,n,i){e.x=t,e.y=n,e.z=i},Bf.copyVector=function(e,t){t.x=e.x,t.y=e.y,t.z=e.z},Bf.addVector=function(e,t){e.x+=t.x,e.y+=t.y,e.z+=t.z},Bf.subVector=function(e,t){e.x-=t.x,e.y-=t.y,e.z-=t.z},Bf.applyQuaternionToVector=function(e,t){var n=t.x,i=t.y,r=t.z,a=e.x,o=e.y,s=e.z,e=e.w,l=e*n+o*r-s*i,u=e*i+s*n-a*r,c=e*r+a*i-o*n,n=-a*n-o*i-s*r;t.x=l*e+n*-a+u*-s-c*-o,t.y=u*e+n*-o+c*-a-l*-s,t.z=c*e+n*-s+l*-o-u*-a},{clampVFOV:function(e,t,n,i){return t\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\n\t\tuniform float lineWidth;\n\t\tuniform vec2 resolution;\n uniform float devicePixelRatio; //add\n \n \n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * lineWidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * lineWidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for lineWidth\n\t\t\t\toffset *= lineWidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y; //* devicePixelRatio;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float lineWidth;\n uniform bool uUseOrthographicCamera; \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\t\t#endif\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 uniform vec3 backColor;\n uniform float occlusionDistance;\n uniform float clipDistance;\n uniform float maxClipFactor;\n uniform float maxOcclusionFactor;\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 //if(uUseOrthographicCamera){\n // return zValue*(farPlane-nearPlane)+nearPlane;\n //}else{ \n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n //} \n }\n #endif\n\n\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include \n\n\t\t\t/*#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif*/\n \n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n \n \n bool unvisible = mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize;\n //加\n #ifdef DASH_with_depth\n \n #else \n if (unvisible) discard; // todo - FIX\n #endif\n\t\t\t#endif\n \n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / lineWidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\n //加\n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n\n float fragDepth = convertToLinear(gl_FragCoord.z);\n //gl_FragCoord大小为 viewport client大小 \n vec2 depthTxtCoords = vec2(gl_FragCoord.x - viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)\n {\n \n mixFactor = clamp(delta / occlusionDistance, 0.0, maxOcclusionFactor);\n clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);\n }\n \n if (clipFactor == 1.0)\n {\n discard;\n }\n \n vec4 backColor_ = vec4(backColor, opacity); //vec4(0.8,0.8,0.8, 0.8*opacity);\n \n #ifdef DASH_with_depth \n // 只在被遮住的部分显示虚线, 所以若同时是虚线不可见部分和被遮住时, a为0\n if(unvisible) backColor_.a = 0.0;\n #endif \n \n //vec4 diffuseColor = vec4(mix(diffuse, backColor_, mixFactor), opacity*(1.0 - clipFactor));\n \n \n \n diffuseColor = mix(diffuseColor, backColor_ , mixFactor); \n \n \n diffuseColor.a *= (1.0 - clipFactor); \n \n #endif\n\n\n\n\t\t\t#include \n\t\t\t#include \n\n\t\t\t//gl_FragColor = vec4( diffuseColor.rgb, alpha );\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, diffuseColor.a );\n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\t\t\t#include \n\n\t\t}\n\t\t"},function(){function r(e){ue(this,r);var t=Potree.Common.changeShaderToWebgl2(Da.line.vertexShader,Da.line.fragmentShader,"ShaderMaterial"),n=t.vs,t=t.fs,i=le(this,r,[{type:"LineMaterial",uniforms:fa.clone(Da.line.uniforms),vertexShader:n,fragmentShader:t,clipping:!0}]),n=(i.isLineMaterial=!0,i.lineWidth_=0,i.supportExtDepth=e.supportExtDepth,i.depthTestWhenPick=!1,e.color&&(i.color=new Se(e.color)),e.backColor&&(i.uniforms.backColor.value=new Se(e.backColor)),e.clipDistance&&(i.uniforms.clipDistance.value=e.clipDistance),e.occlusionDistance&&(i.uniforms.occlusionDistance.value=e.occlusionDistance),e.maxClipFactor&&(i.uniforms.maxClipFactor.value=e.maxClipFactor),Object.defineProperties(i,{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)}},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)}}}),i.events={setSize:function(e){var t=e.viewport;i.uniforms.resolution.value.copy(t.resolution2),i.uniforms.devicePixelRatio.value=window.devicePixelRatio,i.lineWidth=i.lineWidth_,i.realUseDepth&&e.viewport&&(e=t.offset||new THREE.Vector2,i.uniforms.viewportOffset.value.copy(e))},render:function(e){i.useDepth&&i.updateDepthParams(e);e=e.viewport||viewer.mainViewport;e!=i.lastViewport&&i.events.setSize({viewport:e}),i.lastViewport=e}},i.setValues(e),viewer.mainViewport);return i.events.setSize({viewport:n}),viewer.addEventListener("resize",i.events.setSize),viewer.addEventListener("render.begin",i.events.render),i}return v(r,ga),A(r,[{key:"useDepth",get:function(){return this.useDepth_},set:function(e){e=e&&this.supportExtDepth,this.useDepth_!=e&&(this.setRealDepth(e),this.useDepth_=e)}},{key:"setRealDepth",value:function(e,t){this.realUseDepth!=e&&(e?this.defines.useDepth="":delete this.defines.useDepth,this.realUseDepth=e,this.autoDepthTest&&(this.depthWrite=this.depthTest=!e),this.needsUpdate=!0,t=t||viewer.mainViewport,e)&&this.events.setSize({viewport:t})}},{key:"updateDepthParams",value:function(){var e=(0w&&zf.z>w||(Nf.z>w?(b=Nf.z-zf.z,b=(Nf.z-w)/b,Nf.lerp(zf,b)):zf.z>w&&(b=zf.z-Nf.z,x=(zf.z-w)/b,zf.lerp(Nf,x)),Nf.applyMatrix4(m),zf.applyMatrix4(m),Nf.multiplyScalar(1/Nf.w),zf.multiplyScalar(1/zf.w),Nf.x*=v.x/2,Nf.y*=v.y/2,zf.x*=v.x/2,zf.y*=v.y/2,Qf.start.copy(Nf),Qf.start.z=0,Qf.end.copy(zf),Qf.end.z=0,x=Qf.closestPointToPointParameter(Hf,!0),Qf.at(x,jf),E=-1<=(E=Be.lerp(Nf.z,zf.z,x))&&E<=1,C=Hf.distanceTo(jf)<.5*Cf,E&&C&&(Qf.start.fromBufferAttribute(A,B),Qf.end.fromBufferAttribute(y,B),Qf.start.applyMatrix4(g),Qf.end.applyMatrix4(g),E=new Oe,C=new Oe,bf.distanceSqToSegment(Qf.start,Qf.end,C,E),f.push({point:C,pointOnLine:E,distance:bf.origin.distanceTo(C),object:p,face:null,faceIndex:B,uv:null,uv2:null})))}}}])}(),Kf=function(){function r(){var e;return ue(this,r),(e=le(this,r)).isLineGeometry=!0,e.type="LineGeometry",e}return v(r,Lf),A(r,[{key:"setPositions",value:function(e){for(var t=e.length-3,n=new Float32Array(2*t),i=0;i=this.points.length?0:(t=0===e?this.points[this.points.length-1]:this.points[e-1],n=this.points[e],e=this.points[(e+1)%this.points.length],this.getAngleBetweenLines(n,t,e))}},{key:"update",value:function(){if(0!==this.points.length)if(1===this.points.length)m=this.points[0].position,this.spheres[0].position.copy(m),v=this.coordinateLabels[0],m=m.toArray().map(function(e){return ne.addCommas(e.toFixed(2))}).join(" / "),v.setText(m),v.visible=this.showCoordinates;else{for(var e=this.points.length-1,t=new Oe,n=0;n<=e;n++){var i=this.points[n];t.add(i.position)}t.divideScalar(this.points.length);for(var r=0;r<=e;r++){var a=r,o=this.points[a],s=this.points[e=t.radius?2:1}},{key:"generateDataTexture",value:function(e,t,n){for(var i=e*t,r=new Uint8Array(4*e*t),a=Math.floor(255*n.r),o=Math.floor(255*n.g),s=Math.floor(255*n.b),l=0;le.versionMajor||this.versionMajor===e.versionMajor&&this.versionMinor>e.versionMinor}},{key:"equalOrHigher",value:function(e){e=new n(e);return this.versionMajor>e.versionMajor||this.versionMajor===e.versionMajor&&this.versionMinor>=e.versionMinor}},{key:"upTo",value:function(e){return!this.newerThan(e)}}])}()),om=function(){return A(function e(t,n,i){ue(this,e),this.version="string"==typeof t?new am(t):t,this.boundingBox=n,this.scale=i},[{key:"load",value:function(t){var n=this;if(!t.loaded){var i=t.getURL(),r=(this.version.equalOrHigher("1.4")&&(i+=".bin"),Sf.createXMLHttpRequest());r.open("GET",i,!0),r.responseType="arraybuffer",r.overrideMimeType("text/plain; charset=x-user-defined"),r.onreadystatechange=function(){if(4===r.readyState){if(200!==r.status&&0!==r.status||null===r.response)throw new Error("Failed to load file! HTTP status: ".concat(r.status,", file: ").concat(i));var e=r.response;n.parse(t,e)}};try{r.send(null)}catch(e){console.log("fehler beim laden der punktwolke: "+e)}}}},{key:"parse",value:function(o,e,s){var l=o.pcoGeometry.pointAttributes,t=e.byteLength/o.pcoGeometry.pointAttributes.byteSize,u=(this.version.upTo("1.5")&&(o.numPoints=t),Potree.scriptPath+"/workers/BinaryDecoderWorker.js"),c=Potree.workerPool.getWorker(u),t=(c.onmessage=function(e){var i,t=e.data,r=t.attributeBuffers,n=new K((new Oe).fromArray(t.tightBoundingBox.min),(new Oe).fromArray(t.tightBoundingBox.max)),a=(Potree.workerPool.returnWorker(u,c),new V);for(i in r)!function(){var e,t=r[i].buffer,n=r[i].attribute;"POSITION_CARTESIAN"===i?a.setAttribute("position",new H(new Float32Array(t),3)):"rgba"===i?a.setAttribute("rgba",new H(new Uint8Array(t),4,!0)):"NORMAL_SPHEREMAPPED"===i||"NORMAL_OCT16"===i||"NORMAL"===i?a.setAttribute("normal",new H(new Float32Array(t),3)):"INDICES"===i?((e=new H(new Uint8Array(t),4)).normalized=!0,a.setAttribute("indices",e)):"SPACING"===i?(e=new H(new Float32Array(t),1),a.setAttribute("spacing",e)):((e=new H(new Float32Array(t),1)).potree={offset:r[i].offset,scale:r[i].scale,preciseBuffer:r[i].preciseBuffer,range:n.range},a.setAttribute(i,e),(t=l.attributes.find(function(e){return e.name===n.name})).range[0]=Math.min(t.range[0],n.range[0]),t.range[1]=Math.max(t.range[1],n.range[1]),0===o.getLevel()&&(t.initialRange=n.range))}();n.max.sub(n.min),n.min.set(0,0,0);e=e.data.buffer.byteLength/l.byteSize;o.numPoints=e,o.geometry=a,o.mean=ie(Oe,Fe(t.mean)),o.tightBoundingBox=n,o.loaded=!0,o.loading=!1,o.estimatedSpacing=t.estimatedSpacing,Potree.numNodesLoading--,s()},{buffer:e,pointAttributes:l,version:this.version.version,min:[o.boundingBox.min.x,o.boundingBox.min.y,o.boundingBox.min.z],offset:[o.pcoGeometry.offset.x,o.pcoGeometry.offset.y,o.pcoGeometry.offset.z],scale:this.scale,spacing:o.spacing,hasChildren:o.hasChildren,name:o.name});c.postMessage(t,[t.buffer])}}])}(),ah=document.createElement("canvas"),sm=null===(tm=ah.getContext("webgl")||ah.getContext("experimental-webgl"))?{}:(Zd=tm.getShaderPrecisionFormat(tm.VERTEX_SHADER,tm.HIGH_FLOAT),ep=tm.getShaderPrecisionFormat(tm.VERTEX_SHADER,tm.MEDIUM_FLOAT),qh=tm.getShaderPrecisionFormat(tm.FRAGMENT_SHADER,tm.HIGH_FLOAT),Zl=tm.getShaderPrecisionFormat(tm.FRAGMENT_SHADER,tm.MEDIUM_FLOAT),Zd=0=Potree.maxNodesLoading||(this.loading=!0,Potree.numNodesLoading++,this.pcoGeometry.loader.version.equalOrHigher("1.5")?this.level%this.pcoGeometry.hierarchyStepSize==0&&this.hasChildren?this.loadHierachyThenPoints():this.loadPoints():(this.pcoGeometry.dispatchEvent({type:"updateNodeMaxLevel",level:this.level}),this.loadPoints()))}},{key:"loadPoints",value:function(){this.pcoGeometry.loader.load(this)}},{key:"loadHierachyThenPoints",value:function(){var E=this;if(E.level%E.pcoGeometry.hierarchyStepSize==0){var C=E.pcoGeometry.octreeDir+"/"+E.getHierarchyPath()+"/"+E.name+".hrc",B=Sf.createXMLHttpRequest();B.open("GET",C,!0),B.responseType="arraybuffer",B.overrideMimeType("text/plain; charset=x-user-defined"),B.onreadystatechange=function(){if(4===B.readyState)if(200===B.status||0===B.status){for(var e=B.response,t=E,n=e,e=performance.now(),i=new DataView(n),r=[],a=i.getUint8(0),o=i.getUint32(1,!0),s=(t.numPoints=o,r.push({children:a,numPoints:o,name:t.name}),[]),l=5;0 0\n\tuniform mat4 clipBoxes_in[num_in_clipboxes];\n#endif\n#if defined(num_out_clipboxes) && num_out_clipboxes > 0\n\tuniform mat4 clipBoxes_out[num_out_clipboxes];\n#endif\n\n\n#if defined(num_clipspheres) && num_clipspheres > 0\n\tuniform mat4 uClipSpheres[num_clipspheres];\n#endif\n\n \n#if defined(num_highlightBox) && num_highlightBox > 0\n uniform mat4 boxes_highlight[num_highlightBox]; \n#endif \n\t\t \n\n#if defined(num_prism) && num_prism > 0\n uniform mat3 prismList[num_prism];\n uniform vec2 prismPoints[prismPointCountSum]; \n#endif \n\n#if defined(showBaseHeight) \n uniform sampler2D baseHeightAreaMap ;\n uniform vec2 baseHeightBoundZ;\n uniform vec4 baseHeightBoundXY; \n#endif \n\nuniform float size;\nuniform float minSize;\nuniform float maxSize; \nuniform float orthoMaxSize;//add\n\n\nuniform float uPCIndex;\nuniform float uOctreeSpacing;\nuniform float uNodeSpacing;\nuniform float uOctreeSize;\nuniform vec3 uBBSize;\nuniform float uLevel;\nuniform float levelPercent;//add\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(){//////we use this\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(vec4 world){ \n\tfloat w = (world.z - elevationRange.x) / (elevationRange.y - elevationRange.x);\n\tvec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\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(vec4 world){\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(world);\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(vec4 world){\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(world);\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(world);\n\t#elif defined color_type_matcap\n\t\tcolor = getMatcap();\n\t#elif defined color_type_heightCpt //add\n color = vec3(0.0,0.0,0.0);\n #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\tfloat maxSize_ = maxSize;\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 pointSize = size / uOrthoWidth * resolution.x; //改成近似adaptive_point_size根据窗口缩放。其实就是size * zoom (size单位转化为米,如size为1代表一个点云在场景中1米宽,zoom代表1px=1/zoom米)\n maxSize_ = orthoMaxSize; //for panoEditor, when zoom in, need more details, rather than always same size\n\n\t\t}else{ //近大远小,模拟真实mesh,边缘放大\n\t\t\t//pointSize = size * spacing * projFactor; //spacing是attribute 为空 如果有这个值就能更自适应填补\n //pointSize = size * uOctreeSpacing * projFactor / 18.0; //直接用cloud的spacing里,不过因为都一样所以可能没有什么意义\n\t\t\t//pointSize = pointSize * projFactor;\n pointSize = size * projFactor ;\n\t\t}\n \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 maxSize_ = orthoMaxSize;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n \n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize_, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n} \n\n\nbool insideBox(mat4 clipBox, vec4 worldPos){//add\n vec4 clipPosition = clipBox * worldPos;\n bool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;\n inside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;\n inside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;\n\n return inside;\n}\n\n\n\n#if defined(color_type_heightCpt)\n vec3 percentToByte(float num){\n //输出是0-1, shader精度不够,只够存3个数\n float a = 1.0;\n float result[4];\n for(int i=0;i<3;i++){\n a = i == 2 ? a/255.0 : a / 256.0 ; \n //分成256份,其中255份给当前位置,最后一份给后一个位置,而到了最后一个位置时没有下一个位置了所以只分成255份\n if(num > a){\n float c = num / a;\n float r = floor(c);\n r = min(255.0, r);\n result[i] = r;\n num -= r * a;\n }else{\n result[i] = 0.0;\n }\n } \n return vec3(result[0]/255.0, result[1]/255.0,result[2]/255.0); \n \n //除以多少255还是256? 参考uPCIndex / 255.0 应该是255\n } \n#endif\n\n \n\n#if defined(num_prism) && num_prism > 0\n \n \n int insidePrism(mat3 prismInfo, int pointIndexStart, vec4 worldPos){//是否在棱柱里 \n \n float zMin = prismInfo[0][0];\n float zMid = prismInfo[0][1];\n float zMax = prismInfo[0][2]; \n float xMin = prismInfo[1][0];\n float xMax = prismInfo[1][1];\n float yMin = prismInfo[1][2];\n float yMax = prismInfo[2][0]; \n\n int pointCount = int(Round(prismInfo[2][1]));\n \n if( worldPos.x < xMin || worldPos.x > xMax || worldPos.y < yMin || worldPos.y > yMax)return 0;\n #ifndef showBaseHeight\n if( worldPos.z < zMin || worldPos.z > zMax) return 0;\n #endif\n \n \n bool inside = false;\n \n int j=pointCount-1;\n \n for(int i=0; i=pointCount)break;\n float xi = prismPoints[i+pointIndexStart].x, yi = prismPoints[i+pointIndexStart].y, xj = prismPoints[j+pointIndexStart].x, yj = prismPoints[j+pointIndexStart].y;\n\n if(((yi > worldPos.y) != (yj > worldPos.y)) && (worldPos.x < (xj - xi) * (worldPos.y - yi) / (yj - yi) + xi)){\n inside = !inside;\n }\n j=i; \n }\n \n if(inside){\n #ifdef showBaseHeight\n return 1;\n #else \n #ifdef color_type_heightCpt \n vColor = percentToByte((worldPos.z - zMin) / (zMax - zMin)); \n #endif \n #endif\n \n return worldPos.z < zMid ? 1 : 2;\n }else return 0; \n } \n \n#endif\n\n#ifdef showBaseHeight\n float byteToFloat(vec3 color){ \n float percent = 0.0;\n float a = 1.0; \n for(int i=0;i<3;i++){\n a = i == 2 ? a/255.0 : a/256.0; \n percent += a * color[i] ;\n }\n return percent * 255.0 ; \n } \n \n#endif\n\n\n \n\n\nvoid doClipping(vec4 world){\n\n\t{\n\t\tvec4 cl = getClassification(); \n\t\tif(cl.a == 0.0){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\n\t#if defined(clip_return_number_enabled)\n\t{ // return number filter\n\t\tvec2 range = uFilterReturnNumberRange;\n\t\tif(returnNumber < range.x || returnNumber > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_number_of_returns_enabled)\n\t{ // number of return filter\n\t\tvec2 range = uFilterNumberOfReturnsRange;\n\t\tif(numberOfReturns < range.x || numberOfReturns > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_gps_enabled)\n\t{ // GPS time filter\n\t\tfloat time = (gpsTime + uGpsOffset) * uGpsScale;\n\t\tvec2 range = uFilterGPSTimeClipRange;\n\n\t\tif(time < range.x || time > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t#if defined(clip_point_source_id_enabled)\n\t{ // point source id filter\n\t\tvec2 range = uFilterPointSourceIDClipRange;\n\t\tif(pointSourceID < range.x || pointSourceID > range.y){\n\t\t\tgl_Position = vec4(100.0, 100.0, 100.0, 0.0);\n\t\t\t\n\t\t\treturn;\n\t\t}\n\t}\n\t#endif\n\n\t \n\n\n //总共三种box : 最外层可见、内层可见和不可见(外层可见和内层可见是交集,内层可见和内层不可见是并集)\n \n #if defined(bigClipInBox) \n if(!insideBox(clipBoxBig_in, world)){ \n gl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n return;;\n } \n #endif \n \n #if defined(num_in_clipboxes) && num_in_clipboxes > 0\n //当有可见box时,需要在任一可见box内才可见\n bool visi1 = false;\n\t\tfor(int i = 0; i < num_in_clipboxes; i++){ \n if(insideBox(clipBoxes_in[i], world)){\n visi1 = true;\n break;\n } \n\t\t}\n if(!visi1){\n gl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n return;\n }\n\t#endif\n\n\n #if defined(num_out_clipboxes) && num_out_clipboxes > 0\n //当有不可见box时,不在所有不可见box内才可见\n bool visi2 = true;\n\t\tfor(int i = 0; i < num_out_clipboxes; i++){ \n if(insideBox(clipBoxes_out[i], world)){\n visi2 = false;\n break;\n } \n\t\t}\n if(!visi2){\n gl_Position = vec4(100.0, 100.0, 100.0, 1.0);\n return;\n }\n\t#endif \n \n \n #if defined(num_highlightBox) && num_highlightBox > 0\n //当有高亮box时,需要在任一可见高亮内都高宽\n bool highlight = false;\n\t\tfor(int i = 0; i < num_highlightBox; i++){ \n if(insideBox(boxes_highlight[i], world)){\n highlight = true;\n break;\n } \n\t\t}\n if(highlight){\n vColor.r += 0.5; \n }\n\t#endif\n \n \n \n int highlight_ = 0; \n \n #if defined(num_prism) && num_prism > 0 \n //基于prism棱柱的土方量显示或计算\n \n int pointIndexStart = 0;\n\t\tfor(int i = 0; i < num_prism; i++){ \n highlight_ = insidePrism(prismList[i], pointIndexStart, world);\n \n if(highlight_>0){ \n #if !defined(showBaseHeight) && !defined(color_type_heightCpt)\n if(highlight_ == 1){\n vColor.r += 0.5; \n }else if(highlight_ == 2){\n vColor.g += 0.5;\n }\n #endif\n \n break;\n }\n \n \n pointIndexStart += int(Round(prismList[i][2][1])); \n\t\t} \n \n #ifdef color_type_heightCpt \n if(highlight_==0){ \n gl_Position = vec4(100.0, 100.0, 100.0, 1.0); //unvisible\n return;\n }\n #endif \n \n\t#endif\n \n \n \n \n #ifdef showBaseHeight\n //基于模型的土方量显示或计算\n bool outsidePrism = false;\n #if defined(num_prism) && num_prism > 0//高亮交集\n if( highlight_ == 0 ){\n outsidePrism = true;\n }\n #endif \n \n if(!outsidePrism){\n \n float zMin = baseHeightBoundZ.x; \n float zMax = baseHeightBoundZ.y; \n float xMin = baseHeightBoundXY.x;\n float xMax = baseHeightBoundXY.y;\n float yMin = baseHeightBoundXY.z;\n float yMax = baseHeightBoundXY.w; \n \n bool inside = false;\n if(world.z < zMin || world.z > zMax || world.x < xMin || world.x > xMax || world.y < yMin || world.y > yMax){\n inside = false;\n }else{\n vec2 uv = vec2((world.x - xMin) / (xMax - xMin), (world.y - yMin) / (yMax - yMin) );\n \n vec4 color = texture2D(baseHeightAreaMap,uv);\n //抗锯齿待写\n \n \n if(color.a==1.0){ \n \n float currentHeight = (world.z - zMin) / (zMax - zMin) ; \n \n #ifdef color_type_heightCpt\n /*float diff = currentHeight - baseHeight;\n if(diff<0.0){\n diff = -diff;\n vOpacity = 0.5;//需要透明通道,容易出错\n }else{\n vOpacity = 1.0;\n }\n vColor = percentToByte(diff); \n */ \n vColor = percentToByte(currentHeight);\n //vColor = color.rgb;\n vOpacity = 1.0;\n \n #else\n //vColor = color.rgb;\n float baseHeight = byteToFloat(color.rgb);\n if(currentHeight > baseHeight){\n vColor.g += 0.5; \n }else{\n vColor.r += 0.5; \n }\n #endif\n \n inside = true;\n }else{\n inside = false;\n }\n \n \n \n } \n \n if(inside == false){\n #ifdef color_type_heightCpt\n gl_Position = vec4(100.0, 100.0, 100.0, 1.0); //unvisible\n return;\n #endif\n }\n \n }\n\t#endif\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 \n vec4 worldPos = modelMatrix * vec4(position, 1.0); \n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 ); //vec4 mvPosition = viewMatrix * worldPos;\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 \n vec3 positionLocalToPanoCenter0 = worldPos.xyz - pano0Position;\n vec3 vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz; \n vWorldPosition0.x *= -1.0;\n vWorldPosition0 = transformAxis(vWorldPosition0);\n \n vec3 positionLocalToPanoCenter1 = worldPos.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(worldPos);\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(worldPos);\n vColor = mix(vColor,vColor1,easeProgress); \n }\n \n\n #else\n \n vColor = getColor(worldPos);\n \n #endif\n \n \n //------------------- \n \n if(uOpacity>=1.0 || uUseOrthographicCamera){ \n vOpacity = uOpacity; \n \n \n if(uOpacity<1.0){ //uUseOrthographicCamera \n //防止缩小后点云几乎看不见 \n vOpacity *= 4.0-3.0 * levelPercent; \n \n }\n \n }else{ //#ifdef attenuated_opacity zoom不会改变z 所以这并不是用在分屏时候的\n float v = -gl_Position.z-1.0 ; // 范围从-2到0, e的-2到0次方的范围是0.818到1 \n //vOpacity = uOpacity * exp(v/ (levelPercent * 20.0 ) ); \n \n //近处加深,远处变淡 gl_Position.z似乎朝向屏幕里为正\n float r = clamp( pow(1.1, v/10.0 ), 0.1, 1.0 ); //除以的数字越大,近高远低的程度越小,范围越长。 程度太高远处单薄的区域看不见 pow的底数越大改变率越大\n vOpacity = uOpacity * r ;\n \n \n } \n \n vOpacity *= max(0.3, pow((1.0 - normalZ),5.0));//垂直朝相机时降低透明度 \n //vOpacity = clamp(vOpacity, 0.0, 1.0); \n\n\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(worldPos);\n\n #if defined(num_clipspheres) && num_clipspheres > 0\n for(int i = 0; i < num_clipspheres; i++){\n vec4 sphereLocal = uClipSpheres[i] * mvPosition;\n\n float distance = length(sphereLocal.xyz);\n\n if(distance < 1.0){\n float w = distance;\n vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;\n \n vColor = cGradient;\n //vColor = cGradient * 0.7 + vColor * 0.3;\n }\n }\n #endif\n\n #if defined(num_shadowmaps) && num_shadowmaps > 0\n\n const float sm_near = 0.1;\n const float sm_far = 10000.0;\n\n for(int i = 0; i < num_shadowmaps; i++){\n vec3 viewPos = (uShadowWorldView[i] * vec4(position, 1.0)).xyz;\n float distanceToLight = abs(viewPos.z);\n \n vec4 projPos = uShadowProj[i] * uShadowWorldView[i] * vec4(position, 1);\n vec3 nc = projPos.xyz / projPos.w;\n \n float u = nc.x * 0.5 + 0.5;\n float v = nc.y * 0.5 + 0.5;\n\n vec2 sampleStep = vec2(1.0 / (2.0*1024.0), 1.0 / (2.0*1024.0)) * 1.5;\n vec2 sampleLocations[9];\n sampleLocations[0] = vec2(0.0, 0.0);\n sampleLocations[1] = sampleStep;\n sampleLocations[2] = -sampleStep;\n sampleLocations[3] = vec2(sampleStep.x, -sampleStep.y);\n sampleLocations[4] = vec2(-sampleStep.x, sampleStep.y);\n\n sampleLocations[5] = vec2(0.0, sampleStep.y);\n sampleLocations[6] = vec2(0.0, -sampleStep.y);\n sampleLocations[7] = vec2(sampleStep.x, 0.0);\n sampleLocations[8] = vec2(-sampleStep.x, 0.0);\n\n float visibleSamples = 0.0;\n float numSamples = 0.0;\n\n float bias = vRadius * 2.0;\n\n for(int j = 0; j < 9; j++){\n vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);\n\n float linearDepthFromSM = depthMapValue.x + bias;\n float linearDepthFromViewer = distanceToLight;\n\n if(linearDepthFromSM > linearDepthFromViewer){\n visibleSamples += 1.0;\n }\n\n numSamples += 1.0;\n }\n\n float visibility = visibleSamples / numSamples;\n\n if(u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0 || nc.x < -1.0 || nc.x > 1.0 || nc.y < -1.0 || nc.y > 1.0 || nc.z < -1.0 || nc.z > 1.0){\n //vColor = vec3(0.0, 0.0, 0.2);\n }else{\n //vColor = vec3(1.0, 1.0, 1.0) * visibility + vec3(1.0, 1.0, 1.0) * vec3(0.5, 0.0, 0.0) * (1.0 - visibility);\n vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);\n }\n\n\n }\n\n #endif\n\n \n \n}\n',"pointcloud_new.fs":"\n#if defined paraboloid_point_shape\n\t#extension GL_EXT_frag_depth : enable\n#endif\n#define PI 3.141592653589793\n\n\n\nprecision highp float;\nprecision highp int;\n\n/*\n#if defined(usePanoMap) \n \n uniform samplerCube pano0Map; //随便设置一个samplerCube去使用都会让点云消失\n uniform samplerCube pano1Map;\n \n uniform float progress;\n uniform float easeInOutRatio;\n\n \n uniform vec3 pano0Position;\n uniform mat4 pano0Matrix; \n uniform vec3 pano1Position;\n uniform mat4 pano1Matrix;\n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1;\n\n#endif \n*/\n\n\n\n//------------\n\n\n\n\n\nuniform mat4 viewMatrix;\nuniform mat4 uViewInv;\nuniform mat4 uProjInv;\nuniform vec3 cameraPosition;\n\n\nuniform mat4 projectionMatrix;\n//uniform float uOpacity;\nvarying float vOpacity; //add\n\nuniform float blendHardness;\nuniform float blendDepthSupplement;\nuniform float fov;\nuniform float uSpacing;\nuniform float near;\nuniform float far;\nuniform float uPCIndex;\nuniform float uScreenWidth;\nuniform float uScreenHeight;\n\nvarying vec3\tvColor;\nvarying float\tvLogDepth;\nvarying vec3\tvViewPosition;\nvarying float\tvRadius;\nvarying float \tvPointSize;\nvarying vec3 \tvPosition;\n\n\nfloat specularStrength = 1.0;\n\n\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \n\n\n\n\nvoid main() {\n\n vec3 color = vColor; \n\t \n \n /*#if defined(usePanoMap) //加 经测试,即使全部写在fragment里也是无论pointsize多大都是一个点一个颜色,所以干脆写在vectex里\n \n \n vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);\n \n color = mix(colorFromPano0,colorFromPano1,progress).xyz; \n \n \n //float easeInOutRatio = 0.0; //缓冲,渐变点云到贴图的颜色 \n if(progress < easeInOutRatio){\n float easeProgress = (easeInOutRatio - progress) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }else if(progress > 1.0 - easeInOutRatio){ \n float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio; \n color = mix(color,vColor,easeProgress); \n }\n \n \n #else \n color = vColor;\n #endif*/\n \n \n \n\tfloat depth = gl_FragCoord.z;\n\n\t#if defined(circle_point_shape) || defined(paraboloid_point_shape) \n\t\tfloat u = 2.0 * gl_PointCoord.x - 1.0;\n\t\tfloat v = 2.0 * gl_PointCoord.y - 1.0;\n\t#endif\n\t\n\t#if defined(circle_point_shape) \n\t\tfloat cc = u*u + v*v;\n\t\tif(cc > 1.0){\n\t\t\tdiscard;\n\t\t}\n\t#endif\n\t\n\n \n\n\t\n \n #if defined color_type_indices //pick point recognize\n\t\tgl_FragColor = vec4(color, uPCIndex / 255.0); //uPCIndex : node Index\n\t#else\n\t\tgl_FragColor = vec4(color, vOpacity);\n\t#endif\n \n \n \n \n \n \n \n \n\n\t#if defined paraboloid_point_shape\n\t\tfloat wi = 0.0 - ( u*u + v*v);\n\t\tvec4 pos = vec4(vViewPosition, 1.0);\n\t\tpos.z += wi * vRadius;\n\t\tfloat linearDepth = -pos.z;\n\t\tpos = projectionMatrix * pos;\n\t\tpos = pos / pos.w;\n\t\tfloat expDepth = pos.z;\n\t\tdepth = (pos.z + 1.0) / 2.0;\n\t\tgl_FragDepthEXT = depth;\n\t\tgl_FragDepthEXT = clamp(gl_FragDepthEXT, 0.0, 1.0); //add\n \n \n\t\t#if defined(color_type_depth)\n\t\t\tcolor.r = linearDepth;\n\t\t\tcolor.g = expDepth;\n\t\t#endif\n\t\t\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = log2(linearDepth);\n\t\t#endif\n\t\t\n\t#else\n\t\t#if defined(use_edl)\n\t\t\tgl_FragColor.a = vLogDepth;\n\t\t#endif\n\t#endif\n\n\t#if defined(weighted_splats)\n\t\tfloat distance = 2.0 * length(gl_PointCoord.xy - 0.5);\n\t\tfloat weight = max(0.0, 1.0 - distance);\n\t\tweight = pow(weight, 1.5);\n\n\t\tgl_FragColor.a = weight;\n\t\tgl_FragColor.xyz = gl_FragColor.xyz * weight;\n\t#endif\n\n\t//gl_FragColor = vec4(0.0, 0.7, 0.0, 1.0);\n\t\n}\n\n\n","pointcloud_sm.vs":"\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec3 color;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\n\nuniform float uScreenWidth;\nuniform float uScreenHeight;\nuniform float near;\nuniform float far;\n\nuniform float uSpacing;\nuniform float uOctreeSize;\nuniform float uLevel;\nuniform float uVNStart;\n\nuniform sampler2D visibleNodes;\n\nvarying float vLinearDepth;\nvarying vec3 vColor;\n\n#define PI 3.141592653589793\n\n\n\n// ---------------------\n// OCTREE\n// ---------------------\n\n#if defined(adaptive_point_size)\n/**\n * number of 1-bits up to inclusive index position\n * number is treated as if it were an integer in the range 0-255\n *\n */\nfloat numberOfOnes(float number, float index){\n\tfloat tmp = mod(number, pow(2.0, index + 1.0));\n\tfloat numOnes = 0.0;\n\tfor(float i = 0.0; i < 8.0; i++){\n\t\tif(mod(tmp, 2.0) != 0.0){\n\t\t\tnumOnes++;\n\t\t}\n\t\ttmp = floor(tmp / 2.0);\n\t}\n\treturn numOnes;\n}\n\n\n/**\n * checks whether the bit at index is 1\n * number is treated as if it were an integer in the range 0-255\n *\n */\nbool isBitSet(float number, float index){\n\treturn mod(floor(number / pow(2.0, index)), 2.0) != 0.0;\n}\n\n\n/**\n * find the LOD at the point position\n */\nfloat getLOD(){\n\t\n\tvec3 offset = vec3(0.0, 0.0, 0.0);\n\tfloat iOffset = uVNStart;\n\tfloat depth = uLevel;\n\tfor(float i = 0.0; i <= 30.0; i++){\n\t\tfloat nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);\n\t\t\n\t\tvec3 index3d = (position-offset) / nodeSizeAtLevel;\n\t\tindex3d = floor(index3d + 0.5);\n\t\tfloat index = 4.0 * index3d.x + 2.0 * index3d.y + index3d.z;\n\t\t\n\t\tvec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));\n\t\tfloat mask = value.r * 255.0;\n\t\tif(isBitSet(mask, index)){\n\t\t\t// there are more visible child nodes at this position\n\t\t\tiOffset = iOffset + value.g * 255.0 * 256.0 + value.b * 255.0 + numberOfOnes(mask, index - 1.0);\n\t\t\tdepth++;\n\t\t}else{\n\t\t\t// no more visible child nodes at this position\n\t\t\treturn depth;\n\t\t}\n\t\t\n\t\toffset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;\n\t}\n\t\t\n\treturn depth;\n}\n\n#endif\n\nfloat getPointSize(){\n\tfloat pointSize = 1.0;\n\t\n\tfloat slope = tan(fov / 2.0);\n\tfloat projFactor = -0.5 * uScreenHeight / (slope * vViewPosition.z);\n\t\n\tfloat r = uOctreeSpacing * 1.5;\n\tvRadius = r;\n\t#if defined fixed_point_size\n\t\tpointSize = size;\n\t#elif defined attenuated_point_size\n\t\tif(uUseOrthographicCamera){\n\t\t\tpointSize = size;\t\t\t\n\t\t}else{\n\t\t\tpointSize = pointSize * projFactor;\n\t\t}\n\t#elif defined adaptive_point_size\n\t\tif(uUseOrthographicCamera) {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = (worldSpaceSize / uOrthoWidth) * uScreenWidth;\n\t\t} else {\n\t\t\tfloat worldSpaceSize = 1.5 * size * r / getPointSizeAttenuation();\n\t\t\tpointSize = worldSpaceSize * projFactor;\n\t\t}\n\t#endif\n\n\tpointSize = max(minSize, pointSize);\n\tpointSize = min(maxSize, pointSize);\n\t\n\tvRadius = pointSize / projFactor;\n\n\treturn pointSize;\n}\n\n\nvoid main() {\n\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tvLinearDepth = gl_Position.w;\n\n\tfloat pointSize = getPointSize();\n\tgl_PointSize = pointSize;\n\n}\n","pointcloud_sm.fs":"\nprecision mediump float;\nprecision mediump int;\n\nvarying vec3 vColor;\nvarying float vLinearDepth;\n\nvoid main() {\n\n\t//gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\t//gl_FragColor = vec4(vColor, 1.0);\n\t//gl_FragColor = vec4(vLinearDepth, pow(vLinearDepth, 2.0), 0.0, 1.0);\n\tgl_FragColor = vec4(vLinearDepth, vLinearDepth / 30.0, vLinearDepth / 30.0, 1.0);\n\t\n}\n\n\n","normalize.vs":"\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}","normalize.fs":"\n#extension GL_EXT_frag_depth : enable\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uDepthMap;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\t\n\tif(depth >= 1.0){\n\t\tdiscard;\n\t}\n\n\tgl_FragColor = vec4(depth, 1.0, 0.0, 1.0);\n\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\t\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\t\n\tgl_FragDepthEXT = depth;\n\n\n}","normalize_and_edl.fs":"\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\nuniform sampler2D uWeightMap;\nuniform sampler2D uEDLMap;\nuniform sampler2D uDepthMap;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\n\nvarying vec2 vUv;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t\n\t\tfloat neighbourDepth = texture2D(uEDLMap, uvNeighbor).a;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\tif(depth == 0.0){\n\t\t\t\tsum += 100.0;\n\t\t\t}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth);\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main() {\n\n\tfloat edlDepth = texture2D(uEDLMap, vUv).a;\n\tfloat res = response(edlDepth);\n\tfloat shade = exp(-res * 300.0 * edlStrength);\n\n\tfloat depth = texture2D(uDepthMap, vUv).r;\n\tif(depth >= 1.0 && res == 0.0){\n\t\tdiscard;\n\t}\n\t\n\tvec4 color = texture2D(uWeightMap, vUv); \n\tcolor = color / color.w;\n\tcolor = color * shade;\n\n\tgl_FragColor = vec4(color.xyz, 1.0); \n\n\tgl_FragDepthEXT = depth;\n}","edl_new.vs":"\nprecision mediump float;\nprecision mediump int;\n\nattribute vec3 position;\nattribute vec2 uv;\n\nuniform mat4 projectionMatrix;\nuniform mat4 modelViewMatrix;\n\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\t\n\tvec4 mvPosition = modelViewMatrix * vec4(position,1.0);\n\n\tgl_Position = projectionMatrix * mvPosition;\n}","edl_new.fs":"\n#extension GL_EXT_frag_depth : enable\n\n// \n// adapted from the EDL shader code from Christian Boucheny in cloud compare:\n// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL\n//\n\nprecision mediump float;\nprecision mediump int;\n\n//uniform float screenWidth;\n//uniform float screenHeight;\nuniform vec2 resolution;\n\n\nuniform vec2 neighbours[NEIGHBOUR_COUNT];\nuniform float edlStrength;\nuniform float radius;\nuniform float opacity;\n\n//uniform float uNear;\n//uniform float uFar;\n\nuniform mat4 uProj;\n\nuniform sampler2D uEDLColor;\nuniform sampler2D uEDLDepth;\n\nvarying vec2 vUv;\n\nuniform int useEDL;\n\nfloat response(float depth){\n\tvec2 uvRadius = radius / resolution; //vec2(screenWidth, screenHeight);\n\t\n\tfloat sum = 0.0;\n\t\n\tfor(int i = 0; i < NEIGHBOUR_COUNT; i++){\n\t\tvec2 uvNeighbor = vUv + uvRadius * neighbours[i];\n\t\t//获取周围八个格子的值\n\t\tfloat neighbourDepth = texture2D(uEDLColor, uvNeighbor).a;\n\t\tneighbourDepth = (neighbourDepth == 1.0) ? 0.0 : neighbourDepth;\n\n\t\tif(neighbourDepth != 0.0){\n\t\t\t //if(depth == 0.0){\n\t\t\t //\tsum += 100.0;\n\t\t\t //}else{\n\t\t\t\tsum += max(0.0, depth - neighbourDepth); //获取差值\n\t\t\t //}\n\t\t}\n\t}\n\t\n\treturn sum / float(NEIGHBOUR_COUNT);\n}\n\nvoid main(){\n\tvec4 cEDL = texture2D(uEDLColor, vUv);\n\t\n\tfloat depth = cEDL.a;\n\tdepth = (depth == 1.0) ? 0.0 : depth;\n \n if(depth == 0.0){ //去掉这句就能在无点云像素的地方渲染outline,但会遮住其他mesh\n\t\tdiscard;\n\t}\n \n \n if(useEDL == 1){\n float res = response(depth); \n float shade = exp(-res * 300.0 * edlStrength); //自然常数e为底的指数函数 \n const float min = 0.2; //add 使边缘色变浅 范围从0-1 变为min-1\n shade = shade * (1.0-min) + min;\n gl_FragColor = vec4(cEDL.rgb * shade, opacity); \n }else{//加 不改颜色的情况 \n gl_FragColor = vec4(cEDL.rgb, opacity);\n } \n //注意,edlStrength越强,在相同depth的叠放的点云间的轮廓线颜色越深\n //作用:勾勒边缘,强化深度差异,模拟阴影,加强结构立体感\n \n { // write regular hyperbolic depth values to depth buffer 修改深度\n float dl = pow(2.0, depth);\n\n vec4 dp = uProj * vec4(0.0, 0.0, -dl, 1.0);\n float pz = dp.z / dp.w;\n float fragDepth = (pz + 1.0) / 2.0;\n\n gl_FragDepthEXT = fragDepth;\n }\n\t\n}\n","blur.vs":"\nvarying vec2 vUv;\n\nvoid main() {\n\tvUv = uv;\n\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n}","blur.fs":"\nuniform mat4 projectionMatrix;\n\nuniform float screenWidth;\nuniform float screenHeight;\nuniform float near;\nuniform float far;\n\nuniform sampler2D map;\n\nvarying vec2 vUv;\n\nvoid main() {\n\n\tfloat dx = 1.0 / screenWidth;\n\tfloat dy = 1.0 / screenHeight;\n\n\tvec3 color = vec3(0.0, 0.0, 0.0);\n\tcolor += texture2D(map, vUv + vec2(-dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, -dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, 0)).rgb;\n\tcolor += texture2D(map, vUv + vec2(-dx, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2( 0, dy)).rgb;\n\tcolor += texture2D(map, vUv + vec2(+dx, dy)).rgb;\n\n\tcolor = color / 9.0;\n\t\n\tgl_FragColor = vec4(color, 1.0);\n}","depthBasic.vs":"\n \n\nvarying vec2 vUv;\nvoid main() {\n \n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ","depthBasic.fs":"varying vec2 vUv;\nuniform float opacity;\nuniform float mapScale;\nuniform vec3 baseColor;\n\n#if defined use_map\n uniform sampler2D map; \n \n vec4 getMapColor(vec4 color){ \n if(mapScale == 1.0){\n color = texture2D(map, vUv) * color; \n return color;\n }else{ \n vec2 uv = (vUv - 0.5) / mapScale + 0.5; \n if(uv.x > 1.0 || uv.y > 1.0 || uv.x < 0.0 || uv.y < 0.0){\n //color = vec4(0.0,0.0,0.0,0.0);\n discard;\n }else{\n color = texture2D(map, uv) * color; \n }\n return color; \n }\n }\n#endif\n \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 uniform vec3 backColor;\n uniform float occlusionDistance;\n uniform float clipDistance;\n uniform float maxClipFactor;\n uniform float maxOcclusionFactor;\n //uniform bool uUseOrthographicCamera; \n\n float convertToLinear(float zValue)\n {\n //if(uUseOrthographicCamera){\n // return zValue*(farPlane-nearPlane)+nearPlane;\n //}else{ \n float z = zValue * 2.0 - 1.0;\n return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));\n //} \n }\n#endif\n \n \n \nvoid main() {\n \n \n vec4 color = vec4(baseColor, opacity);\n \n \n \n #if defined(GL_EXT_frag_depth) && defined(useDepth) \n // mixFactor and clipFactor define the color mixing proportion between the states of\n // full visibility and occluded visibility\n // and\n // full visibility and total invisibility\n \n float mixFactor = 0.0;\n float clipFactor = 0.0;\n \n \n // The linear depth value of the current fragment\n float fragDepth = convertToLinear(gl_FragCoord.z);\n\n // The coordinates of the current fragment in the depth texture\n vec2 depthTxtCoords = vec2(gl_FragCoord.x-viewportOffset.x, gl_FragCoord.y - viewportOffset.y) / resolution;\n //gl_FragCoord大小为 viewport client大小 \n \n // The linear depth value of the pixel occupied by this fragment in the depth buffer\n float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);\n\n // The difference between the two depths\n float delta = fragDepth - textureDepth;\n\n if (delta > 0.0)//差距\n {\n // occlusionDistance and clipDistance define the width of the respective zones and\n // mixFactor and clipFactor express the interpolation between the two colors depending on the position\n // of the current fragment withing those zones.\n \n \n mixFactor = clamp(delta / occlusionDistance, 0.0, maxOcclusionFactor);\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 = getMapColor(color); \n #endif\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 = getMapColor(color); \n #endif \n #endif\n \n gl_FragColor = color;\n \n}\n","copyCubeMap.vs":"varying vec3 vWorldPos;\nvec3 transformAxis( vec3 direction ) //navvis->4dkk\n{\n float y = direction.y;\n direction.y = direction.z;\n direction.z = -y;\n return direction;\n}\nvoid main() {\n vWorldPos = vec3(-position.x, -position.y, position.z);\n //vWorldPos = transformAxis(vWorldPos);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ","copyCubeMap.fs":"varying vec3 vWorldPos;\nuniform float alpha;\nuniform samplerCube tDiffuse;\n\n\nvoid main() {\n vec4 texColor = textureCube(tDiffuse, vWorldPos);\n gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);\n} \n ","basicTextured.vs":"varying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n} \n ","basicTextured.fs":"varying vec2 vUv;\nuniform float opacity;\n \n\n#ifdef HasMap\n uniform sampler2D map; \n#endif\n#ifdef HasColor\n uniform vec3 color;\n#endif\n\nvoid main() {\n vec4 color_;\n #ifdef HasColor\n color_ = vec4(color, opacity); \n #else\n color_ = vec4(1.0,1.0,1.0, opacity);\n #endif\n \n #ifdef HasMap\n vec4 texColor = texture2D(map, vUv); \n gl_FragColor = texColor * color_;\n #else\n gl_FragColor = color_;\n #endif\n \n \n}\n","skybox.vs":"uniform mat4 matrix; \nvarying vec3 vWorldPosition;\n\n\n\nvoid main() \n{ \n \n vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz ; // - cameraPosition; \n vWorldPosition = (vec4(vWorldPosition, 1.0) * matrix).xyz;\n vWorldPosition.x *= -1.0;\n\n\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}","skybox.fs":"varying vec3 vWorldPosition;\nuniform sampler2D tDiffuse; \n\n#define PI 3.141592653 \n\n/*vec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,direction.z)/(PI*2.0)+0.5;\n float ty=acos(direction.y)/PI;\n\n return vec2(tx,ty);\n}*/\nvec2 getSamplerCoord( vec3 direction ) \n{\n direction = normalize(direction);\n float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;\n float ty=acos(direction.z)/PI;\n\n return vec2(tx,ty);\n} \nvoid main() \n{\n vec2 samplerCoord = getSamplerCoord(vWorldPosition);\n vec4 color = texture2D(tDiffuse, samplerCoord);\n //gl_FragColor = RGBEToLinear( color ); //对于hdr必须加这一句,否则效果很奇怪。copy自meshBasicMaterial里的mat_fragment的mapTexelToLinear函数,只要有map就会使用该函数\n gl_FragColor = color;\n //#include \n //////#include \n\n} \n"},xm={DEFAULT:{0:{visible:!0,name:"never classified",color:[.5,.5,.5,1]},1:{visible:!0,name:"unclassified",color:[.5,.5,.5,1]},2:{visible:!0,name:"ground",color:[.63,.32,.18,1]},3:{visible:!0,name:"low vegetation",color:[0,1,0,1]},4:{visible:!0,name:"medium vegetation",color:[0,.8,0,1]},5:{visible:!0,name:"high vegetation",color:[0,.6,0,1]},6:{visible:!0,name:"building",color:[1,.66,0,1]},7:{visible:!0,name:"low point(noise)",color:[1,0,1,1]},8:{visible:!0,name:"key-point",color:[1,0,0,1]},9:{visible:!0,name:"water",color:[0,0,1,1]},12:{visible:!0,name:"overlap",color:[1,1,0,1]},DEFAULT:{visible:!0,name:"default",color:[.3,.6,.6,.5]}}},Em=(Object.defineProperty(xm,"RANDOM",{get:function(){for(var e={},t=0;t<=255;t++)e[t]=new ei(Math.random(),Math.random(),Math.random());return e.DEFAULT=new ei(Math.random(),Math.random(),Math.random()),e}}),function(){return A(function e(t){ue(this,e);for(var n=0,i=Object.keys(t);n>8,n[4*s+2]=a[s]%256),l.geometryNode.density);"number"==typeof u?(s=Math.log2(u)/2-1.5,n[4*o+3]=10*(10+s)):n[4*o+3]=100}return Potree.measureTimings&&(performance.mark("computeVisibilityTextureData-end"),performance.measure("render.computeVisibilityTextureData","computeVisibilityTextureData-start","computeVisibilityTextureData-end")),{data:n,offsets:i}}},{key:"nodeIntersectsProfile",value:function(e,t){for(var n=e.boundingBox.clone().applyMatrix4(this.matrixWorld).getBoundingSphere(new bi),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 Me).multiplyMatrices(r,o.sceneNode.matrixWorld),h=new ei,p=0;px.vbos.get(E).version&&U.updateBuffer(b);else x=U.createBuffer(b),U.buffers.set(b,x);if(N.bindVertexArray(x.vao),void 0===Om[z.activeAttributeName]&&Object.keys(b.attributes).includes(z.activeAttributeName)){var C,B=Om.aExtra.location;for(C in b.attributes){b.attributes[C];var M=x.vbos.get(C);N.bindBuffer(N.ARRAY_BUFFER,M.handle),N.disableVertexAttribArray(B)}var S=z.activeAttributeName,v=b.attributes[S],T=x.vbos.get(S),e=(void 0!==v&&void 0!==T&&(i=U.glTypeMapping.get(v.array.constructor),n=v.normalized,N.bindBuffer(N.ARRAY_BUFFER,T.handle),N.vertexAttribPointer(B,v.itemSize,i,n,0,0),N.enableVertexAttribArray(B)),R.pcoGeometry.pointAttributes.attributes.find(function(e){return e.name===S})),T=(T=z.getRange(S))||e.range,v=e.initialRange,i=v[1]-v[0],n=T=T||[0,1],e=i/(n[1]-n[0]),T=-(n[0]-v[0])/i,e=Number.isNaN(e)?1:e,T=Number.isNaN(T)?0:T;F.setUniform1f("uExtraScale",e),F.setUniform1f("uExtraOffset",T)}else for(var _ in b.attributes){var P,D,I=b.attributes[_],k=x.vbos.get(_);void 0!==Om[_]&&(_=Om[_].location,P=U.glTypeMapping.get(I.array.constructor),D=I.normalized,N.bindBuffer(N.ARRAY_BUFFER,k.handle),N.vertexAttribPointer(_,I.itemSize,P,D,0,0),N.enableVertexAttribArray(_))}n=x.numElements;N.drawArrays(N.POINTS,0,n),j++}()}catch(e){r.e(e)}finally{r.f()}N.bindVertexArray(null),W.measureTimings&&(performance.mark("renderNodes-end"),performance.measure("render.renderNodes","renderNodes-start","renderNodes-end"))}},{key:"renderOctree",value:function(e,t,n,i){var r=4=this.batchSize){for(var a=0,o=Object.keys(this.currentBatch.geometry.attributes);a",c=0,d=Object.keys(s);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(r[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(r[2],"\n\t\t\t\t\t\t\t\t")}else if("rgba"===e)u+="\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t".concat(e,"\n\t\t\t\t\t\t\t\t\t").concat(i.join(", "),"\n\t\t\t\t\t\t\t\t");else{if("normal"===e)return;u+="mileage"===e?"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t".concat(e,"\n\t\t\t\t\t\t\t\t\t").concat(i.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(e,"\n\t\t\t\t\t\t\t\t\t").concat(a(i),"\n\t\t\t\t\t\t\t\t")}}();u+="",i.html(u),h.selectedPoint=s}else{h.viewer.scene.scene.add(h.viewerPickSphere);e=h.viewer.scene.scene.children.indexOf(h.viewerPickSphere);0<=e&&h.viewer.scene.scene.children.splice(e,1),h.viewer.removeEventListener("update",r)}h.render()}h.mouse.copy(t)}}),$(this.renderArea)[0].addEventListener("mousewheel",e,!1),$(this.renderArea)[0].addEventListener("DOMMouseScroll",e,!1),$("#closeProfileContainer").click(function(){h.hide()});$("#potree_download_csv_icon").click(function(){var e=t(),e=pm.toString(e),e=new Blob([e],{type:"text/string"});$("#potree_download_profile_ortho_link").attr("href",URL.createObjectURL(e))}),$("#potree_download_las_icon").click(function(){var e=t(),e=fm.toLAS(e),e=new Blob([e],{type:"application/octet-binary"});$("#potree_download_profile_link").attr("href",URL.createObjectURL(e))})}},{key:"selectPoint",value:function(e,t,n){var i,r={distance:1/0,pointcloud:null,points:null,index:null},a=new Bh(new Re(e-n,t-n),new Re(e+n,t+n)),o=q(this.pointclouds);try{for(o.s();!(i=o.n()).done;){var s,l=U(i.value,2),u=l[0],c=q(l[1].points);try{for(c.s();!(s=c.n()).done;){var d=s.value;if(new Bh(new Re(d.projectedBox.min.x,d.projectedBox.min.z),new Re(d.projectedBox.max.x,d.projectedBox.max.z)).intersectsBox(a)){d.numPoints;for(var h=0;h(new Date).getTime())){this.scheduledRecomputeTime=(new Date).getTime()+100,this.scheduledRecomputeTime=null,this.reset();var i,t=q(this.viewer.scene.pointclouds.filter(function(e){return e.visible}));try{for(t.s();!(i=t.n()).done;)!function(){var t=i.value,e=t.getPointsInProfile(n.profile,null,{onProgress:function(e){n.enabled&&(n.progressHandler(t,e.points),n.numPoints>n.threshold)&&n.finishLevelThenCancel()},onFinish:function(e){n.enabled},onCancel:function(){n.enabled}});n.requests.push(e)}()}catch(e){t.e(e)}finally{t.f()}}}}])}(),Jm=function(){function a(e){ue(this,a),(t=le(this,a)).viewer=e,t.renderer=e.renderer,t.addEventListener("start_inserting_volume",function(e){t.viewer.dispatchEvent({type:"cancel_insertions"})}),t.scene=new Fs,t.scene.name="scene_volume",t.viewer.inputHandler.registerInteractiveScene(t.scene),t.onRemove=function(e){t.scene.remove(e.volume)},t.onAdd=function(e){t.scene.add(e.volume)};var t,n,i=q(e.scene.volumes);try{for(i.s();!(n=i.n()).done;){var r=n.value;t.onAdd({volume:r})}}catch(e){i.e(e)}finally{i.f()}return t.viewer.inputHandler.addEventListener("delete",function(e){e.selection.filter(function(e){return e instanceof _f}).forEach(function(e){return t.viewer.scene.removeVolume(e)})}),e.addEventListener("update",t.update.bind(t)),e.addEventListener("render.pass.scene",function(e){return t.render(e)}),e.addEventListener("scene_changed",t.onSceneChange.bind(t)),e.scene.addEventListener("volume_added",t.onAdd),e.scene.addEventListener("volume_removed",t.onRemove),t}return v(a,Qn),A(a,[{key:"onSceneChange",value:function(e){e.oldScene&&(e.oldScene.removeEventListeners("volume_added",this.onAdd),e.oldScene.removeEventListeners("volume_removed",this.onRemove)),e.scene.addEventListener("volume_added",this.onAdd),e.scene.addEventListener("volume_removed",this.onRemove)}},{key:"startInsertion",value:function(){var n=this,e=0Potree.pointLoadLimit;){var e=this.first.node;this.disposeDescendants(e)}}},{key:"disposeDescendants",value:function(e){var t=[];for(t.push(e);0p.farBound?p.scale*v/p.farBound:p.scale):te.getScaleForConstantSize($.extend(p,{camera:e,position:this.root.getWorldPosition(new Oe),resolution:n.viewport.resolution})),isNaN(m)||this.root.scale.set(m,m,m)),this.updateMatrix(),this.matrixMap.set(n.viewport,this.matrix.clone()),this.root!=this&&(this.root.updateMatrix(),this.matrixMapRoot.set(n.viewport,this.root.matrix.clone())),this.needsUpdate=!1,this.useViewport=n.viewport}}},{key:"applyMatrix",value:function(e){e=e||{viewport:viewer.mainViewport};var t=this.visiMap.get(e.viewport);Potree.Utils.updateVisible(this,"unableCompute",0!=t),"magnifier"==e.viewport.name||this.viewports&&!this.viewports.includes(e.viewport)||this.root&&this.realVisible(e.viewport,e.interactables)&&((t=this.matrixMap.get(e.viewport))||(this.update(e),t=this.matrixMap.get(e.viewport)))&&e.viewport!=this.useViewport&&(this.useViewport=e.viewport,this.matrix.copy(t),this.root!=this&&(t=this.matrixMapRoot.get(e.viewport),this.root.matrix.copy(t)),e.raycaster)&&this.root.updateMatrixWorld(!0)}},{key:"setUniforms",value:function(e,t){this.material.setUniforms(e,t)}},{key:"dispose",value:function(){this.removeAllListeners(),this.parent&&this.parent.remove(this),this.dispatchEvent("dispose")}}])}(),cv=function(){function i(){var e,t=0\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t').concat(n._description,"\n\t\t\t\t
\n\t\t\t\n\t\t")),n.elTitlebar=n.domElement.find(".annotation-titlebar"),n.elTitle=n.elTitlebar.find(".annotation-label"),n.elTitle.append(n._title),n.elDescription=n.domElement.find(".annotation-description"),n.elDescriptionClose=n.elDescription.find(".annotation-description-close"),n.clickTitle=function(){n.hasView()&&n.moveHere(n.scene.getActiveCamera()),n.dispatchEvent({type:"click",target:n})},n.elTitle.click(n.clickTitle),n.actions=n.actions.map(function(e){return e instanceof hv?e:new hv(e)}),q(n.actions));try{for(i.s();!(e=i.n()).done;)e.value.pairWith(n)}catch(e){i.e(e)}finally{i.f()}var r,a=q(n.actions.filter(function(e){return void 0===e.showIn||e.showIn.includes("scene")}));try{for(a.s();!(r=a.n()).done;)!function(){var e=r.value,t=$(''));n.elTitlebar.append(t),t.click(function(){return e.onclick({annotation: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 v(o,mm),A(o,[{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(),n=(r.setAttribute("width","".concat(n.width)),r.setAttribute("height","".concat(n.height)),r.setAttribute("viewBox","".concat(n.x," ").concat(n.y," ").concat(n.width," ").concat(n.height)),e.y-t.y),t=e.x-t.x;0Potree.pointBudget))&&!(P.get(i)+t.getNumPoints()>i.pointBudget))&&c<=u,i.matrixWorld.clone().invert()),h=i.material.clipBoxes_in,p=(i.material.clipBoxes_out,i.material.bigClipInBox);if(a&&p&&(s(p)||(a=!1)),a&&0Potree.pointBudget)return viewer.dispatchEvent({type:"overPointBudget",restQueueSize:O.size(),numVisiblePoints:_}),1;if(!a)return 0;_+=t.getNumPoints();for(var p=P.get(i),g=(P.set(i,p+t.getNumPoints()),i.numVisibleNodes++,i.numVisiblePoints+=t.getNumPoints(),!t.isGeometryNode()||n&&!n.isTreeNode()||(t.isLoaded()&&N<2?(t=i.toTreeNode(t,n),N++):(k.push({pointcloud:i,node:t}),I.push(t))),t.isTreeNode()&&(Potree.lru.touch(t.geometryNode),t.sceneNode.visible=!0,t.sceneNode.material=i.material,D.push(t),i.visibleNodes.push(t),void 0===t._transformVersion&&(t._transformVersion=-1),a=G.get(i),t._transformVersion!==a.number&&(t.sceneNode.updateMatrix(),t.sceneNode.matrixWorld.multiplyMatrices(i.matrixWorld,t.sceneNode.matrix),t._transformVersion=a.number),i.showBoundingBox&&!t.boundingBoxNode&&t.getBoundingBox?(n=.1+(p=c/(u+1)),a=(new Se).setHSL(p,n,n),(c=new qm(t.getBoundingBox(),a)).matrixAutoUpdate=!1,i.boundingBoxNodes.push(c),t.boundingBoxNode=c,t.boundingBoxNode.matrix.copy(i.matrixWorld)):i.showBoundingBox?(t.boundingBoxNode.visible=!0,t.boundingBoxNode.matrix.copy(i.matrixWorld)):!i.showBoundingBox&&t.boundingBoxNode&&(t.boundingBoxNode.visible=!1)),t.getChildren()),A=0;At;){var n=this.getLRUItem();n&&this.disposeDescendants(n)}},Jm.prototype.update=function(){},Jm.prototype.startInsertion=function(){var t,n=this,i=0Potree.config.clickMaxDragDis))return u();r.removeEventListener("drag",o),r.removeEventListener("drop",l),n.viewer.removeEventListener("cancel_insertions",s),r.isNew=!1,viewer.removeEventListener("camera_changed",a),"remove"==e?viewer.scene.removeVolume(r):(viewer.transformObject(r),r.highlight=!1),r.dispatchEvent({type:"createFinish",success:"remove"!=e}),t&&t.forEach(function(e){return e.highlight=!1})},u=function(){return setTimeout(function(){r.parent&&r.isNew&&viewer.inputHandler.startDragging(r,{notPressMouse:!0})},1)};return r.addEventListener("drag",o),r.addEventListener("drop",l),this.viewer.addEventListener("cancel_insertions",s),viewer.addEventListener("camera_changed",a),this.viewer.inputHandler.startDragging(r,{notPressMouse:!0}),r},Kf.prototype.setPositions=function(e){e=new Float32Array(e);return Lf.prototype.setPositions.call(this,e),this},Object.assign(ff.prototype,Qn.prototype),Object.assign(mv.prototype,Qn.prototype);function Av(){for(var e=document.createElement("textarea"),t=(e.id="consoleLog",e.style.width="160px",e.style.height="200px",e.style.position="fixed",e.style.left=0,e.style.bottom="50px",e.style["z-index"]=9999,e.style.color="black",e.style.opacity=.9,e.style["font-size"]="12px",e.style.backgroundColor="#ffffff",document.getElementsByTagName("body")[0].appendChild(e),["log","error","warn","debug","info","time","timeEnd"]),n=0;ne.pointer.x&&(l*=-1),d.yawDelta+=l),d.pointerDragStart.copy(e.pointer),n.matrixWorld=u)}if(i.includes("pan")){if(!d.canMovePos(t))return;if("OrthographicCamera"==n.type){var a,r=ne.getOrthoCameraMoveVec(e.drag.pointerDelta,n),o=window.viewer.modules.Alignment,s=window.viewer.modules.MergeEditor,l=o.handleState,u=e.buttons===tg.LEFT&&t.alignment&&l&&t.alignment[l];if("pano"==Potree.settings.editType){var o=window.viewer.modules.PanoEditor;if(u&&o.selectedPano&&(o.checkIfAllLinked({group:o.selectedGroup})?(o.dispatchEvent("needToDisConnect"),console.warn("选中的漫游点连通了整个数据集,不允许移动")):("translate"==l&&(e.drag.intersectStart.pointclouds&&j.getMixedSet(o.selectedClouds,e.drag.intersectStart.pointclouds).length||o.selectedPano.hovered)||"rotate"==l)&&(a=o.selectedClouds)),!a&&e.buttons===tg.LEFT&&t.rotateSide)return o.rotateSideCamera(-e.drag.pointerDelta.x)}else if("merge"==Potree.settings.editType){if(e.buttons===tg.LEFT&&t.rotateSide)return s.rotateSideCamera(-e.drag.pointerDelta.x)}else u&&e.drag.intersectStart.pointcloud&&(a=[e.drag.intersectStart.pointcloud],e.drag.intersectStart.pointcloud.dataset_id==Potree.settings.originDatasetId)&&(o=e.drag.intersectStart.pointclouds.find(function(e){return e.dataset_id!=Potree.settings.originDatasetId}))&&(a=[o]);a?("translate"==l&&t.alignment.translateVec&&r.projectOnVector(t.alignment.translateVec),d.dispatchEvent({type:"transformPointcloud",intersect:e.intersect.orthoIntersect,intersectStart:e.drag.intersectStart.orthoIntersect,moveVec:r,pointclouds:a,camera:n})):d.translationWorldDelta.add(r.negate())}else e.drag.intersectStart?(s=null==e.drag.z,u=e.drag.intersectStart.location.clone().project(n),e.drag.z=u.z,s&&(e.drag.projectionMatrixInverse=n.projectionMatrixInverse.clone(),o=new Oe(d.pointerDragStart.x,d.pointerDragStart.y,e.drag.z),e.drag.translateStartPos=o.clone().unproject(n)),l=n.projectionMatrixInverse,n.projectionMatrixInverse=e.drag.projectionMatrixInverse,a=new Oe(e.pointer.x,e.pointer.y,e.drag.z).clone().unproject(n).clone().sub(e.drag.translateStartPos),n.projectionMatrixInverse=l,d.translationWorldDelta.copy(a.negate())):((r=d.target||t.lastIntersect&&(t.lastIntersect.location||t.lastIntersect))&&r instanceof Oe||(r=c.bound.center),u=n.position.distanceTo(r),s=Mf.getHFOVForCamera(n,!0),o=u*Math.tan(s/2),d.translationDelta.x-=e.drag.pointerDelta.x*o,d.translationDelta.z-=e.drag.pointerDelta.y*o);d.useAttenuation=!1}i.includes("scale")&&(d.dollyEnd.subVectors(e.touches[0].pointer,e.touches[1].pointer),l=d.dollyEnd.length()/d.dollyStart.length(),a=(new Re).addVectors(e.touches[0].pointer,e.touches[1].pointer).multiplyScalar(.5),h({pointer:a,scale:l,camera:n,drag:e.drag}),d.dollyStart.copy(d.dollyEnd))}}},h=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 #extension GL_EXT_frag_depth : enable // otherwise error: 'GL_EXT_frag_depth' : extension is disabled\n \n #define PI 3.141592653 \n \n \n uniform float modelAlpha;\n uniform float opacity;\n uniform float progress;\n uniform int tranType;\n uniform vec3 pano0Position;\n uniform vec3 pano1Position;\n uniform float maxDistance;\n uniform float minDistance;\n uniform float minOpa;\n \n \n \n uniform samplerCube pano0Map;\n uniform samplerCube pano1Map;\n \n \n varying vec2 vUv; \n varying vec3 vWorldPosition0;\n varying vec3 vWorldPosition1; \n \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 \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 uniform float cameraHeight0;\n uniform float cameraHeight1;\n uniform float ceilHeight0;\n uniform float ceilHeight1;\n \n \n vec2 getDepth(vec3 dir, sampler2D depthMap, float heightDown, float heightUp, vec4 eyePos){\n vec2 depthValue = vec2(0.0, 0.0);\n vec2 uv2 = getSamplerCoord2( 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.; \n \n if(distance == 0.0){//漫游点底部识别不到的区域,给一个地板高度 \n if(uv2.y < depthTexUVyLimit) distance = heightUp / dir.y; \n else if(uv2.y > 1.0 - depthTexUVyLimit) distance = heightDown / -dir.y; \n else distance = 100000.0;//给个超级远的值\n } \n \n if(distance == 0.0)distance = 100000.0;//给个超级远的值\n \n depthValue.x = distance;\n \n distance += .1; // add a safety margin\n\n vec4 eyePos2 = vec4(normalize(eyePos.xyz) * distance, 1.);\n vec4 clipPos2 = projectionMatrix * eyePos2;\n vec4 ndcPos2 = clipPos2 * 1. / clipPos2.w;\n\n \n depthValue.y = 0.5 * ((gl_DepthRange.far - gl_DepthRange.near) * ndcPos2.z\n + gl_DepthRange.near + gl_DepthRange.far); \n return depthValue; \n }\n //注:未加载好的话,depth为0,导致第一次漫游过去的时候许多mesh会立刻被遮挡,所以要确保加载完\n #endif\n \n void main()\n {\n vec3 vWorldPosition0N = normalize(vWorldPosition0);\n vec3 vWorldPosition1N = normalize(vWorldPosition1);\n float progress_ = progress;\n \n vec4 colorFromPano0 = vec4(0.0,0.0,0.0,0.0);\n #if defined(usePanoMap0)\n //即progress < 1.0 通常是1\n colorFromPano0=textureCube(pano0Map,vWorldPosition0N.xyz);\n #else \n progress_ = 1.0;\n #endif\n vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1N.xyz);\n \n gl_FragColor = mix(colorFromPano0,colorFromPano1,progress_);\n \n \n \n \n //深度图修改深度\n \n #if defined(GL_EXT_frag_depth) && defined(hasDepthTex) \n vec4 ndcPos;\n ndcPos.xy = ((2.0 * gl_FragCoord.xy) - (2.0 * viewport.xy)) / (viewport.zw) - 1.;\n ndcPos.z = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) /\n (gl_DepthRange.far - gl_DepthRange.near);\n ndcPos.w = 1.0;\n\n vec4 clipPos = ndcPos / gl_FragCoord.w;\n vec4 eyePos = inverseProjectionMatrix * clipPos;\n vec2 depth0 = vec2(0.0,0.0); \n #if defined(usePanoMap0)\n depth0 = getDepth(vWorldPosition0N, depthMap0, cameraHeight0, ceilHeight0, eyePos);\n #endif\n vec2 depth1 = getDepth(vWorldPosition1N, depthMap1, cameraHeight1, ceilHeight1, eyePos);\n \n \n gl_FragDepthEXT = mix(depth0.y,depth1.y,progress_); \n gl_FragDepthEXT = clamp(gl_FragDepthEXT, 0.0, 1.0); //防止部分手机出现黑块。ios 16 。 因为我给的超远值超出范围\n \n\n #endif\n\n \n }\n "},lg=function(){function o(){function t(e){e=e.viewport.resolution2,r.uniforms.viewport.value.set(0,0,e.x,e.y)}ue(this,o);var e={depthTexUVyLimit:Potree.config.depthTexUVyLimit},n=j.changeShaderToWebgl2(sg.vertexShader,sg.fragmentShader,"RawShaderMaterial"),i=n.vs,r=le(this,o,[{fragmentShader:n.fs,vertexShader:i,uniforms:fa.clone(sg.uniforms),side:ve,name:"ModelTextureMaterial",defines:e}]),n=(r.glslVersion=Potree.settings.isWebgl2&&"300 es",viewer.mainViewport),a=(t({viewport:n}),viewer.addEventListener("resize",function(e){"MainView"==e.viewport.name&&t(e)}),viewer.addEventListener("camera_changed",function(e){"MainView"==e.viewport.name&&e.camera&&r.uniforms.inverseProjectionMatrix.value.copy(e.camera.projectionMatrixInverse)}),0);return Object.defineProperty(r.uniforms.progress,"value",{get:function(){return a},set:function(e){e<1&&!Potree.settings.fastTran?"usePanoMap0"in r.defines||(r.defines.usePanoMap0="",r.needsUpdate=!0):"usePanoMap0"in r.defines&&(delete r.defines.usePanoMap0,r.needsUpdate=!0),a=e}}),r}return v(o,ac),A(o,[{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.pano1Map.value=t.getSkyboxTexture(),this.uniforms.pano1Position.value.copy(t.position),this.uniforms.pano1Matrix.value.copy(t.panoMatrix),this.pano0=e,this.pano1=t,this.updateDepthTex(e),this.updateDepthTex(t),this.needsUpdate=!0}},{key:"updateDepthTex",value:function(e,t){Potree.settings.useDepthTex&&e&&e.depthTex&&(e==this.pano0||e==this.pano1)&&(this.pano0&&(this.uniforms.depthMap0.value=this.pano0.entered?this.pano0.depthTex:null,this.uniforms.cameraHeight0.value=this.pano0.floorPosition.distanceTo(this.pano0.position),this.uniforms.ceilHeight0.value=this.pano0.getCeilHeight()-this.pano0.position.z),this.pano1&&(this.uniforms.depthMap1.value=this.pano1.depthTex,this.uniforms.cameraHeight1.value=this.pano1.floorPosition.distanceTo(this.pano1.position),this.uniforms.ceilHeight1.value=this.pano1.getCeilHeight()-this.pano1.position.z),this.updateDepthTexEnable())}},{key:"updateDepthTexEnable",value:function(){var e=this.pano0&&this.pano1&&this.pano0.pointcloud.hasDepthTex&&this.pano1.pointcloud.hasDepthTex;Potree.Utils.addOrRemoveDefine(this,"hasDepthTex",e?"add":"remove")}}])}(),ug=function(){return A(function e(t){ue(this,e),this.renderer=t,this.coverRenderTarget=new ti(100,100,{minFilter:N,magFilter:N,format:It}),this.coverTex=this.coverRenderTarget.texture,this.enabled=!1,this.material=this.getMaskMaterial()},[{key:"setSize",value:function(e,t){this.coverRenderTarget.setSize(e,t)}},{key:"start",value:function(){this.enabled=!0;var e=viewer.mainViewport.resolution2,t=e.x,e=e.y,t=(this.setSize(t,e),this.renderer.getRenderTarget()),e=(this.renderer.setRenderTarget(this.coverRenderTarget),viewer.mainViewport.camera.layers.mask);Potree.Utils.setCameraLayers(viewer.mainViewport.camera,["skybox"]),this.renderer.render(viewer.scene.scene,viewer.mainViewport.camera),this.renderer.setRenderTarget(t),viewer.mainViewport.camera.layers.mask=e,this.material.uniforms.progress.value=1,console.log("start111")}},{key:"render",value:function(e,t,n,i,r,a){var o=viewer.mainViewport.resolution2,s=o.x,o=o.y,l=this.material.uniforms;l.coverTex.value=this.coverTex,l.progress.value=viewer.images360.cube.material.uniforms.progress.value,l.screenRatio.value=s/o,l.screenRatio.value*=l.screenRatio.value,Potree.Utils.screenPass.render(viewer.renderer,viewer.images360.fastTranMaskPass.material)}},{key:"stop",value:function(){this.enabled=!1,console.log("stop111")}},{key:"getMaskMaterial",value:function(){return new ga({uniforms:{coverTex:{type:"t",value:null},progress:{type:"f",value:0},screenRatio:{type:"f",value:1}},vertexShader:" \n varying vec2 vUv;\n \n void main() \n {\n vUv = uv;\n \n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n } \n \n ",fragmentShader:" \n uniform sampler2D coverTex; \n uniform float progress; \n uniform float screenRatio;\n varying vec2 vUv;\n \n void main() {\n \n const float maxRadius = 0.708; // sqrt(0.5^2+0.5^2)\n const float minRadius = 0.0 ;\n \n float radius = screenRatio>1.0 ? sqrt((vUv.x - 0.5)*(vUv.x - 0.5) + (vUv.y - 0.5)*(vUv.y - 0.5)/screenRatio) : sqrt((vUv.x - 0.5)*(vUv.x - 0.5)*screenRatio+ (vUv.y - 0.5)*(vUv.y - 0.5));\n float diff = 0.292; //1.0-maxRadius;\n float radiusIn = maxRadius * progress + minRadius * (1.0-progress);\n float radiusOut = radiusIn + diff;\n if(radius < radiusIn) {\n \n discard;\n \n }else if(radius>radiusOut){\n gl_FragColor = texture2D(coverTex, vUv) ;\n //gl_FragColor = vec4(1.0,1.0,0.0,1.0);//\n \n }else{\n \n /* vec4 color1 = texture2D(bgTex, vUv);\n vec4 color2 = texture2D(coverTex, vUv);\n float rotio = smoothstep(radiusIn ,radiusOut,radius);\n \n gl_FragColor = mix(color1, color2, rotio); */\n \n float rotio = smoothstep(radiusIn ,radiusOut, radius);\n \n vec4 color2 = texture2D(coverTex, vUv);\n color2.a = rotio;\n \n \n }\n }\n "})}}])}(),cg=Potree.defines.GLCubeFaces,b={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||b.LocationOnTile.Center){case b.LocationOnTile.UpperLeft:h+=c,d=d-c+o*u;break;case b.LocationOnTile.UpperRight:d+=c,h=h+c-o*u;break;case b.LocationOnTile.LowerRight:h-=c,d=d+c-o*u;break;case b.LocationOnTile.LowerLeft:d-=c,h=h-c+o*u;break;case b.LocationOnTile.Center:}switch(n){case cg.GL_TEXTURE_CUBE_MAP_POSITIVE_X:Bf.setVector(s,-1,h,-d);break;case cg.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:Bf.setVector(s,1,h,d);break;case cg.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:Bf.setVector(s,-d,1,-h);break;case cg.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:Bf.setVector(s,-d,-1,h);break;case cg.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:Bf.setVector(s,-d,h,1);break;case cg.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:Bf.setVector(s,d,h,-1)}Bf.normalize(s)},getFaceForTile:function(e,t){var n=b.TILE_SIZE,e=(ethis.images360.qualityManager.maxNavPanoSize?this.images360.panoRenderer.zoomRenderTarget:(this.tiledPanoRenderTarget.texture.mapping=300,this.tiledPanoRenderTarget)).texture:null}},{key:"isLoaded",value:function(e){return e&&"string"==typeof e&&console.error("Wrong panoSize given to Panorama.isLoaded(); a tiled pano uses PanoSizeClass"),!!this.minimumTiledPanoLoaded&&(!e||this.highestFullTileRenderOpCompleted>=e)}},{key:"getWaitDeferred",value:function(e){var t=this.resolutionPromise[this.id],n=(t||(this.resolutionPromise[this.id]=t={}),t[e]);return n||(n={deferred:$.Deferred(),active:!1},t[e]=n),n}},{key:"clearWaitDeferreds",value:function(){var e,t,n=this.resolutionPromise[this.id];for(e in n||(this.resolutionPromise[this.id]=n={}),n)n.hasOwnProperty(e)&&((t=n[e]).active=!1,t.deferred=$.Deferred())}},{key:"resetWaitDeferred",value:function(e){e=this.getWaitDeferred(e);e.active=!1,e.deferred=$.Deferred()}},{key:"onTileRendered",value:function(e){e.id===this.id&&this.dispatchEvent({type:hg.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:hg.LoadComplete,size:e.panoSize,count:e.totalTiles}))}},{key:"onTileRenderFail",value:function(e){e.id===this.id&&this.dispatchEvent({type:hg.LoadFailed})}},{key:"onUploadAttemptedForAllTiles",value:function(e){var t;e.id===this.id&&(t=this.images360.qualityManager.getPanoSize(pg.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:"addLabel",value:function(){this.removeTextLabel(),this.label=new cv(Object.assign({},gg,{text:this.id+"("+this.originID+")"})),this.images360.node.add(this.label),this.floorPosition&&this.label.position.copy(this.floorPosition)}},{key:"addLabel2",value:function(){this.label2||(this.label2=new cv(Object.assign({},Ag,{text:parseInt(this.id)+1})),this.marker.add(this.label2),this.label2.scale.set(.2,.2,.2),Potree.Utils.updateVisible(this.label2,"notDisplay",!1),Potree.Utils.updateVisible(this.label2,"panoVisi",this.visible))}},{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"))}},{key:"getCeilHeight",value:function(){var e,t=this;return null==this.ceilZ&&(e=(new Me).makeRotationX((Potree.config.depthTexUVyLimit+.01)*Math.PI),(e=[e=new Oe(0,0,1).applyMatrix4(e),e.clone().applyMatrix4((new Me).makeRotationZ(2*Math.PI/3)),e.clone().applyMatrix4((new Me).makeRotationZ(2*-Math.PI/3))].map(function(e){e=e.clone().applyMatrix4(t.panoMatrix2),e=viewer.images360.getIntersect(t,e);return e?e.location.z:1/0})).sort(function(e,t){return t-e}),this.ceilZ=e[0],e=this.position.z+1,this.ceilZ=Math.max(e,this.ceilZ)),this.ceilZ}}])}(),Lh=(xg.prototype.loadTiledPano=(Yv={},Xv={},Kv={},function(t,n,i,r,a,o){var s,l=this,u=n.datasetsLocal.find(function(e){return e.datasetId==l.pointcloud.dataset_id}).direction,c=(null==r&&(r=!0),null==a&&(a=!0),this.getWaitDeferred(t)),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,s=this.id+":"+t,Yv[s]=Yv[s]||[],Kv[s]=null,i&&(b.matchingTilesInDirection(this,t,u,h,p,c=[]),Kv[s]=c,Yv[s].forEach(function(t){var e=Kv[s].find(function(e){return t.faceTileIndex==e.faceTileIndex&&t.face==e.face});e&&(e.loaded=!0)}),Kv[s].some(function(e){return!e.loaded})||(d.resolve(t),this.resetWaitDeferred(t),Kv[s]=null)),Xv[this.id])||(Xv[this.id]=!0,this.addEventListener(hg.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(hg.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(hg.TileLoaded,function(e){var t=e.index,n=e.count,e=e.size,i=this.id+":"+e,r=(Yv[i]=Yv[i]||[],b.getTileLocation(e,t,{})),a=r.faceTileIndex,o=r.face,r=(Yv[i].push({faceTileIndex:a,face:o}),this.getWaitDeferred(e).deferred);r&&"pending"===r.state()&&(r.notify(e,t,n),Kv[i])&&((t=Kv[i].find(function(e){return e.faceTileIndex==a&&e.face==o}))&&(t.loaded=!0),Kv[i].some(function(e){return!e.loaded})||(this.onPanoRendered(this.id,e,n,!0),r.resolve(e,n),this.resetWaitDeferred(e),Kv[i]=null)),viewer.dispatchEvent("content_changed")}.bind(this))),this.images360.tileDownloader.clearForceQueue(),this.images360.tileDownloader.forceQueueTilesForPano(this,t,u,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()}),Potree.defines),Eg=(Lh.ModelManagerEvents,Lh.PanoSizeClass),Cg=function(){return A(function e(t,n,i){ue(this,e),this.maxNavPanoSize=-1,this.maxZoomPanoSize=-1,this.devicePixelDensity=t,this.deviceScreenSize=n,this.clientBandwidth=i,this.panoSizeClassMap={},this.useHighResolutionPanos=!0,this.useUltraHighResolutionPanos=!1,this.modelHasUltraHighPanos=!1,(this.qualityManager=this).maxRenderTargetSize=vf.isMobile()?2048:4096,this.init()},[{key:"init",value:function(e){this.buildPanoSizeClassMap(this.devicePixelDensity,this.deviceScreenSize,this.clientBandwidth),this.ultraHighSize=this.getPanoSize(Eg.ULTRAHIGH),this.highSize=this.getPanoSize(Eg.HIGH),this.standardSize=this.getPanoSize(Eg.STANDARD),this.baseSize=this.getPanoSize(Eg.BASE),yv.tiling.maxZoomPanoQuality&&this.ultraHighSize<=yv.tiling.maxZoomPanoQuality&&(yv.tiling.allowUltraHighResolution=!0),this.highQualityThreshold=vf.valueFromHash("threshold2k",yv.windowHeightHighQualityThreshold),this.updateMaximums()}},{key:"updateFromModel",value:function(e){this.updateUltraHighResolutionSettings(e)}},{key:"updateUltraHighResolutionSettings",value:function(e){yv.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=yv.tiling.maxNavPanoQuality||this.detectMaxNavPanoSize(),this.maxZoomPanoSize=yv.tiling.maxZoomPanoQuality||this.detectMaxZoomPanoSize(),this.maxZoomPanoSizet.panoSize?1:t.panoSize>e.panoSize?-1:-(a-n)}function _g(e){for(var t=(e=e.split(","))[0].match(/:(.*?);/)[1],n=atob(e[1]),i=n.length,r=new Uint8Array(i);i--;)r[i]=n.charCodeAt(i);return new Blob([r],{type:t})}function Pg(){}var Dg,Ig,kg,Rg,Lg,Fg,Og,Ug=function(){function d(e,t,n,i,r){ue(this,d),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 d.PriorityCriteria(null,new Oe(0,0,0),new Oe(0,0,-1),new Oe(0,0,-1))}return A(d,[{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,a){(n=n||[]).length=0;var o=[W0.filters.not(e)],s=[W0.scoreFunctions.distanceSquared(e),W0.scoreFunctions.direction(e.position,i)],l=j.sortByScore(t,o,s);if(a||o.push(W0.filters.inPanoDirection(e.position,i,d.DIRECTION_SCORE_STRICTNESS)),l)for(var u=0;ut.levels)return null;var r=new Xg(t,n);t.allNodes.push(r);for(var a=0;athis.qualityManager.getMaxNavPanoSize()&&(t=this.qualityManager.getMaxNavPanoSize()),r&&t===r.size||(r&&this.deactiveDescripor(r.renderTarget),(r=this.activeDescripor(t))||(t=this.initTiledPano(t,!Potree.settings.disableAATarget&&!vf.isMobile()),(r=this.initDescriptor(t.width)).renderTarget=t),r.pano=e,this.resetPanoDescriptor(e.id),this.resetPanoLODDescriptors(e.id),this.resetRenderStatus(e.id,!0,!0)),this.setActiveRenderTargetDescriptor(e.id,r),n?0:1);return this.updateActivePanos(e,t),r.renderTarget}},{key:"deactivateTiledPano",value:function(e){var t=this.getActiveRenderTargetDescriptor(e.id),t=(this.isRenderTargetDescriptorValid(t)&&(this.deactiveDescripor(t.renderTarget),this.setActiveRenderTargetDescriptor(e.id,null)),this.getUploadQueueForPano(e.id));this.clearUploadQueue(t),this.updateActivePanos(),viewer.cancelLoad(e)}},{key:"getActivePanoCount",value:function(){return this.activePanos.length}},{key:"resetRenderStatus",value:function(e,r,a,t){var n=null;t&&(n=e0.getLevelCountForSize(b.TILE_SIZE,t)+1);for(var i=function(e,t,n,i){a&&(t.tile.zoomUploaded=!1),r&&(t.tile.uploaded=!1)},o=0;o Tree array not yet initialized!"),e=e[t];return e||console.error("PanoRenderer.getTileTree() -> Tree not yet initialized!"),e}},{key:"initTiledPano",value:function(e,t){var n=this.viewer.renderer,e=new xa(e,{stencilBuffer:!1}),i=new ba([]),t=(i.image=[null,null,null,null,null,null],i.flipY=!0,i.format=It,t?(i.generateMipmaps=!0,i.magFilter=N,i.minFilter=gt):(i.generateMipmaps=!1,i.magFilter=N,i.minFilter=N),e.texture=i,n.setRenderTarget(e),n.setRenderTarget(null),n.properties.get(i));return t.__image__webglTextureCube=t.__webglTexture,e}},{key:"getUploadQueueForPano",value:function(e){var t=this.uploadQueues[e];return t||(this.uploadQueues[e]=t=[]),t}},{key:"isTileUploaded",value:function(e){return this.isPanoZoomed(e.panoId)?e.zoomUploaded:e.uploaded}},{key:"setUploaded",value:function(e,t){this.isPanoZoomed(e.panoId)?e.zoomUploaded=t:e.uploaded=t}},{key:"queueTileUpload",value:function(e,t,n){var i,r=this.getActiveRenderTargetDescriptor(e.panoId);!this.isRenderTargetDescriptorValid(r)||!e.downloaded||this.isTileUploaded(e)||e.uploadQueued&&!n||e.panoSize>this.qualityManager.getMaxNavPanoSize()&&!this.zoomingActive||(i=this.getUploadQueueForPano(e.panoId),n?this.uploadTile(e,!1):(this.shoulPushToFrontOfQueue(e)?this.forceQueue.push(e):t&&this.direction?Ug.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===e0.getLevelCountForSize(b.TILE_SIZE,e.panoSize)}},{key:"getTopUploadQueue",value:function(){for(var e,t,n=S0;n<=T0;n++)for(var i=0;i=t?(r.uploadQueued=!1,e.splice(i,1)):i++}}},{key:"updateUploadQueue",value:function(e,t){for(var n=0,i=0;!(t<=i||e<=n);){var r,a=this.getNextFromUploadQueue();if(!a)break;0!==a.level?n++:i++,a.panoSize>this.qualityManager.getMaxNavPanoSize()&&!this.zoomingActive||(r=this.getActiveRenderTargetDescriptor(a.panoId),this.isRenderTargetDescriptorValid(r)&&this.uploadTile(a,a.forceUpload))}}},{key:"updateDirection",value:function(e){if(e=e||this.direction){this.direction=e;for(var t=0;t=this.qualityManager.getMaxNavPanoSize()?this.zoomRenderTarget&&this.zoomRenderTarget.width===this.qualityManager.getMaxZoomPanoSize()||(e=this.zoomRenderTarget,(t=this.qualityManager.getMaxZoomPanoSize())>this.qualityManager.maxRenderTargetSize)||(s0[t]?this.zoomRenderTarget=s0[t]:(this.zoomRenderTarget=this.initTiledPano(t,!1),s0[t]=this.zoomRenderTarget),e&&(t=e.width,n=this.zoomRenderTarget.width,this.copyCubeMap(e.texture,this.zoomRenderTarget,t,t,n,n),e.texture.dispose(),e.texture.loaded=!1,e.texture.version=0,this.deallocateCubeTexture(e.texture),e.texture=null),this.zoomPanoRenderingDisabled=!1):this.zoomPanoRenderingDisabled=!0)}),_0.prototype.updateActivePanos=(l0=[],function(e,t){for(var n=l0.length=0;n Cannot render to a pano that is not activated.");for(var a=0;athis.qualityManager.maxRenderTargetSize?this.viewer.images360.getHighImage(a,e.cubeFace,c,d):(c0[o]||(c0[o]=this.initSizedTexture2D(o,ct)),this.uploadTexture2D(a,A=c0[o],0,0,o,o),s>this.qualityManager.maxRenderTargetSize?loaded||this.viewer.images360.updateHighMap(A,e.cubeFace,c,d):1===d0||2===d0?(a=1===d0?this.overlayTilesBasic:this.overlayTilesEnhanced,this.renderToCubeMap(A,g,o,o,0,0,o,o,t,h,v,v,e.cubeFace),this.renderToCubeMap(a[s],g,o,o,0,0,o,o,t,h,v,v,e.cubeFace,Ae,!0,.5)):this.renderToCubeMap(A,g,o,o,0,0,o,o,t,h,v,v,e.cubeFace)),n()):f?n():(r+":"+s+":"+l,this.setUploaded(e,!1)),e.uploadAttempted||(m.uploadAttempts++,this.dispatchEvent({type:i0.TileUploadAttempted,id:r,panoSize:s,tileIndex:l,totalTiles:u})),e.uploadAttempted=!0,m.uploadAttempts===u&&this.dispatchEvent({type:i0.UploadAttemptedForAllTiles,id:r,panoSize:s,totalTiles:u}),p}),_0.prototype.renderToCubeMap=(h0=!1,g0=v0=m0=f0=p0=null,function(e,t,n,i,r,a,o,s,l,u,c,d,h,p,f,m){var v=this.viewer.renderer,g=(h0||((f0=new Ad(-.5,.5,.5,-.5,-200,200)).position.z=150,(p0=new Fs).add(f0),m0=new t0({depthWrite:!1,depthTest:!1,side:0}),v0=new _a(1,1),(g0=new Q(v0,m0)).position.z=0,p0.add(g0),h0=!0),v0.getAttribute("uv")),g=(g.setDynamic(!0),g.needsUpdate=!0,g.array),r=r/n,a=a/i,o=o/n,n=s/i,s=(g[0]=r,g[1]=a+n,g[2]=r+o,g[3]=a+n,g[4]=r,g[5]=a,g[6]=r+o,g[7]=a,v0.getAttribute("position")),i=(s.setDynamic(!0),s.needsUpdate=!0,s.array),n=l/t.width-.5,r=u/t.height-.5,o=c/t.width,g=d/t.height,a=(i[0]=n,i[1]=r+g,i[3]=n+o,i[4]=r+g,i[6]=n,i[7]=r,i[9]=n+o,i[10]=r,m0.map=e,m0.blending=p||ge,m0.transparent=!!f,m0.uniforms.opacity.value=m=null==m?1:m,t.viewport.set(0,0,t.width,t.height),v.autoClear),s=v.getRenderTarget();v.autoClear=!1,v.setRenderTarget(t,h),v.render(p0,f0),v.setRenderTarget(s),v.autoClear=a}),_0.prototype.copyCubeMap=(y0=!1,E0=x0=b0=w0=null,C0=new Oi,function(e,t,n,i,r,a,o,s,l){if(!(r>this.qualityManager.maxRenderTargetSize)){y0||((b0=new Ad(-1,1,1,-1,0,200)).position.set(0,0,0),(w0=new Fs).add(b0),x0=new ga({uniforms:{tDiffuse:{type:"t",value:null},alpha:{type:"f",value:1}},vertexShader:bm["copyCubeMap.vs"],fragmentShader:bm["copyCubeMap.fs"],depthWrite:!1,depthTest:!1,side:ve}),A0=new Jl(2,2,2),E0=new Q(A0,x0),w0.add(E0),y0=!0);var u=this.viewer.renderer.autoClear,c=this.viewer.renderer.getRenderTarget();this.viewer.renderer.autoClear=!1,x0.uniforms.tDiffuse.value=e,x0.blending=o||ge,x0.transparent=!!s,x0.uniforms.alpha.value=l=null==l?1:l,x0.needUpdate=!0;for(var d=0;d<6;d++)this.getCubeOrientationForCubeFace(d,C0),E0.rotation.copy(C0),E0.matrixWorldNeedsUpdate=!0,E0.updateMatrixWorld(),t.viewport.set(0,0,r,a),this.viewer.renderer.setRenderTarget(t,d),this.viewer.renderer.render(w0,b0);this.viewer.renderer.autoClear=u,this.viewer.renderer.setRenderTarget(c)}});function D0(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}function I0(e,t){D0.call(this),this.textureID=void 0!==t?t:"tDiffuse",e instanceof ga?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=fa.clone(e.uniforms),this.material=new ga({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,transparent:!0})),this.camera=new Ad(-1,1,1,-1,0,1),this.scene=new Fs,this.quad=new Q(new _a(2,2),null),this.quad.frustumCulled=!1,this.scene.add(this.quad)}var k0,R0,L0,F0,O0,U0,N0,z0=function(){function n(){ue(this,n),e=le(this,n);var e,t=document.createElement("canvas");return e.canvas=t,e.context=t.getContext("2d",{willReadFrequently:!0}),e.imgDatas=[],e.maxDataCount=vf.isMobile()?6:20,e.maxNeighCount=vf.isMobile()?3:14,e.nearPanos=[],e}return v(n,Qn),A(n,[{key:"updateNearPanos",value:function(e){this.nearPanos=e.slice(0,this.maxNeighCount)}},{key:"changeImg",value:function(e,t){var n,i=this,r=(this.pano=t,this.imgDatas.find(function(e){return e.pano==t}));if(r)n=this.imgDatas.indexOf(r),this.imgDatas.splice(n,1),this.imgDatas.push(r);else{Potree.timeCollect.depthSamChangeImg.start=!0;try{viewer.addTimeMark("depthSamChangeImg","start"),this.canvas.width=e.width,this.canvas.height=e.height,this.context.drawImage(e,0,0);var a,o=this.context.getImageData(0,0,e.width,e.height),s=o&&o.data;if(!s)return console.error("getImageData 得不到?!why!"),!1;this.imgDatas.length>=this.maxDataCount&&(a=this.imgDatas.find(function(e){return!i.nearPanos.includes(e.pano)}),this.imgDatas.splice(this.imgDatas.indexOf(a),1)),this.imgDatas.push({pano:t,data:s}),this.dispatchEvent({type:"changeImg",pano:t}),viewer.addTimeMark("depthSamChangeImg","end")}catch(e){return console.error(e),!1}}}},{key:"clearTexData",value:function(){this.imgDatas.length=0}},{key:"getDepth",value:function(e,t,n){function i(e,t){if(!(e<0||t<0||e>=r.canvas.width||t>=r.canvas.height))return t=r.canvas.width*t+e,(e=s.data.slice(4*t,4*(t+1)))[1]+e[0]/256}var r=this,a=Math.round(e*(this.canvas.width-1)),o=Math.round(t*(this.canvas.height-1)),s=this.imgDatas.find(function(e){return e.pano==r.pano}),e=i(a,o);if(!e&&n){for(var l=[],u=0;u++<1;)for(var c=-u;c<=u;c++)for(var d,h=-u;h<=u;h++)c!=-u&&c!=u&&h!=-u&&h!=u||0!=(d=i(a+c,o+h))&&l.push(d);l.length&&(e=l.reduce(function(e,t){return e+t},0)/l.length)}return e}},{key:"sample",value:function(e,t,n,i){if(e){var r=new Oe;if((t=t||viewer.images360.currentPano)!=this.currentPano||!this.imgDatas.find(function(e){return e.pano==t})){if(!t.depthTex)return;if(!1===this.changeImg(t.depthTex.image,t))return console.log("失败",t.id),!1;this.currentPano=t}var a,o,s,l=t.position,e=e.dir||(new Oe).subVectors(e.point,l).normalize(),u=e.clone().applyMatrix4(t.panoMatrix2Inverse).normalize(),u=te.getUVfromDir(u),i=this.getDepth(u.x,u.y,i);return i?(r.copy(e).multiplyScalar(i).add(l),n||(n=this.getNearbyPoint(l,u,-1,0),s=this.getNearbyPoint(l,u,1,0),a=this.getNearbyPoint(l,u,0,-1),o=this.getNearbyPoint(l,u,0,1),s=this.planeFit(e,r,n,s,a,o)),{location:r,normal:s,distance:i}):u.y>1-Potree.config.depthTexUVyLimit?(i=(t.floorPosition.z-l.z-.1)/e.z,r.copy(e).multiplyScalar(i).add(l),{location:r,normal:new Oe(0,0,1),distance:i}):u.ys.inputHandler.hoveredElements[0].distance)){if("pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType){if(e.hoverViewport==s.mapViewer.viewports[0])return s.mapViewer.dispatchEvent(e);if(e.hoverViewport!=s.mainViewport)return}Potree.settings.dblToFocusPoint||l.flyToPanoClosestToMouse()}}),s.addEventListener("global_mousemove",function(e){!Potree.settings.unableNavigate&&Potree.settings.ifShowMarker&&e.hoverViewport==s.mainViewport&&l.updateClosestPano(e.intersect)}),l.addEventListener("markerHover",function(e){l.updateClosestPano(e.pano,e.hovered)}),Potree.settings.isOfficial||(l.domRoot=s.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 l.unfocus()}),l.elUnfocus=e,l.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)"}),l.domRoot.appendChild(n[0]),n.on("click",function(e){var t=Potree.Utils.getObjVisiByReason(s.scene.pointclouds[0],"force");s.scene.pointclouds.forEach(function(e){Potree.Utils.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)"}),l.domRoot.appendChild(e[0]),e.on("click",function(e){"showPointCloud"==Potree.settings.displayMode&&0==l.panos.length||(Potree.settings.displayMode="showPointCloud"==Potree.settings.displayMode?"showPanos":"showPointCloud")}),l.elDisplayModel=e,s.mapViewer&&((t=$("")).css({position:"absolute",right:"50%",bottom:"20px",zIndex:"10000",fontSize:"1em",color:"black",width:"100px",background:"rgba(255,255,255,0.8)"}),l.domRoot.appendChild(t[0]),i=s.mapViewer.mapLayer.maps.find(function(e){return"map"==e.name}),t.on("click",function(e){i.switchStyle("satellite"==i.style?"standard":"satellite"),t.val("satellite"==i.style?"卫星":"普通")})));var l,n,e,t,i,u="",r=(l.latestRequestMode="",Object.defineProperty(Potree.settings,"displayMode",{get:function(){return u},set:function(t){function e(){o.showSkybox||o.showPoint&&o.pointUsePanoTex?(l.tileDownloader.start(),l.currentPano&&l.currentPano.enter()):(l.tileDownloader.stop(),l.currentPano&&l.currentPano.exit(),l.nextPano&&s.cancelLoad(l.nextPano))}l.latestRequestMode=t,console.warn("Request setMode: "+t),l.dispatchEvent({type:"requestMode",mode:t});var n=Potree.config.displayMode[t];o=l.isAtPano()&&!l.latestToPano?n.atPano:n.transition;if(t!=u){var i,r=s.scene.getActiveCamera();if("showPanos"==t&&s.mainViewport.view.isFlying())i=function(){l.latestRequestMode==t&&(Potree.settings.displayMode=t),s.mainViewport.view.removeEventListener("flyingDone",i)},s.mainViewport.view.addEventListener("flyingDone",i);else{if(l.isAtPano()&&!l.latestToPano)o=n.atPano;else{var a,o=n.transition;if("showPanos"==t)return 0==l.panos.length?void 0:(a=function(e){console.log("flyToPanoDone"),l.removeEventListener("flyToPanoDone",a),setTimeout(function(){l.latestRequestMode==t&&(Potree.settings.displayMode=t)},e.makeIt?1:50)},l.addEventListener("flyToPanoDone",a),void l.flyToPano({pano:l.findNearestPano()}))}if(e(),o.showSkybox||o.pointUsePanoTex)if(l.checkAndWaitForPanoLoad(l.currentPano,l.basePanoSize,function(){setTimeout(function(){l.latestRequestMode==t&&(Potree.settings.displayMode=t)},1)}))return;s.scene.pointclouds.forEach(function(e){Potree.Utils.updateVisible(e,"displayMode",o.showPoint,2)}),o.pointUsePanoTex?s.scene.pointclouds.forEach(function(e){e.material.setProjectedPanos(l.currentPano,l.currentPano,1)}):s.scene.pointclouds.forEach(function(e){e.material.stopProjectedPanos()}),Potree.Utils.updateVisible(l.cube,"showSkybox",o.showSkybox),l.cube.visible?l.setProjectedPanos({progress:1,ifSkybox:!0,ifPointcloud:!1,easeInOutRatio:0,pano0:l.currentPano,pano1:l.currentPano}):(l.smoothZoomTo(1),l.resetHighMap(),l.hideHighMap()),"showPanos"==(u=t)?(r.far=s.farWhenShowPano,Potree.settings.pointDensity="panorama",Potree.config.displayMode.showPanos.transition.pointUsePanoTex&&s.scene.pointclouds.forEach(function(e){e.material.pointSizeType="FIXED"}),l.updateCube(l.currentPano)):(r.limitFar&&(r.far=Potree.settings.cameraFar),Potree.settings.pointDensity=Potree.settings.UserPointDensity,Potree.config.displayMode.showPanos.transition.pointUsePanoTex&&s.scene.pointclouds.forEach(function(e){e.material.pointSizeType=Potree.config.material.pointSizeType})),r.updateProjectionMatrix(),l.elDisplayModel&&l.elDisplayModel.val("showPointCloud"==t?">>全景":">>点云"),l.dispatchEvent({type:"endChangeMode",mode:t}),console.log("setModeSuccess: "+t)}}else e()}}),Potree.settings.displayMode="showPointCloud",null),a=(Object.defineProperty(l,"currentPano",{get:function(){return r},set:function(e){e!=r&&(r&&r.exit(),e&&e.enter(),r=e)}}),!0),o=(Object.defineProperty(Potree.settings,"ifShowMarker",{get:function(){return a},set:function(t){(t=!!t)!=a&&(l.panos.forEach(function(e){Potree.Utils.updateVisible(e,"ifShowMarker",t,1)}),a=t,s.dispatchEvent("showMarkerChanged"),s.dispatchEvent("content_changed"))}}),s.addEventListener("update",function(){l.update(s)}),{FORWARD:["W".charCodeAt(0),38],BACKWARD:["S".charCodeAt(0),40],LEFT:["A".charCodeAt(0),37],RIGHT:["D".charCodeAt(0),39]});return s.inputHandler.addEventListener("keydown",function(t){if("showPanos"==Potree.settings.displayMode)for(var e in o)if(o[e].some(function(e){return e==t.keyCode})){switch(e){case"FORWARD":l.flyLocalDirection(H0.FORWARD.clone());break;case"BACKWARD":l.flyLocalDirection(H0.BACK.clone());break;case"LEFT":l.flyLocalDirection(H0.LEFT.clone());break;case"RIGHT":l.flyLocalDirection(H0.RIGHT.clone())}break}}),l}return v(d,Qn),A(d,[{key:"updateDepthTex",value:function(e){this.currentPano==e&&e.depthTex&&this.cube.material.updateDepthTex(e)}},{key:"findNearestPano",value:function(t){t=t?(new Oe).copy(t):this.position;var e=j.sortByScore(this.panos,[d.filters.isEnabled()],[function(e){return-e.position.distanceTo(t)}]);return e[0]&&e[0].item}},{key:"flyLocalDirection",value:function(e){var t=this.getDirection(e),n=1===e.y?.4:.75,e=1===Math.abs(e.x);return this.flyDirection(t,n,e,!0)}},{key:"getDirection",value:function(e){return e?(e=e||(new Oe).copy(H0.FORWARD)).applyQuaternion(viewer.mainViewport.camera.quaternion):viewer.scene.view.direction}},{key:"position",get:function(){return this.viewer.scene.view.position.clone()}},{key:"isAtPano",value:function(e){return e?this.currentPano&&te.closeTo(viewer.scene.view.position,this.currentPano.position,e):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=0d)&&(r++,a.push(i[o]),u=new Se("#0f8")),h&&function(e,t,n){var i=3i[r][0].distanceTo(i[r][1]))return!0}},a.pointcloud.hasDepthTex||o.pointcloud.hasDepthTex?(u?null==e[o.id]||null==t[a.id]:null==e[o.id]&&!1!==t[a.id])&&(null==e[o.id]&&a.depthTex&&(r=i(a,o),e[o.id]=!!r),u&&e[o.id]&&o.depthTex&&null==t[a.id]&&(r=i(o,a),t[a.id]=!!r),!1!==e[o.id]&&!1!==t[a.id]||(d<20?a.depthTex&&o.depthTex&&(n=!1,(u=c(a,o))&&(i=c(o,a))&&.6<=u+i&&(n=!0),e[o.id]=t[a.id]=n):(void 0===e[o.id]&&(e[o.id]=0),void 0===t[a.id]&&(t[a.id]=0))),n=null==t[a.id]?e[o.id]:e[o.id]&&t[a.id],h)&&console.log("isNeighbour",a.id+"("+a.originID+")",o.id+"("+o.originID+")",e[o.id],t[a.id]):p||n||(r=function(){var e=(new Oe).subVectors(o.position,a.position).normalize(),t=o.position.distanceTo(a.position),n=Be.degToRad(viewer.mainViewport.camera.fov),i=Mf.getHFOVForCamera(viewer.mainViewport.camera,!0),n=Math.min(n,i),i=Math.cos(Be.degToRad(10)),r=Math.cos(Be.degToRad(40));if(l.getDirection().dot(e)>Be.clamp(Math.cos(n/2)*t/10,r,i))return!0},f?r()&&(n=!viewer.inputHandler.ifBlockedByIntersect({point:o.position,margin:s,cameraPos:a.position})):(n=!viewer.inputHandler.ifBlockedByIntersect({point:o.position,margin:s,cameraPos:a.position}))&&!r()&&(n=void 0),e[o.id]=t[a.id]=n&&"byCloud"),e[o.id]&&t[a.id]&&(a.neighbours.includes(o)||a.neighbours.push(o),o.neighbours.includes(a)||o.neighbours.push(a))),n)}},{key:"bump",value:function(e){var t,n,i=this;this.bumping||this.latestToPano||(t="showPanos"==Potree.settings.displayMode?.15:.12,n=this.position.clone(),e=(new Oe).addVectors(this.position,e.clone().multiplyScalar(t)),viewer.scene.view.setView({position:e,duration:150,callback:function(){viewer.scene.view.setView({position:n,duration:750,callback:function(){i.bumping=!1},Easing:"easeInOutSine",cancelFun:function(){i.bumping=!1}}),i.bumping=!0},cancelFun:function(){i.bumping=!1},Easing:"easeInOutSine"}),this.bumping=!0)}},{key:"flyToPanoClosestToMouse",value:function(){if(Potree.settings.ifShowMarker||this.updateClosestPano(viewer.inputHandler.intersect),this.closestPano)return e=this.closestPano,this.flyToPano({pano:e,easeName:this.isAtPano()?"linearTween":"easeInOutQuad"});var e=this.viewer.inputHandler.getMouseDirection().direction;this.flyDirection(e)}},{key:"flyDirection",value:function(e,t,n,i){var r=this;if(!viewer.mainViewport.view.isFlying()){var a,o=$.Deferred(),t=this.closestPanoInDirection(e,t,n,i);if(t)this.flyToPano({pano:t,callback:o.resolve.bind(o,!0)});else{if("showPointcloud"==Potree.settings.displayMode)if(!viewer.scene.pointclouds.find(function(t){return t.visibleNodes.some(function(e){return e.getLevel()>Math.ceil(.15*t.maxLevel)})}))return this.panos.length?(this.flyToPano({pano:this.findNearestPano(),duration:500,callback:o.resolve.bind(o,!0)}),o.promise()):0==viewer.scene.pointclouds.length?void 0:(a=new Map,(n=viewer.scene.pointclouds.filter(function(e){return e.root.geometryNode})).forEach(function(e){return a.set(e,e.bound.distanceToPoint(r.position))}),n.sort(function(e,t){return a.get(e)-a.get(t)}),viewer.flyToDataset({focusOnPoint:!0,pointcloud:n[0],duration:500}),o.promise());this.bump(e),o.resolve(!1)}return o.promise()}}},{key:"closestPanoInDirection",value:function(e,t,n,i){return this.rankedPanoInDirection(0,e,t,n,i)}},{key:"rankedPanoInDirection",value:function(e,t,n,i,r){var a,o,s=this,l=(Date.now(),{pano:null,candidates:[]}),i=(e=e||0,n=void 0!==n?n:.6,i?"angle":"direction"),u=(viewer.modules.SiteModel.currentFloor,viewer.modules.SiteModel.inEntity,new Map),c=(this.panos.forEach(function(e){var t=e.position.distanceToSquared(s.position);u.set(e,t)}),[d.filters.not(this.currentPano),d.filters.isEnabled(),function(e){if(s.isNeighbour(s.currentPano,e,{onlyUseTex:!0})||e.noNeighbour&&u.get(e)<200)return!0}]),n=(r||c.push(d.filters.inPanoDirection(this.position,this.getDirection(),n)),[function(e){return-u.get(e)},d.scoreFunctions[i](this.position,t,!0),function(e){return s.isNeighbour(s.currentPano,e,{dontCompute:!0,isNeighbour:!0})?400:0}]);return!r&&viewer.inputHandler.intersect&&this.currentPano&&(a=this.currentPano.floorPosition,o=(new Oe).subVectors(viewer.inputHandler.intersect.location,a).normalize(),n.push(function(e){return 400*e.floorPosition.clone().sub(a).normalize().dot(o)*4})),this.findRankedByScore(e,c,n,l),l.pano}},{key:"findRankedByScore",value:function(e,t,n,i){i&&(i.candidates=null,i.pano=null),e=e||0;t=j.sortByScore(this.panos,t,n);return!t||0===t.length||e>=t.length?null:(i&&(i.candidates=t,i.pano=t[e].item),t[e].item)}},{key:"updateClosestPano",value:function(e,t){if(e instanceof xg)n=t?e:null;else{if(this.isAtPano()||this.bumping)return;if(!(e=e&&e.location))return;var t="pano"!=Potree.settings.editType?[d.sortFunctions.floorDisSquaredToPoint(e)]:[d.sortFunctions.disSquaredToPoint(e)],n=j.find(this.panos,[],t)}n!=this.closestPano?(n&&(this.isPanoHover=!0),this.closestPanoChanging(this.closestPano,n),this.closestPano=n):this.isPanoHover=!1}},{key:"closestPanoChanging",value:function(e,t){Potree.settings.ifShowMarker&&(e&&e.hoverOff({byImages360:!0}),t)&&t.hoverOn({byImages360:!0})}},{key:"getTileDirection",value:function(){var n=viewer.scene.view.direction.clone();return{datasetsLocal:viewer.scene.pointclouds.map(function(e){var t=(new Me).copy(e.rotateMatrix).invert(),t=n.clone().applyMatrix4(t);return{datasetId:e.dataset_id,direction:te.convertVector.ZupToYup(t)}}),vectorForward:n}}},{key:"update",value:function(){var e=this.getTileDirection();this.updateTileDownloader(j0,e),this.updatePanoRenderer(e),this.updateZoomPano()}},{key:"updateTileDownloader",value:function(e,t){var n=this.nextPano||this.currentPano;n&&(this.tileDownloader.tilePrioritizer.updateCriteria(n,viewer.scene.view.position.clone(),t,0 Cannot load texture for null pano.");var l=this.getTileDirection();if(!e.isLoaded(t))return a&&viewer.waitForLoad(e,function(){return e.isLoaded(t)}),e.loadTiledPano(t,l,null,o,s,null).done(function(e,t){n&&n(e,t)}.bind(this)).fail(function(e){i&&i(e)}.bind(this)).progress(function(e,t,n){r&&r(e,t,n)}.bind(this)),!0}},{key:"fitPanoTowardPoint",value:function(i){var r=i.point,a=i.target||i.point,e=i.require||[],t=i.rank||[],n=(i.force,i.getAll,i.bestDistance||0),o=i.sameFloor,s=i.maxDis,l=i.dir,u=viewer.scene.getActiveCamera(),c=(a&&!l&&(l=(new Oe).subVectors(a,r).normalize()),o&&viewer.modules.SiteModel.pointInWhichEntity(r,"floor"),i.checkIntersect),d=Math.max(300,3*viewer.bound.boundSize.length()),h=(i.boundSphere&&(n=1t,r=!(this.flying&&this.nextPano&&this.nextPano!==this.currentPano),this.tileDownloader.tilePrioritizer.setZoomingActive(r=n&&r),this.panoRenderer.setZoomingActive(r,e,!0),i=function(e,t){a.panoRenderer.resetRenderStatus(e.id,!1,!0,a.qualityManager.getMaxNavPanoSize()),a.panoRenderer.clearAllQueuedUploadsForPano(e.id),a.panoRenderer.renderPanoTiles(e.id,null,!1,!1),e.setZoomed(t)},r&&(!e.zoomed||this.qualityManager.zoomLevelResolution&&"4k"!=this.qualityManager.zoomLevelResolution)?(e.zoomed||i(e,!0),"1k"==Potree.settings.navTileClass&&"1k"!=Potree.settings.tileClass&&this.zoomLevel<2?this.panoRenderer.enableHighQuality(function(){"4k"!=Potree.settings.tileClass&&i(e,!0)}.bind(this)):this.panoRenderer.enableUltraHighQualityMode(function(){this.qualityManager.useUltraHighResolutionPanos&&(Potree.settings.zoom.max=Potree.config.ultraHighQualityMaxZoom),i(e,!0)}.bind(this))):!n&&e.zoomed&&i(e,!1),r)&&"1k"==Potree.settings.navTileClass&&"4k"==Potree.settings.tileClass&&(r=function(e){a.qualityManager.updateMaximums(),a.panoRenderer.setupZoomRenderTarget()},this.qualityManager.zoomLevelResolution=2<=this.zoomLevel?"4k":this.zoomLevel>t?"2k":"1k",this.oldZoomLevel<2&&2<=this.zoomLevel?(r(),i(e,n)):this.oldZoomLevel<=t&&this.zoomLevel>t?r():2t&&this.zoomLevel<=t&&r(),this.oldZoomLevel=this.zoomLevel)}},{key:"addHighMapCube",value:function(){var t=this;if("4k"==Potree.settings.tileClass&&2048==this.qualityManager.maxRenderTargetSize){var e=new Nu(1,1,1,1),n=new Z;n.tiles=[];for(var i=0;i<6;i++){for(var r=new Z,a=0;a<8;a++)for(var o=0;o<8;o++){var s,l=new Q(e,new R({transparent:!0,opacity:.4,depthTest:!1}));l.position.set(a-3.5,o-3.5,-4),Potree.settings.isTest&&(s=Math.random(),l.material.color=(new Se).setHSL(s,.6,.7)),l.visible=!1,l.tileX=a,l.tileY=o,l.cubeFace=i,n.tiles.push(l),r.add(l)}switch(i){case V0.GL_TEXTURE_CUBE_MAP_POSITIVE_X:r.rotation.set(0,Math.PI/2,0);break;case V0.GL_TEXTURE_CUBE_MAP_NEGATIVE_X:r.rotation.set(0,-Math.PI/2,0);break;case V0.GL_TEXTURE_CUBE_MAP_POSITIVE_Y:var u=(new ii).setFromAxisAngle(new Oe(0,1,0),Math.PI),c=(new ii).setFromAxisAngle(new Oe(1,0,0),Math.PI/2);r.quaternion.copy(u).multiply(c);break;case V0.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:u=(new ii).setFromAxisAngle(new Oe(0,1,0),Math.PI),c=(new ii).setFromAxisAngle(new Oe(1,0,0),-Math.PI/2);r.quaternion.copy(u).multiply(c);break;case V0.GL_TEXTURE_CUBE_MAP_POSITIVE_Z:r.rotation.set(0,Math.PI,0);break;case V0.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:r.rotation.set(0,0,0)}r.scale.set(1,-1,1),r.cubeFace=i,n.add(r)}n.name="highMapCube",this.highMapCube=n,viewer.scene.scene.add(n);n.scale.set(.1,.1,.1),this.highMapCube.visible=!1,Potree.Utils.setObjectLayers(this.highMapCube,"sceneObjects"),viewer.addEventListener("update",function(){t.highMapCube.visibleTiles&&t.updateTiles()}),viewer.addEventListener("camera_changed",function(e){e.viewport==viewer.mainViewport&&j.intervalTool.isWaiting("update4kTiles",function(){var e=t.getDirection();t.updateTiles(e)},500)})}}},{key:"isHighMapLoaded",value:function(e,t,n){return!!this.highMapCube.children[e].children[8*t+n].material.map}},{key:"updateTiles",value:function(r){var a,o,e,n,i,s=this;this.highMapCube&&this.highMapCube.visible&&(this.highMapCube.tiles.filter(function(e){return e.image}).length<=10||(r&&(e=viewer.mainViewport.camera,a=Mf.getHFOVForCamera(e,!0)/2,o=Be.degToRad(e.fov)/2,(e=this.highMapCube.tiles).forEach(function(e){var t=e.getWorldPosition(new Oe),t=(new Oe).subVectors(t,s.highMapCube.position).normalize(),n=t.clone().setZ(r.z).normalize().dot(r),n=Math.acos(n),i=-200;1.5a||n.dot(r)>a}},inFloorDirection:function(i,r,a,o){return function(e){var t=(new Re).subVectors(e.floorPosition,i).normalize(),n=(new Re).copy(r).normalize();return o&&console.log("dire",e.id,t.dot(n)),t.dot(n)>a}},isNotBehindNormal:function(t,n){var i=new Oe;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,t.on("click",function(){i=!i,n.attachToMainViewer(i,"measure"),t.val(i?"map分离":"map绑定")}),e.appendChild(t[0])),n}return v(r,ag),A(r,[{key:"needRender",get:function(){return this.needRender_},set:function(e){(this.needRender_=e)&&(this.viewports[0].needRender=!0)}},{key:"mapChanged",get:function(){return this.mapChanged_},set:function(e){(this.mapChanged_=e)&&(this.needRender=!0)}},{key:"waitLoadDone",value:function(e){function t(){clearTimeout(i)}function n(){clearTimeout(i),i=setTimeout(function(){r.mapLayer.removeEventListener("loadDone",n),r.mapLayer.removeEventListener("startLoad",t),e()},document.hidden?5e3:500)}var i,r=this;this.mapLayer.addEventListener("loadDone",n),this.mapLayer.addEventListener("startLoad",t),0==this.mapLayer.loadingInProgress&&n()}},{key:"addListener",value:function(e){var t=this;e.addEventListener("flyToPano",function(e){e=e.toPano;e.dontMoveMap||t.moveTo(e.pano.position.clone().setZ(Potree.config.map.cameraHeight),void 0,e.duration,null,e.easeName)})}},{key:"initProjection",value:function(){this.started=!0,this.mapLayer.initProjection()}},{key:"initScene",value:function(){var e=this,t=this.renderArea.clientWidth,n=this.renderArea.clientHeight,i=(this.camera=new Ad(-t/2,t/2,n/2,-n/2,.01,1e4),this.camera.zoom=t/50,this.camera.up.set(0,0,1),this.view=new ff,this.view.position.set(0,0,Potree.config.map.cameraHeight),this.view.lookAt(0,0,0),new og(this.view,this.camera,{left:0,bottom:0,width:1,height:1,name:"mapViewport"})),n=(i.axis=["x","y"],i.axisSign=[1,1],i.noPointcloud=!0,i.render=this.render.bind(this),i.addEventListener("resize",function(){e.copyBuffer.setSize(i.resolution2.x,i.resolution2.y)}),this.viewports=[i],this.controls=new ng(this,this.viewports[0]),this.controls.setEnable(!0),this.scene=new Fs,this.inputHandler=new rg(this,this.scene),this.inputHandler.name="mapInputHandler",this.inputHandler.registerInteractiveScene(this.scene),this.viewports[0].interactiveScenes=this.inputHandler.interactiveScenes,new Q(K0,new R({transparent:!0,opacity:.9,depthTest:!1,map:X0.load(Potree.resourcePath+"/textures/pic_location128.png")})));n.position.set(0,0,0),this.cursor=n,this.scene.add(n),Potree.Utils.setObjectLayers(this.scene,"mapObjects")}},{key:"setViewLimit",value:function(e){var t,n,i,r;(e=e||this.limitBoundState)&&(this.limitBoundState=e,(e=Potree.config.OrthoCameraLimit[e])?(this.camera.zoomLimit=$.extend({},e.zoom),n=viewer.transform.lonlatToLocal.inverse([0,0]),t=viewer.transform.lonlatToLocal.forward([n[0],-90+e.latPad])[1],n=viewer.transform.lonlatToLocal.forward([n[0],90-e.latPad])[1],i=this.viewports[0].resolution.y/2/this.camera.zoom,r=this.viewports[0].resolution.x/2/this.camera.zoom,this.view.limitBound=new K(new Oe(e.xBound[0]+r,t+i,Potree.config.map.cameraHeight),new Oe(e.xBound[1]-r,n-i,1/0))):(this.view.limitBound=null,this.camera.zoomLimit=null))}},{key:"updateCursor",value:function(){var e=te.getScaleForConstantSize({minSize:80,maxSize:200,nearBound:5,farBound:100,camera:this.camera,position:this.cursor.getWorldPosition(new Oe),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 Z;r.name="markers",N0={default:new R({transparent:!0,opacity:.5,map:X0.load(Potree.resourcePath+"/textures/map_marker.png")}),selected:new R({transparent:!0,opacity:1,map:X0.load(Potree.resourcePath+"/textures/map_marker.png")})},e.images.panos.forEach(function(t){t.mapMarker=new Q(K0,N0.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=N0.selected,e.byMainView||t.dispatchEvent({type:"hoverOn",byMap:!0}),i.needRender=!0)}function n(e){e.byMap||(t.mapMarker.material=N0.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){Potree.Utils.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=q0,this.panosGroup=r,Potree.Utils.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=[W0.filters.isEnabled(),W0.filters.isVisible(),function(e){return e.position.clone().setZ(0).distanceTo(t)<20}],e=j.find(viewer.images360.panos,e,[W0.sortFunctions.floorDisSquaredToPoint(t)]))&&e!=viewer.images360.currentPano&&viewer.images360.flyToPano(e)}},{key:"fitPanosToViewport",value:function(){var e=viewer.images360.bound.size.clone().multiplyScalar(1.1),t=(e.max(new Oe(4,4,4)),viewer.images360.bound.center.clone());this.moveTo(t,e,0)}},{key:"fitToPointcloud",value:function(e){var t=1=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=J(X().mark(function e(){var l,t,u,c=this;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return((l={})[this.filename()]=this).hasChildren=!1,t="".concat(this.ept.url,"ept-hierarchy/").concat(this.filename(),".json"),e.next=6,fetch(t);case 6:return t=e.sent,e.next=9,t.json();case 9:u=e.sent,Object.keys(u).sort(function(e,t){var e=U(e.split("-").map(function(e){return parseInt(e,10)}),4),n=e[0],i=e[1],r=e[2],e=e[3],t=U(t.split("-").map(function(e){return parseInt(e,10)}),4),a=t[0],o=t[1],s=t[2],t=t[3];return n>1)+"-"+(r>>1)+"-"+(t>>1)];i&&(i.hasChildren=!0,r=i.key.step(a,o,s),(t=new Potree.PointCloudEptGeometryNode(c.ept,r.b,r.d,r.x,r.y,r.z)).level=n,t.numPoints=u[e],i.addChild(t),l[r.name()]=t)});case 12:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"doneLoading",value:function(e,t,n,i){e.boundingBox=this.boundingBox,this.geometry=e,this.tightBoundingBox=t,this.numPoints=n,this.mean=i,this.loaded=!0,this.loading=!1,--Potree.numNodesLoading}},{key:"toPotreeName",value:function(e,t,n,i){for(var r="r",a=0;a=Potree.config.testNodeCount1?this.nodeMaxLevel:Math.max(this.nodeMaxLevel,this.nodeMaxLevelPredict.max),t||Potree.settings.sizeFitToLevel){var t=this.temp.pointSize+":"+this.maxLevel+":"+n,r=this.temp.sizeFitToLevel[t];if(r)o=r;else{if(this.maxLevel==1/0)return;var r=this.material.spacing/Math.pow(2,this.maxLevel),a=0this.maxDepth)return e.abrupt("continue",10);e.next=9}else e.next=13;break;case 9:a.loaded?(n.push(a),W.lru.touch(a),this.highestLevelServed=Math.max(a.getLevel(),this.highestLevelServed),s=a.pcoGeometry,s=s?s.hierarchyStepSize:1,(0===a.getLevel()||a.level%s==0&&a.hasChildren)&&this.traverse(a)):(a.load(),this.priorityQueue.push(r));case 10:i++,e.next=4;break;case 13:if(!(0=Potree.maxNodesLoading||this.octreeGeometry.loader.load(this)}},{key:"getNumPoints",value:function(){return this.numPoints}},{key:"dispose",value:function(){if(this.geometry&&null!=this.parent){this.geometry.dispose(),this.geometry=null,this.loaded=!1;for(var e=0;e\n\n\t\t\t\n\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\n\t\t\t\n\n\t\t\t\n\t\t')),$(e.parentElement).append(r),n=new rm(this.viewer.scene.getActiveCamera().clone()),this.dispatchEvent({type:"start_inserting_clipping_volume"}),this.viewer.scene.addPolygonClipVolume(n),this.sceneMarker.add(n),i=function(i){i.button===oe.LEFT?(n.addMarker(),r.find("polyline").each(function(e,t){var n=r[0].createSVGPoint();n.x=i.offsetX,n.y=i.offsetY,t.points.appendItem(n)}),n.markers.length>o.maxPolygonVertices&&a.callback(),o.viewer.inputHandler.startDragging(n.markers[n.markers.length-1])):i.button===oe.RIGHT&&a.callback(i)},(a={callback:null}).callback=function(e){r.remove(),3\n\t\t\t\t\n\t\t\t\t\n\t\t\t')),this.elClose=this.element.find("img[name=close]"),this.elContainer=this.element.find("span[name=content_container]"),"string"==typeof t?this.elContainer.append($("".concat(t,""))):this.elContainer.append(t)},[{key:"setMessage",value:function(e){this.elContainer.empty(),"string"==typeof e?this.elContainer.append($("".concat(e,""))):this.elContainer.append(e)}}])}()),jh=function(){return A(function e(t){ue(this,e),this.potreeRenderer=t,this.threeRenderer=this.potreeRenderer.threeRenderer,this.target=new ti(2048,2048,{minFilter:N,magFilter:N,format:It,type:Ct}),this.target.depthTexture=new Gl,this.target.depthTexture.type=Et,this.threeRenderer.setClearColor(16711680,1);t=this.threeRenderer.getRenderTarget();this.threeRenderer.setRenderTarget(this.target),this.threeRenderer.clear(!0,!0,!0),this.threeRenderer.setRenderTarget(t)},[{key:"setLight",value:function(e){var t=180*(this.light=e).angle/Math.PI,n=e.shadow.mapSize.width/e.shadow.mapSize.height,i=0===e.distance?1e4:e.distance,t=(this.camera=new ya(t,n,.1,i),this.camera.up.set(0,0,1),this.camera.position.copy(e.position),(new Oe).subVectors(e.position,e.getWorldDirection(new Oe)));this.camera.lookAt(t),this.camera.updateProjectionMatrix(),this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.camera.matrixWorldInverse.copy(this.camera.matrixWorld).invert()}},{key:"setSize",value:function(e,t){this.target.width===e&&this.target.height===t||this.target.dispose(),this.target.setSize(e,t)}},{key:"render",value:function(e,t){this.threeRenderer.setClearColor(0,1);var n=this.threeRenderer.getRenderTarget();this.threeRenderer.setRenderTarget(this.target),this.threeRenderer.clear(!0,!0,!0),this.potreeRenderer.render(e,this.camera,this.target,{}),this.threeRenderer.setRenderTarget(n)}}])}(),zA=function(){function i(){function e(e){t.update(e)}var t,n=0'),n.className&&t.elem.addClass(n.className),t.elem.find("a").html(t.text),$("#potree_labels").append(t.elem),t.pos2d=new Oe,t.dom=n.dom||viewer.renderArea,t.camera=n.camera||viewer.scene.getActiveCamera();return viewer.addEventListener("camera_changed",e),t.addEventListener("dispose",function(){viewer.removeEventListener("camera_changed",e),t.dispose()}),t}return v(i,Qn),A(i,[{key:"update",value:function(){var e;this.position&&!this.elem.hasClass("unvisible")&&((e=ne.getPos2d(this.position,viewer.mainViewport,this.dom)).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()}}])}(),GA=new Th,HA=function(){function r(e,t){var n,i;for(i in ue(this,r),(n=le(this,r)).type=e,n.maxMarkers=Number.MAX_SAFE_INTEGER,n.transformData(t),t)n[i]=t[i];return(n.atPlane||n.showArea)&&n.closed&&"2d"==n.dimension&&(n.areaPlane=n.createAreaPlane(),n.add(n.areaPlane)),n.points=[],n.markers=[],n.edges=[],n.center,n}return v(r,Z),A(r,[{key:"initData",value:function(e){var n=this;if(e.dataset_points&&(this.dataset_points=e.dataset_points),e.datasetId&&(this.datasetId=e.datasetId),e.points_datasets&&(this.points_datasets=e.points_datasets),"merge"==Potree.settings.editType||"MulDistance Ring"==this.measureType)if(this.dataset_points){if(this.dataset_points=this.dataset_points.map(function(e){return e&&(new Oe).copy(e)}),e.points=this.dataset_points.map(function(e,t){return Potree.Utils.datasetPosTransform({fromDataset:!0,datasetId:n.points_datasets[t],position:e})}),e.points.some(function(e){return null==e}))return!1}else this.dataset_points=[];if(e.points){var t,i=q(e.points);try{for(i.s();!(t=i.n()).done;){var r=t.value,a=(new Oe).copy(r);this.addMarker({point:a})}}catch(e){i.e(e)}finally{i.f()}return"merge"!=Potree.settings.editType&&"MulDistance Ring"!=this.measureType&&(null!=this.datasetId?this.dataset_points&&(this.dataset_points=this.dataset_points.map(function(e){return e&&(new Oe).copy(e)}),this.transformByPointcloud()):e.dataset_points&&e.dataset_points.some(function(e){return null!=e})&&(console.error("存在测量线的datasetId为空而dataset_points有值,请检查并删除:"+this.sid),console.log(this))),this.facePlane=this.getFacePlane(),this.getPoint2dInfo(this.points),this.update({ifUpdateMarkers:!0}),this.setSelected(!1),this.markers.forEach(function(e){e.dispatchEvent("addHoverEvent")}),!0}}},{key:"addMarker",value:function(){var t,n=this,i=0Math.abs(p.z)?a.setZ(l[0].z):(a.setX(l[0].x),a.setY(l[0].y)));else{this.cannotConfirmNormal=!0;for(var u=this.isRect?1:r-2,c=0;cPotree.config.clickMaxDragDis)return this.continueDrag(null,e);if(e.hoverViewport!=e.drag.dragViewport)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.isNew&&this.dragMarker(e)}var t;return e.button!=oe.RIGHT&&("all"==this.isIntersectSelf&&this.isNew||this.isAtWrongPlace&&this.isNew||!e.isAtDomElement&&this.isNew||e.hoverViewport!=viewer.mainViewport&&this.unableDragAtMap||this.isNew&&!VA(this.points,this.points.length))?this.continueDrag(null,e):(-1!==(t=this.markers.indexOf(e.drag.object))&&(this.dispatchEvent({type:"marker_dropped",index:t}),2i.count&&(i={id:n,count:r[n]});this.datasetId=0"),o.setText(s),o.setPos(r),o.setVisible(!0);else{var t,n,i,r,o,s,l=function(e,t,n,i){a.setEdgeLabelPos(e,t,n),i=null==i?t.distanceTo(n):i;t=a.getConvertString(i,"distance");return e.setText(t),i},u=this.points.length-1,c=function(e){var t,n,i=a.getIndex(e,-1),r=a.getIndex(e,1),i=(a.points[i],a.points[e]),r=a.points[r];a.showDistances&&(t=a.edgeLabels[e],n=i.distanceTo(r),a.edges[e].distance_=n,t.shouldVisi=(ethis.points[1].z?(t=this.points[0],this.points[1]):(t=this.points[1],this.points[0]),i=new Oe(t.x,t.y,n.z),s=t.distanceTo(i)/n.distanceTo(i),r=Math.atan(s),this.shouldShowHorVerGuide=tyo:(d=n[p],h=n[u],Math.acos(d.dot(h))>t)),l.visiMap.set(r,c))}},{key:"setEdgeLabelPos",value:function(e,t,n){t=(new Oe).addVectors(t,n).multiplyScalar(.5);return e.setPos(t)}},{key:"cloneMarker",value:function(e,t){return this.addMarker({index:t,point:this.points[e],dataset_point:this.dataset_points&&this.dataset_points[e],points_dataset:this.points_datasets[e]})}},{key:"addMarker",value:function(){var i,r=this,e=0=this.points.length?0:(t=0===e?this.points[this.points.length-1]:this.points[e-1],n=this.points[e],e=this.points[(e+1)%this.points.length],this.getAngleBetweenLines(n,t,e))}},{key:"getCenter",value:function(e){var t;return this.center?this.center.clone():(t=this.points.reduce(function(e,t){return e.add(t)},new Oe),this.points.length&&t.multiplyScalar(1/this.points.length),t)}},{key:"createGuideLine",value:function(){var e=av.createFatLine([],{mat:this.getLineMat("guide")});e.visible=!1,this.guideLine=e,this.add(e)}},{key:"createHorVerGuideLine",value:function(){var e=av.createFatLine([],{mat:this.getLineMat("guide")}),e=(e.visible=!1,(this.verGuideEdge=e).name="verGuideEdge",av.createFatLine([],{mat:this.getLineMat("guide")}));e.visible=!1,e.name="horGuideEdge",this.horGuideEdge=e,this.add(this.verGuideEdge),this.add(this.horGuideEdge),this.verEdgeLabel=this.createEdgeLabel("verGuideEdge"),this.horEdgeLabel=this.createEdgeLabel("horGuideEdge")}},{key:"createEdgeLabel",value:function(e,t){var n=this,i={sizeInfo:ZA,name:e||"edgeLabel"},e=(e&&e.includes("Guide")&&(i.fontsize=12),new cv($.extend({},t?$A:ey,i)));return t&&(e.addEventListener("mouseover",function(){n.setSelected(!0,"edgeLabel")}),e.addEventListener("mouseleave",function(){n.setSelected(!1,"edgeLabel")}),e.addEventListener("click",function(){n.isNew||viewer.measuringTool.isAdding||viewer.focusOnObject(n,"measure")})),e.visible=!1,e.measure=this,e.sprite.material.depthTestWhenPick=!0,Potree.Utils.setObjectLayers(e,"measure"),this.add(e),"MulDistance"==this.measureType&&(e.visiMap=new Map),e}},{key:"createAreaLabel",value:function(){return this.createCenterLabel("areaLabel")}},{key:"createTotalDisLabel",value:function(){return this.createCenterLabel("totalDisLabel")}},{key:"createCenterLabel",value:function(e){var t=this,e=new cv($.extend({},$A,{sizeInfo:ZA,name:e,disToLine:0,fontsize:16*qA}));return e.addEventListener("mouseover",function(){t.isNew||t.setSelected(!0,"centerLabel")}),e.addEventListener("mouseleave",function(){t.isNew||t.setSelected(!1,"centerLabel")}),e.addEventListener("click",function(){t.isNew||viewer.measuringTool.isAdding||viewer.focusOnObject(t,"measure")}),Potree.Utils.setObjectLayers(e,"measure"),ne.updateVisible(e,"setVisible",!1),e}},{key:"getMarkerMaterial",value:function(e){return QA||(QA={default:new sv($.extend({},YA,{transparent:!0,opacity:1,map:WA.load(Potree.resourcePath+"/textures/pic_point_s32.png"),useDepth:!0,mapScale:XA})),select:new R({transparent:!0,opacity:1,depthTest:!1,map:WA.load(Potree.resourcePath+"/textures/pic_point32.png")})},(h.markerMats=QA).select.map.repeat.set(1/XA,1/XA),QA.select.map.offset.set((XA-1)/2/XA,(XA-1)/2/XA)),QA[e]}},{key:"getLineMat",value:function(e){return(h.lineMats=h.lineMats?h.lineMats:{edgeDefault:av.createFatLineMat($.extend({},YA,{color:yv.measure.default.color,lineWidth:yv.measure.lineWidth,useDepth:!0,dashWithDepth:!0,dashed:!0,dashSize:.04,gapSize:.04,transparent:!0,opacity:yv.measure.default.opacity,depthTestWhenPick:!0})),edgeSelect:av.createFatLineMat($.extend({},YA,{color:yv.measure.highlight.color,dashSize:.5,gapSize:.2,lineWidth:yv.measure.lineWidth,transparent:!0,opacity:yv.measure.highlight.opacity})),guide:av.createFatLineMat($.extend({},YA,{color:yv.measure.guide.color,dashSize:.1,gapSize:.02,dashed:!0,lineWidth:yv.measure.lineWidth/2}))})[e]}},{key:"createAreaPlane",value:function(){return jA||(jA={default:new sv($.extend({},YA,{color:JA,side:ve,opacity:.2,transparent:!0,useDepth:!0})),selected:new R({color:JA,side:ve,opacity:.3,transparent:!0})},h.planeMats=jA),I(h,"createAreaPlane",this,3)([jA.default])}},{key:"raycast",value:function(e,t){for(var n=0;nthis.volumeInfo.Vlower){for(var o=a.dig.length-1;0<=o;o--)if(this.volumeInfo.Vupper>=a.dig[o].min){l=a.dig[o].color;break}}else for(var s=a.fill.length-1;0<=s;s--)if(this.volumeInfo.Vlower>=a.fill[s].min){l=a.fill[s].color;break}var l,n=(l=new Se(l[0]/255,l[1]/255,l[2]/255)).getHexString();e?(Potree.Utils.updateVisible(this.areaPlane,"screenshot",!0,2,"add"),(e=oy[n])||(e=new R({color:l,transparent:!0,opacity:.6,side:ve}),oy[n]=e),this.oldAreaPlaneMat=this.areaPlane.material,this.areaPlane.material=e,i&&Potree.Utils.updateVisible(this.areaLabel,"screenshot-single",!1),r&&this.areaLabel.setText([this.name,this.area.string]),this.markers.forEach(function(e){return Potree.Utils.updateVisible(e,"screenshot-Prism",!1)}),this.edges.forEach(function(e){return Potree.Utils.updateVisible(e,"screenshot-Prism",!1)}),this.styleRecover=function(){t.areaPlane.material=t.oldAreaPlaneMat,i&&Potree.Utils.updateVisible(t.areaLabel,"screenshot-single",!0),r&&t.areaLabel.setText(t.area.string),t.markers.forEach(function(e){return Potree.Utils.updateVisible(e,"screenshot-Prism",!0)}),t.edges.forEach(function(e){return Potree.Utils.updateVisible(e,"screenshot-Prism",!0)}),t.styleRecover=null}):(this.styleRecover&&this.styleRecover(),Potree.Utils.updateVisible(this.areaPlane,"screenshot",!1,2,"cancel"))}},{key:"dispose",value:function(){I(i,"dispose",this,3)([]),this.clipBoxes.forEach(function(e){return viewer.scene.removeVolume(e)})}},{key:"setEditState",value:function(t){t=!!t,this.editing=t,this.dontHighlight=!t,this.clipBoxes.forEach(function(e){Potree.Utils.updateVisible(e,"hidden",t),e.clip=t})}}])}(),ly=function(){function a(e){ue(this,a),(t=le(this,a)).viewer=e,t.renderer=e.renderer,t.viewer.addEventListener("start_inserting_measurement",function(e){t.viewer.dispatchEvent({type:"cancel_insertions"})}),t.showLabels=!0,t.scene=new Fs,t.scene.name="scene_measurement",t.viewer.inputHandler.registerInteractiveScene(t.scene),t.history=new ay({applyData:function(e){if(e.measure.parent&&e.measure.visible)return(e=Potree.Common.CloneObject(e)).measure.reDraw(),e.measure.initData(e),e.measure.isNew=e.isNew,e.measure.dispatchEvent("changeByHistory"),e.measure.facePlane=e.facePlane&&e.facePlane.clone(),e.measure.cannotConfirmNormal=e.cannotConfirmNormal,!0},getData:function(e){return{measure:e,points:e.points.map(function(e){return e.clone()}),dataset_points:e.dataset_points?e.dataset_points.map(function(e){return e&&e.clone()}):null,points_datasets:e.points_datasets.slice(),datasetId:e.datasetId,isNew:e.isNew,facePlane:e.facePlane&&e.facePlane.clone(),cannotConfirmNormal:e.cannotConfirmNormal}}}),t.onRemove=function(e){e.measurement.dispose()},t.onAdd=function(e){t.scene.add(e.measurement)};var t,n,i=q(e.scene.measurements);try{for(i.s();!(n=i.n()).done;){var r=n.value;t.onAdd({measurement:r})}}catch(e){i.e(e)}finally{i.f()}return e.addEventListener("camera_changed",t.update.bind(t),{importance:10}),Potree.config.measure.mulLabelHideFaraway&&(e.addEventListener("raycaster",t.beforeDraw.bind(t),{importance:10}),e.addEventListener("render.begin",t.beforeDraw.bind(t),{importance:10}),e.addEventListener("render.begin2",t.beforeDraw.bind(t),{importance:10})),e.addEventListener("render.pass.perspective_overlay",t.render.bind(t)),e.addEventListener("scene_changed",t.onSceneChange.bind(t)),e.scene.addEventListener("measurement_added",t.onAdd),e.scene.addEventListener("measurement_removed",t.onRemove),e.addEventListener("resize",t.setSize.bind(t)),t}return v(a,Qn),A(a,[{key:"onSceneChange",value:function(e){e.oldScene&&(e.oldScene.removeEventListener("measurement_added",this.onAdd),e.oldScene.removeEventListener("measurement_removed",this.onRemove)),e.scene.addEventListener("measurement_added",this.onAdd),e.scene.addEventListener("measurement_removed",this.onRemove)}},{key:"createMeasureFromData",value:function(e){e=new("MulDistance Ring"==e.measureType?sy:iy)(e);if(!e.failBuilded)return viewer.scene.addMeasurement(e),e.guideLine&&(e.guideLine.visible=!1),e}},{key:"beforeDraw",value:function(a){"mapViewport"==a.viewport.name&&!viewer.mapViewer.attachedToViewer||viewer.scene.measurements.forEach(function(e){if("MulDistance"==e.measureType&&!(e.isNew?e.points.length<4:e.points.length<3))for(var t=e.points.length-1,n=0;n<=t;n++)if(e.closed||n!=t){var i=e.edgeLabels[n],r=i.visiMap.get(a.viewport.camera);if(null==r)return e.getEdgeLabelVisi(a.viewport);Potree.Utils.updateVisible(i,"tooFar",!1!==r)}})}},{key:"update",value:function(t){viewer.inputHandler.measuring&&Potree.settings.adsorption&&viewer.scene.measurements.forEach(function(e){e.getPointsPos2d(t.viewport,!0)}),Potree.config.measure.mulLabelHideFaraway&&(t.changeInfo.projectionChanged||"PerspectiveCamera"==t.viewport.camera.type&&t.changeInfo.positionChanged)&&viewer.scene.measurements.forEach(function(e){"MulDistance"!=e.measureType||(e.isNew?e.points.length<4:e.points.length<3)||e.getEdgeLabelVisi(t.viewport)})}},{key:"setSize",value:function(e){}},{key:"updateLabelZIndex",value:function(t){t.forEach(function(n,e){n.base=t[e-1]?t[e-1].base+t[e-1].labels.length:0,n.labels.sort(function(e,t){return t.pos2d.z-e.pos2d.z}).forEach(function(e,t){$(e.elem).css("z-index",n.base+t)})})}},{key:"changeEditMode",value:function(e){viewer.dispatchEvent({type:"CursorChange",action:"remove",name:"addPoint"}),viewer.dispatchEvent({type:"CursorChange",action:"remove",name:"delPoint"}),e&&("addPoint"==e?viewer.dispatchEvent({type:"CursorChange",action:"add",name:"addPoint"}):viewer.dispatchEvent({type:"CursorChange",action:"add",name:"delPoint"})),this.editMode=e}},{key:"editStateChange",value:function(e){e.state||viewer.scene.measurements.some(function(e){return e.isEditing})?viewer.dispatchEvent({type:"measureMovePoint"}):viewer.dispatchEvent({type:"endMeasureMove"})}},{key:"startInsertion",value:function(){var n,i=this,r=0=s.maxMarkers?u({finish:!0}):(i.history.beforeChange(s),t=s.cloneMarker(n-1,n),r.isRect&&3==s.markers.length?s.cloneMarker(0,3):(s.markers[n].visible=!1,s.edges[n].visible=!1),s.edges[n-1].visible=!0,s.markers[n-1].visible=!0,t.isDragging=!0,i.history.afterChange(s),s.continueDrag(t,e)):e.button===oe.RIGHT&&(!(e.pressDistancer.minMarkers&&(s.removeMarker(s.points.length-1),s.markers[0].removeEventListener("mouseover",d),s.markers[0].removeEventListener("mouseleave",h),s.markers[0].removeEventListener("click",c),e.byClickMarker)&&s.markers.length>r.minMarkers&&Date.now()-t.createTime<10&&s.removeMarker(s.points.length-1),s.isNew=!1,s.points.length);if(t&&(s.markers[t-1].visible=!0,s.edges[t-1].visible=!!s.closed,s.markers.forEach(function(e){e.dispatchEvent("addHoverEvent")}),s.edges.forEach(function(e){e.dispatchEvent("addHoverEvent")}),s.update()),clearTimeout(n),i.viewer.removeEventListener("cancel_insertions",c),i.viewer.removeEventListener("global_click",p),i.viewer.removeEventListener("global_mousemove",f),viewer.dispatchEvent({type:"CursorChange",action:"remove",name:"polygon_AtWrongPlace"}),viewer.inputHandler.dispatchEvent({type:"measuring",v:!1,cause:"stopInsertion",situation:"adding",object:s}),s.atPlane&&s.closed&&!s.isRect&&s.point2dInfo&&s.intersectSelf(s.point2dInfo.points2d))return o&&o();e.remove||a&&a(),i.isAdding=!1,s.dispatchEvent("createDone")}},c=(s.addEventListener("finish",u),function(e){e.measure&&e.measure!=s||!viewer.scene.measurements.includes(s)||!s.isNew||(!e.remove&&"cancel_insertions"!=e.type||viewer.scene.removeMeasurement(s),s.editStateChange(!1),s.cannotConfirmNormal=!1,s.guideLine&&(s.guideLine.visible=!1),u({finish:!0,remove:e.remove,byClickMarker:"click"==e.type}),i.viewer.inputHandler.drag&&(i.viewer.inputHandler.drag.object=null))}),d=(this.viewer.addEventListener("cancel_insertions",c),function(e){s.setMarkerSelected(e.object,"hover","single")}),h=function(e){s.setMarkerSelected(e.object,"unhover","single")},p=function(e){var t;if(!f(e)&&(!e.clickElement&&e.button!==oe.RIGHT))return(t=e.intersect&&(e.intersect.orthoIntersect||e.intersect.location))?("mapViewport"==e.drag.dragViewport.name&&(t=t.clone().setZ(viewer.mainViewport.camera.position.z)),(t=s.addMarker({point:t})).isDragging=!0,i.viewer.inputHandler.startDragging(t,{endDragFun:l,notPressMouse:!0}),e.drag=i.viewer.inputHandler.drag,s.dragMarker(e),s.dropMarker(e),1>>21,11),e.y=yy(t>>>11,10),e.z=yy(t,11)}function by(e,t,n){return e*(1-n)+t*n}function xy(e,t){return null==(e=e.properties.find(function(e){return e.name===t&&e.storage}))?void 0:e.storage}var Ey,Cy,By,My,Sy,Ty,_y,Py,Dy,Iy,ky,Ry,Ly,Fy,Oy,Uy,Nh=function(){function a(e){ue(this,a),(t=le(this,a)).viewer=e,t.renderer=e.renderer,t.addEventListener("start_inserting_profile",function(e){t.viewer.dispatchEvent({type:"cancel_insertions"})}),t.scene=new Fs,t.scene.name="scene_profile",t.light=new gd(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 t,n,i=q(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(t)),e.addEventListener("render.pass.perspective_overlay",t.render.bind(t)),e.addEventListener("scene_changed",t.onSceneChange.bind(t)),e.scene.addEventListener("profile_added",t.onAdd),e.scene.addEventListener("profile_removed",t.onRemove),t}return v(a,mm),A(a,[{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(){function t(e){var t,n,i;e.button===oe.LEFT?(a.points.length<=1&&(t=(i=r.viewer.scene.getActiveCamera()).position.distanceTo(a.points[0]),n=r.viewer.renderer.getSize(new Re),i=ne.projectedRadius(1,i,t,n.width,n.height),a.setWidth(10/i)),a.addMarker(a.points[a.points.length-1].clone()),r.viewer.inputHandler.startDragging(a.spheres[a.spheres.length-1])):e.button===oe.RIGHT&&o.callback()}var r=this,e=0')),w=($(e.parentElement).append(y),y.css("right","10px"),y.css("bottom","10px"),function(e){A.visible=!0;var t=e.drag.start,n=e.drag.end,i=new Bh,t=(i.expandByPoint(t),i.expandByPoint(n),y.css("left","".concat(i.min.x,"px")),y.css("top","".concat(i.min.y,"px")),y.css("width","".concat(i.max.x-i.min.x,"px")),y.css("height","".concat(i.max.y-i.min.y,"px")),e.viewer.scene.getActiveCamera()),n=e.viewer.renderer.getSize(new Re),i=new Re(t.right-t.left,t.top-t.bottom),r=(new Re).addVectors(e.drag.end,e.drag.start).multiplyScalar(.5),r=ne.mouseToRay(r,t,n.width,n.height),a=(new Re).subVectors(e.drag.end,e.drag.start);a.divide(n).multiply(i),A.position.copy(r.origin),A.up.copy(t.up),A.rotation.copy(t.rotation),A.scale.set(a.x,a.y,1e5),e.consume()}),b=function(e){g.importance=0,$(y).remove(),g.viewer.inputHandler.deselectAll(),g.viewer.inputHandler.toggleSelection(A);var t,n,i,r=e.viewer.scene.getActiveCamera(),a=e.viewer.renderer.getSize(new Re),e=(new Re).addVectors(e.drag.end,e.drag.start).multiplyScalar(.5),o=ne.mouseToRay(e,r,a.width,a.height),s=(new Th(o.origin,(new Oe).addVectors(o.origin,o.direction)),g.removeEventListener("drag",w),g.removeEventListener("drop",b),[]),l=[],u=q(g.viewer.scene.pointclouds);try{for(u.s();!(t=u.n()).done;){var c,d,h,p,f,m,v=t.value;v.visible&&((c=r.clone()).left=-A.scale.x/2,c.right=+A.scale.x/2,c.top=+A.scale.y/2,c.bottom=-A.scale.y/2,c.near=-A.scale.z/2,c.far=+A.scale.z/2,c.rotation.copy(A.rotation),c.position.copy(A.position),c.updateMatrix(),c.updateMatrixWorld(),c.updateProjectionMatrix(),c.matrixWorldInverse.copy(c.matrixWorld).invert(),d=new _i(c.getWorldPosition(new Oe),c.getWorldDirection(new Oe)),h=new _i(d.origin.clone().add(d.direction.clone().multiplyScalar(A.scale.z)),d.direction.clone().multiplyScalar(-1)),p={width:8,height:8,pickWindowSize:8,all:!0,pickClipped:!0,pointSizeType:_m.FIXED,pointSize:1},f=v.pick(viewer,c,d,p),c.rotateX(Math.PI),c.updateMatrix(),c.updateMatrixWorld(),c.updateProjectionMatrix(),c.matrixWorldInverse.copy(c.matrixWorld).invert(),m=v.pick(viewer,c,h,p),s.push.apply(s,Fe(f)),l.push.apply(l,Fe(m)))}}catch(e){u.e(e)}finally{u.f()}0 all splat arrays must have the same spherical harmonics degree.");i=a.sphericalHarmonicsDegree}}for(var o=Re.calculateComponentStorage(t,i),z=o.bytesPerCenter,G=o.bytesPerScale,H=o.bytesPerRotation,V=o.bytesPerColor,Q=o.sphericalHarmonicsComponentsPerSplat,j=o.sphericalHarmonicsBytesPerSplat,W=o.bytesPerSplat,s=Re.CompressionLevels[t].ScaleRange,l=[],J=[],q=0,u=new Le.Quaternion,c=0;co.x)&&(o.x=l[0]),(0===s||l[1]o.y)&&(o.y=l[1]),(0===s||l[2]o.z)&&(o.z=l[2])}for(var u=(new Le.Vector3).copy(o).sub(a),c=Math.ceil(u.y/t),d=Math.ceil(u.z/t),h=new Le.Vector3,p=[],f={},m=0;m=n&&(p.push(A),f[g]=null)}var y,w,b=[];for(y in f)f.hasOwnProperty(y)&&(w=f[y])&&b.push(w);return{fullBuckets:p,partiallyFullBuckets:b}}}])}(),tw=F,nw=(Y(F,"CurrentMajorVersion",0),Y(F,"CurrentMinorVersion",1),Y(F,"CenterComponentCount",3),Y(F,"ScaleComponentCount",3),Y(F,"RotationComponentCount",4),Y(F,"ColorComponentCount",4),Y(F,"CovarianceComponentCount",6),Y(F,"SplatScaleOffsetFloat",3),Y(F,"SplatRotationOffsetFloat",6),Y(F,"CompressionLevels",{0:{BytesPerCenter:12,BytesPerScale:12,BytesPerRotation:16,BytesPerColor:4,ScaleOffsetBytes:12,RotationffsetBytes:24,ColorOffsetBytes:40,SphericalHarmonicsOffsetBytes:44,ScaleRange:1,BytesPerSphericalHarmonicsComponent:4,SphericalHarmonicsOffsetFloat:11,SphericalHarmonicsDegrees:{0:{BytesPerSplat:44},1:{BytesPerSplat:80},2:{BytesPerSplat:140}}},1:{BytesPerCenter:6,BytesPerScale:6,BytesPerRotation:8,BytesPerColor:4,ScaleOffsetBytes:6,RotationffsetBytes:12,ColorOffsetBytes:20,SphericalHarmonicsOffsetBytes:24,ScaleRange:32767,BytesPerSphericalHarmonicsComponent:2,SphericalHarmonicsOffsetFloat:12,SphericalHarmonicsDegrees:{0:{BytesPerSplat:24},1:{BytesPerSplat:42},2:{BytesPerSplat:72}}},2:{BytesPerCenter:6,BytesPerScale:6,BytesPerRotation:8,BytesPerColor:4,ScaleOffsetBytes:6,RotationffsetBytes:12,ColorOffsetBytes:20,SphericalHarmonicsOffsetBytes:24,ScaleRange:32767,BytesPerSphericalHarmonicsComponent:1,SphericalHarmonicsOffsetFloat:12,SphericalHarmonicsDegrees:{0:{BytesPerSplat:24},1:{BytesPerSplat:33},2:{BytesPerSplat:48}}}}),Y(F,"CovarianceSizeFloats",6),Y(F,"HeaderSizeBytes",4096),Y(F,"SectionHeaderSizeBytes",1024),Y(F,"BucketStorageSizeBytes",12),Y(F,"BucketStorageSizeFloats",3),Y(F,"BucketBlockSize",5),Y(F,"BucketSize",256),Y(F,"computeCovariance",(By=new Le.Matrix4,My=new Le.Matrix3,Sy=new Le.Matrix3,Ty=new Le.Matrix3,_y=new Le.Matrix3,Py=new Le.Matrix3,Dy=new Le.Matrix3,function(e,t,n,i){var r=4=nw.length&&!function(e,t){if(e.length>>20,10)-.5)*o,d=(yy(n>>>10,10)-.5)*o,h=(yy(n,10)-.5)*o,p=Math.sqrt(1-(c*c+d*d+h*h));switch(n>>>30){case 0:u.set(p,c,d,h);break;case 1:u.set(c,p,d,h);break;case 2:u.set(c,d,p,h);break;case 3:u.set(c,d,h,p)}return wy(Ry,r[e]),o=Ly,n=s[e],o.x=yy(n>>>24,8),o.y=yy(n>>>16,8),o.z=yy(n>>>8,8),o.w=yy(n,8),l[Fy.X]=by(i.minX[t],i.maxX[t],Iy.x),l[Fy.Y]=by(i.minY[t],i.maxY[t],Iy.y),l[Fy.Z]=by(i.minZ[t],i.maxZ[t],Iy.z),l[Fy.ROTATION0]=ky.x,l[Fy.ROTATION1]=ky.y,l[Fy.ROTATION2]=ky.z,l[Fy.ROTATION3]=ky.w,l[Fy.SCALE0]=Math.exp(by(a.minScaleX[t],a.maxScaleX[t],Ry.x)),l[Fy.SCALE1]=Math.exp(by(a.minScaleY[t],a.maxScaleY[t],Ry.y)),l[Fy.SCALE2]=Math.exp(by(a.minScaleZ[t],a.maxScaleZ[t],Ry.z)),l[Fy.FDC0]=cy(Math.floor(255*Ly.x),0,255),l[Fy.FDC1]=cy(Math.floor(255*Ly.y),0,255),l[Fy.FDC2]=cy(Math.floor(255*Ly.z),0,255),l[Fy.OPACITY]=cy(Math.floor(255*Ly.w),0,255),l})),function(){function S(){ue(this,S)}return A(S,null,[{key:"checkTextForEndHeader",value:function(e){return!!e.includes(S.HeaderEndToken)}},{key:"checkBufferForEndHeader",value:function(e,t,n,i){e=new Uint8Array(e,Math.max(0,t-n),n),t=i.decode(e);return S.checkTextForEndHeader(t)}},{key:"decodeHeaderText",value:function(e){for(var t=e.split("\n"),n=[],i=0,r={},a=!1,o=0;o=e.byteLength)throw new Error("End of file reached while searching for end of header");var r=new Uint8Array(e,n,100);if(i+=t.decode(r),S.checkBufferForEndHeader(e,n+=100,200,t))break}return S.decodeHeaderText(i)}},{key:"findVertexData",value:function(e,t){return new DataView(e,t.headerSizeBytes)}},{key:"readRawVertexFast",value:function(e,t,n,i,r,a){var o,s=a||{},l=q(i);try{for(l.s();!(o=l.n()).done;){var u=o.value,c=r[u];"float"===c?s[u]=e.getFloat32(t+n[u],!0):"double"===c?s[u]=e.getFloat64(t+n[u],!0):"uchar"===c&&(s[u]=e.getUint8(t+n[u])/255)}}catch(e){l.e(e)}finally{l.f()}}},{key:"parseToUncompressedSplatBufferSection",value:function(e,t,n,i,r,a,o){for(var s=7=r)&&(ow.readElementData(k.chunkElement,y,k.headerSizeBytes),P=_=r,S=!0):(I+=L.decode(n),sw.checkTextForEndHeader(I)&&(k=sw.decodeHeaderText(I),b=Math.min(b,k.sphericalHarmonicsDegree),(T=k.compressed)?(k=ow.decodeHeaderText(I),C=k.vertexElement.count):(C=k.splatCount,S=!0),r=F.CompressionLevels[0].SphericalHarmonicsDegrees[b],n=E+r.BytesPerSplat*C,g=new ArrayBuffer(n),F.writeHeaderToBuffer({versionMajor:F.CurrentMajorVersion,versionMinor:F.CurrentMinorVersion,maxSectionCount:1,sectionCount:1,maxSplatCount:C,splatCount:B,compressionLevel:0,sceneCenter:new Le.Vector3},g),_=k.headerSizeBytes,P=k.headerSizeBytes,M=!0)),M&&S)){if(0=n||e.versionMajor>t)return!0;throw new Error("KSplat version not supported: v".concat(e.versionMajor,".").concat(e.versionMinor,". ")+"Minimum required: v".concat(t,".").concat(n))}},{key:"loadFromURL",value:function(e,i,r,l){function a(){if(v&&!x&&(x=b<=A,w=F.HeaderSizeBytes+F.SectionHeaderSizeBytes*d.maxSectionCount&&(g=!0,new Blob(E).arrayBuffer().then(function(e){v=!(g=!1),s=new ArrayBuffer(d.maxSectionCount*F.SectionHeaderSizeBytes),new Uint8Array(s).set(new Uint8Array(e,F.HeaderSizeBytes,d.maxSectionCount*F.SectionHeaderSizeBytes)),m=F.parseSectionHeaders(d,s,0,!1);for(var t=0,n=0;n=F.HeaderSizeBytes&&(f=!0,new Blob(E).arrayBuffer().then(function(e){o=new ArrayBuffer(F.HeaderSizeBytes),new Uint8Array(o).set(new Uint8Array(e,0,F.HeaderSizeBytes)),M.checkVersion(o),p=!(f=!1),d=F.parseHeader(o),window.setTimeout(function(){B()},1)})),B(),a()),i&&i(e,t,dw)},!r).then(function(e){return i&&i(0,"0%",hw),(r?t:M.loadFromFileData(e)).then(function(e){return i&&i(100,"100%",pw),e})})}},{key:"loadFromFileData",value:function(e){return py(function(){return M.checkVersion(e),new F(e)})}}])}(),xw=(Y(bw,"downloadFile",function(e,t){e=new Blob([e.bufferData],{type:"application/octet-stream"});gw||(gw=document.createElement("a"),document.body.appendChild(gw)),gw.download=t,gw.href=URL.createObjectURL(e),gw.click()}),{Splat:0,KSplat:1,Ply:2}),Ru=Object.freeze({__proto__:null,sceneFormatFromPath:vw}),Ew={type:"change"},Cw={type:"start"},Bw={type:"end"},Mw=new Le.Ray,Sw=new Le.Plane,Tw=Math.cos(70*Le.MathUtils.DEG2RAD),_w=function(){function se(r,t){ue(this,se),(e=le(this,se)).object=r,e.domElement=t,e.domElement.style.touchAction="none",e.enabled=!0,e.target=new Le.Vector3,e.minDistance=0,e.maxDistance=1/0,e.minZoom=0,e.maxZoom=1/0,e.minPolarAngle=0,e.maxPolarAngle=Math.PI,e.minAzimuthAngle=-1/0,e.maxAzimuthAngle=1/0,e.enableDamping=!1,e.dampingFactor=.05,e.enableZoom=!0,e.zoomSpeed=1,e.enableRotate=!0,e.rotateSpeed=1,e.enablePan=!0,e.panSpeed=1,e.screenSpacePanning=!0,e.keyPanSpeed=7,e.zoomToCursor=!1,e.autoRotate=!1,e.autoRotateSpeed=2,e.keys={LEFT:"KeyA",UP:"KeyW",RIGHT:"KeyD",BOTTOM:"KeyS"},e.mouseButtons={LEFT:Le.MOUSE.ROTATE,MIDDLE:Le.MOUSE.DOLLY,RIGHT:Le.MOUSE.PAN},e.touches={ONE:Le.TOUCH.ROTATE,TWO:Le.TOUCH.DOLLY_PAN},e.target0=e.target.clone(),e.position0=e.object.position.clone(),e.zoom0=e.object.zoom,e._domElementKeyEvents=null,e.getPolarAngle=function(){return m.phi},e.getAzimuthalAngle=function(){return m.theta},e.getDistance=function(){return this.object.position.distanceTo(this.target)},e.listenToKeyEvents=function(e){e.addEventListener("keydown",ie),this._domElementKeyEvents=e},e.stopListenToKeyEvents=function(){this._domElementKeyEvents.removeEventListener("keydown",ie),this._domElementKeyEvents=null},e.saveState=function(){h.target0.copy(h.target),h.position0.copy(h.object.position),h.zoom0=h.object.zoom},e.reset=function(){h.target.copy(h.target0),h.object.position.copy(h.position0),h.object.zoom=h.zoom0,this.clearDampedRotation(),this.clearDampedPan(),h.object.updateProjectionMatrix(),h.dispatchEvent(Ew),h.update(),f=p.NONE},e.clearDampedRotation=function(){v.theta=0,v.phi=0},e.clearDampedPan=function(){A.set(0,0,0)},e.update=(a=new Le.Vector3,o=(new Le.Quaternion).setFromUnitVectors(r.up,new Le.Vector3(0,1,0)),s=o.clone().invert(),l=new Le.Vector3,u=new Le.Quaternion,c=new Le.Vector3,d=2*Math.PI,function(){o.setFromUnitVectors(r.up,new Le.Vector3(0,1,0)),s.copy(o).invert();var e,t=h.object.position,n=(a.copy(t).sub(h.target),a.applyQuaternion(o),m.setFromVector3(a),h.autoRotate&&f===p.NONE&&D(2*Math.PI/60/60*h.autoRotateSpeed),h.enableDamping?(m.theta+=v.theta*h.dampingFactor,m.phi+=v.phi*h.dampingFactor):(m.theta+=v.theta,m.phi+=v.phi),h.minAzimuthAngle),i=h.maxAzimuthAngle,n=(isFinite(n)&&isFinite(i)&&(n<-Math.PI?n+=d:n>Math.PI&&(n-=d),i<-Math.PI?i+=d:i>Math.PI&&(i-=d),m.theta=n<=i?Math.max(n,Math.min(i,m.theta)):m.theta>(n+i)/2?Math.max(n,m.theta):Math.min(i,m.theta)),m.phi=Math.max(h.minPolarAngle,Math.min(h.maxPolarAngle,m.phi)),m.makeSafe(),!0===h.enableDamping?h.target.addScaledVector(A,h.dampingFactor):h.target.add(A),h.zoomToCursor&&T||h.object.isOrthographicCamera?m.radius=j(m.radius):m.radius=j(m.radius*g),a.setFromSpherical(m),a.applyQuaternion(s),t.copy(h.target).add(a),h.object.lookAt(h.target),!0===h.enableDamping?(v.theta*=1-h.dampingFactor,v.phi*=1-h.dampingFactor,A.multiplyScalar(1-h.dampingFactor)):(v.set(0,0,0),A.set(0,0,0)),!1);return h.zoomToCursor&&T?(i=null,h.object.isPerspectiveCamera?(i=j((t=a.length())*g),h.object.position.addScaledVector(U,t-i),h.object.updateMatrixWorld()):h.object.isOrthographicCamera?((t=new Le.Vector3(S.x,S.y,0)).unproject(h.object),h.object.zoom=Math.max(h.minZoom,Math.min(h.maxZoom,h.object.zoom/g)),h.object.updateProjectionMatrix(),n=!0,(e=new Le.Vector3(S.x,S.y,0)).unproject(h.object),h.object.position.sub(e).add(t),h.object.updateMatrixWorld(),i=a.length()):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),h.zoomToCursor=!1),null!==i&&(this.screenSpacePanning?h.target.set(0,0,-1).transformDirection(h.object.matrix).multiplyScalar(i).add(h.object.position):(Mw.origin.copy(h.object.position),Mw.direction.set(0,0,-1).transformDirection(h.object.matrix),Math.abs(h.object.up.dot(Mw.direction))O||8*(1-u.dot(h.object.quaternion))>O||0\n #include \n varying vec2 vUv;\n uniform sampler2D sourceColorTexture;\n uniform sampler2D sourceDepthTexture;\n void main() {\n vec4 color = texture2D(sourceColorTexture, vUv);\n float fragDepth = texture2D(sourceDepthTexture, vUv).x;\n gl_FragDepth = fragDepth;\n gl_FragColor = vec4(color.rgb, color.a * 2.0);\n }\n ",uniforms:{sourceColorTexture:{type:"t",value:null},sourceDepthTexture:{type:"t",value:null}},depthWrite:!1,depthTest:!1,transparent:!0,blending:Le.CustomBlending,blendSrc:Le.SrcAlphaFactor,blendSrcAlpha:Le.SrcAlphaFactor,blendDst:Le.OneMinusSrcAlphaFactor,blendDstAlpha:Le.OneMinusSrcAlphaFactor});e.extensions.fragDepth=!0,this.renderTargetCopyQuad=new Le.Mesh(new Le.PlaneGeometry(2,2),e),this.renderTargetCopyCamera=new Le.OrthographicCamera(-1,1,1,-1,0,1)}},{key:"destroyRenderTargetCopyObjects",value:function(){this.renderTargetCopyQuad&&(hy(this.renderTargetCopyQuad),this.renderTargetCopyQuad=null)}},{key:"setupMeshCursor",value:function(){var e,t,n,i,r;this.meshCursor||(r=new Le.ConeGeometry(.5,1.5,32),e=new Le.MeshBasicMaterial({color:16777215}),(t=new Le.Mesh(r,e)).rotation.set(0,0,Math.PI),t.position.set(0,1,0),(n=new Le.Mesh(r,e)).position.set(0,-1,0),(i=new Le.Mesh(r,e)).rotation.set(0,0,Math.PI/2),i.position.set(1,0,0),(r=new Le.Mesh(r,e)).rotation.set(0,0,-Math.PI/2),r.position.set(-1,0,0),this.meshCursor=new Le.Object3D,this.meshCursor.add(t),this.meshCursor.add(n),this.meshCursor.add(i),this.meshCursor.add(r),this.meshCursor.scale.set(.1,.1,.1),this.threeScene.add(this.meshCursor),this.meshCursor.visible=!1)}},{key:"destroyMeshCursor",value:function(){this.meshCursor&&(hy(this.meshCursor),this.threeScene.remove(this.meshCursor),this.meshCursor=null)}},{key:"setMeshCursorVisibility",value:function(e){this.meshCursor.visible=e}},{key:"getMeschCursorVisibility",value:function(){return this.meshCursor.visible}},{key:"setMeshCursorPosition",value:function(e){this.meshCursor.position.copy(e)}},{key:"positionAndOrientMeshCursor",value:function(e,t){this.meshCursor.position.copy(e),this.meshCursor.up.copy(t.up),this.meshCursor.lookAt(t.position)}},{key:"setupFocusMarker",value:function(){var e,t;this.focusMarker||(e=new Le.SphereGeometry(.5,32,32),(t=s.buildFocusMarkerMaterial()).depthTest=!1,t.depthWrite=!1,t.transparent=!0,this.focusMarker=new Le.Mesh(e,t))}},{key:"destroyFocusMarker",value:function(){this.focusMarker&&(hy(this.focusMarker),this.focusMarker=null)}},{key:"setFocusMarkerVisibility",value:function(e){this.focusMarker.visible=e}},{key:"setFocusMarkerOpacity",value:function(e){this.focusMarker.material.uniforms.opacity.value=e,this.focusMarker.material.uniformsNeedUpdate=!0}},{key:"getFocusMarkerOpacity",value:function(){return this.focusMarker.material.uniforms.opacity.value}},{key:"setupControlPlane",value:function(){var e,t,n;this.controlPlane||((e=new Le.PlaneGeometry(1,1)).rotateX(-Math.PI/2),(n=new Le.MeshBasicMaterial({color:16777215})).transparent=!0,n.opacity=.6,n.depthTest=!1,n.depthWrite=!1,n.side=Le.DoubleSide,e=new Le.Mesh(e,n),(n=new Le.Vector3(0,1,0)).normalize(),t=new Le.Vector3(0,0,0),n=new kw(n,t,.5,.01,56576,.1,.03),this.controlPlane=new Le.Object3D,this.controlPlane.add(e),this.controlPlane.add(n))}},{key:"destroyControlPlane",value:function(){this.controlPlane&&(hy(this.controlPlane),this.controlPlane=null)}},{key:"setControlPlaneVisibility",value:function(e){this.controlPlane.visible=e}},{key:"addDebugMeshes",value:function(){this.debugRoot=this.createDebugMeshes(),this.secondaryDebugRoot=this.createSecondaryDebugMeshes(),this.threeScene.add(this.debugRoot),this.threeScene.add(this.secondaryDebugRoot)}},{key:"destroyDebugMeshes",value:function(){for(var e=0,t=[this.debugRoot,this.secondaryDebugRoot];e\n varying float ndcDepth;\n\n void main() {\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position.xyz, 1.0);\n ndcDepth = gl_Position.z / gl_Position.w;\n gl_Position.x = gl_Position.x / gl_Position.w;\n gl_Position.y = gl_Position.y / gl_Position.w;\n gl_Position.z = 0.0;\n gl_Position.w = 1.0;\n \n }\n ",fragmentShader:"\n #include \n uniform vec3 color;\n varying float ndcDepth;\n void main() {\n gl_FragDepth = (ndcDepth + 1.0) / 2.0;\n gl_FragColor = vec4(color.rgb, 0.0);\n }\n ",transparent:!1,depthTest:!0,depthWrite:!0,side:Le.FrontSide});return e.extensions.fragDepth=!0,e}},{key:"buildFocusMarkerMaterial",value:function(e){e={color:{type:"v3",value:new Le.Color(e)},realFocusPosition:{type:"v3",value:new Le.Vector3},viewport:{type:"v2",value:new Le.Vector2},opacity:{value:0}};return new Le.ShaderMaterial({uniforms:e,vertexShader:"\n #include \n\n uniform vec2 viewport;\n uniform vec3 realFocusPosition;\n\n varying vec4 ndcPosition;\n varying vec4 ndcCenter;\n varying vec4 ndcFocusPosition;\n\n void main() {\n float radius = 0.01;\n\n vec4 viewPosition = modelViewMatrix * vec4(position.xyz, 1.0);\n vec4 viewCenter = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n\n vec4 viewFocusPosition = modelViewMatrix * vec4(realFocusPosition, 1.0);\n\n ndcPosition = projectionMatrix * viewPosition;\n ndcPosition = ndcPosition * vec4(1.0 / ndcPosition.w);\n ndcCenter = projectionMatrix * viewCenter;\n ndcCenter = ndcCenter * vec4(1.0 / ndcCenter.w);\n\n ndcFocusPosition = projectionMatrix * viewFocusPosition;\n ndcFocusPosition = ndcFocusPosition * vec4(1.0 / ndcFocusPosition.w);\n\n gl_Position = projectionMatrix * viewPosition;\n\n }\n ",fragmentShader:"\n #include \n uniform vec3 color;\n uniform vec2 viewport;\n uniform float opacity;\n\n varying vec4 ndcPosition;\n varying vec4 ndcCenter;\n varying vec4 ndcFocusPosition;\n\n void main() {\n vec2 screenPosition = vec2(ndcPosition) * viewport;\n vec2 screenCenter = vec2(ndcCenter) * viewport;\n\n vec2 screenVec = screenPosition - screenCenter;\n\n float projectedRadius = length(screenVec);\n\n float lineWidth = 0.0005 * viewport.y;\n float aaRange = 0.0025 * viewport.y;\n float radius = 0.06 * viewport.y;\n float radDiff = abs(projectedRadius - radius) - lineWidth;\n float alpha = 1.0 - clamp(radDiff / 5.0, 0.0, 1.0); \n\n gl_FragColor = vec4(color.rgb, alpha * opacity);\n }\n ",transparent:!0,depthTest:!1,depthWrite:!1,side:Le.FrontSide})}}])}(),Lw=new Le.Vector3(1,0,0),Fw=new Le.Vector3(0,1,0),Ow=new Le.Vector3(0,0,1),Uw=function(){return A(function e(){var l,u,c,d,a,t=0e.max.x+n||t.ye.max.y+n||t.ze.max.z+n)}}])}(),Nw=function(){function t(){ue(this,t),this.origin=new Le.Vector3,this.normal=new Le.Vector3,this.distance=0,this.splatIndex=0}return A(t,[{key:"set",value:function(e,t,n,i){this.origin.copy(e),this.normal.copy(t),this.distance=n,this.splatIndex=i}},{key:"clone",value:function(){var e=new t;return e.origin.copy(this.origin),e.normal.copy(this.normal),e.distance=this.distance,e.splatIndex=this.splatIndex,e}}])}(),zw=A(function e(t,n){var i,s,l,u,c,d,h,p,f,m,v,g,A,y,w,b,x,E,r=2 Unsupported camera type");this.ray.origin.set(i.x,i.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld)}this.camera=e})),Y(this,"intersectSplatMesh",(s=new Le.Matrix4,l=new Le.Matrix4,u=new Le.Matrix4,c=new Uw,d=new Le.Vector3,function(e){var t=this,n=1t.distance?1:-1}),n}})),Y(this,"castRayAtSplatTreeNode",(h=new Le.Vector4,p=new Le.Vector3,f=new Le.Vector3,m=new Le.Quaternion,v=new Nw,g=new Le.Vector3(0,0,0),A=new Le.Matrix4,y=new Le.Matrix4,w=new Le.Matrix4,b=new Le.Matrix4,x=new Le.Matrix4,E=new Uw,function(e,t,n){var i=3=this.min[0]&&e[0]<=this.max[0]&&e[1]>=this.min[1]&&e[1]<=this.max[1]&&e[2]>=this.min[2]&&e[2]<=this.max[2]}}])}(),v=A(function e(t,n){ue(this,e),this.maxDepth=t,this.maxCentersPerNode=n,this.sceneDimensions=[],this.sceneMin=[],this.sceneMax=[],this.rootNode=null,this.addedIndexes={},this.nodesWithIndexes=[],this.splatMesh=null,this.disposed=!1}),E=A(function e(t,n,i,r){ue(this,e),this.min=[t[0],t[1],t[2]],this.max=[n[0],n[1],n[2]],this.center=[.5*(n[0]-t[0])+t[0],.5*(n[1]-t[1])+t[1],.5*(n[2]-t[2])+t[2]],this.depth=i,this.children=[],this.data=null,this.id=r||a++});function e(e,t,n,i){return r.apply(this,arguments)}processSplatTreeNode=(r=function(e,t,n,i){var r=t.data.indexes.length;if(re.maxDepth){for(var a=[],o=0;o=e},e,i).then(function(){var t,n,i,r,e=performance.now()-o;s.logLevel>=Yw.Info&&console.log("SplatTree build: "+e+" ms"),s.disposed||(s.splatTree=s.baseSplatTree,s.baseSplatTree=null,r=i=n=t=0,s.splatTree.visitLeaves(function(e){e=e.data.indexes.length;0=Yw.Info&&(console.log("SplatTree leaves: ".concat(s.splatTree.countLeaves())),console.log("SplatTree leaves with splats:".concat(t)),n/=r,console.log("Avg splat count per node: ".concat(n)),console.log("Total splat count: ".concat(s.getSplatCount())))),a()})})}),Y(e,"updateUniforms",(s=new Le.Vector2,function(e,t,n,i,r,a){if(0e)&&(e=n.compressionLevel)}return e}},{key:"getMinimumSplatBufferCompressionLevel",value:function(){for(var e,t=0;tthis.maxSplatDistanceFromSceneCenter&&(this.maxSplatDistanceFromSceneCenter=a)}1=this.scenes.length)throw new Error("SplatMesh::getScene() -> Invalid scene index.");return this.scenes[e]}},{key:"getSplatBufferForSplat",value:function(e){return this.getScene(this.globalSplatIndexToSceneIndexMap[e]).splatBuffer}},{key:"getSceneIndexForSplat",value:function(e){return this.globalSplatIndexToSceneIndexMap[e]}},{key:"getSceneTransformForSplat",value:function(e){return this.getScene(this.globalSplatIndexToSceneIndexMap[e]).transform}},{key:"getSplatLocalIndex",value:function(e){return this.globalSplatIndexToLocalSplatIndexMap[e]}}],[{key:"buildMaterial",value:function(){var e=0\n\n attribute uint splatIndex;\n\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D centersColorsTexture;\n uniform highp sampler2D sphericalHarmonicsTexture;",t=(e&&(o+="\n uniform highp usampler2D transformIndexesTexture;\n uniform highp mat4 transforms[".concat(fw.MaxScenes,"];\n uniform vec2 transformIndexesTextureSize;\n ")),o=(o+="\n uniform vec2 focal;\n uniform float orthoZoom;\n uniform int orthographicMode;\n uniform int pointCloudModeEnabled;\n uniform float inverseFocalAdjustment;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 covariancesTextureSize;\n uniform vec2 centersColorsTextureSize;\n uniform int sphericalHarmonicsDegree;\n uniform vec2 sphericalHarmonicsTextureSize;\n uniform int sphericalHarmonics8BitMode;\n uniform float visibleRegionRadius;\n uniform float visibleRegionFadeStartRadius;\n uniform float firstRenderTime;\n uniform float currentTime;\n uniform int fadeInComplete;\n uniform vec3 sceneCenter;\n uniform float splatScale;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n const float sqrt8 = sqrt(8.0);\n const float minAlpha = 1.0 / 255.0;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getDataUVF(in uint sIndex, in float stride, in uint offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(float(sIndex) * stride) + offset) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n const float SH_C1 = 0.4886025119029199f;\n const float[5] SH_C2 = float[](1.0925484, -1.0925484, 0.3153916, -1.0925484, 0.5462742);\n const vec3 vecOnes3 = vec3(1.0, 1.0, 1.0);\n\n void main () {\n\n uint oddOffset = splatIndex & uint(0x00000001);\n uint doubleOddOffset = oddOffset * uint(2);\n bool isEven = oddOffset == uint(0);\n uint nearestEvenIndex = splatIndex - oddOffset;\n float fOddOffset = float(oddOffset);\n\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));")+(e?"\n uint transformIndex = texture(transformIndexesTexture, getDataUV(1, 0, transformIndexesTextureSize)).r;\n mat4 transform = transforms[transformIndex];\n mat4 transformModelViewMatrix = modelViewMatrix * transform;\n ":"mat4 transformModelViewMatrix = modelViewMatrix;")+"\n vec4 viewCenter = transformModelViewMatrix * vec4(splatCenter, 1.0);\n\n vec4 clipCenter = projectionMatrix * viewCenter;\n\n float clip = 1.2 * clipCenter.w;\n if (clipCenter.z < -clip || clipCenter.x < -clip || clipCenter.x > clip || clipCenter.y < -clip || clipCenter.y > clip) {\n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n return;\n }\n\n vPosition = position.xy;\n vColor = uintToRGBAVec(sampledCenterColor.r);\n\n ",1<=a&&(o=(o=o+" \n if (sphericalHarmonicsDegree >= 1) {\n "+(e?"\n mat4 mTransform = modelMatrix * transform;\n vec3 worldViewDir = normalize(splatCenter - vec3(inverse(mTransform) * vec4(cameraPosition, 1.0)));\n ":"\n vec3 worldViewDir = normalize(splatCenter - cameraPosition);\n "))+(2<=a?"\n vec4 sampledSH0123 = texture(sphericalHarmonicsTexture, getDataUV(6, 0, sphericalHarmonicsTextureSize));\n vec4 sampledSH4567 = texture(sphericalHarmonicsTexture, getDataUV(6, 1, sphericalHarmonicsTextureSize));\n vec4 sampledSH891011 = texture(sphericalHarmonicsTexture, getDataUV(6, 2, sphericalHarmonicsTextureSize));\n vec3 sh1 = sampledSH0123.rgb;\n vec3 sh2 = vec3(sampledSH0123.a, sampledSH4567.rg);\n vec3 sh3 = vec3(sampledSH4567.ba, sampledSH891011.r);\n ":"\n vec2 shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset, sphericalHarmonicsTextureSize);\n vec4 sampledSH0123 = texture(sphericalHarmonicsTexture, shUV);\n shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset + uint(1), sphericalHarmonicsTextureSize);\n vec4 sampledSH4567 = texture(sphericalHarmonicsTexture, shUV);\n shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset + uint(2), sphericalHarmonicsTextureSize);\n vec4 sampledSH891011 = texture(sphericalHarmonicsTexture, shUV);\n\n vec3 sh1 = vec3(sampledSH0123.rgb) * (1.0 - fOddOffset) + vec3(sampledSH0123.ba, sampledSH4567.r) * fOddOffset;\n vec3 sh2 = vec3(sampledSH0123.a, sampledSH4567.rg) * (1.0 - fOddOffset) + vec3(sampledSH4567.gba) * fOddOffset;\n vec3 sh3 = vec3(sampledSH4567.ba, sampledSH891011.r) * (1.0 - fOddOffset) + vec3(sampledSH891011.rgb) * fOddOffset;\n ")+"\n if (sphericalHarmonics8BitMode == 1) {\n sh1 = sh1 * 2.0 - vecOnes3;\n sh2 = sh2 * 2.0 - vecOnes3;\n sh3 = sh3 * 2.0 - vecOnes3;\n }\n float x = worldViewDir.x;\n float y = worldViewDir.y;\n float z = worldViewDir.z;\n vColor.rgb += SH_C1 * (-sh1 * y + sh2 * z - sh3 * x);\n ",2<=a&&(o+="\n if (sphericalHarmonicsDegree >= 2) {\n float xx = x * x;\n float yy = y * y;\n float zz = z * z;\n float xy = x * y;\n float yz = y * z;\n float xz = x * z;\n\n vec4 sampledSH12131415 = texture(sphericalHarmonicsTexture, getDataUV(6, 3, sphericalHarmonicsTextureSize));\n vec4 sampledSH16171819 = texture(sphericalHarmonicsTexture, getDataUV(6, 4, sphericalHarmonicsTextureSize));\n vec4 sampledSH20212223 = texture(sphericalHarmonicsTexture, getDataUV(6, 5, sphericalHarmonicsTextureSize));\n\n vec3 sh4 = sampledSH891011.gba;\n vec3 sh5 = sampledSH12131415.rgb;\n vec3 sh6 = vec3(sampledSH12131415.a, sampledSH16171819.rg);\n vec3 sh7 = vec3(sampledSH16171819.ba, sampledSH20212223.r);\n vec3 sh8 = sampledSH20212223.gba;\n\n if (sphericalHarmonics8BitMode == 1) {\n sh4 = sh4 * 2.0 - vecOnes3;\n sh5 = sh5 * 2.0 - vecOnes3;\n sh6 = sh6 * 2.0 - vecOnes3;\n sh7 = sh7 * 2.0 - vecOnes3;\n sh8 = sh8 * 2.0 - vecOnes3;\n }\n\n vColor.rgb +=\n (SH_C2[0] * xy) * sh4 +\n (SH_C2[1] * yz) * sh5 +\n (SH_C2[2] * (2.0 * zz - xx - yy)) * sh6 +\n (SH_C2[3] * xz) * sh7 +\n (SH_C2[4] * (xx - yy)) * sh8;\n }\n "),o+="\n }\n "),o=(o=o+"\n\n vec4 sampledCovarianceA = texture(covariancesTexture,\n getDataUVF(nearestEvenIndex, 1.5, oddOffset, covariancesTextureSize));\n vec4 sampledCovarianceB = texture(covariancesTexture,\n getDataUVF(nearestEvenIndex, 1.5, oddOffset + uint(1), covariancesTextureSize));\n\n vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rgb) * (1.0 - fOddOffset) +\n vec3(sampledCovarianceA.ba, sampledCovarianceB.r) * fOddOffset;\n vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceA.a, sampledCovarianceB.rg) * (1.0 - fOddOffset) +\n vec3(sampledCovarianceB.gba) * fOddOffset;\n\n // Construct the 3D covariance matrix\n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n\n \n // Construct the Jacobian行列式 of the affine仿射 approximation逼近 of the projection matrix. It will be used to transform the\n // 3D covariance matrix instead of using the actual projection matrix because that transformation would\n // require a non-linear component (perspective division) which would yield a non-gaussian result. (This assumes假设\n // the current projection is a perspective projection).\n //翻译结果:构建投影矩阵仿射近似的雅可比矩阵。它将被用来变换3D协方差矩阵,而不是直接使用实际的投影矩阵,因为使用实际投影矩阵进行变换需要包含非线性成分(透视除法),这会导致非高斯的结果。这里假设当前的投影为透视投影。\n //看不懂 https://zhuanlan.zhihu.com/p/661569671\n\n \n mat3 J;\n if (orthographicMode == 1) {\n // Since the projection is linear, we don't need an approximation\n J = transpose(mat3(orthoZoom, 0.0, 0.0,\n 0.0, orthoZoom, 0.0,\n 0.0, 0.0, 0.0));\n } else {\n // Construct the Jacobian of the affine approximation of the projection matrix. It will be used to transform the\n // 3D covariance matrix instead of using the actual projection matrix because that transformation would\n // require a non-linear component (perspective division) which would yield a non-gaussian result.\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n J = mat3(\n focal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n 0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n 0., 0., 0.\n );\n }\n\n // Concatenate the projection approximation with the model-view transformation\n mat3 W = transpose(mat3(transformModelViewMatrix));\n mat3 T = W * J;\n\n // Transform the 3D covariance matrix (Vrk) to compute the 2D covariance matrix\n mat3 cov2Dm = transpose(T) * Vrk * T;\n "+(t?"\n float detOrig = cov2Dm[0][0] * cov2Dm[1][1] - cov2Dm[0][1] * cov2Dm[0][1];\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n float detBlur = cov2Dm[0][0] * cov2Dm[1][1] - cov2Dm[0][1] * cov2Dm[0][1];\n float compensation = sqrt(max(detOrig / detBlur, 0.0));\n ":"\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n float compensation = 1.0;\n "))+"\n\n vColor.a *= compensation;\n\n if (vColor.a < minAlpha) return;\n\n // We are interested in the upper-left 2x2 portion of the projected 3D covariance matrix because\n // we only care about the X and Y values. We want the X-diagonal, cov2Dm[0][0],\n // the Y-diagonal, cov2Dm[1][1], and the correlation between the two cov2Dm[0][1]. We don't\n // need cov2Dm[1][0] because it is a symetric matrix.\n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n // We now need to solve for the eigen-values and eigen vectors of the 2D covariance matrix\n // so that we can determine the 2D basis for the splat. This is done using the method described\n // here: https://people.math.harvard.edu/~knill/teaching/math21b2004/exhibits/2dmatrices/index.html 公式出处\n // After calculating the eigen-values and eigen-vectors, we calculate the basis for rendering the splat\n // by normalizing the eigen-vectors and then multiplying them by (sqrt(8) * eigen-value), which is\n // equal to scaling them by sqrt(8) standard deviations.\n //\n // This is a different approach than in the original work at INRIA. In that work they compute the\n // max extents of the projected splat in screen space to form a screen-space aligned bounding rectangle\n // which forms the geometry that is actually rasterized. The dimensions of that bounding box are 3.0\n // times the maximum eigen-value, or 3 standard deviations. They then use the inverse 2D covariance\n // matrix (called 'conic') in the CUDA rendering thread to determine fragment opacity by calculating the\n // full gaussian: exp(-0.5 * (X - mean) * conic * (X - mean)) * splat opacity\n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d; //追踪\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(max(0.1f, traceOver2 * traceOver2 - D));\n float eigenValue1 = traceOver2 + term2; //特征值L1\n float eigenValue2 = traceOver2 - term2; //特征值L1\n\n if (pointCloudModeEnabled == 1) {// each splat is rendered as a filled circle\n eigenValue1 = eigenValue2 = 0.2;\n }\n\n if (eigenValue2 <= 0.0) return;\n\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n // since the eigen vectors are orthogonal, we derive the second one from the first 由于本征向量是正交的,因此我们从第一个导出第二个\n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n\n // We use sqrt(8) standard deviations偏差 instead of 3 to eliminate消除 more of the splat with a very low opacity.\n vec2 basisVector1 = eigenVector1 * splatScale * min(sqrt8 * sqrt(eigenValue1), ".concat(parseInt(n),".0);\n vec2 basisVector2 = eigenVector2 * splatScale * min(sqrt8 * sqrt(eigenValue2), ").concat(parseInt(n),".0);\n\n if (fadeInComplete == 0) {\n float opacityAdjust = 1.0;\n float centerDist = length(splatCenter - sceneCenter);\n float renderTime = max(currentTime - firstRenderTime, 0.0);\n\n float fadeDistance = 0.75;\n float distanceLoadFadeInFactor = step(visibleRegionFadeStartRadius, centerDist);\n distanceLoadFadeInFactor = (1.0 - distanceLoadFadeInFactor) +\n (1.0 - clamp((centerDist - visibleRegionFadeStartRadius) / fadeDistance, 0.0, 1.0)) *\n distanceLoadFadeInFactor;\n opacityAdjust *= distanceLoadFadeInFactor;\n vColor.a *= opacityAdjust;\n }\n\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) *\n basisViewport * 2.0 * inverseFocalAdjustment;\n\n vec4 quadPos = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z , 1.0);\n gl_Position = quadPos; //将整个正方形做一定的拉伸形变,之后在fs中因为只显示中间的圆,所以也就是显示拉伸后的圆。(vs只计算四个顶点的具体位置,其他位置是插值得到的)\n\n // Scale the position data we send to the fragment shader\n vPosition *= sqrt8;\n }"),{sceneCenter:{type:"v3",value:new Le.Vector3},fadeInComplete:{type:"i",value:0},orthographicMode:{type:"i",value:0},visibleRegionFadeStartRadius:{type:"f",value:0},visibleRegionRadius:{type:"f",value:0},currentTime:{type:"f",value:0},firstRenderTime:{type:"f",value:0},covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},sphericalHarmonicsTexture:{type:"t",value:null},focal:{type:"v2",value:new Le.Vector2},orthoZoom:{type:"f",value:1},inverseFocalAdjustment:{type:"f",value:1},viewport:{type:"v2",value:new Le.Vector2},basisViewport:{type:"v2",value:new Le.Vector2},debugColor:{type:"v3",value:new Le.Color},covariancesTextureSize:{type:"v2",value:new Le.Vector2(1024,1024)},centersColorsTextureSize:{type:"v2",value:new Le.Vector2(1024,1024)},sphericalHarmonicsDegree:{type:"i",value:a},sphericalHarmonicsTextureSize:{type:"v2",value:new Le.Vector2(1024,1024)},sphericalHarmonics8BitMode:{type:"i",value:0},splatScale:{type:"f",value:i},pointCloudModeEnabled:{type:"i",value:r?1:0}});if(e){t.transformIndexesTexture={type:"t",value:null};for(var s=[],l=0;l\n \n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n void main () {\n // Compute the positional squared distance from the center of the splat to the current fragment.\n float A = dot(vPosition, vPosition);\n // Since the positional data in vPosition has been scaled by sqrt(8), the squared result will be\n // scaled by a factor of 8. If the squared result is larger than 8, it means it is outside the ellipse\n // defined by the rectangle formed by vPosition. It also means it's farther\n // away than sqrt(8) standard deviations from the mean.\n if (A > 8.0) discard; //position的范围半径为1。指一个rectangle面中的范围。椭圆外的完全透明\n vec3 color = vColor.rgb;\n\n // Since the rendered splat is scaled by sqrt(8), the inverse covariance matrix that is part of\n // the gaussian formula becomes the identity matrix. We're then left with (X - mean) * (X - mean),\n // and since 'mean' is zero, we have X * X, which is the same as A:\n float opacity = exp(-0.5 * A) * vColor.a; //周围的透明度降低\n\n gl_FragColor = vec4(color.rgb, opacity);\n //不知道为何ply转过来的vColor.a是0,(但是在外面访问的opacity并不是0), 导致全是黑色\n }",transparent:!0,alphaTest:1,blending:Le.NormalBlending,depthTest:!0,depthWrite:!1,side:Le.DoubleSide})}},{key:"buildGeomtery",value:function(e){var t=new Le.BufferGeometry,n=(t.setIndex([0,1,2,0,2,3]),new Float32Array(12)),n=new Le.BufferAttribute(n,3),n=(t.setAttribute("position",n),n.setXYZ(0,-1,-1,0),n.setXYZ(1,-1,1,0),n.setXYZ(2,1,1,0),n.setXYZ(3,1,-1,0),n.needsUpdate=!0,(new Le.InstancedBufferGeometry).copy(t)),t=new Uint32Array(e),e=new Le.InstancedBufferAttribute(t,1,!1);return e.setUsage(Le.DynamicDrawUsage),n.setAttribute("splatIndex",e),n.instanceCount=0,n}},{key:"buildScenes",value:function(e,t){var n=[];n.length=e.length;for(var i=0;i Could not load file ".concat(t))});return this.addSplatSceneDownloadPromise(s),this.setSplatSceneDownloadAndBuildPromise(s),s}},{key:"downloadAndBuildSingleSplatSceneStreaming",value:function(e,t,n,i,r,a){var o,s,l,u,c=this,d=0,h=!1,p=[],f=function(){var e;0p[0].splatBuffer.getSplatCount())&&(p.push({splatBuffer:e,firstBuild:0===d,finalBuild:t}),d++,f())},t),e=new Yy(function(e,t){o=e,s=t},m.abortHandler),n=new Yy(function(e,t){l=e,u=t});return this.addSplatSceneDownloadPromise(m),this.setSplatSceneDownloadAndBuildPromise(n),m.then(function(){c.removeSplatSceneDownloadPromise(m)}).catch(function(e){c.clearSplatSceneDownloadAndBuildPromise(),c.removeSplatSceneDownloadPromise(m),e instanceof Xy||(u(e),s&&s(e),a&&a(e))}),e}},{key:"addSplatScenes",value:function(i){var a=this,o=!(1 Could not load one or more splat scenes."))}).finally(function(){for(var e=0,t=r;e File format not supported: ".concat(e)))}},{key:"addSplatBuffersToMesh",value:function(e,t){var n,i,r,a=this,o=!(2=Yw.Info&&console.log("Sorting web worker WASM setup complete."),l.sharedMemoryForWorkers?(l.sortWorkerSortedIndexes=new Uint32Array(e.data.sortedIndexesBuffer,e.data.sortedIndexesOffset,o),l.sortWorkerIndexesToSort=new Uint32Array(e.data.indexesToSortBuffer,e.data.indexesToSortOffset,o),l.sortWorkerPrecomputedDistances=new r(e.data.precomputedDistancesBuffer,e.data.precomputedDistancesOffset,o),l.sortWorkerTransforms=new Float32Array(e.data.transformsBuffer,e.data.transformsOffset,16*fw.MaxScenes)):(l.sortWorkerIndexesToSort=new Uint32Array(o),l.sortWorkerPrecomputedDistances=new r(o),l.sortWorkerTransforms=new Float32Array(16*fw.MaxScenes));for(var t,n=0;n=Yw.Info&&(console.log("Sorting web worker ready."),e=(t=l.splatMesh.getSplatDataTextures()).covariances.size,t=t.centerColors.size,console.log("Covariances texture size: "+e.x+" x "+e.y),console.log("Centers/colors texture size: "+t.x+" x "+t.y)),i()}}})}},{key:"disposeSortWorker",value:function(){this.sortWorker&&this.sortWorker.terminate(),this.sortWorker=null,this.sortPromise=null,this.sortPromiseResolver&&(this.sortPromiseResolver(),this.sortPromiseResolver=null),this.sortRunning=!1}},{key:"removeSplatScene",value:function(u){var c=this,i=!(1'),$(viewer.renderArea).append(this.dom)),this.dom.css({display:"none",position:"absolute",right:"1%",top:"60px",width:"100px",height:"100px","z-index":100,"pointer-events":"none"}),$("
"));this.dom.append(e),this.dom.find(".dirText").css({textAlign:"center","font-size":"10px",position:"absolute",width:"100%",height:"25px","line-height":"25px"}),this.dom.find(".north").css({color:"#02a0e9",top:"0"}),this.dom.find(".south").css({color:"#ff1414",bottom:"0"}),this.dom.find(".center").css({width:"50px",height:"50px","background-size":"contain","background-position":"center",left:"50%",top:"50%",transform:"translate(-50%,-50%)",position:"absolute"}),this.dom.find(".dirText").css({"text-align":"center","font-size":"10px",color:"rgb(255, 255, 255)",position:"absolute",top:"50%",left:"50%",width:"45%",height:"0px","transform-origin":"left center"}),this.dom.find(".dirText span").css({display:"block",position:"absolute",right:"5px",top:"0",width:"20px",height:"20px","line-height":"20px","margin-top":"-10px"});try{this.renderer=new Is({antialias:!0,alpha:!0}),this.renderer.autoClear=!0,this.renderer.setPixelRatio(window.devicePixelRatio||1),this.renderer.domElement.setAttribute("name","compass"),this.renderer.setClearAlpha(0),this.renderer.setDrawingBufferSize(50,50,window.devicePixelRatio||1)}catch(e){viewer.dispatchEvent("webglError",{msg:e})}this.dom.find(".center")[0].appendChild(this.renderer.domElement),this.renderer.domElement.style.width=this.renderer.domElement.style.height="100%",this.camera=new ya,this.camera.fov=50,this.camera.updateProjectionMatrix(),this.scene=new Fs,this.scene.add(this.camera),this.createCompass(),viewer.addEventListener("camera_changed",function(e){e.viewport==t.viewport&&e.changeInfo.quaternionChanged&&t.update()}),this.setDomPos(),this.viewport&&this.setDisplay(!0)}},{key:"createCompass",value:function(){function e(e,t,n){for(var i=[],r=0,a=e.attributes.position.count;r\n\t\t\t\t\n\t\t\t\t\tx\n\t\t\t\t\ty\n\t\t\t\t\tz\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t'),s=Potree.resourcePath+"/icons/copy.svg",t=q(e);try{for(t.s();!(r=t.n()).done;)!function(){var t=r.value,e=ne.addCommas(t.x.toFixed(3)),n=ne.addCommas(t.y.toFixed(3)),i=ne.addCommas(t.z.toFixed(3)),e=$("\n\t\t\t\t\n\t\t\t\t\t".concat(e,"\n\t\t\t\t\t").concat(n,"\n\t\t\t\t\t").concat(i,'\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t'));a.elCopy=e.find("img[name=copy]"),a.elCopy.click(function(){var e=t.toArray().map(function(e){return e.toFixed(3)}).join(", ");ne.clipboardCopy(e),a.viewer.postMessage("Copied value to clipboard:
'".concat(e,"'"),{duration:3e3})}),o.append(e)}()}catch(e){t.e(e)}finally{t.f()}return o}},{key:"createAttributesTable",value:function(){var e=$('
');this.measurement.points[0];return e}},{key:"update",value:function(){}}])}(),z1=function(){function n(e,r,t){ue(this,n),a=le(this,n,[e,r,t]);var a,e=Potree.resourcePath+"/icons/remove.svg";return a.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),a.elRemove=a.elContent.find("img[name=remove]"),a.elRemove.click(function(){a.viewer.scene.removeMeasurement(r)}),a.elMakeProfile=a.elContent.find("input[name=make_profile]"),a.elMakeProfile.click(function(){var e,t=new If,n=(t.name=r.name,t.width=r.getTotalDistance()/50,q(r.points));try{for(n.s();!(e=n.n()).done;){var i=e.value;t.addMarker(i.position.clone())}}catch(e){n.e(e)}finally{n.f()}a.viewer.scene.addProfile(t)}),a.propertiesPanel.addVolatileListener(r,"marker_added",a._update),a.propertiesPanel.addVolatileListener(r,"marker_removed",a._update),a.propertiesPanel.addVolatileListener(r,"marker_moved",a._update),a.update(),a}return v(n,N1),A(n,[{key:"update",value:function(){for(var e=this.elContent.find(".coordinates_table_container"),t=(e.empty(),e.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position}))),this.measurement.points.map(function(e){return e.position})),n=[],i=0;i\n\t\t\t\t\t".concat(0===o?"Distances: ":"",'\n\t\t\t\t\t').concat(s,"\n\t\t\t\t"));a.append(s)}e=$('\n\t\t\t\n\t\t\t\tTotal: '.concat(e,"\n\t\t\t"));a.append(e)}}])}(),G1=function(){function r(e,t,n){ue(this,r),i=le(this,r,[e,t,n]);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return v(r,N1),A(r,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container"),e=(e.empty(),e.append(this.createCoordinatesTable(this.measurement.points)),this.elContent.find(".attributes_table_container"));e.empty(),e.append(this.createAttributesTable())}}])}(),H1=function(){function r(e,t,n){ue(this,r),i=le(this,r,[e,t,n]);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\tArea: \n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return v(r,N1),A(r,[{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))}}])}(),V1=function(){function r(e,t,n){ue(this,r),i=le(this,r,[e,t,n]);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
αβγ
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return v(r,N1),A(r,[{key:"update",value:function(){for(var e=this.elContent.find(".coordinates_table_container"),t=(e.empty(),e.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position}))),[]),n=0;n\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return v(r,N1),A(r,[{key:"update",value:function(){var e,t,n,i,r=this.elContent.find(".coordinates_table_container"),r=(r.empty(),r.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position}))),this.elContent.find("#infos_table"));3!==this.measurement.points.length?r.empty():(i=this.measurement.points[0].position,e=this.measurement.points[1].position,t=this.measurement.points[2].position,t=(e=Potree.Utils.computeCircleCenter(i,e,t)).distanceTo(i),i=2*Math.PI*t,e="".concat((n=function(e){return Potree.Utils.addCommas(e.toFixed(3))})(e.x)," ").concat(n(e.y)," ").concat(n(e.z)),t=n(t),n=n(i),i='style="width: 100%; padding: 5px;"',r.html("\n\t\t\t\n\t\t\t\tCenter: \n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t').concat(e,"\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\tRadius: \n\t\t\t\t").concat(t,"\n\t\t\t\n\t\t\t\n\t\t\t\tCircumference: \n\t\t\t\t").concat(n,"\n\t\t\t\n\t\t")))}}])}(),j1=function(){function r(e,t,n){ue(this,r),i=le(this,r,[e,t,n]);var i,e=Potree.resourcePath+"/icons/remove.svg";return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\tHeight:
\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t')),i.elRemove=i.elContent.find("img[name=remove]"),i.elRemove.click(function(){i.viewer.scene.removeMeasurement(t)}),i.propertiesPanel.addVolatileListener(t,"marker_added",i._update),i.propertiesPanel.addVolatileListener(t,"marker_removed",i._update),i.propertiesPanel.addVolatileListener(t,"marker_moved",i._update),i.update(),i}return v(r,N1),A(r,[{key:"update",value:function(){var e=this.elContent.find(".coordinates_table_container");e.empty(),e.append(this.createCoordinatesTable(this.measurement.points.map(function(e){return e.position})));var e=this.measurement.points.slice().sort(function(e,t){return e.position.z-t.position.z}),t=e[0].position.clone(),e=e[e.length-1].position.clone(),t=t.z,e=(e=e.z-t).toFixed(3);this.elHeightLabel=this.elContent.find("#height_label"),this.elHeightLabel.html("Height: ".concat(e))}}])}(),W1=function(){function s(e,t,n){ue(this,s),i=le(this,s,[e,t,n]);var i,e=Potree.resourcePath+"/icons/copy.svg",n=Potree.resourcePath+"/icons/remove.svg",r=new Map([[Pf,"length"],[Df,"rx"]]).get(t.constructor),a=new Map([[Pf,"width"],[Df,"ry"]]).get(t.constructor),o=new Map([[Pf,"height"],[Df,"rz"]]).get(t.constructor);return i.elContent=$('\n\t\t\t
\n\t\t\t\t\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
αβγ
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
').concat(r,"").concat(a,"").concat(o,'
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t
\n\t\t\t\tVolume: \n\t\t\t\t\n\n\t\t\t\t\x3c!--\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • --\x3e\n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t
  • \n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
  • \n\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
  • \n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t')),i.elDownloadButton=i.elContent.find("input[name=download_volume]"),i.propertiesPanel.viewer.server?i.elDownloadButton.click(function(){return i.download()}):i.elDownloadButton.hide(),i.elCopyRotation=i.elContent.find("img[name=copyRotation]"),i.elCopyRotation.click(function(){var e=i.measurement.rotation.toArray().slice(0,3).map(function(e){return e.toFixed(3)}).join(", ");ne.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(", ");ne.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 v(s,N1),A(s,[{key:"download",value:(e=J(X().mark(function e(){var t,n,i,r,a,o,s,l,u,c,d,h,p,f,m,v,g,A,y,w,b,x,E,C,B,M,S,T,_,P,D,I,k,R;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(m=this.measurement,A=[],m=m.matrixWorld,g=new Oe(.5,0,0).applyMatrix4(m),o=new Oe(-.5,0,0).applyMatrix4(m),l=new Oe(0,.5,0).applyMatrix4(m),u=new Oe(0,-.5,0).applyMatrix4(m),p=new Oe(0,0,.5).applyMatrix4(m),m=new Oe(0,0,-.5).applyMatrix4(m),v=(new Oe).subVectors(o,g).normalize(),a=v.clone().multiplyScalar(-1),s=(new Oe).subVectors(u,l).normalize(),d=s.clone().multiplyScalar(-1),h=(new Oe).subVectors(m,p).normalize(),f=h.clone().multiplyScalar(-1),v=[(new ir).setFromNormalAndCoplanarPoint(v,g),(new ir).setFromNormalAndCoplanarPoint(a,o),(new ir).setFromNormalAndCoplanarPoint(s,l),(new ir).setFromNormalAndCoplanarPoint(d,u),(new ir).setFromNormalAndCoplanarPoint(h,p),(new ir).setFromNormalAndCoplanarPoint(f,m)],t=[],n=0,i=v;nERROR: '.concat(e,""))},b=function(e){y.html("".concat(e))},x=null,E="".concat(viewer.server,"/create_regions_filter?pointclouds=[").concat(A,"]®ions=[").concat(a,"]"),b("estimating results ..."),e.next=56,fetch(E);case 56:return E=e.sent,e.next=59,E.json();case 59:if((C=e.sent).handle){e.next=65;break}return w(C.message),e.abrupt("return");case 65:x=C.handle;case 66:B="".concat(viewer.server,"/check_regions_filter?handle=").concat(x),M=function(n){return new Promise(function(e,t){setTimeout(function(){e()},n)})},S=function(e){var t=e.progress,e=e.estimate,t=t["processed points"]/e.points,e=parseInt(100*t);b("progress: ".concat(e,"%"))},T=function(e){var t="downloads ready:
    ";t+="
      ";for(var n=0;nresult_').concat(n,".las \n")}var r="".concat(viewer.server,"/download_regions_filter_report?handle=").concat(x);t+='
    • report.json
    • \n'),b(t+="
    ")},_=function(e){e="Unexpected Response.
    status: ".concat(e.status,"
    message: ").concat(e.message);b(e)},P=function(e){e="ERROR: ".concat(e.message);throw w(e),new Error(e)},D=Date.now();case 73:return e.next=76,fetch(B);case 76:return k=e.sent,e.next=79,k.json();case 79:"ERROR"!==(I=e.sent).status?e.next=84:(P(I),e.next=94);break;case 84:"FILTERING"!==I.status?e.next=88:(S(I),e.next=94);break;case 88:if("FINISHED"===I.status)return T(I),e.abrupt("break",100);e.next=93;break;case 93:_(I);case 94:return k=(Date.now()-D)/1e3,R=k<10?100:1e3,e.next=98,M(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=(e.empty(),e.append(this.createCoordinatesTable([this.measurement.position])),this.measurement.rotation.toVector3()),t=(e=(e=(e=e.toArray()).map(function(e){return 180*e/Math.PI})).map(function(e){return e.toFixed(1)+"°"}),this.elContent.find("#angle_cell_alpha")),n=this.elContent.find("#angle_cell_betta"),i=this.elContent.find("#angle_cell_gamma");t.html(e[0]),n.html(e[1]),i.html(e[2]);t=(t=this.measurement.scale.toArray()).map(function(e){return ne.addCommas(e.toFixed(2))}),n=this.elContent.find("#cell_length"),i=this.elContent.find("#cell_width"),e=this.elContent.find("#cell_height"),n.html(t[0]),i.html(t[1]),e.html(t[2]),n=this.elContent.find("#measurement_volume"),i=this.measurement.getVolume();n.html(ne.addCommas(i.toFixed(2))),this.elCheckClip.prop("checked",this.measurement.clip),this.elCheckShow.prop("checked",this.measurement.visible)}}]);var e}(),J1=function(){function a(e,i,t){ue(this,a),n=le(this,a,[e,i,t]);var n,e=Potree.resourcePath+"/icons/remove.svg",r=(n.elContent=$('\n\t\t\t
    \n\t\t\t\t\n\t\t\t\t
    \n\t\t\t\t\n\t\t\t\t\tWidth: \n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
    \n\n\t\t\t\t
  • \n\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t
  • \n\n\t\t\t\t
    \n\n\t\t\t\t\n\n\t\t\t\t\x3c!-- ACTIONS --\x3e\n\t\t\t\t
    \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t
    \n\t\t')),n.elRemove=n.elContent.find("img[name=remove]"),n.elRemove.click(function(){n.viewer.scene.removeProfile(i)}),n.elDownloadButton=n.elContent.find("input[name=download_profile]"),n.propertiesPanel.viewer.server?n.elDownloadButton.click(function(){return n.download()}):n.elDownloadButton.hide(),n.elContent.find("#sldProfileWidth"));r.spinner({min:0,max:1e7,step:.01,numberFormat:"n",start:function(){},spin:function(e,t){var n=r.spinner("value");i.setWidth(n)},change:function(e,t){var n=r.spinner("value");i.setWidth(n)},stop:function(e,t){var n=r.spinner("value");i.setWidth(n)},incremental:function(e){var t=r.spinner("value"),n=r.spinner("option","step");return Math.max(1,parseInt(.05*t/n))}}),r.spinner("value",i.getWidth()),r.spinner("widget").css("width","100%");return n.propertiesPanel.addVolatileListener(i,"width_changed",function(e){r.spinner("value")!==i.getWidth()&&r.spinner("value",i.getWidth())}),n.elContent.find("#show_2d_profile").click(function(){n.propertiesPanel.viewer.profileWindow.show(),n.propertiesPanel.viewer.profileWindowController.setProfile(i)}),n.propertiesPanel.addVolatileListener(i,"marker_added",n._update),n.propertiesPanel.addVolatileListener(i,"marker_removed",n._update),n.propertiesPanel.addVolatileListener(i,"marker_moved",n._update),n.update(),n}return v(a,N1),A(a,[{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=J(X().mark(function e(){var t,n,i,r,a,o,s,l,u,c,d,h,p,f,m,v,g,A,y,w,b,x,E,C,B,M,S,T,_,P,D,I,k,O,U,N,z,G,H,V,R,L,F;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:E=this.measurement,t=[],C=E.getSegments(),n=E.width,i=q(C);try{for(i.s();!(r=i.n()).done;){for(a=r.value,o=a.start.clone().multiply(new Oe(1,1,0)),s=a.end.clone().multiply(new Oe(1,1,0)),l=(new Oe).addVectors(o,s).multiplyScalar(.5),u=(new Oe).subVectors(s,o).normalize(),c=(new Oe).subVectors(o,s).normalize(),d=new Oe(0,0,1),h=(new Oe).crossVectors(u,d),p=(new Oe).crossVectors(c,d),console.log(p),f=h.clone().multiplyScalar(.5*n).add(l),m=p.clone().multiplyScalar(.5*n).add(l),v=[(new ir).setFromNormalAndCoplanarPoint(u,o),(new ir).setFromNormalAndCoplanarPoint(c,s),(new ir).setFromNormalAndCoplanarPoint(p,f),(new ir).setFromNormalAndCoplanarPoint(h,m)],g=[],A=0,y=v;AERROR: '.concat(e,""))},P=function(e){T.html("".concat(e))},D=null,I="".concat(viewer.server,"/create_regions_filter?pointclouds=[").concat(S,"]®ions=[").concat(E,"]"),P("estimating results ..."),e.next=42,fetch(I);case 42:return R=e.sent,e.next=45,R.json();case 45:if((k=e.sent).handle){e.next=51;break}return _(k.message),e.abrupt("return");case 51:D=k.handle;case 52:O="".concat(viewer.server,"/check_regions_filter?handle=").concat(D),U=function(n){return new Promise(function(e,t){setTimeout(function(){e()},n)})},N=function(e){var t=e.progress,e=e.estimate,t=t["processed points"]/e.points,e=parseInt(100*t);P("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(D);t+='
    • report.json
    • \n'),P(t+="
    ")},G=function(e){e="Unexpected Response.
    status: ".concat(e.status,"
    message: ").concat(e.message);P(e)},H=function(e){e="ERROR: ".concat(e.message);throw _(e),new Error(e)},V=Date.now();case 59:return e.next=62,fetch(O);case 62:return R=e.sent,e.next=65,R.json();case 65:"ERROR"!==(L=e.sent).status?e.next=70:(H(L),e.next=80);break;case 70:"FILTERING"!==L.status?e.next=74:(N(L),e.next=80);break;case 74:if("FINISHED"===L.status)return z(L),e.abrupt("break",86);e.next=79;break;case 79:G(L);case 80:return F=(Date.now()-V)/1e3,F=F<10?100:1e3,e.next=84,U(F);case 84:e.next=59;break;case 86:case"end":return e.stop()}},e,this,[[9,27,30,33]])})),function(){return e.apply(this,arguments)})}]);var e}(),q1=function(){return A(function e(t,n){var i=this,n=(ue(this,e),this.viewer=t,this.propertiesPanel=n,this._update=function(){i.update()},Potree.resourcePath+"/icons/copy.svg");this.elContent=$('\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
    position
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    target
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t
    \n\t\t')),this.elCopyPosition=this.elContent.find("img[name=copyPosition]"),this.elCopyPosition.click(function(){var e=i.viewer.scene.getActiveCamera().position.toArray().map(function(e){return e.toFixed(3)}).join(", ");ne.clipboardCopy(e),i.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),this.elCopyTarget=this.elContent.find("img[name=copyTarget]"),this.elCopyTarget.click(function(){var e=i.viewer.scene.view.getPivot().toArray().map(function(e){return e.toFixed(3)}).join(", ");ne.clipboardCopy(e),i.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),this.propertiesPanel.addVolatileListener(t,"camera_changed",this._update),this.update()},[{key:"update",value:function(){var e=this.viewer.scene.getActiveCamera(),t=this.viewer.scene.view,e=e.position.toArray().map(function(e){return ne.addCommas(e.toFixed(3))}),e=(this.elContent.find("#camera_position_x").html(e[0]),this.elContent.find("#camera_position_y").html(e[1]),this.elContent.find("#camera_position_z").html(e[2]),t.getPivot().toArray().map(function(e){return ne.addCommas(e.toFixed(3))}));this.elContent.find("#camera_target_x").html(e[0]),this.elContent.find("#camera_target_y").html(e[1]),this.elContent.find("#camera_target_z").html(e[2])}}])}(),Y1=function(){return A(function e(t,n,i){var r=this,t=(ue(this,e),this.viewer=t,this.propertiesPanel=n,this.annotation=i,this._update=function(){r.update()},"".concat(Potree.resourcePath,"/icons/copy.svg"));this.elContent=$('\n\t\t
    \n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\n\t\t\t
    position
    \n\t\t\t\t\t\t\n\t\t\t\t\t
    \n\n\t\t\t
    \n\n\t\t\t\t
    Title
    \n\t\t\t\t
    \n\t\t\t\t\tAnnotation Title\n\t\t\t\t
    \n\n\t\t\t\t
    Description
    \n\t\t\t\t
    \n\t\t\t\t\tA longer description of this annotation. \n\t\t\t\t\t\tCan be multiple lines long. TODO: the user should be able\n\t\t\t\t\t\tto modify title and description. \n\t\t\t\t
    \n\n\t\t\t
    \n\n\t\t
    \n\t\t')),this.elCopyPosition=this.elContent.find("img[name=copyPosition]"),this.elCopyPosition.click(function(){var e=r.annotation.position.toArray().map(function(e){return e.toFixed(3)}).join(", ");ne.clipboardCopy(e),r.viewer.postMessage("Copied value to clipboard:
    '".concat(e,"'"),{duration:3e3})}),this.elTitle=this.elContent.find("#annotation_title").html(i.title),this.elDescription=this.elContent.find("#annotation_description").html(i.description),this.elTitle[0].addEventListener("input",function(){var e=r.elTitle.html();i.title=e},!1),this.elDescription[0].addEventListener("input",function(){var e=r.elDescription.html();i.description=e},!1),this.update()},[{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 ne.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)}}])}(),X1=function(){return A(function e(l,t,u){ue(this,e),this.viewer=l,this.propertiesPanel=t,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\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("input[name=pause]").click(function(){u.pause()});function n(){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,{position:l.scene.view.position,target:l.scene.view.getPivot()}),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.targets[t].position.copy(l.scene.view.getPivot()),u.changeCallback(t)}),r.click(function(){l.scene.view.position.copy(u.posCurve.points[t]),l.scene.view.lookAt(u.targets[t].position)}),a.click(function(){u.removeControlPoint(t),u.changeCallback()}),c.append(n),o(++s)})}this.elContent.find("#sldTime").slider({value:0,min:0,max:1,step:.001,slide:function(e,t){u.set(t.value),u.updateFrustum()}});var i=this.elContent.find("input[name=spnDuration]"),c=(i.spinner({min:0,max:300,step:.01,numberFormat:"n",start:function(){},spin:function(e,t){var n=i.spinner("value");u.setDuration(n)},change:function(e,t){var n=i.spinner("value");u.setDuration(n)},stop:function(e,t){var n=i.spinner("value");u.setDuration(n)},incremental:function(e){var t=i.spinner("value"),n=i.spinner("option","step");return Math.max(1,parseInt(.05*t/n))}}),i.spinner("value",u.getDuration()),i.spinner("widget").css("width","100%"),this.elContent.find("#animation_keyframes"));n(),u.addEventListener("controlpoint_added",n),u.addEventListener("controlpoint_removed",n)},[{key:"update",value:function(){}}])}(),K1=function(){return A(function e(t,n){ue(this,e),this.container=t,this.viewer=n,this.object=null,this.cleanupTasks=[],this.scene=null},[{key:"setScene",value:function(e){this.scene=e}},{key:"set",value:function(e){if(this.object!==e){this.object=e;var t,n=q(this.cleanupTasks);try{for(n.s();!(t=n.n()).done;)(0,t.value)()}catch(e){n.e(e)}finally{n.f()}this.cleanupTasks=[],this.container.empty(),e instanceof gm?this.setPointCloud(e):e instanceof im||e instanceof If||e instanceof _f?this.setMeasurement(e):e instanceof Aa?this.setCamera(e):e instanceof pv?this.setAnnotation(e):e instanceof U1&&this.setCameraAnimation(e)}}},{key:"addVolatileListener",value:function(e,t,n){e.addEventListener(t,n),this.cleanupTasks.push(function(){e.removeEventListener(t,n)})}},{key:"setPointCloud",value:function(f){function e(e){s.html(m.size.toFixed(2)),o.slider({value:m.size})}function t(e){u.html(m.minSize.toFixed(2)),l.slider({value:m.minSize})}function n(){var e=Object.keys(Pm)[m.shape];h.selectmenu().val(e).selectmenu("refresh")}function i(){var e=m.backfaceCulling;p.prop("checked",e)}function r(e){A.html(m.opacity.toFixed(2)),g.slider({value:m.opacity})}var a=this,m=f.material,v=$('\n\t\t\t
    \n\t\t\t\t
      \n\n\t\t\t\t
    • \n\t\t\t\t
      \n\t\t\t\t
    • \n\t\t\t\t
    • \n\t\t\t\t
      \n\t\t\t\t
    • \n\n\t\t\t\t\x3c!-- SIZE TYPE --\x3e\n\t\t\t\t
    • \n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t\x3c!-- SHAPE --\x3e\n\t\t\t\t
    • \n\t\t\t\t\t
      \n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t
    • \n\t\t\t\t\n\t\t\t\t
    • \n\t\t\t\t\n\t\t\t\t\x3c!-- OPACITY --\x3e\n\t\t\t\t
    • :
    • \n\n\t\t\t\t
      \n\t\t\t\t\tAttribute\n\t\t\t\t
      \n\n\t\t\t\t
    • \n\t\t\t\t\t\n\t\t\t\t
    • \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tAttribute Weights\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • RGB:
      \t
    • \n\t\t\t\t\t
    • Intensity:
      \t
    • \n\t\t\t\t\t
    • Elevation:
      \t
    • \n\t\t\t\t\t
    • Classification:
      \t
    • \n\t\t\t\t\t
    • Return Number:
      \t
    • \n\t\t\t\t\t
    • Source ID:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tRGB\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • Gamma:
      \t
    • \n\t\t\t\t\t
    • Brightness:
      \t
    • \n\t\t\t\t\t
    • Contrast:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tExtra Attribute\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • :
    • \n\n\t\t\t\t\t
    • Gamma:
    • \n\t\t\t\t\t
    • Brightness:
    • \n\t\t\t\t\t
    • Contrast:
    • \n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tMATCAP\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tColor\n\t\t\t\t\t
      \n\n\t\t\t\t\t\n\t\t\t\t
      \n\n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tElevation\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • :
      \t
    • \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t
    • \n\n\t\t\t\t\t
    • \n\t\t\t\t\t\tGradient Scheme:\n\t\t\t\t\t\t
      \n\t\t\t\t\t\t
      \n\t\t\t\t\t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tTransition\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • transition:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tIntensity\n\t\t\t\t\t
      \n\n\t\t\t\t\t
    • Range:
      \t
    • \n\t\t\t\t\t
    • Gamma:
      \t
    • \n\t\t\t\t\t
    • Brightness:
      \t
    • \n\t\t\t\t\t
    • Contrast:
      \t
    • \n\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tGPS Time\n\t\t\t\t\t
      \n\n\t\t\t\t
      \n\t\t\t\t\n\t\t\t\t
      \n\t\t\t\t\t
      \n\t\t\t\t\t\tIndices\n\t\t\t\t\t
      \n\t\t\t\t
      \n\n\n\t\t\t\t
    \n\t\t\t
    \n\t\t'),o=(v.i18n(),this.container.append(v),v.find("#sldPointSize")),s=v.find("#lblPointSize"),l=(o.slider({value:m.size,min:0,max:3,step:.01,slide:function(e,t){m.size=t.value}}),this.addVolatileListener(m,"point_size_changed",e),e(),v.find("#sldMinPointSize")),u=v.find("#lblMinPointSize"),c=(l.slider({value:m.size,min:0,max:3,step:.01,slide:function(e,t){m.minSize=t.value}}),this.addVolatileListener(m,"point_size_changed",t),t(),Object.keys(_m)[m.pointSizeType]),d=v.find("#optPointSizing"),h=(d.selectmenu(),d.val(c).selectmenu("refresh"),d.selectmenu({change:function(e,t){m.pointSizeType=_m[t.item.value]}}),v.find("#optShape")),p=(h.selectmenu({change:function(e,t){t=t.item.value;m.shape=Pm[t]}}),this.addVolatileListener(m,"point_shape_changed",n),n(),v.find("#set_backface_culling")),c=(p.click(function(){m.backfaceCulling=p.prop("checked")}),this.addVolatileListener(m,"backface_changed",i),i(),$("#materials_backface_container")),d=(c.css("display","none"),f.pcoGeometry.pointAttributes),g=(!!d.hasNormals&&d.hasNormals()&&c.css("display","block"),v.find("#sldOpacity")),A=v.find("#lblOpacity");g.slider({value:m.opacity,min:0,max:1,step:.001,slide:function(e,t){m.opacity=t.value}});this.addVolatileListener(m,"opacity_changed",r),r();var y,d=f.pcoGeometry.pointAttributes.attributes,d=((c=[]).push.apply(c,Fe(d.map(function(e){return e.name}))),c.indexOf("intensity")),w=(0<=d&&c.splice(d+1,0,"intensity gradient"),c.push("elevation","color","matcap","indices","level of detail","composite"),["POSITION_CARTESIAN","position"]),c=c.filter(function(e){return!w.includes(e)}),b=v.find("#optMaterial"),x=q(c);try{for(x.s();!(y=x.n()).done;){var E=y.value,C=$(""));b.append(C)}}catch(e){x.e(e)}finally{x.f()}function B(e,t){var n=b.selectmenu().val(),i=(m.activeAttributeName=n,f.getAttribute(n)),r=(!!(i="intensity gradient"===n?f.getAttribute("intensity"):i)&&["intensity","intensity gradient"].includes(i.name)?(f.material.intensityRange[0]===1/0&&(f.material.intensityRange=i.range),a=(r=U(i.range,2))[0],r=r[1],v.find("#sldIntensityRange").slider({range:!0,min:a,max:r,step:.01,values:[a,r],slide:function(e,t){var n=t.values[0],t=t.values[1];m.intensityRange=[n,t]}})):i&&(r=(a=U(i.range,2))[0],a=a[1],o=(o=m.getRange(i.name))||Fe(i.range),"number"==typeof r)&&"number"==typeof a&&v.find("#sldExtraRange").slider({range:!0,min:r,max:a,step:.01,values:o,slide:function(e,t){var t=U(t.values,2),n=t[0],t=t[1];m.setRange(i.name,[n,t])}}),$("#materials\\.composite_weight_container")),a=$("#materials\\.elevation_container"),o=$("#materials\\.rgb_container"),s=$("#materials\\.extra_container"),l=$("#materials\\.color_container"),u=$("#materials\\.intensity_container"),c=$("#materials\\.index_container"),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"))}function M(){b.val(m.activeAttributeName).selectmenu("refresh")}b.selectmenu({change:B});this.addVolatileListener(m,"point_color_type_changed",M),this.addVolatileListener(m,"active_attribute_changed",M),M(),B();var S,d=Object.keys(Potree.Gradients).map(function(e){return{name:e,values:wm[e]}}),T=v.find("#elevation_gradient_scheme_selection"),_=q(d);try{for(_.s();!(S=_.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=wm[e.name]}),T.append(t)}()}catch(e){_.e(e)}finally{_.f()}for(var c=[{name:"Normals",icon:"".concat(Potree.resourcePath,"/icons/matcap/check_normal+y.jpg")},{name:"Basic 1",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_1.jpg")},{name:"Basic 2",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_2.jpg")},{name:"Basic Dark",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_dark.jpg")},{name:"Basic Side",icon:"".concat(Potree.resourcePath,"/icons/matcap/basic_side.jpg")},{name:"Ceramic Dark",icon:"".concat(Potree.resourcePath,"/icons/matcap/ceramic_dark.jpg")},{name:"Ceramic Lightbulb",icon:"".concat(Potree.resourcePath,"/icons/matcap/ceramic_lightbulb.jpg")},{name:"Clay Brown",icon:"".concat(Potree.resourcePath,"/icons/matcap/clay_brown.jpg")},{name:"Clay Muddy",icon:"".concat(Potree.resourcePath,"/icons/matcap/clay_muddy.jpg")},{name:"Clay Studio",icon:"".concat(Potree.resourcePath,"/icons/matcap/clay_studio.jpg")},{name:"Resin",icon:"".concat(Potree.resourcePath,"/icons/matcap/resin.jpg")},{name:"Skin",icon:"".concat(Potree.resourcePath,"/icons/matcap/skin.jpg")},{name:"Jade",icon:"".concat(Potree.resourcePath,"/icons/matcap/jade.jpg")},{name:"Metal_ Anisotropic",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_anisotropic.jpg")},{name:"Metal Carpaint",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_carpaint.jpg")},{name:"Metal Lead",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_lead.jpg")},{name:"Metal Shiny",icon:"".concat(Potree.resourcePath,"/icons/matcap/metal_shiny.jpg")},{name:"Pearl",icon:"".concat(Potree.resourcePath,"/icons/matcap/pearl.jpg")},{name:"Toon",icon:"".concat(Potree.resourcePath,"/icons/matcap/toon.jpg")},{name:"Check Rim Light",icon:"".concat(Potree.resourcePath,"/icons/matcap/check_rim_light.jpg")},{name:"Check Rim Dark",icon:"".concat(Potree.resourcePath,"/icons/matcap/check_rim_dark.jpg")},{name:"Contours 1",icon:"".concat(Potree.resourcePath,"/icons/matcap/contours_1.jpg")},{name:"Contours 2",icon:"".concat(Potree.resourcePath,"/icons/matcap/contours_2.jpg")},{name:"Contours 3",icon:"".concat(Potree.resourcePath,"/icons/matcap/contours_3.jpg")},{name:"Reflection Check Horizontal",icon:"".concat(Potree.resourcePath,"/icons/matcap/reflection_check_horizontal.jpg")},{name:"Reflection Check Vertical",icon:"".concat(Potree.resourcePath,"/icons/matcap/reflection_check_vertical.jpg")}],F=v.find("#matcap_scheme_selection"),P=0,D=c;P\n\t\t\t\t'));t.click(function(){m.matcap=e.icon.substring(e.icon.lastIndexOf("/"))}),F.append(t)}();v.find("#sldRGBGamma").slider({value:m.rgbGamma,min:0,max:4,step:.01,slide:function(e,t){m.rgbGamma=t.value}}),v.find("#sldRGBContrast").slider({value:m.rgbContrast,min:-1,max:1,step:.01,slide:function(e,t){m.rgbContrast=t.value}}),v.find("#sldRGBBrightness").slider({value:m.rgbBrightness,min:-1,max:1,step:.01,slide:function(e,t){m.rgbBrightness=t.value}}),v.find("#sldExtraGamma").slider({value:m.extraGamma,min:0,max:4,step:.01,slide:function(e,t){m.extraGamma=t.value}}),v.find("#sldExtraBrightness").slider({value:m.extraBrightness,min:-1,max:1,step:.01,slide:function(e,t){m.extraBrightness=t.value}}),v.find("#sldExtraContrast").slider({value:m.extraContrast,min:-1,max:1,step:.01,slide:function(e,t){m.extraContrast=t.value}}),v.find("#sldHeightRange").slider({range:!0,min:0,max:1e3,step:.01,values:[0,1e3],slide:function(e,t){m.heightMin=t.values[0],m.heightMax=t.values[1]}}),v.find("#sldIntensityGamma").slider({value:m.intensityGamma,min:0,max:4,step:.01,slide:function(e,t){m.intensityGamma=t.value}}),v.find("#sldIntensityContrast").slider({value:m.intensityContrast,min:-1,max:1,step:.01,slide:function(e,t){m.intensityContrast=t.value}}),v.find("#sldIntensityBrightness").slider({value:m.intensityBrightness,min:-1,max:1,step:.01,slide:function(e,t){m.intensityBrightness=t.value}}),v.find("#sldWeightRGB").slider({value:m.weightRGB,min:0,max:1,step:.01,slide:function(e,t){m.weightRGB=t.value}}),v.find("#sldWeightIntensity").slider({value:m.weightIntensity,min:0,max:1,step:.01,slide:function(e,t){m.weightIntensity=t.value}}),v.find("#sldWeightElevation").slider({value:m.weightElevation,min:0,max:1,step:.01,slide:function(e,t){m.weightElevation=t.value}}),v.find("#sldWeightClassification").slider({value:m.weightClassification,min:0,max:1,step:.01,slide:function(e,t){m.weightClassification=t.value}}),v.find("#sldWeightReturnNumber").slider({value:m.weightReturnNumber,min:0,max:1,step:.01,slide:function(e,t){m.weightReturnNumber=t.value}}),v.find("#sldWeightSourceID").slider({value:m.weightSourceID,min:0,max:1,step:.01,slide:function(e,t){m.weightSourceID=t.value}}),v.find("#materials\\.color\\.picker").spectrum({flat:!0,showInput:!0,preferredFormat:"rgb",cancelText:"",chooseText:"Apply",color:"#".concat(m.color.getHexString()),move:function(e){e=e.toRgb(),e=(new Se).setRGB(e.r/255,e.g/255,e.b/255);m.color=e},change:function(e){e=e.toRgb(),e=(new Se).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 I(){var e,t=f.getAttribute("position"),n=(t=t?(e=(n=t.range[0][2])-.2*(n=(t=t.range[1][2])-n),t+.2*n):(t=[f.pcoGeometry.tightBoundingBox,f.getBoundingBoxWorld()].find(function(e){return void 0!==e}),f.updateMatrixWorld(!0),n=(t=ne.computeTransformedBoundingBox(t,f.matrixWorld)).max.z-t.min.z,e=t.min.z-.2*n,t.max.z+.2*n),m.elevationRange);v.find("#lblHeightRange").html("".concat(n[0].toFixed(2)," to ").concat(n[1].toFixed(2))),v.find("#sldHeightRange").slider({min:e,max:t,values:n})}function k(){var e=m.activeAttributeName,t=f.getAttribute(e);null!=t&&"number"==typeof(e=null==(e=m.getRange(e))?t.range:e)[0]&&"number"==typeof e[1]&&(e?(t="".concat(e[0].toFixed(2)," to ").concat(e[1].toFixed(2)),v.find("#lblExtraRange").html(t)):v.find("could not deduce range"))}function R(){var e=m.intensityGamma,t=m.intensityContrast,n=m.intensityBrightness;O(),v.find("#lblIntensityGamma").html(e.toFixed(2)),v.find("#lblIntensityContrast").html(t.toFixed(2)),v.find("#lblIntensityBrightness").html(n.toFixed(2)),v.find("#sldIntensityGamma").slider({value:e}),v.find("#sldIntensityContrast").slider({value:t}),v.find("#sldIntensityBrightness").slider({value:n})}function L(){var e=m.rgbGamma,t=m.rgbContrast,n=m.rgbBrightness;v.find("#lblRGBGamma").html(e.toFixed(2)),v.find("#lblRGBContrast").html(t.toFixed(2)),v.find("#lblRGBBrightness").html(n.toFixed(2)),v.find("#sldRGBGamma").slider({value:e}),v.find("#sldRGBContrast").slider({value:t}),v.find("#sldRGBBrightness").slider({value:n})}var O=function(){var e=m.intensityRange;v.find("#lblIntensityRange").html("".concat(parseInt(e[0])," to ").concat(parseInt(e[1])))},d=(I(),v.find("#sldHeightRange").slider("option","min"),v.find("#sldHeightRange").slider("option","max"),v.find("#gradient_repeat_option")),c=(d.selectgroup({title:"Gradient"}),d.find("input").click(function(e){a.viewer.setElevationGradientRepeat(Sm[e.target.value])}),Object.keys(Sm).filter(function(e){return Sm[e]===a.viewer.elevationGradientRepeat}));d.find("input[value=".concat(c,"]")).trigger("click");this.addVolatileListener(m,"material_property_changed",k),this.addVolatileListener(m,"material_property_changed",I),this.addVolatileListener(m,"material_property_changed",R),this.addVolatileListener(m,"material_property_changed",L),k(),I(),R(),L()}},{key:"setMeasurement",value:function(e){var t={DISTANCE:{panel:z1},AREA:{panel:H1},POINT:{panel:G1},ANGLE:{panel:V1},HEIGHT:{panel:j1},PROFILE:{panel:J1},VOLUME:{panel:W1},CIRCLE:{panel:Q1},OTHER:{panel:G1}},n=new((n=e)instanceof im?!n.showDistances||n.showArea||n.showAngles?n.showDistances&&n.showArea&&!n.showAngles?t.AREA:1===n.maxMarkers?t.POINT:n.showDistances||n.showArea||!n.showAngles?n.showHeight?t.HEIGHT:n.showCircle?t.CIRCLE:t.OTHER:t.ANGLE:t.DISTANCE:n instanceof If?t.PROFILE:n instanceof _f?t.VOLUME:void 0).panel(this.viewer,e,this);this.container.append(n.elContent)}},{key:"setCamera",value:function(e){var t=new q1(this.viewer,this);this.container.append(t.elContent)}},{key:"setAnnotation",value:function(e){e=new Y1(this.viewer,this,e);this.container.append(e.elContent)}},{key:"setCameraAnimation",value:function(e){e=new X1(this.viewer,this,e);this.container.append(e.elContent)}}])}();function Z1(e){for(var e=e.toFixed(3),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(Be.degToRad(e/2));n.shear[1]+=.1*e}),n.elRight.click(function(){var e=t.getFOV(),e=Math.tan(Be.degToRad(e/2));n.shear[0]+=.1*e}),n.elDown.click(function(){var e=t.getFOV(),e=Math.tan(Be.degToRad(e/2));n.shear[1]-=.1*e}),n.elLeft.click(function(){var e=t.getFOV(),e=Math.tan(Be.degToRad(e/2));n.shear[0]-=.1*e}),n.scene=null,n.sceneControls=new Fs;return n.addEventListener("mousewheel",function(e){n.fovDelta+=-e.delta}),n}return v(e,mm),A(e,[{key:"hasSomethingCaptured",value:function(){return null!==this.image}},{key:"capture",value:function(e){this.hasSomethingCaptured()||(this.image=e,this.originalFOV=this.viewer.getFOV(),this.originalControls=this.viewer.getControls(),this.viewer.setControls(this),this.viewer.scene.overrideCamera=this.shearCam,e=this.viewer.renderer.domElement,e=$(e.parentElement),this.shear=[0,0],e.append(this.elUp),e.append(this.elRight),e.append(this.elDown),e.append(this.elLeft),e.append(this.elExit))}},{key:"release",value:function(){this.image=null,this.viewer.scene.overrideCamera=null,this.elUp.detach(),this.elRight.detach(),this.elDown.detach(),this.elLeft.detach(),this.elExit.detach(),this.viewer.setFOV(this.originalFOV),this.viewer.setControls(this.originalControls)}},{key:"setScene",value:function(e){this.scene=e}},{key:"update",value:function(e){var t=this.viewer.getFOV(),n=t*(1+ +this.fovDelta/10),n=Math.max(this.fovMin,n),t=(n=Math.min(this.fovMax,n))/t,i=this.viewer.inputHandler.mouse,r=this.viewer.renderer.getSize(new Re),i=[i.x/r.x,(r.y-i.y)/r.y],r=r.x/r.y,a=2*Math.tan(Be.degToRad(n/2)),r=r*a,r=[this.shear[0]-.5*r,this.shear[0]+.5*r],a=[this.shear[1]-.5*a,this.shear[1]+.5*a],t=1-t,r=[(1-t)*this.shear[0]+t*((1-i[0])*r[0]+i[0]*r[1]),(1-t)*this.shear[1]+t*((1-i[1])*a[0]+i[1]*a[1])],t=(this.shear=r,this.viewer.setFOV(n),this.originalCam),i=this.shearCam,r=(t.fov=n,t.updateMatrixWorld(),t.updateProjectionMatrix(),i.copy(t),(a=i.rotation).set.apply(a,Fe(t.rotation.toArray())),i.updateMatrixWorld(),i.projectionMatrix.copy(t.projectionMatrix),U(this.shear,2)),n=r[0],a=r[1],t=(new Me).set(1,0,n,0,0,1,a,0,0,0,1,0,0,0,0,1),r=i.projectionMatrix;r.multiply(t),i.projectionMatrixInverse.copy(r).invert(),i.projectionMatrix.elements.reduce(function(e,t){return e+t},0);this.fovDelta*=0}}])}();var tb,nb,ib,rb,ab,ob,sb,lb,ub,cb,db,hb,pb,fb,mb=new Nu(1,1),vb=new Wl,gb=(vb.vertices.push(new Oe(-.5,-.5,0),new Oe(.5,-.5,0),new Oe(.5,.5,0),new Oe(-.5,.5,0),new Oe(-.5,-.5,0)),function(){return A(function e(t){ue(this,e),this.id=t,this.fov=1,this.position=new Oe,this.rotation=new Oe,this.width=0,this.height=0,this.fov=1;(t=new ga({uniforms:{tColor:{value:new Zn},uNear:{value:0},uOpacity:{value:1}},vertexShader:"\n\tuniform float uNear;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\t\n\tvoid main(){\n\t\tvDebug = vec4(0.0, 1.0, 0.0, 1.0);\n\t\tvec4 modelViewPosition = modelViewMatrix * vec4(position, 1.0);\n\t\t// make sure that this mesh is at least in front of the near plane\n\t\tmodelViewPosition.xyz += normalize(modelViewPosition.xyz) * uNear;\n\t\tgl_Position = projectionMatrix * modelViewPosition;\n\t\tvUV = uv;\n\t}\n\t",fragmentShader:"\n\tuniform sampler2D tColor;\n\tuniform float uOpacity;\n\tvarying vec2 vUV;\n\tvarying vec4 vDebug;\n\tvoid main(){\n\t\tvec4 color = texture2D(tColor, vUV);\n\t\tgl_FragColor = color;\n\t\tgl_FragColor.a = uOpacity;\n\t}\n\t",side:ve})).side=ve;var n=new wl({color:65280});this.mesh=new Q(mb,t),this.line=new Ml(vb,n),this.texture=null,this.mesh.orientedImage=this},[{key:"set",value:function(e,t,n,i){var t=t.map(Be.degToRad),r=((r=this.position).set.apply(r,Fe(e)),(r=this.mesh.position).set.apply(r,Fe(e)),(r=this.rotation).set.apply(r,Fe(t)),(e=this.mesh.rotation).set.apply(e,Fe(t)),U(n,2));this.width=r[0],this.height=r[1],this.mesh.scale.set(this.width/this.height,1,1),this.fov=i,this.updateTransform()}},{key:"updateTransform",value:function(){var e=this.mesh,t=this.line,n=this.fov,i=(e.updateMatrixWorld(),e.getWorldDirection()),n=Be.degToRad(n/2),n=-.5/Math.tan(n),i=i.clone().multiplyScalar(n);e.position.add(i),t.position.copy(e.position),t.scale.copy(e.scale),t.rotation.copy(e.rotation)}}])}()),Ab=function(){function t(){var e;return ue(this,t),(e=le(this,t)).node=null,e.cameraParams=null,e.imageParams=null,e.images=null,e._visible=!0,e}return v(t,mm),A(t,[{key:"visible",get:function(){return this._visible},set:function(e){if(this._visible!==e){var t,n=q(this.images);try{for(n.s();!(t=n.n()).done;){var i=t.value;i.mesh.visible=e,i.line.visible=e}}catch(e){n.e(e)}finally{n.f()}this._visible=e,this.dispatchEvent({type:"visibility_changed",images:this})}}}])}(),Lh=function(){function D(){ue(this,D)}return A(D,null,[{key:"loadCameraParams",value:(n=J(X().mark(function e(t){var n,i,r,a,o;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:return n=e.sent,e.next=5,n.text();case 5:return n=e.sent,r=new DOMParser,r=r.parseFromString(n,"application/xml"),o=parseInt(r.getElementsByTagName("width")[0].textContent),i=parseInt(r.getElementsByTagName("height")[0].textContent),r=parseFloat(r.getElementsByTagName("f")[0].textContent),a=i/2/r,a=2*Be.radToDeg(Math.atan(a)),o={path:t,width:o,height:i,f:r,fov:a},e.abrupt("return",o);case 15:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"loadImageParams",value:(t=J(X().mark(function e(t){var n,i,r,a,o,s,l;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t);case 2:if((n=e.sent).ok){e.next=6;break}return console.error("failed to load ".concat(t)),e.abrupt("return");case 6:return e.next=8,n.text();case 8:i=e.sent,i=i.split(/\r?\n/),r=[],a=1;case 12:if(a\n\t\t'));return e.click(n),e}},{key:"init",value:function(){"merge"==Potree.settings.editType?(this.initMergeBar(),this.initToolbar(),this.initScene(),this.initNavigation()):(this.initAccordion(),this.initAppearance(),this.initToolbar(),this.initScene(),this.initNavigation(),this.initFilters(),this.initSettings(),"pano"!=Potree.settings.editType?(this.initAlignment(),this.initClipModel(),this.initSiteModel(),this.initParitcle(),this.initClippingModel()):this.initPanosEdit()),$("#potree_version_number").html(Potree.version.major+"."+Potree.version.minor+Potree.version.suffix)}},{key:"initAlignment",value:function(){function e(n,i){return function(){var e=$('#alignment li[name="selectPointCloud"] input:checked');Array.from(e).forEach(function(t){var e=viewer.scene.pointclouds.find(function(e){return e.name==t.name});n(e,i)})}}var t=viewer.modules.Alignment,n=$("#alignment"),i=n.find('[name="transform"] button');i.eq(0).on("click",e(t.rotate,10)),i.eq(1).on("click",e(t.rotate,1)),i.eq(2).on("click",e(t.rotate,.1)),i.eq(3).on("click",e(t.rotate,-10)),i.eq(4).on("click",e(t.rotate,-1)),i.eq(5).on("click",e(t.rotate,-.1)),i.eq(6).on("click",e(t.translate,new Oe(-1,0,0))),i.eq(7).on("click",e(t.translate,new Oe(1,0,0))),i.eq(8).on("click",e(t.translate,new Oe(0,-1,0))),i.eq(9).on("click",e(t.translate,new Oe(0,1,0))),i.eq(10).on("click",e(t.translate,new Oe(0,0,-1))),i.eq(11).on("click",e(t.translate,new Oe(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),i=!1;e.find('ul[name="model"] li button').on("click",function(e){var t,n;return i?console.log("还在加载",i):(e=$(e.target),t=e.parent().attr("name"),"select"==e.attr("name")?Potree.selectModel(t):void("添加"==e.text()?(n=Date.now(),Potree.addModel(t,function(){i=!1;var e=Date.now();console.log("加载完毕",t,"用时",(e-n)/1e3,"s")}),i=t):(Potree.removeModel(t),e.text("添加"))))}),e.find('li button[name="splitScreen"]').on("click",function(e){e=$(e.target);"分屏"==e.text()?(e.text("恢复"),t.enterSplit()):(e.text("分屏"),t.leaveSplit())});e.find('li button[name="tag"]').on("click",function(e){$(e.target);viewer.tagTool.startInsertion()})}},{key:"initClippingModel",value:function(){var e=this,t=viewer.modules.clipping,n=$("#clipping"),i=n.find('[name="operation"] button[name="add"] '),r=n.find('[name="operation"] button[name="switchView"] '),a=n.find(' button[name="enter"] '),o=n.find(' button[name="exit"] '),s=n.find('[name="list"] ul ');a.on("click",function(){t.enter(),n.find("li[name=operation]").css("display","block"),n.find("li[name=list]").css("display","block")}),o.on("click",function(){t.leave(),n.find("li[name=operation]").css("display","none"),n.find("li[name=list]").css("display","none")}),r.on("click",function(){t.switchView("top"==t.activeViewName?"mainView":"top")}),n.find('[name="operation"] button[name="translation"] ').on("click",function(){t.setTranMode("translation")}),n.find('[name="operation"] button[name="rotation"] ').on("click",function(){t.setTranMode("rotation")}),n.find('[name="operation"] button[name="scale"] ').on("click",function(){t.setTranMode("scale")}),i.on("click",function(){var t=e.volumeTool.startInsertion({clip:!0,clipTask:Potree.ClipTask.SHOW_OUTSIDE}),n=$("
  • ");s.append(n),n.find("button[name=changeTask]").on("click",function(e){"不可见"==e.target.innerText?(t.clipTask=Potree.ClipTask.SHOW_INSIDE,e.target.innerText="可见"):(t.clipTask=Potree.ClipTask.SHOW_OUTSIDE,e.target.innerText="不可见"),t.update()}),n.find("button[name=chose]").on("click",function(e){viewer.transformObject(t)}),n.find("button[name=delete]").on("click",function(e){n.remove(),viewer.scene.removeVolume(t)})}),n.find("button[name=save]").on("click",function(e){t.saveClipData()})}},{key:"addAlignmentButton",value:function(e){var t=$('#alignment li[name="selectPointCloud"]>div'),e=$(' \n \n "));t.append(e)}},{key:"initClipModel",value:function(){var e=viewer.modules.Clip,t=$("#clipModel").find("button");t.eq(0).on("click",e.enter.bind(e)),t.eq(1).on("click",e.download.bind(e)),t.eq(2).on("click",e.leave.bind(e))}},{key:"initSiteModel",value:function(){var e=viewer.modules.SiteModel,t=$("#siteModel");t.find('button[name="start"] ').on("click",e.enter.bind(e)),t.find('button[name="exit"] ').on("click",e.leave.bind(e)),t.find('button[name="building"] ').on("click",e.startInsertion.bind(e,"building")),t.find('button[name="floor"] ').on("click",function(){e.addFloor(e.buildings[0],"top")}),t.find('button[name="room"] ').on("click",function(){e.startInsertion("room",e.buildings[0].buildChildren[0])}),t.find('button[name="digHole"] ').on("click",function(){e.selected&&e.startInsertion("hole",e.selected)}),t.find('button[name="selectBuilding"] ').on("click",function(){e.selectEntity(e.buildings[0])}),t.find('button[name="selectFloor"] ').on("click",function(){e.selectEntity(e.buildings[0].buildChildren[0])}),t.find('button[name="selectRoom"] ').on("click",function(){e.selectEntity(e.buildings[0].buildChildren[0].buildChildren[0])}),t.find('button[name="removeFirstBuilding"] ').on("click",function(){e.removeEntity(e.buildings[0])}),t.find('button[name="removeFirstFloor"] ').on("click",function(){e.removeEntity(e.buildings[0].buildChildren[0])}),t.find('button[name="removeFirstRoom"] ').on("click",function(){e.removeEntity(e.buildings[0].buildChildren[0].buildChildren[0])}),t.find('button[name="removeFirstHole"] ').on("click",function(){e.selected.removeHole(e.selected.holes[0])}),t.find('button[name="removeFirstMarker"] ').on("click",function(){e.selected.removeMarker(0)})}},{key:"initParitcle",value:function(){var e=viewer.modules.ParticleEditor,t=$("#particle");t.find('button[name="addFire"] ').on("click",function(){e.startInsertion("fire+smoke")}),t.find('button[name="addExplode"] ').on("click",function(){e.startInsertion("explode")})}},{key:"initPanosEdit",value:function(){var e=viewer.modules.PanoEditor,t=viewer.modules.Alignment,n=$("#panos");n.find('button[name="save"] ').on("click",function(){console.log("saveData",e.exportSavingData())}),n.find('button[name="translate"] ').on("click",function(){t.switchHandle("translate")}),n.find('button[name="rotate"] ').on("click",function(){t.switchHandle("rotate")}),n.find('button[name="topView"] ').on("click",function(){e.switchView("top")}),n.find('button[name="sideView"] ').on("click",function(){e.switchView("right")}),n.find('button[name="3DView"] ').on("click",function(){e.switchView("mainView")}),n.find('button[name="addLink"] ').on("click",function(){e.setLinkOperateState("addLink",!0)}),n.find('button[name="removeLink"] ').on("click",function(){e.setLinkOperateState("removeLink",!0)}),n.find('button[name="getCloser"] ').on("click",function(){e.setZoomInState(!0)})}},{key:"initToolbar",value:function(){var n=this,e=$("#tools"),e=(e.append(this.createToolIcon(Potree.resourcePath+"/icons/angle.png","[title]tt.angle_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showAngles:!0,showArea:!1,closed:!0,maxMarkers:3,minMarkers:3,measureType:"Angle"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/point.svg","[title]tt.point_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showAngles:!1,showCoordinates:!0,showEdges:!1,showArea:!1,closed:!0,maxMarkers:1,minMarkers:1,measureType:"Point"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]tt.distance_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!1,closed:!1,minMarkers:2,maxMarkers:2,measureType:"Distance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]MulDistance",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!1,closed:!1,minMarkers:2,measureType:"MulDistance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]MulDistance Ring",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({closed:!0,minMarkers:3,measureType:"MulDistance Ring"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]Ver MulDistance",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({measureType:"Ver MulDistance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/distance.svg","[title]Hor MulDistance",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({measureType:"Hor MulDistance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/height.svg","[title]tt.height_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showHeight:!0,showArea:!1,closed:!1,maxMarkers:2,minMarkers:2,measureType:"Ver Distance"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/circle.svg","[title]tt.circle_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showHeight:!1,showArea:!1,showCircle:!0,showEdges:!1,closed:!1,maxMarkers:3,minMarkers:3,measureType:"Circle"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/azimuth.svg","Azimuth",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!1,showHeight:!1,showArea:!1,showCircle:!1,showEdges:!1,showAzimuth:!0,closed:!1,maxMarkers:2,minMarkers:2,measureType:"Azimuth"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]tt.area_measurement",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:3,measureType:"Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]Hor Area",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:3,measureType:"Hor Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]Ver Area",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:3,measureType:"Ver Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]area_freedom_rect",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:4,maxMarkers:4,isRect:!0,measureType:"Rect Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]area_horizontal_rect",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:4,maxMarkers:4,isRect:!0,faceDirection:"horizontal",measureType:"Hor Rect Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]area_vertical_rect",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({showDistances:!0,showArea:!0,closed:!0,minMarkers:4,maxMarkers:4,isRect:!0,faceDirection:"vertical",measureType:"Ver Rect Area"}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/area.svg","[title]prism",function(){$("#menu_measurements").next().slideDown();var t=n.measuringTool.startInsertion({measureType:"MulDistance Ring",unit:"metric"}),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:qy}),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/profile.svg","[title]tt.height_profile",function(){$("#menu_measurements").next().slideDown();var t=n.profileTool.startInsertion(),e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/annotation.svg","[title]tt.annotation",function(){$("#menu_measurements").next().slideDown();var t=n.viewer.annotationTool.startInsertion(),e=$("#jstree_scene").jstree().get_json("annotations").children.find(function(e){return e.data.uuid===t.uuid});$.jstree.reference(e.id).deselect_all(),$.jstree.reference(e.id).select_node(e.id)})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/reset_tools.svg","[title]tt.remove_all_measurement",function(){n.viewer.scene.removeAllMeasurements()})),$("#measurement_options_show")),t=(e.selectgroup({title:"Show/Hide labels"}),e.find("input").click(function(e){e="SHOW"===e.target.value;n.measuringTool.showLabels=e}),this.measuringTool.showLabels?"SHOW":"HIDE");e.find("input[value=".concat(t,"]")).trigger("click")}},{key:"initScene",value:function(){function t(e){var t=e.pointcloud,e="".concat(Potree.resourcePath,"/icons/cloud.svg"),n=w(b,t.name,e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function n(e){var e=e.measurement,t=ne.getMeasurementIcon(e);w(x,e.name,t,e)}function i(e){var t=e.volume,e=ne.getMeasurementIcon(t),n=w(x,t.name,e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function r(e){var e=e.profile,t=ne.getMeasurementIcon(e);w(x,e.name,t,e)}function e(e){var e=e.animation,t="".concat(Potree.resourcePath,"/icons/camera_animation.svg");w(E,"animation",t,e)}function a(e){var t=e.images,e="".concat(Potree.resourcePath,"/icons/picture.svg"),n=w(C,"images",e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function o(e){var t=e.images,e="".concat(Potree.resourcePath,"/icons/picture.svg"),n=w(C,"360° images",e,t);t.addEventListener("visibility_changed",function(){t.visible?y.jstree("check_node",n):y.jstree("uncheck_node",n)})}function s(e){var t,e=e.geopackage,n="".concat(Potree.resourcePath,"/icons/triangle.svg"),i=$("#jstree_scene"),r=q(e.node.children);try{for(r.s();!(t=r.n()).done;){var a=t.value,o=a.name,s=i.jstree("create_node","vectors",{text:o,icon:n,object:a,data:a},"last",!1,!1);i.jstree(a.visible?"check_node":"uncheck_node",s)}}catch(e){r.e(e)}finally{r.f()}}function l(t){var e=$("#jstree_scene").jstree().get_json("measurements").children.find(function(e){return e.data.uuid===t.measurement.uuid});y.jstree("delete_node",e.id)}var u,c=this,d=$("#menu_scene"),F=d.next().find("#scene_objects"),O=d.next().find("#scene_object_properties"),d=d.next().find("#scene_export"),h="".concat(Potree.resourcePath,"/icons/file_geojson.svg"),p="".concat(Potree.resourcePath,"/icons/file_dxf.svg"),f="".concat(Potree.resourcePath,"/icons/file_potree.svg"),m=(d.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')),d.find("img[name=geojson_export_button]").parent()),v=(m.click(function(e){var t=c.viewer.scene,t=[].concat(Fe(t.measurements),Fe(t.profiles),Fe(t.volumes));0')),w=(F.append(y),y.jstree({plugins:["checkbox","state"],core:{dblclick_toggle:!1,state:{checked:!0},check_callback:!0,expand_selected_onload:!0},checkbox:{keep_selected_style:!0,three_state:!1,whole_node:!1,tie_selection:!1}}),function(e,t,n,i){e=y.jstree("create_node",e,{text:t,icon:n,data:i},"last",!1,!1);return i.visible?y.jstree("check_node",e):y.jstree("uncheck_node",e),e}),b=y.jstree("create_node","#",{text:"Point Clouds",id:"pointclouds"},"last",!1,!1),x=y.jstree("create_node","#",{text:"Measurements",id:"measurements"},"last",!1,!1),h=y.jstree("create_node","#",{text:"Annotations",id:"annotations"},"last",!1,!1),E=y.jstree("create_node","#",{text:"Other",id:"other"},"last",!1,!1),p=y.jstree("create_node","#",{text:"Vectors",id:"vectors"},"last",!1,!1),C=y.jstree("create_node","#",{text:" Images",id:"images"},"last",!1,!1),U=(y.jstree("check_node",b),y.jstree("check_node",x),y.jstree("check_node",h),y.jstree("check_node",E),y.jstree("check_node",p),y.jstree("check_node",C),y.on("create_node.jstree",function(e,t){y.jstree("open_all")}),y.on("select_node.jstree",function(e,t){t=t.node.data;A.set(t),c.viewer.inputHandler.deselectAll(),t instanceof Wy&&c.viewer.inputHandler.toggleSelection(t),$(c.viewer.renderer.domElement).focus()}),y.on("deselect_node.jstree",function(e,t){A.set(null)}),y.on("delete_node.jstree",function(e,t){A.set(null)}),y.on("dblclick",".jstree-anchor",function(e){var t,n,i=$.jstree.reference(e.target).get_node(e.target).data;e.target.classList.contains("jstree-checkbox")||(i instanceof gm?(e=c.viewer.getBoundingBox([i]),(n=new Z).boundingBox=e,c.viewer.zoomTo(n,1,500)):i instanceof iy?(e=i.points.map(function(e){return e.position}),0==(n=(new K).setFromPoints(e)).getSize(new Oe).length()&&(n.min=n.max.clone(),n.expandByVector(new Oe(1,1,1))),(e=new Z).boundingBox=n,c.viewer.zoomTo(e,2,500)):i instanceof If?(n=i.points,0<(e=(new K).setFromPoints(n)).getSize(new Oe).length()&&((n=new Z).boundingBox=e,c.viewer.zoomTo(n,1,500))):i instanceof Wy?0<(e=i.boundingBox.clone().applyMatrix4(i.matrixWorld)).getSize(new Oe).length()&&((n=new Z).boundingBox=e,c.viewer.zoomTo(n,1,500)):i instanceof pv?i.moveHere(c.viewer.scene.getActiveCamera()):i instanceof rm?(e=i.camera.getWorldDirection(new Oe),i.camera instanceof Ad?(e.multiplyScalar(i.camera.right),t=(new Oe).addVectors(i.camera.position,e),c.viewer.setCameraMode(Cm.ORTHOGRAPHIC)):i.camera instanceof ya&&(e.multiplyScalar(c.viewer.scene.view.radius),t=(new Oe).addVectors(i.camera.position,e),c.viewer.setCameraMode(Cm.PERSPECTIVE)),c.viewer.scene.view.position.copy(i.camera.position),c.viewer.scene.view.lookAt(t)):"SpotLight"===i.type?(n=0\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t')),e=r.find("input"),i=r.find("#".concat(i)),e=(e.click(function(e){c.viewer.setClassificationVisibility(t,e.target.checked)}),n.color.map(function(e){return 255*e}).join(", ")),e="rgb(".concat(e,")");i.spectrum({color:e,showInput:!0,preferredFormat:"rgb",cancelText:"",chooseText:"Apply",move:function(e){e=e.toRgb(),e=[e.r/255,e.g/255,e.b/255,1];n.color=e},change:function(e){e=e.toRgb(),e=[e.r/255,e.g/255,e.b/255,1];n.color=e}}),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()})}),[["EN","en"],["FR","fr"],["DE","de"],["JP","jp"],["ES","es"],["SE","se"],["ZH","zh"]]),a=$("#potree_languages"),o=0;o".concat(t,""));e.click(function(){return i.viewer.setLanguage(n)}),0===o&&e.css("margin-left","30px"),a.append(e),o"),e.append(this.createToolIcon(Potree.resourcePath+"/icons/left.svg","[title]tt.left_view_control",function(){n.viewer.setLeftView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/right.svg","[title]tt.right_view_control",function(){n.viewer.setRightView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/front.svg","[title]tt.front_view_control",function(){n.viewer.setFrontView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/back.svg","[title]tt.back_view_control",function(){n.viewer.setBackView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/top.svg","[title]tt.top_view_control",function(){n.viewer.setTopView()})),e.append(this.createToolIcon(Potree.resourcePath+"/icons/bottom.svg","[title]tt.bottom_view_control",function(){n.viewer.setBottomView()})),$('\n\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t')),e=(e.append(a),a.selectgroup({title:"Camera Projection"}),a.find("input").click(function(e){n.viewer.setCameraMode(Cm[e.target.value])}),Object.keys(Cm).filter(function(e){return Cm[e]===n.viewer.scene.cameraMode})),o=(a.find("input[value=".concat(e,"]")).trigger("click"),new Re(1,1e4));i.slider({value:t(this.viewer.getMoveSpeed()),min:0,max:1,step:.01,slide:function(e,t){n.viewer.setMoveSpeed((t=t.value,Math.pow(t,4)*o.y+o.x))}}),this.viewer.addEventListener("move_speed_changed",function(e){r.html(n.viewer.getMoveSpeed().toFixed(1)),i.slider({value:t(n.viewer.getMoveSpeed())})}),r.html(this.viewer.getMoveSpeed().toFixed(1))}},{key:"initSettings",value:function(){var n=this,e=($("#sldMinNodeSize").slider({value:this.viewer.getMinNodeSize(),min:0,max:1e3,step:.01,slide:function(e,t){n.viewer.setMinNodeSize(t.value)}}),this.viewer.addEventListener("minnodesize_changed",function(e){$("#lblMinNodeSize").html(parseInt(n.viewer.getMinNodeSize())),$("#sldMinNodeSize").slider({value:n.viewer.getMinNodeSize()})}),$("#lblMinNodeSize").html(parseInt(this.viewer.getMinNodeSize())),$("#splat_quality_options")),t=(e.selectgroup({title:"Splat Quality"}),e.find("input").click(function(e){"standard"===e.target.value?n.viewer.useHQ=!1:"hq"===e.target.value&&(n.viewer.useHQ=!0)}),this.viewer.useHQ?"hq":"standard");e.find("input[value=".concat(t,"]")).trigger("click"),$("#show_bounding_box").click(function(){n.viewer.setShowBoundingBox($("#show_bounding_box").prop("checked"))}),$("#set_freeze").click(function(){n.viewer.setFreeze($("#set_freeze").prop("checked"))})}}])}(),Ob=function(){function n(e){var t;return ue(this,n),(t=le(this,n)).viewer=e,t.renderer=e.renderer,t.sg=new ju(.1),t.sm=new cc,t.s=new Q(t.sg,t.sm),t}return v(n,mm),A(n,[{key:"startInsertion",value:function(){function t(e){e.button===oe.LEFT?o.finish():e.button===oe.RIGHT&&o.cancel()}var n=this,i=this.viewer.renderer.domElement,r=new pv({position:[589748.27,231444.54,753.675],title:"Annotation Title",description:"Annotation Description"}),a=(this.dispatchEvent({type:"start_inserting_annotation",annotation:r}),this.viewer.scene.annotations),o=(a.add(r),{cancel:null,finish:null}),s=(o.cancel=function(e){a.remove(r),i.removeEventListener("mouseup",t,!0)},o.finish=function(e){i.removeEventListener("mouseup",t,!0)},i.addEventListener("mouseup",t,!0),function(e){e=ne.getMousePointCloudIntersection(e.drag.end,e.viewer.scene.getActiveCamera(),e.viewer,e.viewer.scene.pointclouds,{pickClipped:!0});e&&(n.s.position.copy(e.location),r.position.copy(e.location))}),l=function(e){viewer.scene.scene.remove(n.s),n.s.removeEventListener("drag",s),n.s.removeEventListener("drop",l)};return this.s.addEventListener("drag",s),this.s.addEventListener("drop",l),this.viewer.scene.scene.add(this.s),this.viewer.inputHandler.startDragging(this.s),r}},{key:"update",value:function(){}},{key:"render",value:function(){}}])}(),Ub={priorityEvent:[{zoomInCloud:"zoom-in"},{hoverPano:"pointer"},{connectPano:"url({Potree.resourcePath}/images/connect.png),auto"},{disconnectPano:"url({Potree.resourcePath}/images/connect-dis.png),auto"},{hoverLine:"pointer"},{hoverTranHandle:"grab"},{movePointcloud:"move"},{polygon_isIntersectSelf:"not-allowed"},{polygon_AtWrongPlace:"not-allowed"},{delPoint:'url("https://4dkk.4dage.com/v4-test/www/sdk/images/polygon_mark/pic_pen_sub.png"), auto'},{markerMove:"grab"},{addPoint:'url("https://4dkk.4dage.com/v4-test/www/sdk/images/polygon_mark/pic_pen_add.png"), auto'},{mapClipMove:"move"},{mapClipRotate:"url({Potree.resourcePath}/images/rotate-cursor.png),auto"},{rotatePointcloud:"url({Potree.resourcePath}/images/rotate-cursor.png),auto"},{siteModelFloorDrag:"row-resize"},{addSth:"cell"}],list:[],currentCursorIndex:null,init:function(e,t){var n=this;this.priorityEvent.forEach(function(e){for(var t in e)e[t]=j.replaceAll(e[t],"{Potree.resourcePath}",Potree.resourcePath)}),this.domElements=t.map(function(e){return e.renderArea}),e.addEventListener("CursorChange",function(e){"add"==e.action?n.add(e.name):n.remove(e.name)})},add:function(t){var e=this.priorityEvent.find(function(e){return e[t]});e?this.list.includes(t)||(this.judge({addItem:e,name:t}),this.list.push(t)):console.error("CursorDeal 未定义优先级 name:"+t)},remove:function(e){e=this.list.indexOf(e);-1=r}):e).reduce(function(e,t){return t.fromBase(n)=r}).reduce(function(e,t){return t.toBase(n)n))return i=this.holes.concat(this.parentHoles).filter(function(e){return e!=t&&2i)&&(e.zMax=i),o&&(o.zMin=e.zMax,o.update(),o.dispatchEvent({type:"changeHeight"}))):(o=e.buildParent.buildChildren[a-1],e.zMin=Math.max(qx.zMin,n),i=e.zMax-.5,e.zMin>i?e.zMin=i:o&&(r=o.zMin+.5,e.zMinthis.times[n];)n++;return 0==n?this.values[0]:n==i?this.values[i-1]:(t=(e-this.times[n-1])/(this.times[n]-this.times[n-1]),this.values[0]instanceof Oe?this.values[n-1].clone().lerp(this.values[n],t):this.values[n-1]+t*(this.values[n]-this.values[n-1]))}}},{key:"clone",value:function(){return j.CloneClassObject(this)}}])}(),lE=function(){return A(function e(){var t=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",cE=(Object.freeze({CUBE:1,SPHERE:2}),new da(1,1,1,1),new R({wireframe:!0,color:"#ffffff"}),{positions:[],positionStyle:"sphere",positionBase:new Oe(0,0,0),positionSpread:new Oe(1,1,0),radius:1,velocityStyle:"cube",velocityBase:new Oe(0,0,.5),velocitySpread:new Oe(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 Oe(0,1,.5),colorSpread:new Oe(0,0,0),colorTween:new sE([.2,1],[new Oe(0,0,.4),new Oe(0,0,.1)]),opacityBase:.1,opacitySpread:.2,opacityTween:[[0,.1,.9,1],[.1,.4,.03,0]],strength:1,particleDeathAge:3,height:3}),dE=(new Q(new Qu(.03,5,5),new R({color:"white",depthTest:!1})),function(){function o(){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 H(new Float32Array(r),3)),this.geometry.setAttribute("customColor",new H(new Float32Array(a),3)),this.geometry.setAttribute("customVisible",new H(new Float32Array(o),1)),this.geometry.setAttribute("customOpacity",new H(new Float32Array(s),1)),this.geometry.setAttribute("customSize",new H(new Float32Array(l),1)),this.geometry.setAttribute("customAngle",new H(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==Ae,blending:this.blendMode})}},{key:"createParticles",value:function(){this.particles=[];for(var e=this.particleCount,t=new Float32Array(3*e),n=new Float32Array(3*e),i=new Float32Array(e),r=new Float32Array(e),a=new Float32Array(e),o=new Float32Array(e),s=0;s1",e);for(var t=this.particleDeathAge,n=this.particleSpaceTime,i=[],r=[],a=[],o=this.geometry.attributes.position.array,s=this.geometry.attributes.opacity.array,l=this.geometry.attributes.visible.array,u=this.geometry.attributes.color.array,c=this.geometry.attributes.angle.array,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 Potree.Utils.updateVisible(this,"isInsideFrustum",!1)}}},{key:"setSize",value:function(e){e=e.viewport;this.screenHeight=e.resolution.y,this.setPerspective(this.fov,this.screenHeight)}},{key:"setFov",value:function(e){this.fov=e,this.setPerspective(this.fov,this.screenHeight)}},{key:"setPerspective",value:function(e,t){t=Math.abs(t/(2*Math.tan(Be.degToRad(.5*e))));this.material.uniforms.heightOfNearPlane.value=t}},{key:"updateGeometry",value:function(){this.computeParams(),this.reStart()}},{key:"dispose",value:function(){this.geometry.dispose(),this.material.dispose(),this.dispatchEvent("dispose")}}])}(),yE={"fire+smoke":16777215,smoke:16777215,explode:16777215},wE={clipDistance:100,occlusionDistance:60,maxClipFactor:.5,backColor:"#777",useDepth:!0,transparent:!0},bE={bus:new Qn,particleGroup:new Z,curveGroup:new Z,init:function(){this.particleGroup.name="particles",viewer.scene.scene.add(this.particleGroup),this.curveGroup.name="particles-curves",viewer.scene.scene.add(this.curveGroup)},addParticle:function(){var e,t=0t._taskLoad?-1:1});var n,e=r.workerPool[r.workerPool.length-1];return e._taskCosts[t]=i,e._taskLoad+=i,e})}},{key:"_releaseTask",value:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}},{key:"debug",value:function(){console.log("Task load: ",this.workerPool.map(function(e){return e._taskLoad}))}},{key:"dispose",value:function(){for(var e=0;e>8&255,c>>16&255,c>>24&255)),n;d=!0,u=64,n.format=It}n.mipmapCount=1,131072&l[2]&&!1!==t&&(n.mipmapCount=Math.max(1,l[7]));r=l[28];if(n.isCubemap=!!(512&r),!n.isCubemap||1024&r&&2048&r&&4096&r&&8192&r&&16384&r&&32768&r){n.width=l[4],n.height=l[3];for(var h=l[1]+4,p=n.isCubemap?6:1,f=0;f>1,1),v=Math.max(v>>1,1)}}else console.error("THREE.DDSLoader.parse: Incomplete cubemap faces")}return n}});var PC={},DC=R.prototype.setValues,IC=(R.prototype.setValues=function(e){return DC.call(this,e)},function(){function i(e,t,n){return ue(this,i),(e=le(this,i,[e])).dracoLoader=new tC,e.ktx2Loader=new AC,e.meshoptDecoder=SC,e.ddsLoader=new _C,e.dracoLoader.setDecoderPath(n+"three.js/loaders/draco/"),e.ktx2Loader.setTranscoderPath(n+"three.js/loaders/basis/").detectSupport(t),e.pluginCallbacks=[],e.register(function(e){return new UC(e)}),e.register(function(e){return new jC(e)}),e.register(function(e){return new WC(e)}),e.register(function(e){return new zC(e)}),e.register(function(e){return new GC(e)}),e.register(function(e){return new HC(e)}),e.register(function(e){return new VC(e)}),e.register(function(e){return new OC(e)}),e.register(function(e){return new QC(e)}),e.register(function(e){return new NC(e)}),e.register(function(e){return new LC(e)}),e.register(function(e){return new JC(e)}),e.register(function(e){return new qC(e)}),e}return v(i,kc),A(i,[{key:"load",value:function(t,n,e,i){function r(e){i?i(e):console.error(e),a.manager.itemError(t),a.manager.itemEnd(t)}var a=this,o=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:Md.extractUrlBase(t),s=(this.manager.itemStart(t),new Lc(this.manager));s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,function(e){try{a.parse(e,o,function(e){n(e),a.manager.itemEnd(t)},r)}catch(e){r(e)}},e,r)}},{key:"setDRACOLoader",value:function(e){return this.dracoLoader=e,this}},{key:"setDDSLoader",value:function(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}},{key:"setKTX2Loader",value:function(e){return this.ktx2Loader=e,this}},{key:"setMeshoptDecoder",value:function(e){return this.meshoptDecoder=e,this}},{key:"register",value:function(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}},{key:"unregister",value:function(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}},{key:"parse",value:function(e,t,n,i){var r,a={},o={};if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(Md.decodeText(new Uint8Array(e,0,4))===YC){try{a[RC.KHR_BINARY_GLTF]=new ZC(e)}catch(e){return void(i&&i(e))}r=JSON.parse(a[RC.KHR_BINARY_GLTF].content)}else r=JSON.parse(Md.decodeText(new Uint8Array(e)));else r=e;if(void 0===r.asset||r.asset.version[0]<2)i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));else{var s=new wB(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});s.fileLoader.setRequestHeader(this.requestHeader);for(var l=0;l",n).replace("#include ",i).replace("#include ",r).replace("#include ",a).replace("#include ",o)},Object.defineProperties(t,{specular:{get:function(){return s.specular.value},set:function(e){s.specular.value=e}},specularMap:{get:function(){return s.specularMap.value},set:function(e){(s.specularMap.value=e)?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return s.glossiness.value},set:function(e){s.glossiness.value=e}},glossinessMap:{get:function(){return s.glossinessMap.value},set:function(e){(s.glossinessMap.value=e)?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete t.metalness,delete t.roughness,delete t.metalnessMap,delete t.roughnessMap,t.setValues(e),t}return v(l,oc),A(l,[{key:"copy",value:function(e){return I(l,"copy",this,3)([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}}])}(),nB=function(){return A(function e(){ue(this,e),this.name=RC.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]},[{key:"getMaterialType",value:function(){return tB}},{key:"extendParams",value:function(e,t,n){var i,t=t.extensions[this.name],r=(e.color=new Se(1,1,1),e.opacity=1,[]);return Array.isArray(t.diffuseFactor)&&(i=t.diffuseFactor,e.color.fromArray(i),e.opacity=i[3]),void 0!==t.diffuseTexture&&r.push(n.assignTexture(e,"map",t.diffuseTexture,On)),e.emissive=new Se(0,0,0),e.glossiness=void 0!==t.glossinessFactor?t.glossinessFactor:1,e.specular=new Se(1,1,1),Array.isArray(t.specularFactor)&&e.specular.fromArray(t.specularFactor),void 0!==t.specularGlossinessTexture&&(i=t.specularGlossinessTexture,r.push(n.assignTexture(e,"glossinessMap",i)),r.push(n.assignTexture(e,"specularMap",i,On))),Promise.all(r)}},{key:"createMaterial",value:function(e){var t=new tB(e);return t.fog=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=void 0===e.emissiveIntensity?1:e.emissiveIntensity,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,t.normalMapType=Nn,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}}])}(),iB=A(function e(){ue(this,e),this.name=RC.KHR_MESH_QUANTIZATION}),rB=function(){function r(e,t,n,i){return ue(this,r),le(this,r,[e,t,n,i])}return v(r,vc),A(r,[{key:"copySampleValue_",value:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i,a=0;a!==i;a++)t[a]=n[r+a];return t}},{key:"interpolate_",value:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=2*o,l=3*o,u=i-t,i=(n-t)/u,n=i*i,t=n*i,c=e*l,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],A=a[d+v+s]*u,y=a[c+v+o],w=a[c+v]*u;r[v]=f*g+m*A+h*y+p*w}return r}}])}(),aB=new ii,oB=function(){function r(){return ue(this,r),le(this,r,arguments)}return v(r,rB),A(r,[{key:"interpolate_",value:function(e,t,n,i){e=I(r,"interpolate_",this,3)([e,t,n,i]);return aB.fromArray(e).normalize().toArray(e),e}}])}(),sB={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},lB={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},uB={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},cB={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},dB={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},hB={CUBICSPLINE:void 0,LINEAR:In,STEP:Dn},pB="OPAQUE",fB="MASK",mB="BLEND";function vB(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 gB(e,t){void 0!==t.extras&&("object"===O(t.extras)?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function AB(e){for(var t="",n=Object.keys(e).sort(),i=0,r=n.length;ithis._getMaxConcurrency()?(e.destroy(),this.count--):this.idleQueue.push(e),this.isDestroyed||this._startQueuedJob()}},{key:"_getAvailableWorker",value:function(){var e;return 0i&&(n=Math.min(n,i/e.width)),e.width*n),e=e.height*n,n=["font-size:1px;","padding:".concat(Math.floor(e/2),"px ").concat(Math.floor(i/2),"px;"),"line-height:".concat(e,"px;"),"background:url(".concat(r,");"),"background-size:".concat(i,"px ").concat(e,"px;"),"color:transparent;"].join("");return["".concat(t," %c+"),n]}function YM(e,t){var n,i=1=iS(e)}},{key:"_getLogFunction",value:function(e,t,n,i,r){if(this._shouldLog(e)){r=rS({logLevel:e,message:t,args:i,opts:r}),XM(n=n||r.method),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=KM();e=r.tag||r.message;if(r.once){if(tS[e])return eS;tS[e]=KM()}return t=function(e,t,n){{var i;"string"==typeof t&&(i=n.time?function(e,t){return t=Math.max((12*Math.PI)throw Error("radians");i*=Math.tan(t/2),t=i*n;return(new c).ortho({left:-t,right:t,bottom:-i,top:i,near:r,far:e})}},{key:"perspective",value:function(){var e=02*Math.PI)throw Error("radians");return n=this,t=t,i=i,r=r,e=e,t=1/Math.tan(t/2),n[0]=t/i,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,null!=e&&e!==1/0?(n[10]=(e+r)*(i=1/(r-e)),n[14]=2*e*r*i):(n[10]=-1,n[14]=-2*r),this.check()}},{key:"determinant",value:function(){return t=(e=this)[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],u=e[8],c=e[9],d=e[10],h=e[11],p=e[12],f=e[13],m=e[14],e=e[15],(t*o-n*a)*(d*e-h*m)-(t*s-i*a)*(c*e-h*f)+(t*l-r*a)*(c*m-d*f)+(n*s-i*o)*(u*e-h*p)-(n*l-r*o)*(u*m-d*p)+(i*l-r*s)*(u*f-c*p);var e,t,n,i,r,a,o,s,l,u,c,d,h,p,f,m}},{key:"getScale",value:function(){var e=0t[a=0]&&(a=1),n=((a=t[8]>t[3*a+a]?2:a)+1)%3,i=(a+2)%3,r=Math.sqrt(t[3*a+a]-t[3*n+n]-t[3*i+i]+1),e[a]=.5*r,e[3]=(t[3*n+i]-t[3*i+n])*(r=.5/r),e[n]=(t[3*n+a]+t[3*a+n])*r,e[i]=(t[3*i+a]+t[3*a+i])*r),e}var GT,HT,VT,QT=function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e[2]=t[2]+n[2],e[3]=t[3]+n[3],e},jT=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e},WT=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},JT=function(e,t,n,i){var r=t[0],a=t[1],o=t[2],t=t[3];return e[0]=r+i*(n[0]-r),e[1]=a+i*(n[1]-a),e[2]=o+i*(n[2]-o),e[3]=t+i*(n[3]-t),e},qT=function(e){var t=e[0],n=e[1],i=e[2],e=e[3];return Math.hypot(t,n,i,e)},YT=function(e){var t=e[0],n=e[1],i=e[2],e=e[3];return t*t+n*n+i*i+e*e},XT=function(e,t){var n=t[0],i=t[1],r=t[2],t=t[3],a=n*n+i*i+r*r+t*t;return 0t_);return s_.scale([A,y,w]).to(n)}}(e,this,t)}},{key:"scaleToGeocentricSurface",value:function(e){var t=1=this.radii.z-t))return x_.set(0,0,e).to(n)}}],[{key:"WGS84",get:function(){return A_=A_||new i(6378137,6378137,6356752.314245179)}}])}(),M_=A(function e(t,n,i){ue(this,e),l(this,"item",void 0),l(this,"previous",void 0),l(this,"next",void 0),this.item=t,this.previous=n,this.next=i}),S_=function(){return A(function e(){ue(this,e),l(this,"head",null),l(this,"tail",null),l(this,"_length",0)},[{key:"length",get:function(){return this._length}},{key:"add",value:function(e){e=new M_(e,this.tail,null);return this.tail?this.tail.next=e:this.head=e,this.tail=e,++this._length,e}},{key:"remove",value:function(e){e&&(e.previous&&e.next?(e.previous.next=e.next,e.next.previous=e.previous):e.previous?(e.previous.next=null,this.tail=e.previous):e.next?(e.next.previous=null,this.head=e.next):(this.head=null,this.tail=null),e.next=null,e.previous=null,--this._length)}},{key:"splice",value:function(e,t){e!==t&&(this.remove(t),this._insert(e,t))}},{key:"_insert",value:function(e,t){var n=e.next;e.next=t,this.tail===e?this.tail=t:n.previous=t,t.next=n,t.previous=e,++this._length}}])}();function T_(e){return null!=e}var __=function(){return A(function e(){ue(this,e),l(this,"_list",void 0),l(this,"_sentinel",void 0),l(this,"_trimTiles",void 0),this._list=new S_,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1},[{key:"reset",value:function(){this._list.splice(this._list.tail,this._sentinel)}},{key:"touch",value:function(e){e=e._cacheNode;T_(e)&&this._list.splice(this._sentinel,e)}},{key:"add",value:function(e,t,n){T_(t._cacheNode)||(t._cacheNode=this._list.add(t),n&&n(e,t))}},{key:"unloadTile",value:function(e,t,n){var i=t._cacheNode;T_(i)&&(this._list.remove(i),t._cacheNode=void 0,n)&&n(e,t)}},{key:"unloadTiles",value:function(e,t){for(var n=this._trimTiles,i=(this._trimTiles=!1,this._list),r=1024*(Potree.settings.tiles3DMaxMemory||e.maximumMemoryUsage)*1024,a=this._sentinel,o=i.head;o!==a&&(function e(t){var t=0r||n);){var s=o.item,o=o.next;this.unloadTile(e,s,t),15e5this.radius&&(this.radius=e),this}},{key:"transform",value:function(e){this.center.transform(e);t=D_,i=(n=e)[0],r=e[1],a=e[2],o=e[4],s=e[5],l=e[6],u=e[8],c=e[9],n=e[10],t[0]=Math.hypot(i,r,a),t[1]=Math.hypot(o,s,l),t[2]=Math.hypot(u,c,n);var t,n,i,r,a,o,s,l,u,c,e=t;return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}},{key:"distanceSquaredTo",value:function(e){e=this.distanceTo(e);return e*e}},{key:"distanceTo",value:function(e){e=(e=D_.from(e)).subtract(this.center);return Math.max(0,e.len()-this.radius)}},{key:"intersectPlane",value:function(e){var t=this.center,n=this.radius,t=e.normal.dot(t)+e.distance;return t<-n?P_.OUTSIDE:tthis._array.length&&(this._array.length=e)}},{key:"values",get:function(){return this._array}},{key:"get",value:function(e){return _B(e=this.length&&(this.length=e+1),this._map.has(this._array[e])&&this._map.delete(this._array[e]),this._array[e]=t,this._map.set(t,e)}},{key:"delete",value:function(e){var t=this._map.get(e);0<=t&&(this._array.splice(t,1),this._map.delete(e),this.length--)}},{key:"peek",value:function(){return this._array[this._length-1]}},{key:"push",value:function(e){var t;this._map.has(e)||(t=this.length++,this._array[t]=e,this._map.set(e,t))}},{key:"pop",value:function(){var e=this._array[--this.length];return this._map.delete(e),e}},{key:"reserve",value:function(e){_B(0<=e),e>this._array.length&&(this._array.length=e)}},{key:"resize",value:function(e){_B(0<=e),this.length=e}},{key:"trim",value:function(e){null==e&&(e=this.length),this._array.length=e}},{key:"reset",value:function(){this._array=[],this._map=new Map,this._length=0}},{key:"find",value:function(e){return this._map.has(e)}}])}(),NP={loadSiblings:!1,skipLevelOfDetail:!1,maximumScreenSpaceError:2,updateTransforms:!0,onTraversalEnd:function(){},viewportTraversersMap:{},basePath:""},zP=function(){return A(function e(t){ue(this,e),l(this,"options",void 0),l(this,"root",void 0),l(this,"requestedTiles",void 0),l(this,"selectedTiles",void 0),l(this,"emptyTiles",void 0),l(this,"_traversalStack",void 0),l(this,"_emptyTraversalStack",void 0),l(this,"_frameNumber",void 0),this.options=g(g({},NP),t),this._traversalStack=new UP,this._emptyTraversalStack=new UP,this._frameNumber=null,this.root=null,this.selectedTiles={},this.requestedTiles={},this.emptyTiles={}},[{key:"traverse",value:function(e,t,n){this.root=e,this.options=g(g({},this.options),n),this.reset(),this.updateTile(e,t),this._frameNumber=t.frameNumber,this.executeTraversal(e,t)}},{key:"reset",value:function(){this.requestedTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}},{key:"executeTraversal",value:function(e,t){var n=this._traversalStack;for(e._selectionDepth=1,n.push(e);0this.options.maximumScreenSpaceError}},{key:"updateTileVisibility",value:function(e,t){var n=[];if(this.options.viewportTraversersMap)for(var i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===t.viewport.id&&n.push(i);else n.push(t.viewport.id);e.updateVisibility(t,n)}},{key:"compareDistanceToCamera",value:function(e,t){return e._distanceToCamera-t._distanceToCamera}},{key:"anyChildrenVisible",value:function(e,t){var n,i=!1,r=q(e.children);try{for(r.s();!(n=r.n()).done;){var a=n.value;a.updateVisibility(t),i=i||a.isVisibleAndInRequestVolume}}catch(e){r.e(e)}finally{r.f()}return i}},{key:"executeEmptyTraversal",value:function(e,t){var n=!0,i=this._emptyTraversalStack;for(i.push(e);0")}}])}(Symbol.toStringTag);function SD(e,t,n){var i=function(e){switch(e.constructor){case Int8Array:return new mD;case Uint8Array:return new AD;case Int16Array:return new vD;case Uint16Array:return new yD;case Int32Array:return new gD;case Uint32Array:return new wD;case Float32Array:return new CD;case Float64Array:return new BD;default:throw new Error("array type not supported")}}(t.value),n=n||function(e){var t=new Map;"byteOffset"in e&&t.set("byteOffset",e.byteOffset.toString(10));"byteStride"in e&&t.set("byteStride",e.byteStride.toString(10));"normalized"in e&&t.set("normalized",e.normalized.toString());return t}(t);return new hD(e,new MD(t.size,new hD("value",i)),!1,n)}function TD(e,t,n){var i,r=PD(t.metadata),a=[],o=function(e){var t,n={};for(t in e){var i=e[t];n[i.name||"undefined"]=i}return n}(t.attributes);for(i in e){var s=_D(i,e[i],o[i]);a.push(s)}return n&&(t=_D("indices",n),a.push(t)),new uD(a,r)}function _D(e,t,n){return SD(e,t,n?PD(n.metadata):void 0)}function PD(e){var t,n=new Map;for(t in e)n.set("".concat(t,".string"),JSON.stringify(e[t]));return n}var DD={POSITION:"POSITION",NORMAL:"NORMAL",COLOR:"COLOR_0",TEX_COORD:"TEXCOORD_0"},ID={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array},kD=function(){return A(function e(t){ue(this,e),l(this,"draco",void 0),l(this,"decoder",void 0),l(this,"metadataQuerier",void 0),this.draco=t,this.decoder=new this.draco.Decoder,this.metadataQuerier=new this.draco.MetadataQuerier},[{key:"destroy",value:function(){this.draco.destroy(this.decoder),this.draco.destroy(this.metadataQuerier)}},{key:"parseSync",value:function(e){var t,n,i,r,a,o,s=1>5&63,i=31&e;return t[0]=(e>>11&31)<<3,t[1]=n<<2,t[2]=i<<3,t}(t[c]);u[3*c]=d[0],u[3*c+1]=d[1],u[3*c+2]=d[2]}return{type:VD.UNSIGNED_BYTE,value:u,size:3,normalized:!0}}return t&&t.length===3*a?{type:VD.UNSIGNED_BYTE,value:t,size:3,normalized:!0}:{type:VD.UNSIGNED_BYTE,value:t,size:4,normalized:!0}}var mI=new B;function vI(e,t){if(!t)return null;if(e.isOctEncoded16P){for(var n=new Float32Array(3*e.pointsLength),i=0;i=3&&t.getUint16(0,r2)===65496&&t.getUint8(2)===255)for(var e=function(){for(var e=new Set([65499,65476,65484,65501,65534]),t=65504;t<65520;++t)e.add(t);var n=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:n}}(),n=e.tableMarkers,i=e.sofMarkers,r=2;r+9mk+vk),o=r.getUint32(a+0,xk),s=r.getUint32(a+4,xk),a+=vk,_B(s===bk),Ck(i,r,a,o),a=(a+=o)+Bk(i,r,a,i.header.byteLength);case 2:s=u,o=l,r={},_B((i=e).header.byteLength>mk+vk);for(var d=i,h=s,p=o,f=r;p+8<=d.header.byteLength;){var m=h.getUint32(p+0,xk),v=h.getUint32(p+4,xk);switch(p+=vk,v){case gk:Ck(d,h,p,m);break;case Ak:Bk(d,h,p,m);break;case yk:f.strict||Ck(d,h,p,m);break;case wk:f.strict||Bk(d,h,p,m)}p+=uM(m,4)}return o+i.header.byteLength;default:throw new Error("Invalid GLB version ".concat(e.version,". Only supports v1 and v2."))}}function Ck(e,t,n,i){t=new Uint8Array(t.buffer,n,i),n=new TextDecoder("utf8").decode(t);e.json=JSON.parse(n),uM(i,4)}function Bk(e,t,n,i){return e.header.hasBinChunk=!0,e.binChunks.push({byteOffset:n,byteLength:i,arrayBuffer:t.buffer}),uM(i,4)}function Mk(){return(Mk=J(X().mark(function e(o,s){var l,u,c,d,h,p,f=arguments;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:l=3>1&1,I=y>>2&1,w=(Math.pow(A,p)-1)/(A-1),y=$k(E.mortonIndex,y),w=w+y,b=$k(E.x,b),x=$k(E.y,x),E=$k(E.z,I),I=!1,C>t&1))}function $k(e,t){return parseInt(e.toString(2)+t.toString(2),2)}function eR(e,t,n,i,r){var a=function(e){var t,n={};for(t in e)n["{".concat(t,"}")]=e[t];return n}({level:t,x:n,y:i,z:r});return e.replace(/{level}|{x}|{y}|{z}/gi,function(e){return a[e]})}function tR(e){if(!e.contentUrl)return MP.EMPTY;var t=e.contentUrl.split(".").pop();switch(t){case"pnts":return MP.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return MP.SCENEGRAPH;default:return t}}function nR(e){switch(e){case"REPLACE":case"replace":return BP.REPLACE;case"ADD":case"add":return BP.ADD;default:return e}}function iR(e,t){var n;return e?(e.content&&(n=e.content.uri||e.content.url,e.contentUrl="".concat(t.basePath,"/").concat(n)),e.id=e.contentUrl,e.lodMetricType=TP.GEOMETRIC_ERROR,e.lodMetricValue=e.geometricError,e.transformMatrix=e.transform,e.type=tR(e),e.refine=nR(e.refine),e):null}function rR(){return(rR=J(X().mark(function e(t){var n,i,r,a,o,s,l,u,c,d;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.root){e.next=2;break}return e.abrupt("return",null);case 2:return n=t.basePath,o=t.root.extensions["3DTILES_implicit_tiling"],i=o.subdivisionScheme,r=o.maximumLevel,a=o.subtreeLevels,o=o.subtrees.uri,s=eR(o,0,0,0,0),s="".concat(n,"/").concat(s),e.next=9,NS(s,qk);case 9:return s=e.sent,d="".concat(n,"/").concat(t.root.content.uri),l=t.root.refine,u=t.root.geometricError,c=t.root.boundingVolume,d={contentUrlTemplate:d,subtreesUriTemplate:o,subdivisionScheme:i,subtreeLevels:a,maximumLevel:r,refine:l,basePath:n,lodMetricType:TP.GEOMETRIC_ERROR,rootLodMetricValue:u,rootBoundingVolume:c,getTileType:tR,getRefine:nR},e.next=17,function(){return aR.apply(this,arguments)}(t.root,s,d);case 17:return e.abrupt("return",e.sent);case 18:case"end":return e.stop()}},e)}))).apply(this,arguments)}function aR(){return(aR=J(X().mark(function e(t,n,i){var r,a;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",null);case 2:return t.lodMetricType=TP.GEOMETRIC_ERROR,t.lodMetricValue=t.geometricError,t.transformMatrix=t.transform,e.next=7,Xk(n,i);case 7:return a=e.sent,r=a.children,(a=a.contentUrl)&&(t.contentUrl=a,t.content={uri:a.replace("".concat(i.basePath,"/"),"")}),t.refine=nR(t.refine),t.type=tR(t),t.children=r,t.id=t.contentUrl,e.abrupt("return",t);case 16:case"end":return e.stop()}},e)}))).apply(this,arguments)}var oR="3DTILES_implicit_tiling",sR={id:"3d-tiles",name:"3D Tiles",module:"3d-tiles",version:"3.1.4",extensions:["cmpt","pnts","b3dm","i3dm"],mimeTypes:["application/octet-stream"],tests:["cmpt","pnts","b3dm","i3dm"],parse:function(e,t,n){return cR.apply(this,arguments)},options:{"3d-tiles":{loadGLTF:!0,decodeQuantizedPositions:!1,isTileset:"auto",assetGltfUpAxis:null}}};function lR(){return(lR=J(X().mark(function e(t,n,i){var r;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={content:{featureIds:null}},e.next=4,zk(t,0,n,i,r.content);case 4:return e.abrupt("return",r.content);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function uR(){return(uR=J(X().mark(function e(i,r,a){var o,s;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((s=JSON.parse((new TextDecoder).decode(i))).loader=r.loader||sR,s.url=a.url,s.basePath=AM(s.url),n=void 0,null!=(t=s)&&null!=(n=t.extensionsRequired)&&n.includes(oR)&&null!=t&&null!=(n=t.extensionsUsed)&&n.includes(oR))return e.next=7,function(){return rR.apply(this,arguments)}(s);e.next=10;break;case 7:e.t0=e.sent,e.next=11;break;case 10:e.t0=function(e){var t=e.basePath,e=iR(e.root,e),n=[];for(n.push(e);0=u.preloadTilesCount)&&(_=!0,G.loadingManager.itemEnd(G.url)),n}},U=function(){var e;u.geoTransform!=CR.WGS84Cartesian&&(e=(new Me).copy(B).invert(),C.copy(R).multiply(e),E.modelMatrix=new LT(C.toArray()),E.tileTransInvert=e.toArray())},O=function(e){var t;e.boundingVolume.halfAxes&&(e=e.boundingVolume.halfAxes,e=(new Me).extractRotation(bR(e)).premultiply((new Me).extractRotation(L)),(new Oi).setFromRotationMatrix(e).equals(new Oi)||(S=!0,t=new Oe(B.elements[12],B.elements[13],B.elements[14]),B.extractRotation(e),B.setPosition(t),U()))},u=Object.assign(Object.assign({},SR),G.options),r=G.url,a=u.updateInterval,o=5,s={},u.cesiumIONToken)return s["cesium-ion"]={accessToken:u.cesiumIONToken},e.next=12,gR.preload(r,s);e.next=14;break;case 12:l=e.sent,s.fetch={headers:l.headers};case 14:return G.loadingManager&&G.loadingManager.itemStart(r),e.next=17,NS(r,sR,Object.assign({},s));case 17:return l=e.sent,c={},d={},h=[],p=new Ts,(f=new Ts).matrixAutoUpdate=!1,u.debug?u.parent.add(f):f.visible=!1,m={pointSize:{type:"f",value:u.pointSize},gradient:{type:"t",value:BR},grayscale:{type:"t",value:MR},rootCenter:{type:"vec3",value:new Oe},rootNormal:{type:"vec3",value:new Oe},coloring:{type:"i",value:u.pointCloudColoring},hideGround:{type:"b",value:!0},elevationRange:{type:"vec2",value:new Re(0,400)},maxIntensity:{type:"f",value:1},intensityContrast:{type:"f",value:1},alpha:{type:"f",value:1}},v=new ga({uniforms:m,vertexShader:"\n varying vec3 vColor;\n uniform sampler2D gradient;\n uniform sampler2D grayscale;\n attribute float intensity;\n attribute float classification;\n uniform vec3 rootCenter;\n uniform vec3 rootNormal;\n uniform vec2 elevationRange;\n uniform int coloring;\n uniform bool hideGround;\n uniform float maxIntensity;\n uniform float intensityContrast;\n uniform float pointSize;\n\n #ifdef USE_COLOR\n vec3 getRGB() {\n vec3 rgb = color;\n return rgb;\n }\n #endif\n\n vec3 getElevation(){\n vec4 world = modelMatrix * vec4( position, 1.0 );\n float diff = abs(dot(rootNormal, (vec3(world) - rootCenter)));\n float w = max(diff - elevationRange.x,0.0) / max(elevationRange.y - elevationRange.x,1.0);\n vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;\n\n return cElevation;\n }\n\n vec3 getIntensity(){\n // TODO: real contrast enhancement. Check https://github.com/yuki-koyama/enhancer/blob/master/shaders/enhancer.fs\n float intmod = pow(intensity, intensityContrast);\n vec3 cIntensity = texture2D(grayscale, vec2(intmod / maxIntensity ,1.0-(intmod / maxIntensity))).rgb;\n return cIntensity;\n }\n\n vec3 getClassification(){\n float classNormalized = classification / 255.0;\n vec3 cClassification = texture2D(gradient, vec2(classNormalized * 5.0,1.0-classNormalized * 5.0)).rgb;\n return cClassification;\n }\n\n vec3 getColor(){\n vec3 color;\n if (hideGround && classification == 2.0) {\n return vec3(0.0, 0.0, 0.0); \n }\n\n if (coloring == 1) {\n color = getIntensity();\n }\n else if (coloring == 2) {\n color = getClassification();\n } else if (coloring == 3) {\n color = getElevation();\n } \n #ifdef USE_COLOR\n else if (coloring == 4) {\n color = getRGB();\n }\n #endif\n else {\n color = vec3(1.0, 1.0, 1.0);\n }\n return color;\n }\n\n void main() {\n vColor = getColor();\n\n gl_PointSize = pointSize;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }\n",fragmentShader:"\n varying vec3 vColor;\n uniform float alpha;\n\n void main() {\n if (vColor == vec3(0.0, 0.0, 0.0)) {\n discard;\n } else {\n gl_FragColor = vec4( vColor, alpha);\n }\n }\n",transparent:u.transparent,vertexColors:!0}),A=g=null,y=G.gltfLoader||new IC,b=w=void 0,u.basisTranscoderPath&&((w=new AC).detectSupport(G.renderer),w.setTranscoderPath(u.basisTranscoderPath+"/"),w.setWorkerLimit(1),y.setKTX2Loader(w)),u.dracoDecoderPath&&((b=new tC).setDecoderPath(u.dracoDecoderPath+"/"),b.setWorkerLimit(u.maxConcurrency),y.setDRACOLoader(b)),x=new t0({transparent:u.transparent}),M={maximumMemoryUsage:u.maximumMemoryUsage,maximumScreenSpaceError:u.maximumScreenSpaceError,viewDistanceScale:u.viewDistanceScale,skipLevelOfDetail:u.skipLevelOfDetail,updateTransforms:u.updateTransforms,throttleRequests:u.throttleRequests,maxRequests:u.maxRequests,updateTime:u.updateTime||0,contentLoader:function(i){return TB(z,void 0,void 0,X().mark(function e(){var t,n;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=null,e.t0=i.type,e.next=e.t0===MP.POINTCLOUD?4:e.t0===MP.SCENEGRAPH||e.t0===MP.MESH?6:10;break;case 4:return t=function(e,t,n,i){var r={rtc_center:e.content.rtcCenter,points:e.content.attributes.positions,intensities:e.content.attributes.intensity,classifications:e.content.attributes.classification,rgb:null,rgba:null},a=e.content.attributes.colors;a&&3===a.size&&(r.rgb=a.value);a&&4===a.size&&(r.rgba=a.value);a=new V,a.setAttribute("position",new ee(r.points,3)),e=(new Me).fromArray(e.computedTransform).premultiply(i);r.rgba?a.setAttribute("color",new ee(r.rgba,4)):r.rgb&&a.setAttribute("color",new Sr(r.rgb,3,!0));r.intensities&&a.setAttribute("intensity",new H(r.intensities,1,!0));r.classifications&&a.setAttribute("classification",new Sr(r.classifications,1,!1));i=new Fl(a,n.material||t);r.rtc_center&&(a=r.rtc_center,e.multiply((new Me).makeTranslation(a[0],a[1],a[2])));return i.applyMatrix4(e),i}(i,v,u,L),e.abrupt("break",10);case 6:return e.next=8,function(n,s,l,u){return TB(this,void 0,void 0,X().mark(function e(){return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(r,t){var e,a=(new Me).makeRotationAxis(new Oe(1,0,0),Math.PI/2),o="Z"!==(null==(e=s.tileset.asset)?void 0:e.gltfUpAxis);n.parse(("glTF"==s.content.type?s.content.gltf:s.content).gltfArrayBuffer,s.contentUrl?s.contentUrl.substr(0,s.contentUrl.lastIndexOf("/")+1):"",function(e){var t,n,i=e.scenes[0],e=(i.vertexCount=0,s.tileContent=i,s.rtcCenterState!=!!s.content.rtcCenter&&(t=!0),s.rtcCenterState=MB=!!s.content.rtcCenter,s.getContentTransform(t));s.content.rtcCenter&&((n=new Me).makeTranslation(s.content.rtcCenter[0],s.content.rtcCenter[1],s.content.rtcCenter[2]),e.premultiply(n)),t&&s._updateBoundingVolume(s.header),o&&e.multiply(a),i.applyMatrix4(e),i.traverse(function(e){var t,n;"Mesh"==e.type&&(n=(t=(e=e).material).map,u.material?(e.material=u.material.clone(),t.dispose()):u.shading==ER.FlatTexture&&(e.material=l.clone(),t.dispose()),u.shading!=ER.ShadedNoTexture?"ShaderMaterial"!=e.material.type||e.material instanceof t0?e.material.map=n:e.material.uniforms.map={value:n}:(n&&n.dispose(),e.material.map=null),u.shaderCallback&&(e.onBeforeRender=u.shaderCallback),e.material.wireframe=u.wireframe,u.computeNormals&&e.geometry.computeVertexNormals(),i.vertexCount+=e.geometry.attributes.position.count)}),r(i)},function(e){t(new Error("error parsing gltf in tile ".concat(s.id,": ").concat(e)))})}));case 1:case"end":return e.stop()}},e)}))}(y,i,x,u);case 8:return t=e.sent,e.abrupt("break",10);case 10:t&&(t.visible=!1,(c[i.id]=t).name=i.id,t.tile=i,p.add(c[i.id]),u.debug&&(n=wR(i),f.add(n),d[i.id]=n),E.dispatchEvent({type:"tileLoaded",tileContent:t}));case 11:case"end":return e.stop()}},e)}))},onTileLoad:function(t){return TB(z,void 0,void 0,X().mark(function e(){return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:E&&(!S&&(null==t?void 0:t.depth)<=o&&O(t),E._frameNumber++,N(E,c,A,g));case 1:case"end":return e.stop()}},e)}))},onTileUnload:function(e){h.push(e)},onTileError:function(e,t){console.error("Tile error",e.id,t)}},(E=new oD(l,Object.assign(Object.assign({},M),{loadOptions:Object.assign(Object.assign({},s),{maxConcurrency:u.maxConcurrency,worker:u.worker,gltf:{loadImages:!1},"3d-tiles":{loadGLTF:!1}})}))).boxMap=d,C=new Me,B=new Me,M=new Oe,S=!1,E.root.boundingVolume?(E.root.header.boundingVolume.region&&(console.warn("Cannot apply a model matrix to bounding volumes of type region. Tileset stays in original geo-coordinates."),u.geoTransform=CR.WGS84Cartesian),B.setPosition(E.root.boundingVolume.center[0],E.root.boundingVolume.center[1],E.root.boundingVolume.center[2])):console.warn("Bounding volume not found, no transformations applied"),u.debug&&(F=wR(E.root),f.add(F),d[E.root.id]=F),_=T=!1,m.rootCenter.value.copy(M),m.rootNormal.value.copy(new Oe(0,0,1).normalize()),E.stats.get("Loader concurrency").count=u.maxConcurrency,E.stats.get("Maximum SSE").count=u.maximumScreenSpaceError,E.stats.get("Maximum mem usage").count=u.maximumMemoryUsage,D=null,I=new Oe(1/(P=0),1/0,1/0),k=null,p.updateMatrixWorld(!0),R=(new Me).copy(p.matrixWorld),L=(new Me).copy(R).invert(),E.lastRootTransform=R,O(E.root),U(),u.debug&&(d[E.root.id].applyMatrix4(C),f.matrixWorld.copy(p.matrixWorld)),u.geoTransform==CR.Mercator?(t=E.cartographicCenter[1],n=E.cartographicCenter[0],i=void 0,i=2*Math.PI*6378137/2,n=n*i/180,t=Math.log(Math.tan((90+t)*Math.PI/360))/(Math.PI/180),F=new Re(n,t*i/180),M.set(F.x,0,-F.y),p.position.copy(M),p.rotation.set(-Math.PI/2,0,0),p.updateMatrixWorld(!0)):u.geoTransform==CR.WGS84Cartesian&&(p.applyMatrix4(B),p.updateMatrixWorld(!0),M.copy(p.position)),e.abrupt("return",{model:p,runtime:{getTileset:function(){return E},getStats:function(){return E.stats},showTiles:function(e){f.visible=e},setWireframe:function(t){u.wireframe=t,p.traverse(function(e){e instanceof Q&&(e.material.wireframe=t)})},setDebug:function(e){u.debug=e,f.visible=e},setShading:function(e){u.shading=e},getTileBoxes:function(){return f},setViewDistanceScale:function(e){E.options.viewDistanceScale=e,E._frameNumber++,N(E,c,A,g)},setHideGround:function(e){m.hideGround.value=e},setPointCloudColoring:function(e){m.coloring.value=e},setElevationRange:function(e){m.elevationRange.value.set(e[0],e[1])},setMaxIntensity:function(e){m.maxIntensity.value=e},setIntensityContrast:function(e){m.intensityContrast.value=e},setPointAlpha:function(e){m.alpha.value=e},getLatLongHeightFromPosition:function(e){e=E.ellipsoid.cartesianToCartographic((new Oe).copy(e).applyMatrix4((new Me).copy(C).invert()).toArray());return{lat:e[1],long:e[0],height:e[2]}},getPositionFromLatLongHeight:function(e){e=E.ellipsoid.cartographicToCartesian([e.long,e.lat,e.height]);return ie(Oe,Fe(e)).applyMatrix4(C)},getCameraFrustum:function(e){var t,e=yR(e).planes.map(function(e){return new $_(e.normal.toArray(),e.constant)}).map(function(e){return e=e,t=new Ts,n=new Nu(10,5),i=ie(Oe,Fe(e.projectPointOntoPlane([0,0,0]))),e=new Oe(e.normal.x,e.normal.y,e.normal.z),r=(new Oe).copy(i).add(e),n.lookAt(r),n.translate(i.x,i.y,i.z),r=new t0({color:65535,side:ve}),n=new Q(n,r),r=new ip(e,i,5,16776960),t.add(r),t.add(n),t;var t,n,i,r}),n=new Ts,i=q(e);try{for(i.s();!(t=i.n()).done;){var r=t.value;n.add(r)}}catch(e){i.e(e)}finally{i.f()}return n},update:function(e,t,n,i){g=n,A=t,P+=e,i=i||E.nextForceUpdate,E.nextForceUpdate=!1,E.needRenderNext&&viewer.dispatchEvent("content_changed"),E.needRenderNext=i,E&&(a<=P||i)&&(R.equals(p.matrixWorld)||(P=0,R.copy(p.matrixWorld),U(),e=(new Oe).setFromMatrixPosition(R),m.rootCenter.value.copy(e),m.rootNormal.value.copy(new Oe(0,0,1).applyMatrix4(R).normalize()),L.copy(R).invert(),u.debug&&f.matrix.copy(p.matrixWorld)),null==this.lastCameraTransform?this.lastCameraTransform=(new Me).copy(n.matrixWorld):n.matrixWorld.equals(this.lastCameraTransform)&&n.aspect==D&&!i||(P=0,E._frameNumber++,n.getWorldPosition(I),this.lastCameraTransform.copy(n.matrixWorld),N(E,c,t,n)))},dispose:function(){for(T=!0,E._destroy();0=t.elements[a].count&&(a++,o=0),l=function(e,t){for(var n=t.split(/\s+/),i={},r=0;r","varying vec4 vPosition;","varying vec4 projTexCoord;","uniform sampler2D depthTexture;","uniform vec2 cameraNearFar;","void main() {","\tfloat depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));","\tfloat viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );","\tfloat depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;","\tgl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);","}"].join("\n")}):new R({color:"#000000"})},getEdgeDetectionMaterial:function(e){return new ga({uniforms:{edgeStrength:{value:e},maskTexture:{value:null},texSize:{value:new Re(10,10)},visibleEdgeColor:{value:new Oe(1,1,1)},hiddenEdgeColor:{value:new Oe(1,1,1)}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D maskTexture;\n uniform float edgeStrength;\n\t\t\t\tuniform vec2 texSize;\n\t\t\t\tuniform vec3 visibleEdgeColor;\n\t\t\t\tuniform vec3 hiddenEdgeColor;\n\t\t\t\t\n\t\t\t\tvoid main() { \n const float thickness = 1.0;\n vec2 invSize = thickness / texSize;\n\t\t\t\t\tvec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n\t\t\t\t\tvec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n\t\t\t\t\tvec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n\t\t\t\t\tvec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n\t\t\t\t\tvec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n\t\t\t\t\tfloat diff1 = (c1.r - c2.r)*0.5; //检测边缘,\n\t\t\t\t\tfloat diff2 = (c3.r - c4.r)*0.5;\n\t\t\t\t\tfloat d = length( vec2(diff1, diff2) ) * edgeStrength;\n\t\t\t\t\tfloat a1 = min(c1.g, c2.g);\n\t\t\t\t\tfloat a2 = min(c3.g, c4.g);\n\t\t\t\t\tfloat visibilityFactor = min(a1, a2); //检测深度值,是否被遮挡\n\t\t\t\t\tvec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n\t\t\t\t\t//gl_FragColor = vec4(0.0,1.0,0.0,1.0); \n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d); \n\t\t\t\t}"})},getSeperableBlurMaterial:function(e){return new ga({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new Re(.5,.5)},direction:{value:new Re(.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 ga({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv; \n\t\t\t\tuniform sampler2D edgeTexture1; \n\t\t\t\tuniform float edgeStrength; \n\t\t\t\t \n\t\t\t\tvoid main() { \n\t\t\t\t\tgl_FragColor = edgeStrength * texture2D(edgeTexture1, vUv); \n\t\t\t\t}",blending:ye,depthTest:!1,depthWrite:!1,transparent:!0})}}),RR.BlurDirectionX=new Re(1,0),RR.BlurDirectionY=new Re(0,1),2),UR=function(){function i(e,t){function n(e){var t,n;a.enabled&&e.dragViewport&&null===e.drag.object&&(t=e.isTouch?1==e.touches.length?"rotate":"scale-pan":e.buttons===Potree.defines.Buttons.LEFT?"rotate":"pan",void 0===e.drag.startHandled&&(e.drag.startHandled=!0,a.dispatchEvent({type:"start"})),(n=e.drag.pointerDelta.clone()).y*=-1,"rotate"==t?(a.yawDelta+=n.x*a.rotationSpeed,a.pitchDelta+=n.y*a.rotationSpeed):"pan"==t?(a.panDelta.x+=n.x,a.panDelta.y+=n.y):"scale-pan"==t&&(a.dollyEnd.subVectors(e.touches[0].pointer,e.touches[1].pointer),n=a.dollyEnd.length()/a.dollyStart.length(),a.dollyStart.copy(a.dollyEnd),a.radiusDelta=(1-n)*a.currentViewport.view.radius,t=(new Re).addVectors(e.touches[0].pointer,e.touches[1].pointer).multiplyScalar(.5),(n=(new Re).subVectors(t,a.lastScalePointer)).y*=-1,a.panDelta.add(n),a.lastScalePointer=t.clone()),a.stopTweens())}ue(this,i),(a=le(this,i)).viewer=e,a.renderer=e.renderer,a.scene=null,a.sceneControls=new Fs,a.rotationSpeed=3,t=t||e.viewports[0],a.setCurrentViewport({hoverViewport:t,force:!0}),a.fadeFactor=20,a.yawDelta=0,a.pitchDelta=0,a.panDelta=new Re(0,0),a.radiusDelta=0,a.doubleClockZoomEnabled=!0,a.tweens=[],a.dollyStart=new Re,a.dollyEnd=new Re,a.keys={FORWARD:["W".charCodeAt(0),38],BACKWARD:["S".charCodeAt(0),40],LEFT:["A".charCodeAt(0),37],RIGHT:["D".charCodeAt(0),39],UP:["Q".charCodeAt(0)],DOWN:["E".charCodeAt(0)]};var a,o=null;a.addEventListener("touchstart",function(e){o=e}),a.addEventListener("touchend",function(e){o=e}),a.addEventListener("touchmove",function(e){var t,n,i,r;a.enabled&&(2===e.touches.length&&2===o.touches.length?(t=e,r=(i=o).touches[0].pageX-i.touches[1].pageX,i=i.touches[0].pageY-i.touches[1].pageY,r=Math.sqrt(r*r+i*i),i=t.touches[0].pageX-t.touches[1].pageX,t=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(i*i+t*t),t=a.currentViewport.view.radius+a.radiusDelta,a.radiusDelta=t/(i/r)-t,a.stopTweens()):3===e.touches.length&&3===o.touches.length&&(r=((i=o).touches[0].pageX+i.touches[1].pageX+i.touches[2].pageX)/3,t=(i.touches[0].pageY+i.touches[1].pageY+i.touches[2].pageY)/3,i=(e.touches[0].pageX+e.touches[1].pageX+e.touches[2].pageX)/3,n=(e.touches[0].pageY+e.touches[1].pageY+e.touches[2].pageY)/3,i=(i-r)/a.renderer.domElement.clientWidth,r=(n-t)/a.renderer.domElement.clientHeight,a.panDelta.x+=i,a.panDelta.y+=r,a.stopTweens()),o=e)}),a.viewer.addEventListener("global_drag",n),a.viewer.addEventListener("global_drop",function(e){a.enabled&&a.dispatchEvent({type:"end"})}),a.viewer.addEventListener("global_mousewheel",function(e){var t;!a.enabled||(t=a.currentViewport.view.radius+a.radiusDelta)<.1&&0EXIT\n\t\t\t\t
    VR
    \n\t\t\t'},s=function(){o.element.innerHTML='\n\t\t\t\t
    ENTER
    \n\t\t\t\t
    VR
    \n\t\t\t'},t&&console.error('THREE.VRButton: The "options" parameter has been removed. Please set the reference space type via renderer.xr.setReferenceSpaceType() instead.'),o=new u,n=document.createElement("button"),o.element=n,"xr"in navigator)return o.element.id="VRButton",o.element.style.display="none",r(o.element),e.next=14,navigator.xr.isSessionSupported("immersive-vr");e.next=23;break;case 14:if(e.sent)return i(),e.abrupt("return",o);e.next=20;break;case 20:return e.abrupt("return",null);case 21:e.next=25;break;case 23:return!1===window.isSecureContext?console.log("WEBXR NEEDS HTTPS"):console.log("WEBXR not available"),e.abrupt("return",null);case 25:case"end":return e.stop()}},e)})),function(e,t){return n.apply(this,arguments)})}]);var n}(),zR=(Zd="undefined"!=typeof self?self:void 0,Zl=function(){return n=[function(e,t,n){var i;void 0!==(n="function"==typeof(i=function(){var r=function(){},s="undefined",l=["trace","debug","info","warn","error"];function i(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(t){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function u(e,t){for(var n=0;nthis._data.length-2)},p.prototype.isEOF=function(){return this._eof};var f=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function r(e){var t={},n=(e.rewind(),e.next()),i=n.code;if(t.x=n.value,i+=10,(n=e.next()).code!=i)throw new Error("Expected code for point value to be "+i+" but got "+n.code+".");return t.y=n.value,i+=10,(n=e.next()).code!=i?e.rewind():t.z=n.value,t}function s(e,t){switch(t.code){case 0:e.type=t.value;break;case 5:e.handle=t.value;break;case 6:e.lineType=t.value;break;case 8:e.layer=t.value;break;case 48:e.lineTypeScale=t.value;break;case 60:e.visible=0===t.value;break;case 62:e.colorIndex=t.value,e.color=(n=Math.abs(t.value),f[n]);break;case 67:e.inPaperSpace=0!==t.value;break;case 100:break;case 330:e.ownerHandle=t.value;break;case 347:e.materialObjectHandle=t.value;break;case 370:e.lineweight=t.value;break;case 420:e.color=t.value;break;case 1e3:e.extendedData=e.extendedData||{},e.extendedData.customStrings=e.extendedData.customStrings||[],e.extendedData.customStrings.push(t.value);break;case 1001:e.extendedData=e.extendedData||{},e.extendedData.applicationName=t.value;break;default:return}var n}function a(){}function o(){}function l(){}function u(){}function c(){}function d(){}function h(){}function m(){}function v(){}function g(){}function A(){}function y(){}function w(){}function b(){}function x(){}function E(){}a.ForEntityName="3DFACE",a.prototype.parseEntity=function(e,t){var n={type:t.value,vertices:[]};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 70:n.shape=1==(1&t.value),n.hasContinuousLinetypePattern=128==(128&t.value);break;case 10:n.vertices=function(e,t){for(var n=[],i=!1,r=!1,a=0;a<=4;a++){for(var o={};"EOF"!==t&&0!==t.code&&!r;){switch(t.code){case 10:case 11:case 12:case 13:if(i){r=!0;continue}o.x=t.value,i=!0;break;case 20:case 21:case 22:case 23:o.y=t.value;break;case 30:case 31:case 32:case 33:o.z=t.value;break;default:return n}t=e.next()}n.push(o),r=i=!1}return e.rewind(),n}(e,t),t=e.lastReadGroup;break;default:s(n,t)}t=e.next()}return n},o.ForEntityName="ARC",o.prototype.parseEntity=function(e,t){var n={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:n.center=r(e);break;case 40:n.radius=t.value;break;case 50:n.startAngle=Math.PI/180*t.value;break;case 51:n.endAngle=Math.PI/180*t.value,n.angleLength=n.endAngle-n.startAngle;break;default:s(n,t)}t=e.next()}return n},l.ForEntityName="ATTDEF",l.prototype.parseEntity=function(e,t){var n={type:t.value,scale:1,textStyle:"STANDARD"};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 1:n.text=t.value;break;case 2:n.tag=t.value;break;case 3:n.prompt=t.value;break;case 7:n.textStyle=t.value;break;case 10:n.startPoint=r(e);break;case 11:n.endPoint=r(e);break;case 39:n.thickness=t.value;break;case 40:n.textHeight=t.value;break;case 41:n.scale=t.value;break;case 50:n.rotation=t.value;break;case 51:n.obliqueAngle=t.value;break;case 70:n.invisible=!!(1&t.value),n.constant=!!(2&t.value),n.verificationRequired=!!(4&t.value),n.preset=!!(8&t.value);break;case 71:n.backwards=!!(2&t.value),n.mirrored=!!(4&t.value);break;case 72:n.horizontalJustification=t.value;break;case 73:n.fieldLength=t.value;break;case 74:n.verticalJustification=t.value;break;case 100:break;case 210:n.extrusionDirectionX=t.value;break;case 220:n.extrusionDirectionY=t.value;break;case 230:n.extrusionDirectionZ=t.value;break;default:s(n,t)}t=e.next()}return n},u.ForEntityName="CIRCLE",u.prototype.parseEntity=function(e,t){var n,i={type:t.value};for(t=e.next();"EOF"!==t&&0!==t.code;){switch(t.code){case 10:i.center=r(e);break;case 40:i.radius=t.value;break;case 50:i.startAngle=Math.PI/180*t.value;break;case 51:(n=Math.PI/180*t.value) HEADER"),t.header=function(){var e=null,t=null,n={};for(o=a.next();;){if(s(0,"ENDSEC")){e&&(n[e]=t);break}9===o.code?(e&&(n[e]=t),e=o.value):10===o.code?t={x:o.value}:20===o.code?t.y=o.value:30===o.code?t.z=o.value:t=o.value,o=a.next()}return o=a.next(),n}(),C.debug("<")):"BLOCKS"===o.value?(C.debug("> BLOCKS"),t.blocks=function(){var e,t={};for(o=a.next();"EOF"!==o.value&&!s(0,"ENDSEC");)s(0,"BLOCK")?(C.debug("block {"),e=i(),C.debug("}"),h(e),e.name?t[e.name]=e:C.error('block with handle "'+e.handle+'" is missing a name.')):(M(o),o=a.next());return t}(),C.debug("<")):"ENTITIES"===o.value?(C.debug("> ENTITIES"),t.entities=c(!1),C.debug("<")):"TABLES"===o.value?(C.debug("> TABLES"),t.tables=function(){var e={};for(o=a.next();"EOF"!==o.value&&!s(0,"ENDSEC");)s(0,"TABLE")?(o=a.next(),u[o.value]?(C.debug(o.value+" Table {"),e[u[o.value].tableName]=l(),C.debug("}")):C.debug("Unhandled Table "+o.value)):o=a.next();return o=a.next(),e}(),C.debug("<")):"EOF"===o.value?C.debug("EOF"):C.warn("Skipping section '%s'",o.value)}else o=a.next();return t}throw Error("Empty file")},t.default=B}],i={},r.m=n,r.c=i,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==O(t)&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1).default;function r(e){var t;return(i[e]||(t=i[e]={i:e,l:!1,exports:{}},n[e].call(t.exports,t,t.exports,r),t.l=!0,t)).exports}var n,i},"object"==(void 0===W?"undefined":O(W))&&"object"==("undefined"==typeof module?"undefined":O(module))?module.exports=Zl():"function"==typeof define&&define.amd?define([],Zl):"object"==(void 0===W?"undefined":O(W))?W.DxfParser=Zl():Zd.DxfParser=Zl(),function(){function t(){var e;return ue(this,t),(e=le(this,t)).parser=new Potree.DxfParser,e}return v(t,Qn),A(t,[{key:"load",value:function(e,t){var n=this,i=2e.width)return void console.log("Can't render this multipline MTEXT entity, sorry.",e);switch(i.position.z=0,e.attachmentPoint){case 1:i.position.x=e.position.x,i.position.y=e.position.y-e.height;break;case 2:i.position.x=e.position.x-r/2,i.position.y=e.position.y-e.height;break;case 3:i.position.x=e.position.x-r,i.position.y=e.position.y-e.height;break;case 4:i.position.x=e.position.x,i.position.y=e.position.y-e.height/2;break;case 5:i.position.x=e.position.x-r/2,i.position.y=e.position.y-e.height/2;break;case 6:i.position.x=e.position.x-r,i.position.y=e.position.y-e.height/2;break;case 7:i.position.x=e.position.x,i.position.y=e.position.y;break;case 8:i.position.x=e.position.x-r/2,i.position.y=e.position.y;break;case 9:i.position.x=e.position.x-r,i.position.y=e.position.y;break;default:return}return i}(e,t):"ELLIPSE"===e.type?(i=QR(n=e,i=t),o=Math.sqrt(Math.pow(n.majorAxisEndPoint.x,2)+Math.pow(n.majorAxisEndPoint.y,2)),s=o*n.axisRatio,l=Math.atan2(n.majorAxisEndPoint.y,n.majorAxisEndPoint.x),o=new Vc(n.center.x,n.center.y,o,s,n.startAngle,n.endAngle,!1,l).getPoints(50),s=(new V).setFromPoints(o),n=new wl({linewidth:1,color:i}),h=new Ml(s,n)):"DIMENSION"===e.type?0==(l=7&e.dimensionType)?h=VR(e,t,r,a,!0):console.log("Unsupported Dimension type: "+l):console.log("Unsupported Entity Type: "+e.type),(h="LWPOLYLINE"!==e.type&&"LINE"!==e.type&&"POLYLINE"!==e.type?h:HR(e,t))&&(h.dxfInfo=e),h;console.warn("����һ��dxf������Ƶ�type��",e.type)}function HR(e,t){var n,i,r,a,o,s=new Wl,l=QR(e,t);if(!e.vertices)return console.log("entity missing vertices.");for(o=0;o\n\t\t'),$(e).append(i.elMessages),i.fakeMeasure={};try{Potree.settings.isOfficial||(0===$(e).find("#potree_map").length&&(a=$('\n \n '),$(e).append(a)),0===$(e).find("#potree_description").length&&(o=$('
    '),$(e).append(o)),0===$(e).find("#potree_annotations").length&&(s=$('\n
    '),$(e).append(s)),0===$(e).find("#potree_quick_buttons").length&&(l=$('\n
    \n
    \n '),$(e).append(l)),$(e).append($("
    ")),jR)||"merge"==Potree.settings.editType||(jR=$("
    "),$(e).append(jR),jR=jR[0]),i.tiles3dMemoryUsage=0,i.pointCloudLoadedCallback=r.onPointCloudLoaded||function(){},i.server=null,i.fov=60,i.isFlipYZ=!1,i.useDEMCollisions=!1,i.generateDEM=!1,i.minNodeSize=30,i.edlStrength=1,i.edlRadius=1.4,i.edlOpacity=1,i.useEDL=!1,i.description="",i.classifications=xm.DEFAULT,i.moveSpeed=1,i.lengthUnit=Im.METER,i.lengthUnitDisplay=Im.METER,i.showBoundingBox=!1,i.showAnnotations=!0,i.freeze=!1,i.elevationGradientRepeat=Sm.CLAMP,i.filterReturnNumberRange=[0,7],i.filterNumberOfReturnsRange=[0,7],i.filterGPSTimeRange=[-1/0,1/0],i.filterPointSourceIDRange=[0,65535],i.potreeRenderer=null,i.edlRenderer=null,i.pRenderer=null,i.scene=null,i.sceneVR=null,i.overlay=null,i.overlayCamera=null,i.inputHandler=null,i.controls=null,i.clippingTool=null,i.transformationTool=null,i.navigationCube=null,i.compass=null,i.skybox=null,i.clock=new Wd,i.background=null,i.buffers=new Map,r.noDragAndDrop||i.initDragAndDrop(),"undefined"!=typeof Stats&&(i.stats=new Stats,i.stats.showPanel(0),document.body.appendChild(i.stats.dom)),i.overlay=new Fs,i.overlayCamera=new Ad(0,1,1,0,-1e3,1e3),i.pRenderer=new E1(i.renderer);i.shadowTestCam=new ya(90,1,2.5,10),i.shadowTestCam.position.set(3.5,-2.8,8.561),i.shadowTestCam.lookAt(new Oe(0,0,4.87));var a,o,s,l,u=new mv(i.renderer),c=(i.sceneVR=new Fs,i.setScene(u),i.composer=new kR(i.renderer),i.composer.scaleRatio=4,i.composer.readTarget=!0,i.outlinePass=new RR),d=(c.renderToScreen=!0,c.enabled=!1,i.composer.addPass(c),c.edgeStrength=4,c.edgeGlow=0,c.visibleEdgeColor=new Se("#09a1b3"),i.mainViewport=new og(i.scene.view,i.scene.cameraP,{left:0,bottom:0,width:1,height:1,name:"MainView"}),i.viewports=[i.mainViewport],Potree.settings.showCompass&&(i.compass=new f1(Potree.settings.compassDom,i.mainViewport)),i.magnifier=new WE(i),i.reticule=new YE(i),i.scene.scene.add(i.magnifier),i.scene.scene.add(i.reticule),"pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType&&(i.mapViewer=new Z0(jR)),i.inputHandler=new rg(i,i.scene.scene),i.inputHandler.containsMouse=!0,i.clippingTool=new UA(i),i.transformationTool=new zy(i),i.navigationCube=new _1(i),i.navigationCube.visible=!1,i.createControls(),i.clippingTool.setScene(i.scene),function(e){1===i.scene.pointclouds.length&&(e=e.pointcloud.boundingBox.getSize(new Oe).length(),i.setMoveSpeed(e/=2e3))}),h=function(e){i.inputHandler.deselect(e.volume)};i.addEventListener("scene_changed",function(e){i.inputHandler.setScene(e.scene),i.clippingTool.setScene(i.scene),e.scene.hasEventListener("pointcloud_added",d)||e.scene.addEventListener("pointcloud_added",d),e.scene.hasEventListener("volume_removed",d)||e.scene.addEventListener("volume_removed",h)}),i.scene.addEventListener("volume_removed",h),i.scene.addEventListener("pointcloud_added",d),i.setFOV(60),i.setEDLEnabled(!1),i.setEDLRadius(3),i.setEDLStrength(.01),i.setEDLOpacity(1),i.setPointBudget(1e6),i.setShowBoundingBox(!1),i.setFreeze(!1),i.setControls(i.fpControls),i.setBackground(new Se(Potree.config.background),1),i.scaleFactor=1,i.loadSettingsFromURL(),i.renderer.setAnimationLoop(i.loop.bind(i)),i.loadGUI=i.loadGUI.bind(i),i.annotationTool=new Ob(i),i.measuringTool=new ly(i),i.volumeTool=new Jm(i),i.tagTool=new p1(i),Ub.init(i,i.mapViewer?[i,i.mapViewer]:[i]),("pano"==Potree.settings.editType?i.modules.PanoEditor:"merge"==Potree.settings.editType?i.modules.MergeEditor:(i.modules.SiteModel.init(),i.modules.ParticleEditor)).init(),i.modules.Alignment.init(),i.images360=new W0(i),i.scene.scene.add(i.objs),YR={objLoader:new XE(qR),mtlLoader:new $E(qR),glbLoader:new IC(void 0,i.renderer,Potree.settings.libsUrl),plyLoader:new DR(qR),dxfLoader:new zR,shapeLoader:new Potree.ShapefileLoader},i.modules.volumeComputer&&i.modules.volumeComputer.init()}catch(e){i.onCrash(e)}var p="",f=(Object.defineProperty(Potree.settings,"pointDensity",{get:function(){return p},set:function(e){var t,n;e&&(n=(t=Potree.config.pointDensity[e]).pointBudget,"magnifier"==e?n=Math.max(Potree.pointBudget,Potree.config.pointDensity.magnifier.pointBudget):i.magnifier.visible&&(n=Math.max(n,Potree.config.pointDensity.magnifier.pointBudget)),viewer.setMinNodeSize(t.minNodeSize||Potree.config.minNodeSize),viewer.setPointBudget(n),p=e,i.setPointLevels(),i.dispatchEvent("pointDensityChanged"))}}),""),m=(Object.defineProperty(Potree.settings,"UserPointDensity",{get:function(){return f},set:function(e){f!=e&&("showPointCloud"==Potree.settings.displayMode&&4!=i.viewports.length&&(Potree.settings.pointDensity=e),f=e,i.dispatchEvent("UserPointDensityChanged"))}}),Potree.settings.cameraFar);Object.defineProperty(Potree.settings,"cameraFar",{get:function(){return m},set:function(e){e!=m&&("showPanos"==Potree.settings.displayMode||i.fixCamFar||(i.mainViewport.camera.far=e,i.mainViewport.camera.updateProjectionMatrix()),m=e)}}),i.reticule.addEventListener("update",function(e){i.reticule.hoverViewport&&(i.reticule.hoverViewport.needRender=!0),i.lazyRenderViewports(),i.mapViewer&&i.mapViewer.attachedToViewer&&(i.mapViewer.viewports[0].needRender||i.needRender)&&(i.mapViewer.needRender=!0)}),i.addEventListener("pointcloud_changed",function(e){i.screenshoting?i.viewports.filter(function(e){return!e.noPointcloud}).forEach(function(e){return e.needRender=!0}):i.lazyRenderViewports()}),i.addEventListener("allLoaded",function(){setTimeout(i.testPointcloudsMaxLevel.bind(i),1e3),i.scene.pointclouds.forEach(function(e){e.addEventListener("isVisible",function(e){"displayMode"!=e.reason&&"overlinePass"!=e.reason&&i.updateModelBound("visibleChanged"),i.dispatchEvent("pointcloud_changed")}),e.material.addEventListener("material_property_changed",function(){i.dispatchEvent("pointcloud_changed")})}),window.addEventListener("unfocusPage",function(e){console.log("unfocusPage",document.title),i.setDisplay(!1)}),window.addEventListener("focusPage",function(e){console.log("focusPage",document.title),i.setDisplay(!0)})}),"pano"!=Potree.settings.editType&&"merge"!=Potree.settings.editType&&(i.addEventListener("switchFloorplanSelect",function(e){var t;i.selectedFloorplan=e.pointcloud,i.updateFpVisiDatasets(),e.pointcloud?t=[e.pointcloud]:i.fpVisiDatasets.length&&(t=i.fpVisiDatasets),t&&i.mapViewer.fitToDatasets(t)}),i.modules.SiteModel.bus.addEventListener("FloorChange",function(e){i.updateFpVisiDatasets(),i.updatePanosVisibles(e.currentFloor)}),i.mapViewer.mapLayer.addEventListener("floorplanLoaded",function(){i.updateCadVisibles(i.fpVisiDatasets,!0)}));function v(e){("updateModelBound"==e.type||e.viewport==i.mainViewport&&(e.changeInfo.positionChanged||g!=i.images360.zoomLevel))&&(g=i.images360.zoomLevel,"updateModelBound"!=e.type&&!e.changeInfo.positionChanged||i.updateDatasetAt(),Potree.settings.ifShowMarker)&&"merge"!=Potree.settings.editType&&j.intervalTool.isWaiting("updateMarkerVisibles",function(){i.mainViewport.view.isFlying()||i.updateMarkerVisibles()},500)}var g,A;return i.addEventListener("camera_changed",v),i.addEventListener("updateModelBound",v),i.addEventListener("showMarkerChanged",function(){i.updatePanosVisibles(i.modules.SiteModel.currentFloor),i.updateMarkerVisibles()}),i.images360.addEventListener("getNeighbourAuto",function(e){e.panos.includes(i.images360.currentPano)&&j.intervalTool.isWaiting("updateMarkerVisibles",function(){i.updateMarkerVisibles()},500)}),document.addEventListener("visibilitychange",function(e){var t=!document.hidden;i.dispatchEvent({type:"pageVisible",v:t}),i.screenshoting&&!t?A=setInterval(function(){i.screenshoting&&i.loop(Date.now())},50):t&&A&&clearInterval(A)}),i}return v(y,ag),A(y,[{key:"lazyRenderViewports",value:function(e){var t=this.viewports;if(1==t.length||this.needRender)return this.needRender=!0;var n=Date.now(),i=(t.forEach(function(e){200=e?a():(s=viewer.images360.panos.filter(function(e){return e.visible&&!i(e)&&o(e,t)})).length<=e?(s.forEach(function(e){return r.get(e).visible=!0}),a()):(s.sort(function(e,t){return r.get(e).dis-r.get(t).dis}),s.slice(0,e).forEach(function(e){return r.get(e).visible=!0}),void a())}},{key:"updateFpVisiDatasets",value:function(){this.modules.Clip;var e,t=this.modules.SiteModel,n=this.modules.Alignment,i=t.currentFloor;this.selectedFloorplan?(e=[this.selectedFloorplan],this.updateCadVisibles(e)):t.editing||n.editing?(e=this.scene.pointclouds.filter(function(e){return Potree.Utils.getObjVisiByReason(e,"datasetSelection")}),this.updateCadVisibles(e)):(0==(t=0==(t=i?this.findPointcloudsAtFloor(i):[]).length&&this.focusDatasets?this.focusDatasets:t).length&&(t=this.atDatasets),this.updateCadVisibles(t))}},{key:"findPointcloudsAtFloor",value:function(a){var o=[],t=viewer.scene.pointclouds.filter(function(e){var t=0;if(e.belongToEntity&&(e.belongToEntity==a||e.belongToEntity.buildParent==a))return!0;if(e.panos.length){var n=e.panos.filter(function(e){return a.ifContainsPoint(e.position)}).length/e.panos.length;if(.5 \n\t\t\t\t\n\t\t\t\t

    Potree Encountered An Error

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

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

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

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

    \n\t\t\t\t

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

    \n\n\t\t\t\t
    \n\t\t\t\t\n\t\t\t')).find("#potree_error_console").html(e.stack),$(this.renderArea).append(t)),e}},{key:"setScene",value:function(e){var t,n=this;e!==this.scene&&(t=this.scene,this.scene=e,this.dispatchEvent({type:"scene_changed",oldScene:t,scene:e}),$(".annotation").detach(),this.scene.annotations.traverse(function(e){n.renderArea.appendChild(e.domElement[0])}),this.onAnnotationAdded||(this.onAnnotationAdded=function(e){e.annotation.traverse(function(e){$("#potree_annotation_container").append(e.domElement),e.scene=n.scene})}),t&&t.annotations.removeEventListener("annotation_added",this.onAnnotationAdded),this.scene.annotations.addEventListener("annotation_added",this.onAnnotationAdded))}},{key:"setControls",value:function(e){e!==this.controls&&(this.controls&&(this.controls.setEnable(!1),this.controls.moveSpeed=this.moveSpeed),(this.controls=e).moveSpeed&&this.setMoveSpeed(e.moveSpeed),this.controls.setEnable(!0))}},{key:"getControls",value:function(){return this.renderer.xr.isPresenting?this.vrControls:this.controls}},{key:"getMinNodeSize",value:function(){return this.minNodeSize}},{key:"setMinNodeSize",value:function(e){this.minNodeSize!==e&&(this.minNodeSize=e,this.dispatchEvent({type:"minnodesize_changed",viewer:this}))}},{key:"getBackground",value:function(){return this.background}},{key:"setBackground",value:function(e,t){var n=this;"skybox"===e?(t=t||Potree.resourcePath+"/textures/skybox/xingkong.jpg",this.skybox=ne.loadSkybox(t,this.skybox,function(){n.background=e})):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 jm(i),i.profileWindowController=new Wm(i),$("#profile_window").draggable({handle:$("#profile_titlebar"),containment:$(document.body)}),$("#profile_window").resizable({containment:$(document.body),handles:"n, e, s, w"}),$(function(){i.guiLoaded=!0;var e,t=q(i.guiLoadTasks);try{for(t.s();!(e=t.n()).done;)(0,e.value)()}catch(e){t.e(e)}finally{t.f()}})}))})}),this.promiseGuiLoaded()}},{key:"setLanguage",value:function(e){i18n.setLng(e),$("body").i18n()}},{key:"setServer",value:function(e){this.server=e}},{key:"initDragAndDrop",value:function(){var c=this;function e(e){e.dataTransfer.dropEffect="copy",e.preventDefault()}var t=function(){var t=J(X().mark(function e(t){var n,i,r,a,o,s,l,u;return X().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:console.log(t),t.preventDefault(),n=q(t.dataTransfer.items),e.prev=3,n.s();case 5:if((a=n.n()).done)e.next=49;else{if(i=a.value,console.log(i),"file"!==i.kind)return e.abrupt("continue",47);e.next=10}break;case 10:if(r=i.getAsFile(),a=r.name.toLowerCase().endsWith(".json"),o=r.name.toLowerCase().endsWith(".gpkg"),a)return e.prev=14,e.next=17,r.text();e.next=28;break;case 17:l=e.sent,"Potree"===(l=JSON.parse(l)).type&&Potree.loadProject(viewer,l),e.next=26;break;case 22:e.prev=22,e.t0=e.catch(14),console.error("failed to parse the dropped file as JSON"),console.error(e.t0);case 26:e.next=47;break;case 28:o?0e.collapseThreshold||e.boundingBox.containsPoint(s.scene.getActiveCamera().position),(e.expand=r)||-1<=a.z&&a.z<=1&&c.push(e),r;-1<=a.z&&a.z<=1&&c.push(e)}),new Set(this.visibleAnnotations)),t=0,n=c;ta?l.y/2/Math.tan(Be.degToRad(d.fov/2))+l.z/2:(e=Mf.getHFOVForCamera(d,!0),l.x/2/Math.tan(e/2)+l.z/2),v+=d.near),v=Math.max(.1,v),t=u.dontChangeCamDir?viewer.mainViewport.view.direction.negate():(new Oe).subVectors(i,n).normalize(),u.dontLookUp&&t.z<0&&t.negate(),c.copy(n).add(t.multiplyScalar(v)),c};if(this.images360.flying)h=function(){o.focusOnObject(r,e,a,$.extend(u,{deferred:n})),o.images360.removeEventListener("cameraMoveDone",h)},this.images360.addEventListener("cameraMoveDone",h);else{if("measure"==e){if(0==r.points.length)return{promise:n.resolve()};if(s.copy(r.getCenter()),u.gotoBestView?2Math.PI-g)&&(y>Math.PI/2&&f.negate(),m=(new Oe).subVectors(d.position,s).normalize(),g=(new Oe).addVectors(f,m).normalize(),y=(new Oe).addVectors(m,g),i.copy(s.clone().add(y)))):console.error("measure 没有facePlane points点数还不为2?"),c=p(r.points,null,s,i),t(),"showPointCloud"==Potree.settings.displayMode);else if("showPanos"==Potree.settings.displayMode){r.measureType.includes("MulDistance")&&(A=r.points[Math.round(r.points.length/2)],w=(new Oe).subVectors(A,c).normalize());var f=viewer.images360.fitPanoTowardPoint({target:s,dir:w,point:c,bestDistance:0,checkIntersect:u.checkIntersect,gotoBestView:u.gotoBestView}),m={promise:n.promise()};if(f&&f.msg&&(f=f.pano,m.msg=f.msg),f)if(viewer.images360.flyToPano({pano:f,target:A||s,duration:a,deferred:n,dontMoveMap:!0,basePanoSize:u.basePanoSize}),viewer.images360.currentPano==f)return{msg:1.5<(g=viewer.images360.currentPano.position.distanceTo(s))/(y=c.distanceTo(s))&&10')[0],e=(i.setAttribute("crossOrigin","Anonymous"),i.src=n.url||Potree.resourcePath+"/video/".concat(Potree.settings.number,"/").concat(n.id,".mp4"),new Ul(i)),r=o.videoPlane=new Q(a,new R({color:"#ffffff",transparent:!0,depthTest:!1,opacity:0,map:e}));r.position.fromArray(n.position),r.rotation.fromArray(n.rotation),n.scale&&r.scale.fromArray(n.scale),o.scene.scene.add(r),(n.plane=r).boundingBox=new K(new Oe(0,-.5,0),new Oe(1,-.4,.2)),i.addEventListener("loadeddata",function(e){i.play(),n.visibles||(r.material.opacity=1),n.scale||r.scale.set(i.videoWidth/1e3,i.videoHeight/1e3,1),console.log("video loadeddata",n.id)}),n.visibles&&o.images360.addEventListener("flyToPano",function(t){n.visibles.includes(t.toPano.pano.id)?setTimeout(function(){var e;r.visible=!0,i.currentTime=0,i.play(),i.paused&&(e=function(){r.visible&&i.play(),o.removeEventListener("global_mousedown",e)},o.addEventListener("global_mousedown",e)),Potree.settings.zoom.enabled=!1,df.start(uf(r.material,"opacity",1),.4*t.toPano.duration,function(){},0,of.easeInOutQuad)},.6*t.toPano.duration):df.start(uf(r.material,"opacity",0),.4*t.toPano.duration,function(){n||(r.visible=!1,i.pause(),Potree.settings.zoom.enabled=!0)},0,of.easeInOutQuad)}),o.addEventListener("global_mousedown",t),Potree.settings.isTest&&r.addEventListener("select",function(e){console.log(e)})}))}},{key:"addTube",value:function(t){var v,n,i,g=this;for(i in t)!function(){if(i==Potree.settings.number){var e=t[i],m=new K;for(m.min.set(-1,-1,-1),m.max.set(1,1,1),v=0,n=function(){for(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=i.find("label"),a=i.find("input");a.change(function(){o.find("label").removeClass("ui-state-active"),o.find("label").addClass("ui-state-default"),a.is(":checked")&&r.addClass("ui-state-active")}),l.push(i)}),WR('\n\t\t\t\t
    \n\t\t\t\t\t'.concat(t,'\n\t\t\t\t\t\n\n\t\t\t\t\t\n\t\t\t\t
    \n\t\t\t'))),n=e.find("span"),i=0,r=l;ir.bottomRange.max||e.btmHeight